fix(cli): resolve duplicate footer on tool cancel via ESC (#21743)#21781
fix(cli): resolve duplicate footer on tool cancel via ESC (#21743)#21781
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 a visual bug in the CLI where cancelling a tool confirmation with the ESC key led to a duplicated footer. The changes ensure that the UI state related to height constraints is correctly reset and the display is refreshed, providing a consistent and clean user interface experience. 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
|
|
Size Change: +211 B (0%) Total Size: 26.2 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request addresses a UI issue where the CLI footer would duplicate when cancelling a tool confirmation using the ESC key. The fix involves updating the ToolConfirmationMessage component to reset constrainHeight to true and trigger a static refresh when ESC is pressed, ensuring correct layout recalculation. New unit tests have been added to cover this specific ESC key behavior and its interaction with constrainHeight.
My primary feedback concerns the use of magic numbers in the newly added test cases, which can lead to flaky tests and impact maintainability.
packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx
Outdated
Show resolved
Hide resolved
packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx
Outdated
Show resolved
Hide resolved
ffd8c65 to
843c70a
Compare
|
I have reviewed this PR using the
Otherwise, the fix correctly addresses the footer duplication issue and the PR title follows our conventional commit standards. |
152df12 to
9d3540c
Compare
9d3540c to
75f6f1b
Compare
| { isActive: isFocused, priority: true }, | ||
| ); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
there is already code in AppContainer calling refreshStatic when appropriate on changes to constrainHeight. Please make these changes there instead of adding this logic here.
Also make sure we are only doing this when not in alternate buffer mode.
There was a problem hiding this comment.
Thanks!
Once I moved the handleConfirm to useEffect, the constrainHeight is actually set by handleGlobalKeypress in AppContainer.
75f6f1b to
ef0a6bf
Compare
ef0a6bf to
d812c25
Compare
a6108a6 to
72db16e
Compare
e408d7d to
a6ffecb
Compare
packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx
Outdated
Show resolved
Hide resolved
The ToolConfirmationMessage component previously suffered from a race condition where cancelling a tool confirmation via the ESC key would synchronously call handleConfirm. This caused the component to be abruptly unmounted before Ink could flush its final render frame, resulting in UI glitches like duplicate footers.
a6ffecb to
414ccb4
Compare

Summary
This PR fixes an issue where the CLI footer would duplicate when cancelling a tool confirmation using the
ESCAPEkey.Details
ToolConfirmationMessageto callhandleConfirminsideuseEffect. This ensures the appContainer first updatesconstrainHeightand then unmountsToolConfirmationMessage.ToolConfirmationMessage.test.tsxcovering the ESC sync confirmation behavior.Related Issues
Fixes #21743
How to Validate
npm run startand ask to write a file).npm test -w @google/gemini-cli -- src/ui/components/messages/ToolConfirmationMessage.test.tsxPre-Merge Checklist