Conversation
|
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. |
CorgiBoyG
force-pushed
the
fix/streaming-tool-task-tracking
branch
from
September 8, 2026 10:26
4f68ffe to
33602a5
Compare
CorgiBoyG
force-pushed
the
fix/streaming-tool-task-tracking
branch
from
September 20, 2026 14:11
33602a5 to
8fee86a
Compare
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.
Summary
LiveRequestQueueand broadcast live input to all active call streamsstop_streaming, transfer, and live-run teardown while preserving later registrationsFixes #7058
Problem
_process_function_live_helper()stored one task per tool name inInvocationContext.active_streaming_tools. When one live model response invoked the same async-generator tool more than once, each registration replaced the previous task reference. The earlier call kept running but was no longer reachable bystop_streaming()or run teardown, so it could continue writing responses after its agent run ended.This violated the lifecycle invariant that every background tool call started by a live run remains tracked until it completes or the run stops it.
Solution
ActiveStreamingToolnow maintains a private task-to-stream registry while preserving its existingtaskandstreamcompatibility fields. Compatibility construction throughActiveStreamingTool(task=..., stream=...)initializes the same registry.Each call gets an independent input queue. Completion callbacks release task and stream references,
stop_streamingoperates on a snapshot so it cannot remove calls registered later, and transfer/run teardown enumerate every active task.The implementation is based on the current live runtime layout:
google.adk.live._active_streaming_toolgoogle.adk.flows.llm_flows.tools._callergoogle.adk.agents.active_streaming_toolcompatibility re-exportTesting
AgentandRunner.run_live:mainatd57c84f1: two calls start; teardown reports[False, True][True, True]stop_streamingcancellation paths.983 passedacross the complete LLM-flow, streaming, active-streaming-tool, and FunctionTool test sets.PYTHONASYNCIODEBUG=1.The full
tests/unittestsrun reached 72% without failures, then stopped making progress for approximately eight minutes and was terminated. It is not reported as a passing full-suite run.Risk
The change is limited to live async-generator tool bookkeeping and input-stream injection. Existing name-based
stop_streamingsemantics remain intact: it stops all active calls for that tool name. Public compatibility fields and the compatibility import preserve their existing roles, while completed tasks and streams are released promptly.