Skip to content

fix: end a ParallelAgent early only when a direct sub-agent escalates (cherry-pick to release/candidate) - #6918

Merged
wukath merged 1 commit into
release/candidatefrom
cherry-pick/release-candidate-cd04c7a7
Aug 26, 2026
Merged

fix: end a ParallelAgent early only when a direct sub-agent escalates (cherry-pick to release/candidate)#6918
wukath merged 1 commit into
release/candidatefrom
cherry-pick/release-candidate-cd04c7a7

Conversation

@wukath

@wukath wukath commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

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-pick workflow failed on this commit with a merge conflict
in src/google/adk/agents/parallel_agent.py, so the resolution was done by
hand. Re-running the workflow will not help — it hits the same conflict.

Problem:

The conflict is contextual, not semantic. On main, _merge_agent_run wraps
its asyncio.TaskGroup in a try: / except BaseExceptionGroup block that
release/candidate does not have; that wrapper arrived in a separate commit
that 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/candidate and applied only this
commit's change: _has_escalate_action(event) becomes
_asks_this_agent_to_exit(event, sub_agent_names), with sub_agent_names
threaded through both merge helpers.

The BaseExceptionGroup handling was deliberately left out. It belongs to a
different commit and pulling it in would have carried an unrelated behavior
change into the release branch.

The diff of this branch against release/candidate is identical to the
upstream commit's own diff, modulo line offsets — nothing extra was introduced.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Tests come from the cherry-picked commit itself.

tests/unittests/agents/test_parallel_agent.py    27 passed
tests/unittests/agents/                          952 passed, 2 xfailed

The regression test added by the commit,
test_run_async_keeps_siblings_when_a_nested_loop_ends_itself, passes on both
parametrizations (use_pre_3_11_merge False and True), so the 3.11 TaskGroup
path and the pre-3.11 path are both covered.

To confirm the resolution is semantically correct rather than merely compiling:
reverting parallel_agent.py to the release/candidate version makes both
parametrizations fail, and restoring the resolved version makes them pass.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Original authorship (George Weale) is preserved on the commit.

Please review the conflict resolution specifically — the judgement call was
excluding the BaseExceptionGroup wrapper.

After this merges, run the Release: Cut workflow with action='regenerate'
and branch='main' to refresh the changelog PR.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 971542697
@github-actions

Copy link
Copy Markdown

Release artifact check: PASS

Comparing 2.7.1 against 2.7.0.
Modules swept: 685 candidate, 674 baseline.

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.

  • google.adk.integrations.model_armor._plugin
    • ModuleNotFoundError: No module named 'google.api_core'
  • google.adk.labs.antigravity._sub_agent_tools
    • ImportError: The 'google-antigravity' package is required to use the ADK Antigravity integration. Install it with: pip install "google-adk[antigravity]"
  • google.adk.labs.antigravity._tool_result_capture
    • ImportError: The 'google-antigravity' package is required to use the ADK Antigravity integration. Install it with: pip install "google-adk[antigravity]"
No longer shipped (1)
  • google.adk.labs.antigravity._trajectory_files

@wukath
wukath merged commit 0880bbe into release/candidate Aug 26, 2026
4 checks passed
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.

3 participants