[BUG] ESC keypresses intermittently dropped under load (tmux + Terminal.app); split escape sequences leak literal fragments like "[<65;75;42M" into the prompt
Environment
- Claude Code 2.1.196 and 2.1.207 (interactive TUI; episodes observed on both)
- macOS (Darwin 25.6.0), Apple Terminal.app, tmux 3.6a / 3.7b, zsh
- Heavy multi-session use: 10–20 concurrent CC sessions, load avg 4–7
Symptom
Intermittently, ESC becomes completely unresponsive in the TUI — cancel-generation, clear-input, and double-ESC rewind all dead. Episodes last minutes and self-recover with no config change. Ctrl+C (hardcoded interrupt) keeps working throughout, so the process is alive and reading input. Strongly correlated with high system load / many concurrent sessions.
Evidence the terminal path is healthy (CC-side drop)
During a live episode, cat -v in an adjacent pane of the same tmux session printed ^[ instantly on ESC — keyboard → Terminal.app → tmux → pty delivers the byte fine. Full config audits (twice) were clean: tmux escape-time 10 (later 50), no ESC rebinds anywhere, no keybindings.json, copy-mode not engaged. The drop is inside Claude Code's input handling.
Corroborating: escape sequences get split; the remainder is typed into the prompt
Our ~/.claude/history.jsonl contains 8 submitted prompts that are literal SGR mouse fragments, e.g.:
[<65;75;42M
[<65;29;32M[<65;29;32M
[<0;27;27m
i.e. the ESC byte of ESC [ <65;…M (trackpad wheel/click while CC had mouse reporting on) was consumed separately, and the printable remainder entered the input buffer as typed text — and got submitted. Same failure family: lone-ESC / sequence-reassembly handling drops the ESC under load. The split lone ESC presumably also fires spurious cancels.
CLAUDE_CODE_DISABLE_MOUSE=1 eliminated the fragment class for us (thanks for that escape hatch); the intermittent lone-ESC unresponsiveness is the remaining concern.
Expected
- ESC keypresses not to be dropped under load
- Escape-sequence reassembly to be atomic: on a split read, either reassemble or discard the remainder — never type it into the prompt
Notes
Intermittent by nature (not deterministically reproducible); happy to provide more diagnostics. Related but different: #7208 (ESC after agent creation, closed) — this one is load-correlated and transport-verified.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗