Repository navigation
Conversation
Restoring a pane no longer replays DECSET mouse tracking from a checkpoint when the TUI that armed it does not come back. A fresh PTY spawn also disarms leftover 1003/1006 on the reused xterm so motion cannot leak `35;col;rowM` into a replacement shell. Fixes stablyai#18424 Fixes stablyai#15625
There was a problem hiding this comment.
ℹ️ No critical issues — a couple of stale comments worth a one-line update.
Reviewed changes
buildRehydrateSequencesstops re-arming mouse —src/main/daemon/terminal-mode-rehydrate-sequences.tsno longer emits?9h/?1000h/?1002h/?1003h/?1006h/?1016h; alt-screen, bracketed-paste, and app-cursor still rehydrate.- Cold restore strips legacy mouse DECSET —
omitMouseTrackingFromRehydrateSequencesremoves the six enable sequences from older checkpoints incoldRestoreInfoFromSnapshot, leavingmodes.mouseTrackingintact (no schema change). - Fresh spawn disarms leftover mouse reporting —
startFreshSpawnwritesRESET_MOUSE_REPORTINGinto the reused xterm after the kitty-keyboard reset.
The change is correct and well-tested. Live-TUI mouse restore is preserved through frameRestoreAnsi and the SerializeAddon mode trailer in snapshotAnsi, so dropping it from rehydrateSequences does not regress alt-screen reattach scroll gestures; cold restore still clears it via COLD_RESTORE_SEED_MODE_RESET.
ℹ️ Nitpicks
src/shared/terminal-mode-reset-profiles.ts:30-33— thePOST_REPLAY_REATTACH_RESET_KEEP_MOUSE"Why" still claims "an alt-screen reattach replays the daemon's rehydrateSequences, which re-arm the live TUI's mouse modes". After this PR the re-arm comes fromframeRestoreAnsiand thesnapshotAnsitrailer, notrehydrateSequences; a one-line correction would stop future readers being misled about the mechanism.tests/e2e/terminal-reattach-mouse-mode-leak.spec.ts:22-24— the header comment saysbuildRehydrateSequencesre-arms the mode on reattach; it is now the serializer trailer. Same one-line fix.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change removes mouse-reporting escape sequences from generated and stored terminal rehydration sequences while preserving mouse mode state in snapshots. Cold restore and seed-segment logic now apply this filtering. Headless emulator and regression tests cover standard, SGR, any-motion, pixel, and alternate-screen cases. Fresh PTY startup now sends Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Mouse reporting is reset for fresh shells and excluded from restored replay data. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the PR. Will get it reviewed this weekend |
|
Hit this on 1.4.245 (macOS host, driven from a paired desktop client). After Agent sleep stopped a Claude pane and I reopened the tab, the wake command landed in a shell that still had mouse tracking on, so it ran as: and the agent did not resume. Details and logs in #36427. Would love to see this merged. |

ELI5
When a TUI such as Grok or Claude Code turns on mouse tracking and then dies, Orca used to restore that mouse mode onto the next shell. Moving the mouse then typed garbage like
35;42;47Minto the window. This change stops restoring mouse tracking from checkpoints, and a replacement PTY also turns leftover mouse tracking off.What Changed
buildRehydrateSequencesno longer emits DECSET?9h/?1000h/?1002h/?1003h/?1006h/?1016h. Live TUIs re-assert those modes on startup. Alt-screenframeRestoreAnsistill carries mouse for a still-running TUI.rehydrateSequencesare stripped on restore without changing the checkpoint schema (modes.mouseTrackingis still recorded).RESET_MOUSE_REPORTINGinto the reused xterm after the existing kitty-keyboard reset, so a remounted pane cannot keep a dead TUI's any-event tracking.Why
Mouse motion with DECSET 1003 + SGR 1006 is encoded as
CSI < 35;col;row M. Readline consumesESC[<as an unbound sequence and self-inserts the rest, so every pointer move fills the prompt with control characters. Cold restore already appended a seed reset, but live rehydrate and the rendererstartFreshSpawnpath could still re-arm the emulator.This is the same class of bug as #18424 (checkpoint rehydrate) and #15625 (fresh spawn after sleep). Related user reports: #13077, #18064.
Overlaps community PR #18454 (rehydrate-only). This PR also covers the fresh-spawn renderer gap called out on #15625.
Linked Issue
Fixes #18424
Fixes #15625
Visual Proof
N/A — no UI chrome change. The behavior change is that mouse motion over a replacement shell no longer inserts SGR report tails.
Testing
Targeted vitest (all passed):
src/main/daemon/terminal-mode-rehydrate-sequences.test.tssrc/main/daemon/headless-emulator.test.tssrc/main/daemon/terminal-history-seed-segments.test.tssrc/main/daemon/repro-12101-mouse-tracking-survives-agent-death.test.tssrc/main/daemon/repro-7329-remote-snapshot-corruption.test.tssrc/main/daemon/history-reader.test.tssrc/main/daemon/hibernation-cold-restore-repro.test.tssrc/renderer/src/components/terminal-pane/pty-connection-fresh-spawn-guards.test.tssrc/renderer/src/components/terminal-pane/pty-connection-reattach-mode-reset.test.tssrc/renderer/src/components/terminal-pane/pty-connection-hibernation-wake.test.tsDid not rebuild or run the desktop app; CI should cover
pnpm lint/pnpm typecheck/ fullpnpm test.AI Disclosure
Implemented with Grok 4.6 (xAI) in a local coding session.
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
rehydrateSequencesis the same prefix the daemon snapshot uses for those consumers.pnpm lint/pnpm typecheck/pnpm buildnot run locally (CI).Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)