fix(workflow): preserve conversation array appends across Iteration rounds#34539
Open
Dexterity104 wants to merge 8 commits intolanggenius:mainfrom
Open
fix(workflow): preserve conversation array appends across Iteration rounds#34539Dexterity104 wants to merge 8 commits intolanggenius:mainfrom
Dexterity104 wants to merge 8 commits intolanggenius:mainfrom
Conversation
…lder for isolated variable pools
Author
|
Hi @QuantumGhost @laipz8200 @Yeuoly @crazywoola |
Author
Author
|
Hi @asukaminato0721 , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #34417
Summary
Sequential Iteration runs a separate child graph engine per item with a deep-copied variable pool. Variable Assigner updates (e.g. appending to a conversation
array[...]) were still applied to the parent pool only when the parent engine's dispatcher handledNodeRunVariableUpdatedEvent. That could happen after the next iteration had already taken another deep copy of the parent pool, so one append could be missing, especially visible on a later chat turn when the array was non-empty.This change adds an
IterationVariableSyncLayeron child engines that use an isolated pool (the Iteration pattern). On eachNodeRunVariableUpdatedEvent, the layer writes the same variable into the parent pool inside the child'sEventManager.collectpath, so the parent pool is up to date before the child run finishes and the next iteration copies it. Loop child engines are unchanged (they share the parent pool and never pass a customvariable_pool).api/core/app/workflow/layers/iteration_variable_sync.pyapi/core/workflow/workflow_entry.py(_WorkflowChildEngineBuilder.build_child_engine)api/tests/unit_tests/core/workflow/test_iteration_variable_sync_patch.pyand updated expectations intest_workflow_entry_helpers.pyChecklist
uv run --project api pytest api/tests/unit_tests/core/workflow/(and targeted tests for the new layer); runmake lint/make type-checkfromapibefore merge if CI differs from local setup.