Parallel calls to the same streaming tool leave an orphan task after live teardown
Los mantenedores suelen responder en 5 días
@llalitkumarrr ya está trabajando en esto.
Desde el 8/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Required Information
Describe the Bug:
When one live model response contains multiple calls to the same async-generator tool, ADK starts each call concurrently but stores only one task under InvocationContext.active_streaming_tools[tool.name]. Each registration overwrites the previous task reference. As a result, run teardown and stop_streaming(function_name) can only cancel the last registered call; earlier calls continue writing to the live request queue after their agent run has ended.
The violated lifecycle invariant is that every background tool task started by a live agent run must remain tracked until it completes or the run tears it down.
Steps to Reproduce:
- Create an async-generator
FunctionToolthat yields once and then waits. - Build one live function-call event containing two calls to that tool with different call IDs/arguments.
- Pass the event through
handle_function_calls_live(). - Wait until both tool tasks have started.
- Call
SingleFlow()._stop_background_tool_tasks(invocation_context). - Inspect both tasks.
Expected Behavior:
Both calls are tracked and cancelled during live-run teardown.
Observed Behavior:
Only the task currently stored in active_streaming_tools[tool.name].task is cancelled. The other task remains pending. This reproduces consistently on current main (b0180620f4c2f4f4467a89c37a30f75bf849700b).
Environment Details:
- ADK Library Version: current
mainatb0180620 - Desktop OS: macOS
- Python Version: 3.10.20
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A (unit-level live function-call event)
Additional Context
The overwrite occurs in _process_function_live_helper() when it assigns a newly created task to active_streaming_tools[tool.name].task. stop_background_tool_tasks() later enumerates one task per registry entry, so it has no reference to the earlier call. Non-blocking live tools avoid the same collision by including the function-call ID in their task key.
I intend to keep all concurrent tasks for a streaming tool tracked while preserving the existing name-based stop_streaming behavior, and add a regression test through the real live function-call path. I can send the focused fix and test within 24 hours.
Regression:
Not confirmed.
Logs:
assert all(task.done() for task in tasks)
E assert False
Minimal Reproduction Code:
await handle_function_calls_live(
invocation_context,
event_with_two_calls_to_monitor,
{monitor_tool.name: monitor_tool},
)
await both_started.wait()
await SingleFlow()._stop_background_tool_tasks(invocation_context)
assert all(task.done() for task in started_tasks) # fails: one is still pending
How often has this issue occurred?:
- Always (100%)
- Lenguaje dominante
- Python
- Estrellas
- 21.6k
- Forks
- 4k
- Merge medio
- 12 h 6 min
- PR fusionados (30 d)
- 4
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de google/adk-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
google/adk-python#7334 · 1 comentario ·
Los mantenedores suelen responder en 5 días
-
Redis append_event stamps last_update_time with the wall clock, not the event timestampPosiblemente ocupada @sanketpatil06 la tomó hace 1 día. Abiertoservices
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
google/adk-python#7292 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 5 días
-
GoogleOidcVerifier treats string "false" as a verified email claimPosiblemente ocupada @surajksharma07 la tomó hace 1 día. Abiertocore
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
google/adk-python#7289 · 5 comentarios · 1 asignado ·
Los mantenedores suelen responder en 5 días
-
RestApiTool raises uncaught KeyError when a required path param is omittedPosiblemente ocupada @llalitkumarrr la tomó hace 1 día. Abiertotools
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/adk-python#7282 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 5 días
-
CredentialsManager should also extract scopes when populating auth schemesPosiblemente ocupada @sanketpatil06 la tomó hace 4 días. Abiertocore needs review
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/adk-python#7266 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 5 días
Todos los issues de google/adk-python
Issues similares
-
ACK_WAITING HELP_WANTED UPDATE_CS
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OWASP/CheatSheetSeries#2458 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
BasedHardware/omi#19711 ·
Los mantenedores suelen responder en 1 día
-
Qwen3_5MoeModel no longer returns router_logits, breaking aux loss with output_router_logits=TrueAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
huggingface/transformers#49172 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vllm-project/vllm-metal#885 ·
Los mantenedores suelen responder en 1 día