Repository navigation
Open
Description
Self Checks
- I have searched for existing issues, including closed ones.
- I confirm that I am using English to submit this report.
- Non-english title submitions will be closed directly.
- Please do not modify this template :) and fill in all the required fields.
RAGFlow workspace code commit ID
RAGFlow image version
N/A (local source checkout of main at da4a155)
Other environment information
- OS: Windows 11 (amd64)
- Go: 1.27.3 (
CGO_ENABLED=0)
Actual behavior
BinaryOperatorAggregate in internal/harness/graph/channels/binop.go has three related bugs when handling Overwrite values:
isOverwriteignorestypes.Overwrite/*types.Overwrite:isOverwritechecks for an internalinterface{ GetValue() interface{} }and a single-keymap[string]interface{}{"__overwrite__": v}. However,types.Overwriteininternal/harness/graph/types/types.gostores the value in the exportedValuefield and does not implementGetValue(), sotypes.NewOverwrite(v)andtypes.Overwrite{Value: v}are never recognized as overwrite wrappers and are passed straight toc.operatoras regular values.- Empty-channel
Updatebypasses overwrite handling onvalues[0]: WhenIsMissing(c.value)is true (for exampleNewBinaryOperatorAggregate(nil, op)),Updateexecutesc.value = values[0]; values = values[1:]before checkingisOverwrite. As a result, a leadingOverwritestores the raw wrapper object inc.value, leavesseenOverwritefalse (so a secondOverwritein the same super-step succeeds instead of returningInvalidUpdateError), and passes the raw wrapper intoc.operatorfor any remaining values. - Duplicate
Overwritemutatesc.valuebefore failing: On a super-step containing multipleOverwritevalues (or a normal value followed by twoOverwritevalues),Updatewrites earlier values intoc.valuebefore encountering the secondOverwriteand returningInvalidUpdateError, leaving the channel state mutated on a rejected update.
7484
ol>
isOverwriteshould unwrap*types.Overwrite(when non-nil) andtypes.Overwritealongside the existingoverwriterinterface andconstants.Overwritemap form.BinaryOperatorAggregate.Updateshould validate and resolveOverwriteentries across the entirevaluesslice before mutatingc.value:- Two or more
Overwritevalues in the same super-step returnInvalidUpdateErrorand leavec.valueunchanged (including keeping an empty channel empty). - A single
Overwritesetsc.valueto the unwrapped value regardless of whether the channel was initiallyMissingor whether other normal values appear in the same super-step.
- Two or more
- Create
ch := channels.NewBinaryOperatorAggregate(int(0), channels.IntAdd), seed10, then callch.Update([]interface{}{types.NewOverwrite(99)}):ch.Get()returns10instead of99. - Create
ch := channels.NewBinaryOperatorAggregate(nil, channels.IntAdd)and callch.Update([]interface{}{map[string]interface{}{constants.Overwrite: 42}}):ch.Get()returns the raw mapmap["__overwrite__":42]instead of42. - Create
ch := channels.NewBinaryOperatorAggregate(int(0), channels.IntAdd), seed10, and callch.Update([]interface{}{map[string]interface{}{constants.Overwrite: 42}, map[string]interface{}{constants.Overwrite: 99}}):UpdatereturnsInvalidUpdateError, yetch.Get()is mutated to42instead of remaining10.
Expected behavior
Steps to reproduce
Additional information
A fix with regression tests is ready.
AI-assisted: drafted with an AI coding agent; the tests above were run locally.
Reacted by dosubot
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(harness): unwrap types.Overwrite and keep BinaryOperatorAggregate…