Repository navigation
fix(workflow): preserve routes when flushing and delegating output - #7931
Closed
1828703450qqcom-ux wants to merge 2 commits into
Closed
1828703450qqcom-ux wants to merge 2 commits into
1828703450qqcom-ux wants to merge 2 commits into
Conversation
Merge pending state and artifact changes into the existing event actions instead of replacing the actions object. Keep the route persisted so a parent retry can resume the selected workflow branch. Fixes google#7930
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
1828703450qqcom-ux
marked this pull request as ready for review
November 2, 2026 07:40
Keep a route-bearing parent event when its duplicate delegated output is suppressed. Preserve false, zero, and empty-list routes, and prove parent retry follows the saved branch without duplicating child output.
9 tasks done
copybara-service Bot
pushed a commit
that referenced
this pull request
Nov 2, 2026
Merge #7931 A node's final flushed event now keeps its route when it also carries state or artifact deltas, and a parent that delegates its output with `use_as_output=True` now persists its routing event (with the duplicate output cleared) instead of dropping it. A parent retry can then rerun the selected branch from the recorded route. Closes #7930 PiperOrigin-RevId: 1012267523
Collaborator
|
Thank you @1828703450qqcom-ux for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit af6f671. Closing this PR as the changes are now in the main branch. |
1828703450qqcom-ux
deleted the
fix/workflow-preserve-route-with-deltas
branch
November 2, 2026 20:27
1828703450qqcom-ux
restored the
fix/workflow-preserve-route-with-deltas
branch
November 2, 2026 20:27
This was referenced Nov 3, 2026
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.
Link to Issue or Description of Change
Closes: #7930
Problem: Workflow routes can disappear from persisted events in two output-publication paths. The initial execution still follows the Context's route, but a parent retry cannot recover that decision and silently ends the selected branch instead of retrying its failed node.
ctx.run_node(..., use_as_output=True)and returnsEvent(output=answer, route=...). Suppressing the duplicate output drops the entire parent event unless it has state/artifact deltas, so its route is lost too.Solution: Merge deferred deltas into the event's existing actions using
_flush_deltas. When suppressing delegated output, retain a parent event that carries a route and clear only its duplicate output. Check against None soFalse,0, and an empty route list remain meaningful. The child result is still published exactly once.Testing Plan
Unit and integration tests:
'next',False,0,[]) and a delegated parent-retry case fails. All pass after the fix, while asserting a single published child output.test_execute_bash_tool_node_runs_command_after_approval[False/True], which also fail on unchanged main on Windows: ExecuteBashTool explicitly supports POSIX only.git diff --checkpasses.Manual End-to-End (E2E):
Ran standalone scripts with real
Runner,App,InMemorySessionServiceand public Workflow/Node APIs, with no model or cloud connection. An outer driver with a two-attempt retry policy invokes a nested workflow. Its router selects one branch; that branch fails once and succeeds on its second call. The other branch must never run.Both the deferred state-writing router and the output-delegating router exhibit the bug on main: router runs once, selected branch runs once, no saved route, final result missing. With the fixes, router runs once, selected branch runs twice, other branch runs zero times, the route is saved, and the final result is produced. Repository regressions exercise these scenarios with the invariant-enabled Runner fixture.
Checklist
AI assistance: Codex investigated, implemented, and verified this change.