[Bug] Windows Terminal PowerShell: Raw ANSI mouse tracking sequences echoed to screen
Bug Description
When running Claude Code in Windows Terminal with PowerShell, moving the mouse over the window floods the screen with raw ANSI mouse tracking escape sequences (e.g. [555;31;25M[555;31;26M... plus [O / [I focus events) instead of them being captured by the app; these appear to be SGR mouse mode events (DECSET 1003/1006) being echoed as literal text, printed continuously while the mouse moves, sometimes ending up in the input box and making the session unusable until the screen is cleared. Steps to reproduce: open Windows Terminal with a PowerShell profile, run claude, and move the mouse over the window after a long session. It affects all Terminal tabs with Claude Code open.
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.1.234
- Feedback ID: 818ccfb5-eaaf-4d85-aa8a-c1266e621f05
Hitting what looks like the same underlying issue, but with a reliable, single-action repro instead of "after a long session, move the mouse":
Environment: Windows Terminal + WSL2 (Ubuntu), Claude Code 2.1.207, TERM=xterm-256color.
Repro: a custom statusLine command (claude-statusline-pro, commit a616557) emits OSC 8 hyperlinks (\033]8;;URL\033\text\033]8;;\033\) as part of its output — a documented, supported use of the statusline (it renders correctly, and Ctrl+Click reliably opens the link). A plain left click (no Ctrl) on that hyperlinked text — instead of being ignored or intercepted by the terminal for navigation — gets forwarded to Claude Code as a raw SGR mouse-click event. In our case this didn't just echo garbage to the screen (as in the original report) but fully froze the session — completely unresponsive, requiring the terminal tab to be closed and restarted.
Same class of bug as #85772 (fullscreen renderer opening links / mishandling clicks when it can't distinguish modifier bits from the mouse event stream), but on Windows Terminal the failure mode is a hard hang instead of an unwanted link-open — possibly because the specific byte sequence Windows Terminal forwards for an unmodified click over a hyperlink-marked region trips something in the input parser that a plain mouse-move event (the original report here) doesn't.
Why this repro is useful: it's deterministic (click the link, every time) rather than time/mouse-movement-dependent, so should be much easier to trace than "happens after a while."
Happy to provide more detail, test a candidate fix, or share the exact statusline script that triggers it — reachable here or at [email protected].
Same symptom — native Windows (not WSL), v2.1.310 — with a probable trigger: auto-update of a shadowed install.
Environment: Windows 11, Windows Terminal + PowerShell, Claude Code 2.1.310. Note: two installs on PATH — the one resolved first is C:\Users\<user>\AppData\Local\hermes\node\claude (Node bundled with another agent); the second is npm-global (2.1.280, untouched since Sep 22, with autoUpdates: false set in user settings).
Timeline (Oct 25):
- 23:11 — the shadowed install auto-updated to 2.1.310 (package dir mtime), despite
autoUpdates: falsein user settings - Session kept running on top of the swapped binary; "restart to apply" pending
- 23:35 — session died abruptly; terminal flooded with raw SGR mouse sequences (
ESC[<35;COL;ROWM, 64/65 on scroll) — mouse tracking was left enabled with no reset emitted --continuerestores the session fine afterwards; background jobs (a runninggit push) were killed
Workarounds: printf '\e[?1000l\e[?1002l\e[?1003l\e[?1006l' (or reset) clears the screen; DISABLE_AUTOUPDATER=1 as a user env var stopped further updates across all install vectors.
Hypothesis: the TUI enables mouse modes 1000/1002/1003/1006 but an abrupt-teardown path never emits the reset sequences — and an in-place binary swap under a live session makes that teardown path much more likely. May also relate to #97297 (mouse tracking wedging sessions across resumes) and the auto-update-terminates-running-app reports (#89992, #93627).
— dadawalisson + Rainha (AI co-author)