Skip to content

fix(runners): honor yield_user_message for composite-agent roots - #8408

Open
sumedh-aerram wants to merge 1 commit into
google:mainfrom
sumedh-aerram:fix/runner-yield-user-message
Open

sumedh-aerram wants to merge 1 commit into
google:mainfrom
sumedh-aerram:fix/runner-yield-user-message

Conversation

@sumedh-aerram

Copy link
Copy Markdown

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:

  • I have added or updated unit tests for my change.
  • Relevant new and existing runner unit tests pass locally.

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.py passes. 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

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective.
  • Relevant new and existing unit tests pass locally with my changes.
  • I have manually tested the offline reproduction end-to-end.

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.

Yield newly persisted composite-root user events before execution when requested, preserving event identity and existing default and resume behavior.

Fixes google#8407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runner.run_async ignores yield_user_message=True for composite-agent roots

1 participant