claude-code - 💡(How to fix) Fix Streaming renderer duplicates tail chunk of long assistant reply (3x repeat of mid-sentence fragment + code block) [2 comments, 2 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#55102Fetched 2026-05-01 05:46:14
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
1
Timeline (top)
labeled ×5commented ×2closed ×1cross-referenced ×1

Root Cause

Repro context (not minimal — just what was on screen):

  • Reply was ~80 lines of markdown
  • Mixed h2 / h3 / bold-numbered list / fenced bash blocks
  • Triggered after a Skill invocation returned a long context block, followed by an assistant reply that synthesized that content
  • VS Code integrated terminal — this matters because VS Code's terminal handles ANSI cursor/clear rewrites slightly differently from standalone Windows Terminal or ConPTY hosts, and that's a likely interaction point.
RAW_BUFFERClick to expand / collapse

Environment:

  • Claude Code 2.1.123
  • Host terminal: VS Code integrated terminal, shell PowerShell (Windows PowerShell 5.1 on Windows 11 Pro 10.0.26200)
  • Model: Claude Opus 4.7 (1M context)

What happened: A long assistant reply containing nested markdown (h2/h3 headings, bold-numbered list items 1–6, and multiple fenced code blocks) was rendered with the tail of the message duplicated three times. The duplication started mid-sentence at a chunk boundary (not at a clean section break), repeated items 2–6 of a numbered list plus the next heading and its code block, and replayed that whole chunk twice more before the message ended.

Symptoms that point to a streaming-renderer issue (not model output):

  • Duplicate begins mid-line ("it right — only matters if you bypass the wrapper"), which is inside list item 2 — a chunk-boundary replay, not a re-emission.
  • The first tail is fragmented: list item 2 is cut off, then a later heading ("Remove an entity") and its code block appear, then the "Reference" heading — i.e., sections got reflowed before the duplicate ran.
  • Asking the assistant to re-check confirmed its generated text had each section exactly once.

Repro context (not minimal — just what was on screen):

  • Reply was ~80 lines of markdown
  • Mixed h2 / h3 / bold-numbered list / fenced bash blocks
  • Triggered after a Skill invocation returned a long context block, followed by an assistant reply that synthesized that content
  • VS Code integrated terminal — this matters because VS Code's terminal handles ANSI cursor/clear rewrites slightly differently from standalone Windows Terminal or ConPTY hosts, and that's a likely interaction point.

Expected: Each section rendered once. Actual: Tail chunk rendered three times. Screenshot to follow as a comment.

Severity: Cosmetic but confusing — looks like the model output was duplicated, which is incorrect attribution.

extent analysis

TL;DR

The issue can be mitigated by investigating the interaction between the Claude Code rendering and the VS Code integrated terminal's handling of ANSI cursor rewrites.

Guidance

  • Verify that the issue is specific to the VS Code integrated terminal by testing the same scenario in a standalone Windows Terminal or ConPTY host.
  • Check if the problem persists when rendering shorter markdown responses to isolate if the issue is related to the length of the response or the specific content.
  • Investigate the Claude Code 2.1.123 rendering logic to see if there are any known issues with handling chunk boundaries or if there are any configuration options to adjust the rendering behavior.
  • Consider testing with a different shell or environment to rule out any PowerShell 5.1 or Windows 11 Pro 10.0.26200 specific issues.

Example

No specific code snippet can be provided without more information on the Claude Code rendering logic.

Notes

The issue seems to be related to the interaction between the Claude Code rendering and the VS Code integrated terminal, but without more information on the rendering logic, it's difficult to provide a definitive solution.

Recommendation

Apply workaround: Test the scenario in different terminals and environments to isolate the issue and potentially find a configuration that mitigates the problem, as the root cause is unclear and may require further investigation.

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…

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 Streaming renderer duplicates tail chunk of long assistant reply (3x repeat of mid-sentence fragment + code block) [2 comments, 2 participants]