claude-code - 💡(How to fix) Fix [BUG] Intermediate text between tool calls is not streamed to the user [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49223Fetched 2026-04-17 08:47:19
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×3closed ×1

When a model response interleaves text and tool calls (e.g. text → tool → tool → text → tool → text), the intermediate text segments between tool invocations are not streamed to the user in real time. Instead, they appear to be buffered and delivered only after all tool calls in the response have completed — or in some cases swallowed entirely.

Root Cause

Intermediate text is how the assistant communicates reasoning, status updates, and context to the user during multi-step work. Without streaming, long tool-heavy responses feel like a black box until they complete, reducing trust and making it harder to interrupt or redirect when something goes wrong.

RAW_BUFFERClick to expand / collapse

Description

When a model response interleaves text and tool calls (e.g. text → tool → tool → text → tool → text), the intermediate text segments between tool invocations are not streamed to the user in real time. Instead, they appear to be buffered and delivered only after all tool calls in the response have completed — or in some cases swallowed entirely.

Expected behavior

Each text segment should be streamed to the user as soon as it is produced by the model, regardless of whether it precedes, follows, or sits between tool calls. This would allow the user to see incremental progress and reasoning as the assistant works through a multi-step response.

Actual behavior

Only the final text block (after the last tool call) appears to stream normally. Text emitted between tool calls is either:

  • Delivered all at once after the surrounding tool calls finish, or
  • Not displayed at all until the full response is complete

Reproduction

Ask the model to perform a task that naturally produces a text → tool → text → tool → text pattern — for example, explaining what it will do, running a command, commenting on the result, running another command, and summarizing. Observe that intermediate commentary does not appear incrementally.

Why this matters

Intermediate text is how the assistant communicates reasoning, status updates, and context to the user during multi-step work. Without streaming, long tool-heavy responses feel like a black box until they complete, reducing trust and making it harder to interrupt or redirect when something goes wrong.

Environment

  • Claude Code CLI and Desktop (macOS)
  • Also observed via MCP-based clients

extent analysis

TL;DR

Implementing a mechanism to flush or yield control back to the streaming process after each text segment is produced, regardless of tool calls, is likely necessary to achieve the desired real-time streaming behavior.

Guidance

  • Investigate the current buffering or caching mechanisms in place for text segments between tool calls to understand why they are not being streamed immediately.
  • Consider introducing a yield or flush operation after each text segment is generated to ensure it is sent to the user without waiting for subsequent tool calls to complete.
  • Review the model's response generation logic to identify any implicit assumptions about tool call completion before streaming text, and adjust accordingly to prioritize real-time updates.
  • Test the implementation with various tool call patterns (e.g., text → tool → text → tool → text) to ensure intermediate text segments are streamed as expected.

Example

No specific code example can be provided without more details on the implementation, but the concept would involve ensuring that after each text segment is generated, there's an explicit step to send or yield that segment to the user, rather than buffering it until all tool calls are complete.

Notes

The exact solution may depend on the specifics of the model's response generation and streaming implementation, which are not fully detailed in the issue. Additionally, ensuring real-time streaming may require balancing between immediate updates and potential performance considerations.

Recommendation

Apply a workaround by introducing a yield or flush mechanism after each text segment, as this directly addresses the observed behavior of buffering until tool calls complete, and allows for incremental progress updates to be streamed to the user.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Each text segment should be streamed to the user as soon as it is produced by the model, regardless of whether it precedes, follows, or sits between tool calls. This would allow the user to see incremental progress and reasoning as the assistant works through a multi-step response.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Intermediate text between tool calls is not streamed to the user [1 participants]