fix(cli): auto-disable mouse reporting on leaky terminals (Konsole/Plasma Wayland) - #48701
Closed
mjwicker wants to merge 1 commit into
Closed
fix(cli): auto-disable mouse reporting on leaky terminals (Konsole/Plasma Wayland)#48701mjwicker wants to merge 1 commit into
mjwicker wants to merge 1 commit into
Conversation
…asma Wayland) Adds Level-1 mitigation for the long-reported "spam letters on mouse/keyboard" bug caused by raw bracketed mouse sequences leaking into stdin. Detection: - KONSOLE_VERSION env var (strongest signal) - TERM containing "konsole" - XDG_SESSION_TYPE=wayland + Plasma/KDE desktop - XDG_CURRENT_DESKTOP containing plasma/kde Actions: - Emits \e[?1000l etc. to disable before prompt_toolkit grabs the tty - Never re-enables (preserves mouse for other TUIs) - Completely silent on well-behaved terminals (Kitty, Alacritty, etc.) This matches the existing workaround documented in the hermes-agent skill under "Input Glitches (Mouse Reporting ANSI Codes)". Refs: user reports of ;83;30M spam and similar garbage on mouse movement.
Collaborator
|
Related: this is part of the SGR mouse-tracking leak chain (#18658 core issue; #42527, #31213, #17701 prior fixes). Those address the leak reactively — stripping leaked sequences from the input buffer and resetting terminal mode on teardown/startup. This PR adds a distinct, proactive mechanism: env-based detection of known-leaky terminals (KONSOLE_VERSION / Plasma / Wayland) and emitting the disable sequences before prompt_toolkit takes over. Complementary, not a duplicate. |
Contributor
|
Thanks for the targeted mitigation. The mouse-reporting startup leak is already addressed on current
|
zipzob
added a commit
to zipzob/hermes-agent
that referenced
this pull request
Aug 6, 2026
Force a full Ink redraw after coalesced terminal resize events and on terminal focus regain, and reassert bracketed paste when focus returns. This hardens the Alacritty/terminal-stale-frame class without rewriting input handling. Refs upstream TUI redraw/input issues: - NousResearch#54284 - NousResearch#25337 - NousResearch#35530 - NousResearch#48701 - NousResearch#30092 - NousResearch#55415 (cherry picked from commit 61d9540565c62a7434e35b0ec774988f18967deb) (cherry picked from commit a8385de07f84e0e4baa2f3959973328f1b609651)
zipzob
added a commit
to zipzob/hermes-agent
that referenced
this pull request
Aug 13, 2026
Force a full Ink redraw after coalesced terminal resize events and on terminal focus regain, and reassert bracketed paste when focus returns. This hardens the Alacritty/terminal-stale-frame class without rewriting input handling. Refs upstream TUI redraw/input issues: - NousResearch#54284 - NousResearch#25337 - NousResearch#35530 - NousResearch#48701 - NousResearch#30092 - NousResearch#55415 (cherry picked from commit 61d9540565c62a7434e35b0ec774988f18967deb)
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
Level-1 mitigation for the long-standing "spam letters/symbols on mouse movement or keypress" bug that occurs in Konsole + Plasma (especially on Wayland/Pop!_OS).
The Bug
Certain terminals (notably Konsole) enable bracketed mouse reporting for the entire terminal emulator. Hermes (which uses prompt_toolkit) receives the raw escape sequences (
\e[?1000h,\e[<83;30M, etc.) as input, causing garbage spam every time the mouse moves or a button is pressed.Users have to manually run:
or disable mouse input in the Konsole profile.
The Fix (Level 1)
Detection Logic
KONSOLE_VERSIONenv var (strongest signal)TERMcontainingkonsoleXDG_SESSION_TYPE=wayland+ Plasma/KDE desktopXDG_CURRENT_DESKTOPcontainingplasma/kdeScope
This matches the existing workaround documented in the
hermes-agentskill under "Troubleshooting → Input Glitches (Mouse Reporting ANSI Codes)".Refs: multiple user reports of
;83;30M/ random symbol spam during interactive sessions.