[BUG] Input invisible / cursor frozen for up to 20s after /compact, then dumps at once
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Immediately after /compact finishes, the input prompt appears responsive but is not. Typing produces no visible cursor movement and no echoed characters for up to ~20 seconds. Once the stall ends, the entire typed buffer appears at once in the input box. The keystrokes were not lost, they were just not rendered until the TUI unblocked.
This is distinct from #18943 (lag when context is full). In this report the context has just been freshly compacted, so usage is low. The stall is tied to the post-compact transition, not to context size.
What Should Happen?
After /compact completes and the prompt is redrawn, keystrokes should be echoed immediately (sub-50ms). The cursor and typed characters should appear as the user types, not in a single deferred flush.
Error Messages/Logs
(no error output; TUI input render stalls silently)
Steps to Reproduce
- Start a Claude Code session and do enough work to make
/compactmeaningful (or just run it on any session). - Run
/compactand wait for it to report completion and re-render the input prompt. - As soon as the new prompt appears, start typing a message.
- Observe: no cursor movement, no characters appear. The TUI looks frozen.
- After up to ~20 seconds, the entire typed string appears at once in the input box and the cursor catches up.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
(unknown)
Claude Code Version
2.1.139 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- Keystrokes are buffered correctly (no characters lost), so this looks like a TUI render/event-loop stall on the immediate post-compact transition rather than an stdin handling bug.
- Possible related work happening during the stall: post-compact summary persisting, prompt-cache warm-up, status line or token-count recomputation against the freshly compacted transcript, file/index rehydration.
- Related but different: #18943 (input lag correlated with high context usage). This bug occurs when context is freshly low immediately after compaction.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗