Repository navigation
fix(cli): flush queued mouse reports at the process boundary (issue 3) - #26
Merged
Merged
Conversation
Drive the real wire protocol (bare PTY bash + Session + startServer + ws client) with a stalled mouse-enabled TUI fixture. SGR motion packets sent as input frames while the TUI is stalled queue unread in the tty buffer and leak into the returning shell as literal input, then execute as commands on Enter — for both abrupt (SIGKILL) and clean (SIGTERM + DECRST) exits. Two bug-characterization tests document the leak; two it.fails tests pin the acceptance behavior until a fix lands. Co-authored-by: kiran kumar <kirank55@users.noreply.github.com>
…issue-3-c Add the branch test report and update the ticket with progress, annotated acceptance criteria, and the confirmed leak mechanism. Co-authored-by: kiran kumar <kirank55@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Mouse reports sent while a mouse-enabled TUI is stalled queue unread in the tty input buffer and leak into the returning shell as literal input, executing as commands — on both abrupt kills and clean DECRST exits. Add MouseReportingGuard to the Station Session: it arms on DECSET 1000/1002/1003 in the output stream, tracks pure mouse-report input frames, and at the [mobily] prompt boundary writes VINTR so the line discipline discards the queued input (SIGINT also aborts any readline line the packets already polluted). In-flight mouse packets are dropped for 1500ms post-boundary; all other input and keyboard-only sessions are untouched. DECRST/1049l do not disarm — only the prompt proves the shell, not a still-running TUI, is reading. Covered by 12 guard unit tests and rewritten wire-level integration tests: abrupt kill, clean exit, active-TUI click/wheel/key delivery, and no-interrupt for keyboard-only sessions. Co-authored-by: kiran kumar <kirank55@users.noreply.github.com>
Rewrite the branch report around the MouseReportingGuard fix (root cause, design, backend coverage, trade-offs, gates) and check off the ticket's acceptance criteria with the residual on-device verification noted. Co-authored-by: kiran kumar <kirank55@users.noreply.github.com>
kiranscript
marked this pull request as ready for review
August 3, 2026 18:11
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This branch was successfully deployed
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.
Summary
Fixes the issue-3 ticket from
.scratch/android-terminal-rash-bugs/issues/03-prevent-queued-mouse-report-leaks.md: mouse reports queued while a mouse-enabled TUI is stalled leaked into the returning shell as literal text (35;5;3M35;18;14M…at the prompt) and executed as shell commands — on both abrupt kills and clean DECRST exits.Root cause (reproduced deterministically on this branch over the real wire protocol): the WebView sends mouse packets fire-and-forget and the CLI wrote every
inputframe straight into the PTY; bytes queued unread in the tty input buffer are re-read by the shell after the process boundary. Sender-side suppression can only gate future gestures, never the already-queued packets.Fix — new
MouseReportingGuardincli/src/mouseReportingGuard.ts, wired intoSessionacross all output and both input paths (WSinputframes + embedded workstation):[mobily]prompt proves the shell, not a still-running TUI, is reading.\x03): the line discipline discards queued input, and SIGINT aborts any readline line the packets already polluted — every arrival ordering ends at a clean, empty prompt and nothing executes.Backend coverage: bare is fully covered; tmux with default
mouse offneither re-emits DECSET nor lets clients generate mouse packets (probed), so arming matches the leak precondition; tmux with usermouse onre-emits DECSET and the flush reaches the pane as an ordinary key.Trade-off: when mouse input flowed, a TUI exit emits one VINTR — bash shows a transient
^Cabove a fresh, empty prompt (zsh/fish show nothing). Chosen over executing35;5;3M…as a command. Report:.scratch/android-terminal-rash-bugs/issue-3-cli-test-report-c.md.Test plan
pnpm typecheck/lint/build/test— root gate green (turbo 5/5)pnpm --filter mobily test— 25 files / 234 tests green (real tmux on PATH per AGENTS.md); 12 new guard unit tests + 4 rewritten wire-level integration tests (abrupt kill, clean exit, active-TUI click/wheel/key delivery, keyboard-only no-interrupt); integration suite stable 5/5 repeat runspnpm --filter mobily-android test— 21 files / 81 tests greenpnpm --filter mobily-android run test:browser— 25/26; the one failure is the pre-existing snapshot cursor case documented in AGENTS.md (red onmainand CI'sandroid-browserjob)hover-string-repro.ps1harness — needs a physical device + Dev Tunnel login, unavailable headless (noted in the ticket)Notes
All seven acceptance criteria in the ticket are checked off, with on-device verification as the only residual. The first two commits on this branch hold the pre-fix reproduction evidence (raw PTY transcripts in the report).