fix(live): stop retired streaming tools from writing into a new agent run
Maintainer antworten meist innerhalb von 3 Tagen
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Start with stop_background_tool_tasks() and _run_streaming_tool(), then trace how ActiveBackgroundTool registry entries relate to the shared LiveRequestQueue during Runner.run_live transfers. Reproduce with the mock Live connection. Done when a tool that ignores cancellation and yields after its entry is retired sends nothing to the model or user event path, and a late finally cannot remove a newer entry with the same function-call id. A linked pull request (#8303) already exists, so check it first.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
stop_background_tool_tasks() gives a background tool one second to stop, then retires its registry entry even if the tool ignored cancellation. That best-effort lifecycle is useful, but retirement currently does not fence the tool's output path.
A streaming tool can swallow CancelledError, wait until its registry entry has been cleared, and then yield another result. _run_streaming_tool() still sends that result to the shared LiveRequestQueue. An Event yielded at the same point can still be enqueued as a user-facing message. During agent transfer, the old call can therefore write into the next agent's stream.
This is a remaining case after #7006. Ordinary cooperative cancellation stops the tool before the transfer delay; this report covers a tool that deliberately ignores the first cancellation and produces output only after retirement.
Reproduction
The regression uses the real Runner.run_live, an in-memory LiveRequestQueue, and the existing mock Live connection:
- The root agent starts a streaming tool and transfers to a subagent.
- The tool ignores its first cancellation.
- The shutdown timeout expires and the registry is cleared.
- The tool yields
{"late": True}during the transfer delay.
On current main (2b90353cd2f1ee0a8a52262a7843333b6f7d2c8d), late_stream reaches the model connection after transfer. A second direct reproduction shows a retired tool yielding Event(message="stale") into the user event path.
Expected
Use the existing ActiveBackgroundTool entry as the call's ownership token. Once that exact entry is no longer registered, the call must stop producing model responses and user events. A late finally block must not remove a newer entry with the same function-call id. The existing one-second best-effort cancellation policy and normal output from a still-current tool should stay unchanged. No real Gemini Live endpoint is needed to verify the ADK-owned task, registry, and queue behavior.
- Vorherrschende Sprache
- Python
- Sterne
- 22.3k
- Forks
- 4.4k
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus google/adk-python
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
google/adk-python#8360 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
google/adk-python#8359 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Can pin to litellm version be changed?Evtl. vergeben @llalitkumarrr hat das vor 10 Tagen übernommen. Offenmodels
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
google/adk-python#8129 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
OpenAPI tools ignore operation- and path-level server overridesEvtl. vergeben @sanketpatil06 hat das vor 14 Tagen übernommen. Offentools
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
google/adk-python#8064 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Two docstrings in openapi_tool document parameters the signatures do not acceptEvtl. vergeben @surajksharma07 hat das vor 17 Tagen übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
google/adk-python#8024 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in google/adk-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
vllm-project/vllm#70030 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
TigreGotico/tugaphone#408 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
gke-labs/kube-agents#7308 ·
Maintainer antworten meist innerhalb von 1 Tag
-
t: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 3 Tagen
-
chore
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
lugassawan/swe-workbench#841 ·