[Bug] TUI exit doesn't disable SGR mouse mode, flooding shell with escape sequences
Status Open
Reported on v2.1.215
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Jul 19, 2026
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
Ran claude logs <id> on a background session, TUI exited leaving SGR mouse mode (1000/1002/1003/1006) enabled, shell flooded with mouse escape sequences
Environment Info
- Platform: darwin
- Terminal: ghostty
- Version: 2.1.215
- Feedback ID: 8bce19e5-c821-4c74-90bf-2852f3e74db9
Errors
[]
3 Comments
<img width="1508" height="949" alt="Image" src="https://github.com/user-attachments/assets/7254c682-4e39-46b1-9a34-6aabe66ec30d" />
Confirmed — reproduced on 2.1.233 (Linux).
Running
claude logs <session-id>opens a full-screen view that turns on SGR mouse tracking (modes 1000/1002/1003/1006) and the alternate screen, but on exit it does not emit the matching disable sequences. Capturing the raw terminal stream, the mouse-enable sequences are the very last bytes written before the process exits — there is no mouse-disable or screen-restore afterward.The result is exactly what you saw: after it exits, the terminal is left in mouse-reporting mode and the shell floods with escape sequences on any mouse movement or click. Filing as a confirmed bug — the viewer needs to restore terminal modes on every exit path.
🤖 Generated with Claude Code
Please note that the label
reproducedon this issue does not shield it from becoming stale and eventually auto-closed.To prevent this you would need to collect at least 10 thumbs up or comment every time before the 14 days stale interval expires.
See https://github.com/anthropics/claude-code/issues/87647 for details, and consider upvoting that for visibility.