Skip to content

fix(tui): recover fragmented SGR mouse reports#18113

Merged
OutThisLife merged 2 commits into
mainfrom
bb/tui-sgr-mouse-fragments
Apr 30, 2026
Merged

fix(tui): recover fragmented SGR mouse reports#18113
OutThisLife merged 2 commits into
mainfrom
bb/tui-sgr-mouse-fragments

Conversation

@OutThisLife
Copy link
Copy Markdown
Collaborator

Summary

  • Recover fragmented SGR mouse report tails in the TUI input parser so they become mouse events instead of prompt text.
  • Keep isolated semicolon-heavy user text intact unless it is clearly an SGR mouse fragment or burst.
  • Broaden the TUI terminal reset sequence for common sticky mouse/focus modes at process boundaries.

Test plan

  • npm test -- parse-keypress terminalModes
  • scripts/run_tests.sh tests/cli/test_cli_terminal_response_sanitizer.py

@OutThisLife OutThisLife requested a review from Copilot April 30, 2026 22:44
@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves TUI robustness around terminal input/mouse handling by (1) resetting additional sticky terminal modes at process boundaries and (2) recovering fragmented SGR mouse report “tails” that can otherwise leak into prompt text.

Changes:

  • Extend the terminal mode reset sequence to disable more mouse/locator/focus-related modes.
  • Add parsing logic to detect and re-synthesize fragmented SGR mouse report fragments embedded in text tokens.
  • Add/extend Vitest coverage for terminal mode resets and fragmented SGR mouse recovery behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
ui-tui/src/lib/terminalModes.ts Adds additional terminal mode disable sequences to the reset string.
ui-tui/src/tests/terminalModes.test.ts Updates assertions to cover the newly added reset sequences.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Introduces fragmented SGR mouse fragment detection/parsing and updates text-token handling.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds tests validating SGR fragment recovery and preservation of semicolon-heavy user text.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/lib/terminalModes.ts Outdated
Comment thread ui-tui/src/__tests__/terminalModes.test.ts Outdated
Comment thread ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OutThisLife OutThisLife merged commit 8fed969 into main Apr 30, 2026
12 of 13 checks passed
@OutThisLife OutThisLife deleted the bb/tui-sgr-mouse-fragments branch April 30, 2026 22:57
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…use-fragments

fix(tui): recover fragmented SGR mouse reports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants