[BUG] Silent compaction re-renders unsent input buffer in prompt line without "Compacting conversation…" indicator

Resolved 💬 5 comments Opened Apr 19, 2026 by rkm097git Closed May 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Two bugs combine into a single observed failure:

  1. Compaction fires silently — no "Compacting conversation…" pause and no countdown indicator. The conversation blocks frequently and suddenly redraw all at once without any transition or progress message. Related to #31828.
  1. The input buffer is restored into the prompt line after compaction — text that was typed in the prompt field but never submitted (Enter was never pressed) reappears in the prompt line after the silent compaction completes, as if it were a ghost copy. This is not a model fabrication issue (the text doesn't appear as a conversation turn); it appears inside the prompt input box itself, as a duplicate image of what was typed before compaction fired.

The two effects sometimes co-occur: silent compaction fires while text is in the input buffer → TUI remounts → input draft is restored → user sees unsent text ghosted in the prompt with no indication that compaction happened at all.

The issue is aggressively increasing token consumption.

What Should Happen?

  1. Compaction should display a visible "Compacting conversation…" indicator before and during compaction — the earlier behavior where a countdown was shown and compaction was visibly acknowledged. Compaction should not happen so frequently and in such short intervals.
  2. After compaction completes, the prompt input line should be empty (or clearly indicate that a draft was preserved), not silently restore pre-compaction buffer state that the user may have already abandoned.

Error Messages/Logs

No error output. The failure is entirely visual/behavioral — the TUI repaints silently.

Steps to Reproduce

  1. Start a Claude Code session with a large codebase or a multi-agent pipeline (anything that will cause context to grow quickly)
  2. While Claude is processing (or just after a response), begin typing a new message in the prompt field — do not press Enter
  3. Wait for context compaction to trigger automatically
  4. Observe: the conversation blocks redraw all at once with no "Compacting conversation…" message
  5. Observe: the text you typed (but did not submit) reappears in the prompt input line as if it is still active

Expected at step 4: visible compaction indicator
Expected at step 5: empty prompt field

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

~v2.1.80

Claude Code Version

2.1.114

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Related issues:

  • #31828 — "auto compaction become silence" (open) — confirms the compaction indicator regression
  • #48740 — "Emit compact_started event before compaction begins" (open) — the stream-json output also has no pre-compaction event, confirming the silence is at the protocol level
  • #46983 — TUI banner/statusline duplication after silent redraw (open, has repro)

Root cause hypothesis:
The CLI appears to persist the current input buffer as part of session snapshot state (for crash recovery). When silent compaction fires and the TUI tears down and remounts its React/Ink component tree, the snapshot is replayed — including the unsaved input draft — even though the user likely does not intend to submit the text they were in the middle of typing before compaction interrupted them.
The fix would require either (a) not persisting the input buffer in the compaction snapshot, or (b) showing a clear "draft restored" indicator so the user can decide whether to submit or discard it.

View original on GitHub ↗

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