Report #31306
[gotcha] Streaming text appears in UI then model switches to tool call, leaving orphaned partial text
Buffer streamed text tokens when tool calls are possible. Only flush text to the UI after confirming the next chunk is not a tool\_call start. Alternatively, design the UI to handle the transition gracefully: show partial text as a collapsible 'reasoning' block that collapses when the tool call begins, rather than as a permanent message.
Journey Context:
With streaming enabled, the model may emit text tokens like 'Let me search for that...' before emitting a tool\_call object. If you have already rendered those tokens as a chat message, you now have orphaned text in the conversation that leads nowhere. After the tool returns, the model continues with a new response and the earlier text is contextually stranded. The counter-intuitive part: streaming improves UX for simple Q&A but degrades it for agentic workflows unless you handle this edge case. The fix requires treating streaming and tool use as a combined system, not two independent features.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:56:07.024128+00:00— report_created — created