claude-code - 💡(How to fix) Fix TUI duplicates recent output into scrollback after permission-prompt modal dismisses [1 comments, 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#52027Fetched 2026-04-23 07:38:30
View on GitHub
Comments
1
Participants
1
Timeline
7
Reactions
0
Participants
Timeline (top)
labeled ×5commented ×1cross-referenced ×1

When a permission prompt modal (e.g., "Do you want to make this edit to SKILL.md? 1. Yes 2. Yes, and allow... 3. No") appears and is dismissed mid-session, Claude Code's TUI redraws its state in a way that flushes the current prompt bar, thinking indicator, and recent tool-call output into scrollback — sometimes 3–4 times — producing visual duplicates. The duplicates are static (not re-firing work), but the scrollback gets cluttered to the point of looking like parallel sessions are running.

Root Cause

Related

We previously observed a similar symptom at session boot when the boot sequence produced 8+ tool calls — the alt-screen buffer exceeded its size and flushed to scrollback, producing duplicate welcome banners. We worked around that locally by consolidating our boot into 2 tool calls. That workaround confirmed the root cause as a TUI flush/redraw edge case. The mid-session permission-prompt case here appears to be the same mechanism triggered by modal layout changes rather than buffer overflow.

Fix Action

Fix / Workaround

Related

We previously observed a similar symptom at session boot when the boot sequence produced 8+ tool calls — the alt-screen buffer exceeded its size and flushed to scrollback, producing duplicate welcome banners. We worked around that locally by consolidating our boot into 2 tool calls. That workaround confirmed the root cause as a TUI flush/redraw edge case. The mid-session permission-prompt case here appears to be the same mechanism triggered by modal layout changes rather than buffer overflow.

RAW_BUFFERClick to expand / collapse

Summary

When a permission prompt modal (e.g., "Do you want to make this edit to SKILL.md? 1. Yes 2. Yes, and allow... 3. No") appears and is dismissed mid-session, Claude Code's TUI redraws its state in a way that flushes the current prompt bar, thinking indicator, and recent tool-call output into scrollback — sometimes 3–4 times — producing visual duplicates. The duplicates are static (not re-firing work), but the scrollback gets cluttered to the point of looking like parallel sessions are running.

Environment

  • Claude Code version: 2.1.117
  • Node: v25.8.1
  • OS: macOS 26.2 (Darwin 25.2.0)
  • Terminal: Apple_Terminal (Terminal.app) 466
  • TERM: xterm-256color
  • Model: Claude Opus 4.7 (1M context)

Steps to reproduce

  1. Start an interactive session: claude
  2. Ask Claude to edit a file outside the allowlisted additionalDirectories (so a permission prompt fires). Example: if additionalDirectories is /Users/you/projects, ask Claude to edit ~/.claude/skills/some-skill/SKILL.md.
  3. When the permission prompt appears, select option 2 ("Yes, and allow Claude to edit its own settings for this session").
  4. Observe the scrollback after Claude finishes the edit: the Edit output, the "thinking" indicator (Topsy-turvying... (Ns • ↓ Nk tokens)), and the next prompt bar appear duplicated 2–4 times.

Expected behavior

After dismissing the modal, the TUI redraws the single current state. Scrollback contains the content that just completed, once.

Actual behavior

The TUI flushes the current prompt bar + thinking indicator + recent tool-call rendering into scrollback multiple times. Each duplicate shows the same values (same Ns • Nk tokens, same context percentage), confirming they are static re-draws of the same state, not separate work.

Verified this is single-session, single-process:

  • ps aux | grep claude shows exactly one claude process for the terminal
  • Only one JSONL exists in ~/.claude/projects/<project>/<session-id>.jsonl
  • The JSONL contains a normal, linear sequence of tool calls (no duplication in the transcript)

So the work itself is correct — only the TUI rendering is glitched.

Evidence

Screenshot attached below (drag-dropped in a comment): shows 4 duplicate renderings in a single session's scrollback after one permission-prompt dismissal.

Related

We previously observed a similar symptom at session boot when the boot sequence produced 8+ tool calls — the alt-screen buffer exceeded its size and flushed to scrollback, producing duplicate welcome banners. We worked around that locally by consolidating our boot into 2 tool calls. That workaround confirmed the root cause as a TUI flush/redraw edge case. The mid-session permission-prompt case here appears to be the same mechanism triggered by modal layout changes rather than buffer overflow.

Impact

Cosmetic only — no actual duplicate work, no wrong output, no data corruption. But visually confusing for non-technical operators (hard to tell what's real state vs. scrollback echo), and scrollback fills up fast in long sessions with many permission prompts.

Suggested investigation

Check the Ink renderer's layout-change handling when modal overlays mount/unmount. The redraw that happens after modal dismissal appears to rewrite buffer regions that have already been committed to scrollback, causing the duplication.

extent analysis

TL;DR

The most likely fix involves modifying the Ink renderer's layout-change handling to prevent rewriting buffer regions that have already been committed to scrollback when modal overlays mount/unmount.

Guidance

  • Investigate the Ink renderer's layout-change handling to identify the cause of the buffer region rewriting issue.
  • Check if the modal dismissal event is triggering an unnecessary redraw of the entire buffer, rather than just updating the changed regions.
  • Consider implementing a flag or mechanism to track which buffer regions have already been committed to scrollback and avoid rewriting them.
  • Review the related issue's workaround, which consolidated boot sequences into fewer tool calls, to see if a similar approach can be applied to the permission-prompt case.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue appears to be a cosmetic problem, but it can cause visual confusion and fill up the scrollback quickly. The root cause is likely related to the TUI rendering and layout-change handling.

Recommendation

Apply a workaround by modifying the Ink renderer's layout-change handling to prevent unnecessary buffer region rewriting. This approach is chosen because it directly addresses the suspected root cause and has been successful in a related issue.

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

After dismissing the modal, the TUI redraws the single current state. Scrollback contains the content that just completed, once.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING