Skip to content

Conversation

@abhipatel12
Copy link
Contributor

Summary

This PR fixes a regression where the "Modify with external editor" option was incorrectly hidden in external terminals when IDE mode was enabled in settings.

Details

A previous refactor (c266b529ae) simplified the logic in ToolConfirmationMessage.tsx to hide the manual modification option based solely on the config.getIdeMode() setting. However, this setting is persistent once the companion extension is installed. This caused the option to be missing even when running the CLI in a separate terminal (e.g., iTerm, Terminal.app) where the IDE cannot provide a native diff view.

The fix involves:

  • Updating ToolActionsContext.tsx to subscribe to real-time IdeClient status changes and expose a reactive isDiffingEnabled boolean.
  • Updating ToolConfirmationMessage.tsx to only hide the "Modify" button if both IDE mode is enabled and the IDE is currently connected and capable of handling diffs.

Related Issues

Closes #17576

How to Validate

  1. Enable IDE mode in settings (or install the companion extension).
  2. Run Gemini CLI in a separate terminal (e.g., iTerm2 or Terminal.app).
  3. Trigger a tool that supports modification (e.g., edit a file).
  4. Verify that "Modify with external editor" is visible in the options list.
  5. Run Gemini CLI inside the IDE integrated terminal.
  6. Trigger the same tool and verify the option is hidden (native IDE diff should be used instead).
  7. Run the new unit tests: npm test -w @google/gemini-cli -- src/ui/contexts/ToolActionsContext.test.tsx src/ui/components/messages/ToolConfirmationMessage.test.tsx

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on MacOS

The 'Modify with external editor' option was incorrectly hidden when IDE mode was enabled in settings, even if the CLI was running in a separate terminal not connected to the IDE.

This change:
1. Updates ToolActionsContext to track real-time IDE connection status.
2. Restores logic to only hide the modification option if the IDE is actually connected and capable of handling diffs.
3. Adds unit tests to verify status reactivity and UI visibility logic.
@abhipatel12 abhipatel12 requested a review from a team as a code owner January 27, 2026 01:07
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @abhipatel12, 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 a regression where the 'Modify with external editor' option was unintentionally suppressed in the CLI when operating in external terminals, despite IDE mode being active. The previous logic incorrectly assumed that an enabled IDE mode always implied an active IDE connection capable of providing a native diff view. The updated implementation introduces a dynamic check for the IDE's actual diffing capability, ensuring that the external editor option is only hidden when a functional IDE diff view is available. This restores the expected user experience for those using the CLI outside of an integrated IDE terminal, while maintaining the streamlined workflow within the IDE.

Highlights

  • Restored 'Modify with external editor' option: Fixed a regression that incorrectly hid this option in external terminals when IDE mode was enabled, ensuring users can always access it when needed.
  • Dynamic IDE Diffing Status: Introduced a reactive isDiffingEnabled state in ToolActionsContext that tracks the real-time connection and diffing capability of the IdeClient.
  • Refined Option Visibility Logic: Updated ToolConfirmationMessage to only hide the 'Modify' button if both IDE mode is active and the IDE is currently connected and capable of handling diffs.
  • Comprehensive Unit Tests: Added new unit tests for ToolConfirmationMessage and ToolActionsContext to ensure the correct behavior of the 'Modify with external editor' option under various IDE mode and diffing status conditions.
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 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 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

  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.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

The pull request effectively addresses the regression by correctly implementing the logic to show or hide the 'Modify with external editor' option based on both IDE mode and the IDE's diffing capability. The introduction of isDiffingEnabled in ToolActionsContext and its reactive updates ensure that the UI accurately reflects the IDE's connection status. The new unit tests thoroughly cover the intended behavior, providing good confidence in the fix. Overall, the changes are well-implemented and maintain code quality.

@github-actions
Copy link

Size Change: +575 B (0%)

Total Size: 23.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.4 MB +575 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added priority/p0 Critical and urgent (e.g., critical security vulnerability, major breakage). area/core Issues related to User Interface, OS Support, Core Functionality labels Jan 27, 2026
Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

@scidomino scidomino added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit 68649c8 Jan 27, 2026
27 checks passed
@scidomino scidomino deleted the abhi/fix/modify-with-editor branch January 27, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality priority/p0 Critical and urgent (e.g., critical security vulnerability, major breakage).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"modify with external editor" is missing

3 participants