fix(cli): prevent settings escape key from cancelling active turn#22788
fix(cli): prevent settings escape key from cancelling active turn#22788JayadityaGit wants to merge 3 commits intogoogle-gemini:mainfrom
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 resolves an issue where pressing the Highlights
Changelog
Activity
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes a bug where the Escape key in settings dialogs was not being fully consumed, leading to unintended side effects like cancelling background requests. The change modifies the keypress handler in BaseSettingsDialog.tsx to explicitly return true for handled key events, which stops event propagation. All instances where a keypress is handled are updated to reflect this, and the final return is changed to false for unhandled keys, improving clarity.
|
normally slash commands are not allowed to be executed during a running request but there are some commands which are considered safe and one of them is /settings giving luxury to user to change settings in middle of their work is proccessing but in a case when request is still being processed and the user executes /settings and presses esc, it closes the dialog but also cancels the ongoing request which is not intended this PR makes that propagation not occur. now it only closes the dialog, not canceling the ongoing request. |
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
|
Hey @jackwotherspoon !! some time ago, I was assigned for this issue by you, can you have a look at this 😄? thanks for your time ⏰!! |
|
This was a great catch and should be looked at. I have some notes regarding the situation in general.
tldr: Should dialogs like settings be able to activate during ongoing requests? (e.g, should these dialogs behave like theme does, or like how settings does)? Answering that question should let us know what this PR should really be. either way, a PR to consolidate the UX seems like a good move. CC @keithguerin |
Summary
Fixes an issue where pressing
Escapeto close the/settingsdialog (or any dialog usingBaseSettingsDialogsuch as/agent) inadvertently cancels an active background stream request because the keypress event is not fully consumed.Details
In
BaseSettingsDialog.tsx'suseKeypresshook, the handler was returning implicitly (return;which isundefined). This causedKeypressContextto treat the event as unhandled, allowing it to bubble up to the globalEscapehandler inuseGeminiStreamwhich cancels the active turn. I've updated the handler to explicitlyreturn true;when keys are consumed.Related Issues
Fixes #22787
How to Validate
/settingsto open the Settings dialog.Escapeto close the dialog.npm test -w @google/gemini-cli -- src/ui/components/shared/BaseSettingsDialog.test.tsxPre-Merge Checklist