Repository navigation
fix(runners): run on_run_error_callback for invocation setup failures - #8406
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
Notify run-error plugins when composite-root message setup or resumed state appends fail, preserving the original propagated exception and success-only after-run callbacks. Fixes google#8405
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 #8405
Problem:
Composite roots handle incoming messages before entering the invocation lifecycle. A user-message callback or user-event append failure therefore escapes without notifying
on_run_error_callback. Resumed message and state-only appends have the same gap.Solution:
Catch ordinary message-setup exceptions in the new and resumed invocation helpers, notify through the existing best-effort helper, and re-raise the same propagated exception. Keep execution-error notification and success-only
after_run_callbackbehavior unchanged.Testing Plan
Unit Tests:
pytest tests/unittests/test_runners.py tests/unittests/runners -q: 368 passed, 1 skipped, 3 xfailed.29 regression/control cases across SequentialAgent, ParallelAgent, LoopAgent, direct LlmAgent and BaseNode roots: user-message callback failures, session append failures, resumed function-response setup, state-only resume appends, and execution failures. Assert exactly one run-error callback with the propagated exception and no after-run callback.
Unpatched upstream with the final focused tests: 15 failed, 14 passed. Patched: 29 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:
LlmAgent: exception=RuntimeError error_hooks=1 notified_original=TrueandSequentialAgent: exception=RuntimeError error_hooks=1 notified_original=True.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.