Skip to content

fix(cli): restore approval focus after cancelling editor selection - #29798

Open
seokjeongeum wants to merge 2 commits into
google-gemini:mainfrom
seokjeongeum:fix/editor-cancel-focus
Open

seokjeongeum wants to merge 2 commits into
google-gemini:mainfrom
seokjeongeum:fix/editor-cancel-focus

Conversation

@seokjeongeum

@seokjeongeum seokjeongeum commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

Make Escape close external-editor selection and return to usable pending tool approval. The user can then Allow or Reject the edit without cancelling the request or changing the editor preference.

Details

Suspend the underlying approval controls while a dialog is visible, and prioritize the editor dialog's Escape handler over stream cancellation. Closing editor selection emits an undefined selection without persisting a preference. The scheduler returns to approval; cancelling the selector never executes the edit.

The integration regression includes a competing stream-style Escape handler and verifies both Allow and Reject, the build-file security warning, unchanged settings, and listener cleanup. No authentication, public settings-schema, model-catalog, or package-version changes.

Related Issues

User-reported regression; no linked issue.

How to Validate

Validated final head 67fc04dfc424c1f2bf760886a2cda9d75634992d, based on upstream ed96faedfd5571f055c44f2c9509d62321d1138d.

  • node node_modules/vitest/vitest.mjs run --root packages/cli src/ui/components/ToolConfirmationQueue.editor.test.tsx src/ui/components/ToolConfirmationQueue.test.tsx src/ui/components/messages/ToolConfirmationMessage.test.tsx src/ui/components/EditorSettingsDialog.test.tsx src/ui/hooks/useEditorSettings.test.tsx --coverage.enabled=false --maxWorkers=1 --minWorkers=1: 77/77 pass on Linux Node 24.21.0 and native Windows Node 24.14.1. The competing-handler integration fails both cases before the dialog-priority correction and passes afterward.
  • A real terminal fixture launches the compiled CLI with an isolated project/home and localhost Code Assist server. It requests a write_file edit to package.json, opens editor selection, sends one Escape, checks that the file is unchanged and the security warning/approval return, then separately verifies Allow changes the file and Reject leaves it unchanged. Both cases pass with CLI exit 0 on Linux and native Windows source launches, isolated actual packed-npx launches, and the built Linux Docker artifact. Fixture updates and update notifications are explicitly disabled.
  • Native Windows runs use an isolated NTFS checkout with native dependencies. Source blobs match this head; core/devtools resolution from the actual CLI entry points to its own workspace builds. Actual npx launches use a verified isolated prefix through npm exec --offline --no-install --call, preserving the fixture project directory and preventing global binary shadowing. Native cold launches needed a 120-second fixture allowance; an extra captured-process wrapper was removed after a direct-launch comparison. Native PTY helpers retained handles after recording the CLI exit-0 assertion and were cleaned up separately; helper teardown is not reported as a successful product command.
  • Linux npm run build, affected npm run typecheck, npm run bundle, changed-file ESLint/Prettier, and git diff --check pass. Native affected CLI build/typecheck and bundle generation pass. Locally packed artifacts are installed into isolated consumers before the npx feature probes.
  • Docker Allow/Reject probes pass on the built candidate artifact under Linux Node 20.20.2. Native Windows also launches both Docker probes through WSL; those are Linux containers, not native Windows-container coverage.
  • Full npm run preflight completed on this exact head in a disposable Linux checkout under Node 20.19.0 with two Vitest workers. Install/format/build/full lint/all typechecks pass and tracked source remains clean. CLI reports 10 failed, 7,401 passed, 4 skipped; core reports 76 failed, 8,296 passed, 57 skipped. All 86 failing records, including duplicate parameterized identities, reproduce on the matching upstream base with the same runtime, dependencies, isolated home, and worker bounds. There are no candidate-only failures. They concern mocked home/workspace paths, keychain mocks, and unavailable bwrap. Separately, npm run test:scripts passes 202/202 and npm run test:sea-launch passes 17/17.

GitHub Testing: CI for this head reports action_required. A maintainer must approve the external-contributor workflow run; local results do not imply CI passed. Links and E2E runs have the same approval gate. macOS/Seatbelt are unavailable; Podman fixtures remain pending because host sudo authentication is unavailable.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@github-actions github-actions Bot added the size/l A large sized PR label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

📊 PR Size: size/L

  • Lines changed: 276
  • Additions: +273
  • Deletions: -3
  • Files changed: 3

@seokjeongeum
seokjeongeum marked this pull request as ready for review October 18, 2026 11:46
@seokjeongeum
seokjeongeum requested a review from a team as a code owner October 18, 2026 11:46
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 user-reported regression in the CLI where pressing Escape during external editor selection would incorrectly cancel the tool approval request. The changes ensure that the editor selection dialog takes priority over stream cancellation, allowing users to safely exit the selection menu and return to the pending tool approval state without losing their progress.

Highlights

  • Editor Selection UX: Updated the editor selection dialog to properly handle the Escape key, ensuring that cancelling the selection returns the user to the tool approval flow instead of cancelling the entire request.
  • Dialog Priority: Implemented priority handling for the editor selection dialog, preventing competing stream-style Escape handlers from triggering prematurely.
  • UI State Management: Added logic to suspend underlying approval controls while a dialog is visible, ensuring a clean state transition when returning from the editor selector.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the ToolConfirmationQueue and EditorSettingsDialog components to handle focus states dynamically when dialogs are visible. Specifically, ToolConfirmationQueue now sets isFocused to !dialogsVisible using the dialogsVisible state from useUIState, and EditorSettingsDialog updates its keypress listener with priority: true. Additionally, a new test file ToolConfirmationQueue.editor.test.tsx has been introduced to verify tool confirmation behavior during external editor selection. There are no review comments, and I have no feedback to provide.

@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Oct 18, 2026
@rananisarsb51214

Copy link
Copy Markdown

file_000000009d3c81fa94c6c58e2462c5e9.png

@rananisarsb51214

Copy link
Copy Markdown

#29798 (review)

@gemini-cli

gemini-cli Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

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 only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@rananisarsb51214

Copy link
Copy Markdown

@rananisarsb51214

Copy link
Copy Markdown

nova-mart-gbob-article-1793132262085.md

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l A large sized PR status/need-issue Pull requests that need to have an associated issue. status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants