Skip to content

fix(live): handle transfer responses in any order - #6563

Draft
kinKingen wants to merge 2 commits into
google:mainfrom
kinKingen:fix/live-transfer-response-order
Draft

fix(live): handle transfer responses in any order#6563
kinKingen wants to merge 2 commits into
google:mainfrom
kinKingen:fix/live-transfer-response-order

Conversation

@kinKingen

Copy link
Copy Markdown

Link to Issue or Description of Change

Closes #6541

Problem:

During a Live API transfer, parallel tool results can place another function response before transfer_to_agent. The transfer gate only inspected event.content.parts[0], so the parent connection stayed active and the target sub-agent never started even though event.actions.transfer_to_agent was set.

Solution:

Scan event.get_function_responses() for transfer_to_agent before entering the existing transfer block. The existing action check, connection close, delay, resumption reset, and sub-agent startup behavior remain unchanged.

Testing Plan

Unit Tests:

  • Added regression coverage for [set_state, transfer_to_agent], reversed order, transfer-only, and a non-transfer control.
  • pytest -vv tests/unittests/flows/llm_flows/test_base_llm_flow.py::test_run_live_transfers_regardless_of_function_response_order — 4 passed.
  • pytest -q tests/unittests/flows/llm_flows/test_base_llm_flow.py tests/unittests/flows/llm_flows/test_functions_parallel.py — 61 passed.
  • Full suite is clean: tox ran Python 3.10, 3.11, 3.12, 3.13, and 3.14; each environment reported 9734 passed, 51 skipped, 15 xfailed, 1 failed. The sole failure in every environment is the unrelated existing tests/unittests/cli/utils/test_cli_tools_click.py::test_telemetry_cli_commands; it reproduces in isolation and neither changed file is in the CLI/telemetry path.
  • Formatting/static hooks passed: YAML, EOF, trailing whitespace, pyproject-fmt, ruff, isort, pyink, addlicense, filename policy, ADK compliance, mdformat, codespell, and git diff --check. The constraints update hook cannot complete in this sparse checkout because its constraints files are absent; generated artifacts were not committed.

Manual End-to-End (E2E) Tests:

Ran the Live flow through BaseLlmFlow.run_live with a mocked model connection and child agent. Console result:

[set_state, transfer_to_agent]  PASSED  # child starts once; connection closes once
[transfer_to_agent, set_state]  PASSED  # child starts once; connection closes once
[transfer_to_agent]             PASSED  # child starts once; connection closes once
[set_state, other_tool]         PASSED  # no child start; no connection close
4 passed

This is offline and does not require provider credentials.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have added tests that prove the fix is effective.
  • All existing unit tests pass locally (one unrelated CLI failure is documented above).
  • I have manually exercised the Live transfer path end-to-end with mocked transport boundaries.
  • No dependent changes are required.

Additional context

A maintainer reproduced the same order dependency and approved this predicate-widening approach in #6541. The two remote files were SHA-256 compared with the locally tested files after browser upload and match byte-for-byte.

AI assistance disclosure: Codex assisted with reproduction, implementation, test execution, and PR preparation. The contributor reviewed the final diff, validation output, and claims before submission.

Scan every function response before starting the transferred sub-agent. Preserve the existing connection close, delay, and resumption behavior.

Fixes google#6541
Exercise both response orders, a single transfer response, and a non-transfer response set through the live flow.
@google-cla

google-cla Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot adk-bot added the live [Component] This issue is related to live, voice and video chat label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

live [Component] This issue is related to live, voice and video chat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python][Live] transfer_to_agent is ignored when its function response is not content.parts[0]

3 participants