fix(cli): resolve input handling flaws and add emergency abort#27415
fix(cli): resolve input handling flaws and add emergency abort#27415KoushikAD1234 wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical input handling issues in the CLI, particularly for users on touch-based interfaces. It introduces a robust emergency abort mechanism and provides granular control over terminal mouse tracking to prevent input corruption and terminal freezes, significantly improving the experience on mobile environments. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new configuration setting, "ui.mouseEvents", which allows users to control terminal mouse tracking. It defaults to "auto", which automatically disables mouse tracking in touch-oriented environments like Termux to prevent interference. Additionally, the PR implements an "Emergency Abort" feature, allowing users to cancel ongoing requests using Ctrl+C or F10 without exiting the CLI. This includes updates to the settings schema, documentation, event handling, and comprehensive test coverage for the new logic. I have no feedback to provide.
Note: Security Review did not run due to the size of the PR.
Summary
This PR resolves a safety-critical issue where users on touch interfaces (like Termux on Android) were unable to interrupt or stop the AI agent due to inequitable keybindings and input race conditions. It introduces a dedicated "Emergency Abort" mechanism and optimizes mouse handling for mobile environments.
Details
Ctrl+C(\x03) that bypasses the standard input parser. This ensures that the interrupt signal is captured even if the UI thread or mouse parser is busy/locked.F10as a deterministic, single-key abort signal, which is much more reliable on mobile virtual keyboards than multi-key combinations.ESCkey byte (\x1b), leading to terminal freezes.TERMUX_VERSION, etc.) to prevent input flood corruption, while remaining enabled for desktop users.useSuspendto properly restore terminal modes based on the newui.mouseEventssettings.Related Issues
Fixes #18087
How to Validate
Mobile/Termux Simulation:
TERMUX_VERSION=0.118.0.Ctrl+C(once) orF10immediately stops the agent.Desktop Validation:
Ctrl+Conce aborts a running request, while a second press (when idle) triggers the quit logic.Settings Test:
ui.mouseEventstoenabledordisabledinsettings.jsonand verify the behavior overrides the auto-detection.Pre-Merge Checklist