fix: end a ParallelAgent early only when a direct sub-agent escalates (cherry-pick to release/candidate) - #6918
Merged
Conversation
Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 971542697
Release artifact check: PASSComparing No module regressed against the baseline. New modules that do not import (3)Not a failure. New modules usually sit behind an optional extra, so this is expected on a bare install -- but a module that is meant to work without extras belongs on the list above, so it is worth a glance.
No longer shipped (1)
|
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
Manual cherry-pick of cd04c7a ("fix: end a
ParallelAgent early only when a direct sub-agent escalates") into
release/candidate.The
Release: Cherry-pickworkflow failed on this commit with a merge conflictin
src/google/adk/agents/parallel_agent.py, so the resolution was done byhand. Re-running the workflow will not help — it hits the same conflict.
Problem:
The conflict is contextual, not semantic. On
main,_merge_agent_runwrapsits
asyncio.TaskGroupin atry:/except BaseExceptionGroupblock thatrelease/candidatedoes not have; that wrapper arrived in a separate committhat was never cherry-picked. The wrapper is pure context around the single line
this fix changes, and it shifts the whole block by one indent level, so git
could not line the hunk up.
Solution:
Kept the structure already on
release/candidateand applied only thiscommit's change:
_has_escalate_action(event)becomes_asks_this_agent_to_exit(event, sub_agent_names), withsub_agent_namesthreaded through both merge helpers.
The
BaseExceptionGrouphandling was deliberately left out. It belongs to adifferent commit and pulling it in would have carried an unrelated behavior
change into the release branch.
The diff of this branch against
release/candidateis identical to theupstream commit's own diff, modulo line offsets — nothing extra was introduced.
Testing Plan
Unit Tests:
Tests come from the cherry-picked commit itself.
The regression test added by the commit,
test_run_async_keeps_siblings_when_a_nested_loop_ends_itself, passes on bothparametrizations (
use_pre_3_11_mergeFalse and True), so the 3.11 TaskGrouppath and the pre-3.11 path are both covered.
To confirm the resolution is semantically correct rather than merely compiling:
reverting
parallel_agent.pyto therelease/candidateversion makes bothparametrizations fail, and restoring the resolved version makes them pass.
Checklist
Additional context
Original authorship (George Weale) is preserved on the commit.
Please review the conflict resolution specifically — the judgement call was
excluding the
BaseExceptionGroupwrapper.After this merges, run the
Release: Cutworkflow withaction='regenerate'and
branch='main'to refresh the changelog PR.