fix(live): handle transfer responses in any order - #6563
Draft
kinKingen wants to merge 2 commits into
Draft
Conversation
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.
|
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. |
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
Closes #6541
Problem:
During a Live API transfer, parallel tool results can place another function response before
transfer_to_agent. The transfer gate only inspectedevent.content.parts[0], so the parent connection stayed active and the target sub-agent never started even thoughevent.actions.transfer_to_agentwas set.Solution:
Scan
event.get_function_responses()fortransfer_to_agentbefore 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:
[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.toxran Python 3.10, 3.11, 3.12, 3.13, and 3.14; each environment reported9734 passed, 51 skipped, 15 xfailed, 1 failed. The sole failure in every environment is the unrelated existingtests/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.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_livewith a mocked model connection and child agent. Console result:This is offline and does not require provider credentials.
Checklist
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.