WebSocket reconnect corrupts readline input buffer in iTerm2
Resolved 💬 2 comments Opened Jun 7, 2026 by buck-openart Closed Jul 14, 2026
Description:
When Claude Code reconnects after a brief WebSocket drop, the TUI repaint sends ANSI escape sequences that corrupt the readline input buffer. This destroys in-progress input in two ways depending on timing:
- If paused mid-type: garbage characters are appended to the input line (Ctrl+W can clear them)
- If actively typing when the reconnect fires: the repaint truncates what was typed, with no way to recover the lost text
Steps to reproduce:
- Type a prompt but don't submit
- Wait for a WebSocket drop/reconnect (visible as a white flash in the upper-right corner of the terminal)
- Observe input line is corrupted — garbage characters appended or text truncated
Environment:
- macOS 25.5.0
- iTerm2 3.6.11
Expected: Reconnect restores terminal state cleanly without touching the input buffer
Actual: ANSI escape sequences from the TUI repaint leak into stdin, corrupting in-progress input
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗