fix(open): Ignore mouse reports in the rename gate - #116
Merged
Merged
Conversation
Ignore SGR mouse reports without resetting the rename gate, so terminal pointer events cannot hold a queued rename. Preserve unknown escapes and process adjacent typed text normally. Co-Authored-By: Codex <noreply@anthropic.com>
Keep the six gate scenarios together without changing their timing or assertions. Co-Authored-By: Codex <noreply@openai.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Since #105, sessions opened by
codedeck openstopped renaming themselves. The title hook still writes the name sidecar, but the input gate never types the/rename. In the transcripts, 10 of the 11 sessions opened after the #105 build keptCodeDeck · <project> · orchestratoras theircustom-title, including sessions with dozens of prompts.The cause is mouse tracking. Launched from a trusted directory, Claude Code 2.1.281 enters the alternate screen and enables
ESC[?1003h(any-event tracking) withESC[?1006h(SGR encoding). From then on, every pointer move over the window sends a report such asESC[<35;40;12Mon stdin. The gate read those reports as unrecognised escapes, so each one marked the box dirty and guarded the next Enter. The pointer crosses the window between prompts, so the held name was never released. Through the built gate, a move before typing, a move after Enter, a wheel scroll, and a move before each of five prompts all left the rename held.createInputGatenow recognises SGR mouse reports (ESC[<+ three numeric fields +Morm) in its byte parser and drops them. A report does not dirty the box, does not guard the next Enter, and does not reset the 300 ms quiet timer, because with any-event tracking a moving pointer would otherwise keep postponing the rename. Text in the same chunk as a report is still processed, and a report split across two chunks is still recognised. A sequence that starts withESC[<and breaks the grammar falls back to the unknown-escape path, and arrows keep guarding Enter.Spec:
.specs/features/pty-session-rename/spec.md, Block B. The measured modes are recorded indocs/harness-behaviour.md.A keyboard capture in Alacritty, with the modes Claude enables (
ESC[>5u,ESC[>4;2m), showed Enter as a plain\rand accented text as plain bytes, so the keyboard protocol is not involved.Not covered:
scripts/pty-gate.shandscripts/rename-gate.shwere not rerun, and no livecodedeck opensession has run on this build yet. Legacy X10 and urxvt mouse encodings are out of scope, because Claude requests SGR.Tests
npx vitest run tests/open-pty.test.ts: 71 passed (65 before the change)npx tsc --noEmit -p .: cleanESC[<sequence guards Enter, and the Up arrow still guards Enter