TUI duplicates recent output into scrollback after permission-prompt modal dismisses

Resolved 💬 5 comments Opened Apr 22, 2026 by natefosterwarner Closed May 28, 2026

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.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗