[Bug] Non-progressive streaming aggregation drops all but the first text part in a chunk
Les mainteneurs répondent en général sous 3 jours
Évaluation
Cette issue n'a pas encore été évaluée.
Description
[Bug] Non-progressive streaming aggregation drops all but the first text part in a chunk
Describe the Bug
In the non-progressive SSE streaming path, StreamingResponseAggregator.process_response only looks at content.parts[0] of each chunk. When a single chunk carries two text parts — for example a thought part and a regular part together, which is common when thinking is enabled — every part after the first is silently dropped from the aggregated response. The final close() response then contains only the first part's text, so the user-visible answer is incomplete with no error.
Scope, stated plainly: this only affects the non-progressive path. PROGRESSIVE_SSE_STREAMING is STABLE with default_on=True (src/google/adk/features/_feature_registry.py), so the default configuration is not affected — the progressive branch already iterates over all parts. The bug bites only when the feature is explicitly disabled (ADK_DISABLE_PROGRESSIVE_SSE_STREAMING=1, or --disable_features=...PROGRESSIVE_SSE_STREAMING). The doc in src/google/adk/agents/_streaming_mode.py already warns that with the feature OFF, aggregation is "simple text accumulation" that "may lose some information" — this bug is one concrete instance of that loss.
Steps to Reproduce
- Install
google-adkfrommain(2.15.0, commit2b90353). - Disable progressive SSE streaming:
ADK_DISABLE_PROGRESSIVE_SSE_STREAMING=1. - Feed one
GenerateContentResponsechunk carrying a thought part and a regular part together throughStreamingResponseAggregator, then callclose()and inspect the aggregated response's parts.
Expected Behavior
The aggregated response keeps both text parts, in order:
- part 0:
text="Thinking...",thought=True - part 1:
text="Hello",thought=False
Observed Behavior
The aggregated response contains only one part:
- part 0:
text="Thinking...",thought=True
"Hello" (the second text part) is gone — no error, no warning.
Environment Details
- ADK Library Version (pip show google-adk): 2.15.0 (
main@2b90353) - Desktop OS: Linux
- Python Version (python -V): 3.12.3
Model Information
- Are you using LiteLLM: No
- Which model is being used: N/A (no model call is needed to reproduce; a synthetic
GenerateContentResponseis enough — the parts are dropped in local aggregation, before any model call matters)
Regression
Unknown — not checked against earlier releases.
How often has this issue occurred?
- Always (100%) — whenever progressive streaming is disabled and a chunk carries two or more text parts.
Root Cause
StreamingResponseAggregator.process_response in src/google/adk/utils/streaming_utils.py, non-progressive branch, reads only the first part:
llm_response.content.parts[0].textdecides whether there is text to accumulatepart0.thoughtdecides whether it goes to_thought_textor_text
Parts after the first are never appended to either buffer, so close() can only merge what the first part contributed. The same first-part-only assumption appears in the merged-text-event guard: not llm_response.content.parts[0].inline_data — an audio (inline_data) part sitting at index 1 or later would not suppress the merged text event.
The progressive branch (earlier in the same method) does not have this bug: it already loops for part in llm_response.content.parts and accumulates every text part. The fix is to do the same in the non-progressive branch — iterate over all parts with text, sort each into _thought_text or _text by its thought flag — and to check inline_data with any(...) across all parts.
Minimal Reproduction Code
import asyncio
from google.adk.features import FeatureName
from google.adk.features._feature_registry import temporary_feature_override
from google.adk.utils import streaming_utils
from google.genai import types
async def main():
with temporary_feature_override(FeatureName.PROGRESSIVE_SSE_STREAMING, False):
aggregator = streaming_utils.StreamingResponseAggregator()
response = types.GenerateContentResponse(
candidates=[types.Candidate(content=types.Content(parts=[
types.Part(text="Thinking...", thought=True),
types.Part(text="Hello"),
]))]
)
async for _ in aggregator.process_response(response):
pass
closed = aggregator.close()
print([p.text for p in closed.content.parts])
# Expected: ['Thinking...', 'Hello']
# Actual on main: ['Thinking...']
asyncio.run(main())
- Langage dominant
- Python
- Étoiles
- 22.3k
- Forks
- 4.4k
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 6
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de google/adk-python
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
google/adk-python#8360 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
google/adk-python#8359 ·
Les mainteneurs répondent en général sous 3 jours
-
Can pin to litellm version be changed?Peut-être pris @llalitkumarrr l’a pris il y a 10 jours. Ouvertemodels
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
google/adk-python#8129 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
OpenAPI tools ignore operation- and path-level server overridesPeut-être pris @sanketpatil06 l’a pris il y a 14 jours. Ouvertetools
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
google/adk-python#8064 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
Two docstrings in openapi_tool document parameters the signatures do not acceptPeut-être pris @surajksharma07 l’a pris il y a 17 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
google/adk-python#8024 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de google/adk-python
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
vllm-project/vllm#70030 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TigreGotico/tugaphone#408 ·
Les mainteneurs répondent en général sous 1 jour
-
needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
gke-labs/kube-agents#7308 ·
Les mainteneurs répondent en général sous 1 jour
-
t: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours
-
chore
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
lugassawan/swe-workbench#841 ·