Repository navigation
fix(runners): honor yield_user_message for composite-agent roots - #8408
Open
sumedh-aerram wants to merge 1 commit into
Open
sumedh-aerram wants to merge 1 commit into
sumedh-aerram wants to merge 1 commit into
Conversation
Yield newly persisted composite-root user events before execution when requested, preserving event identity and existing default and resume behavior. Fixes google#8407
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
Fixes #8407
Problem:
Composite roots persist the incoming user event but omit it from the public stream even when
yield_user_message=True. Direct LlmAgent and node roots already honor the flag.Solution:
Record the session-event count before composite-root setup and yield only newly appended user events when requested, before plugin or agent output. Reuse the persisted event, including its ID, invocation ID, transformed content and state delta. Preserve default/false behavior and completed-invocation execution guards.
Testing Plan
Unit Tests:
pytest tests/unittests/test_runners.py tests/unittests/runners -q: 453 passed, 1 skipped, 3 xfailed.114 regression/control cases across SequentialAgent, ParallelAgent, LoopAgent, direct LlmAgent and BaseNode roots: true/false/default flag, resumable and non-resumable new turns, modified messages, before-run short-circuits, resume with no append, state-only resume, resumed function responses and duplicate-message suppression. Assert event order and persisted event identity/content/state delta.
Unpatched upstream with the final focused tests: 18 failed, 96 passed. Patched: 114 focused cases pass. Full runner-suite counts above include those cases. The skip and expected failures are existing tests.
pre-commit run --files src/google/adk/runners.py tests/unittests/test_runners.pypasses. Mypy reports the same 521 existing test diagnostics as upstream, with zero new errors; the changed runner source has no errors.Manual End-to-End (E2E) Tests:
Run the offline code in the linked issue against a source checkout. After the fix: Both roots print
yielded=['user', 'child'] stored=['user', 'child'].Checklist
Additional context
The node and direct LlmAgent runtime paths retain their existing behavior. No new API, configuration, sample, or documentation contract is introduced; this restores the documented runner behavior.