fix(live): stop retired streaming tools from writing into a new agent run
Maintainer thường phản hồi trong vòng 3 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 22.3k
- Fork
- 4.4k
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/adk-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
google/adk-python#8360 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
google/adk-python#8359 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Can pin to litellm version be changed?Có thể đã có người làm @llalitkumarrr đã nhận 10 ngày trước. Đang mởmodels
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
google/adk-python#8129 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
-
OpenAPI tools ignore operation- and path-level server overridesCó thể đã có người làm @sanketpatil06 đã nhận 14 ngày trước. Đang mởtools
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
google/adk-python#8064 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Two docstrings in openapi_tool document parameters the signatures do not acceptCó thể đã có người làm @surajksharma07 đã nhận 17 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
google/adk-python#8024 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của google/adk-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
vllm-project/vllm#70030 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TigreGotico/tugaphone#408 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
gke-labs/kube-agents#7308 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
t: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày
-
chore
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
lugassawan/swe-workbench#841 ·