claude-code - 💡(How to fix) Fix TUI relayouts (SIGWINCH / permission-mode toggle) spill entire transcript into scrollback as duplicate copies [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#46834Fetched 2026-04-12 13:31:51
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Fix Action

Fix / Workaround

Workarounds

  • cmd+K / clear to flush scrollback after the fact
  • Avoid resizing the terminal mid-session
  • Avoid toggling permission mode via Shift+Tab in long sessions
RAW_BUFFERClick to expand / collapse

Version

  • Claude Code v2.1.101
  • macOS (Darwin 25.3.0)
  • Opus 4.6 (1M context), Claude Max
  • Standard macOS terminal

What happens

During a single Claude Code session, the entire conversation transcript is re-emitted into the terminal's primary scrollback as a fresh full copy every time the TUI relayouts. The live alt-screen pane continues to show the session correctly, but scrolling up reveals N identical copies of the session so far.

Each duplicate is the same session content — same user messages, same assistant responses, same tool calls, same tool-output line numbers, same in-progress spinner state (e.g. Wibbling… (4m 39s)) — rewrapped at a slightly different terminal column width.

Repro

  1. Start a CC session. Run a few commands that produce meaningful transcript (e.g. an MCP call, a skill launch, multi-hunk file edits with visible diffs).
  2. Trigger any of:
    • Resize the terminal window
    • Press Shift+Tab to cycle permission mode (e.g. flip to ⏵⏵ accept edits on)
    • External display connect/disconnect, full-screen toggle, Mission Control gesture — anything that fires a SIGWINCH
  3. Scroll up in the terminal.

Expected: one transcript of the session. Actual: multiple full copies of the transcript stacked in scrollback, each at a different column width.

Evidence it's a renderer issue, not duplicate sessions

  • ps aux | grep claude shows only one live claude process
  • Each scrollback copy wraps at a different column width (e.g. ~100 → ~115 → ~130 cols) — the content is being re-laid out and re-emitted
  • Status line drifts between copies: earlier copies show 1 MCP server failed · /mcp, later copies show ⏵⏵ accept edits on (shift+tab to cycle), proving the copies were captured at different TUI states within the same session
  • The in-memory conversation the model sees is not duplicated — only the primary scrollback buffer is

Likely cause

The Ink/Yoga TUI appears to re-render the full in-scrollback conversation history on SIGWINCH or permission-mode toggle, rather than limiting the relayout to the active alt-screen pane. Each relayout flushes the entire history back into primary scrollback as a fresh block. The cost is proportional to transcript length, so it's most visible in long sessions.

Impact

Cosmetic / disorienting. The session itself continues to work correctly and the model does not see duplicated context. But scrollback becomes unusable for reviewing a long session, and on first encounter it reads like a real duplication bug — my first hypothesis was that my MCP memory layer was writing duplicate records. It wasn't; the storage was clean.

Suggested fix

  • Limit relayout to the active alt-screen pane; don't re-emit historical transcript on SIGWINCH
  • If relayout of in-scrollback history is truly necessary for correctness, do it in place via cursor addressing rather than appending to scrollback

Workarounds

  • cmd+K / clear to flush scrollback after the fact
  • Avoid resizing the terminal mid-session
  • Avoid toggling permission mode via Shift+Tab in long sessions

Happy to provide additional environment info, a recording, or a minimal repro if useful.

extent analysis

TL;DR

Limiting the relayout to the active alt-screen pane or re-rendering in-place via cursor addressing may resolve the issue of duplicate conversation transcripts in the terminal scrollback.

Guidance

  • Verify that the issue is indeed related to the Ink/Yoga TUI re-rendering the full conversation history on SIGWINCH or permission-mode toggle by checking the terminal output and scrollback behavior.
  • Consider implementing a fix that limits the relayout to the active alt-screen pane, rather than re-emitting the entire conversation history.
  • If re-rendering of in-scrollback history is necessary, explore using cursor addressing to update the scrollback in-place, rather than appending to it.
  • In the meantime, use workarounds such as flushing scrollback with cmd+K / clear or avoiding terminal resizing and permission mode toggles during long sessions.

Notes

The issue appears to be cosmetic and does not affect the functionality of the session itself, but it can still cause disorientation and make it difficult to review long sessions.

Recommendation

Apply the suggested fix of limiting relayout to the active alt-screen pane or re-rendering in-place via cursor addressing, as this approach addresses the root cause of the issue and provides a more efficient and user-friendly solution.

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