You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Pi adapter publishes empty assistant messages, shown as "(empty response)" between tool calls #43433
I included enough detail to reproduce or investigate the problem.
Why a new issue
#42689 was closed as not planned with a no-repro note, but the triage run on it did reproduce the bug. I can't reopen it myself and my comment there hasn't been picked up, so I'm filing it again with a shorter summary.
The only step that failed was the live Gemini run. It hit a 429 quota error before any stream came back.
Area
apps/server
Actual behavior
With Pi on google/gemini-4-neon, a tool-use turn shows an (empty response) row before almost every tool call on web and desktop.
Pi forwards Gemini's empty text part as a text_delta with delta: "". In the Pi adapter, scheduleStreamFlush publishes the item after 50ms without checking that it has text. When text_end arrives after that, the empty item is already published, so completeStreamItem finalizes it as an empty assistant_message.
Steps to reproduce
Run the test in the commit above. Or by hand:
Start a Pi turn and emit message_start with role: "assistant".
Emit text_start, then text_delta with delta: "".
Wait more than 50ms, then emit text_end with content: "" and message_end.
Expected behavior
No assistant_message for a text block that never had any text.
Suggested fix
In scheduleStreamFlush, skip emitStreamItem when item.text.length === 0 && !item.published. Leave completeStreamItem as it is, so a published block that restarts empty still clears its old text.
Happy to send a PR with this guard and the test above.
Activity