Repository navigation
fix(workflow): preserve messages and errors alongside delegated output - #7950
Open
1828703450qqcom-ux wants to merge 2 commits into
Open
1828703450qqcom-ux wants to merge 2 commits into
1828703450qqcom-ux wants to merge 2 commits into
Conversation
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: #7949
Problem: A parent using
ctx.run_node(..., use_as_output=True)can yield an event that combines the repeated output with new message content or error details. NodeRunner currently suppresses the entire event. Besides losing text and image messages, this hides and fails to persist a combined function-call/long-running-tool approval request, leaving the workflow waiting for a response the caller cannot discover. Combined output/error events also loseerror_codeanderror_message, so callers and stored sessions cannot discover the failure. This reproduces on main after #7931 landed.Solution: Treat non-None message content and nonempty error details as non-output content. The existing output-removal path then forwards and persists the rest of the event, while output-only duplicates remain suppressed. No public API or session schema changes.
Testing Plan
Unit Tests:
tests/unittests/workflowsuite on Python 3.13: 1329 passed, 2 failed, 1 xfailed. The two failures aretest_execute_bash_tool_node_runs_command_after_approval[False/True]; both reproduce in a separate unmodified 73ae69e worktree. ExecuteBashTool's POSIX-only implementation is an existing Windows limitation.Manual End-to-End (E2E) Tests:
Executed a standalone script using a real Runner, Workflow, InMemorySessionService, and custom BaseNode; no LLM, cloud API, or command tool is involved. Its node calls
ctx.run_node(prepare, use_as_output=True)to publishdraft, then yields a combined output/approval event with function call IDapproval. A downstream node records its input and returnspublished.Before (unmodified main):
{"approval_visible": false, "approval_persisted": false, "draft_output_count": 1, "published_before_approval": []}After:
{"approval_visible": true, "approval_persisted": true, "draft_output_count": 1, "published_before_approval": []} {"published_inputs_after_approval": ["approved draft"], "published_result_visible": true}To reproduce, the added
test_delegated_output_preserves_confirmation_and_resumecontains the complete Runner setup. Run:An additional standalone Runner scenario delegates
partial result, then yields that repeated output witherror_code="UPSTREAM_ERROR"anderror_message="The upstream operation failed.". On unmodified 73ae69e it reportserror_visible=false,error_persisted=false, andoutput_count=1. With the complete fix it reports both flags true, retains both exact error strings, still publishes the result once, and removes the error event's repeated output. It uses only real in-memory ADK components and custom nodes, with no model or external API.Checklist
Additional context
AI assistance was used for investigation, implementation, and test preparation. All reported checks were executed locally. This change preserves messages and error details; it does not redesign suppression of other event metadata.