Skip to content

fix(runners): preserve multi-branch visibility for function responses (#8515) - #8521

Open
Abdulrehman1978 wants to merge 1 commit into
google:mainfrom
Abdulrehman1978:fix/parallel-agent-resume-multi-response
Open

Abdulrehman1978 wants to merge 1 commit into
google:mainfrom
Abdulrehman1978:fix/parallel-agent-resume-multi-response

Conversation

@Abdulrehman1978

Copy link
Copy Markdown

Summary

When a single user message carries function_responses answering long-running tool calls from multiple branches of a resumable ParallelAgent, _stamp_event_branch_context() previously called find_matching_function_call() (which only inspects the first function_response) and stamped the entire user event with that first call's branch (e.g. root.a). As a result, sibling branches (root.b) never received the user event in InvocationContext._get_events(current_branch=True) and stayed paused.

Fixes #8515

Changes

  • Update _stamp_event_branch_context() in src/google/adk/runners.py to match all function_responses in the event against prior function calls in the invocation.
    • When all matched calls share a single branch, stamp event.branch as before.
    • When matched calls span multiple distinct branches, leave event.branch unset (None) so each branch receives the event while InvocationContext._get_events(current_branch=True) continues to scope responses by _branch_function_call_ids().
    • Only stamp event.isolation_scope when all matched calls agree on a single non-None scope.
  • Add regression test test_resumable_parallel_agent_single_message_resumes_all_branches in tests/unittests/runners/test_resume_invocation.py.

Testing

  • pytest tests/unittests/runners/test_resume_invocation.py tests/unittests/runners/test_pause_invocation.py tests/unittests/agents/test_parallel_agent.py -q (33 passed, 1 skipped, 3 xfailed)

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.

ParallelAgent resume: one message answering calls in two branches only resumes the first

1 participant