Skip to content

fix(cli): resolve drive letter casing mismatch in workspace trust check#25087

Open
hiratara wants to merge 1 commit intogoogle-gemini:mainfrom
hiratara:fix/25085-windows-drive-casing
Open

fix(cli): resolve drive letter casing mismatch in workspace trust check#25087
hiratara wants to merge 1 commit intogoogle-gemini:mainfrom
hiratara:fix/25085-windows-drive-casing

Conversation

@hiratara
Copy link
Copy Markdown

Why

This PR fixes a bug where users on Windows are incorrectly prompted to trust their workspace folder even if it is already trusted.

The issue was caused by strict string comparison (!==) used to filter the cwd from the IDE-provided workspace paths. On Windows, the IDE (VS Code) often provides paths with a lowercase drive letter (c:\), while the cwd might resolve with an uppercase letter (C:\). This mismatch causes the cwd to be erroneously added to includeDirectories a second time, triggering a redundant trust verification flow.

This is a regression introduced in PR #21380.

How

Replaced the strict string comparison with path.relative(). Since path.relative(a, b) === '' handles OS-specific path normalization and case-insensitivity natively, it reliably identifies when an IDE workspace folder matches the cwd, regardless of drive letter casing.

Fixes

Fixes #25085

@hiratara hiratara requested a review from a team as a code owner April 10, 2026 01:54
@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 regression in the workspace trust verification flow on Windows. By utilizing path-aware comparison methods instead of direct string matching, the CLI now correctly identifies workspace folders regardless of drive letter casing, preventing unnecessary user prompts.

Highlights

  • Path Comparison Logic: Replaced strict string inequality checks with path.relative() to handle OS-specific path normalization.
  • Windows Compatibility: Resolved an issue where drive letter casing mismatches on Windows caused redundant workspace trust prompts.
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.

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.

@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 10, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
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

This pull request updates the workspace folder path comparison in packages/cli/src/config/config.ts to use path.relative instead of a direct string comparison. This change ensures that path differences are handled safely across different operating systems by accounting for case insensitivity. I have no feedback to provide.

@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Apr 10, 2026
When launching the CLI from an IDE on Windows, a trusted workspace
dialog would incorrectly appear. This happened because the logic
attempting to filter the current working directory (`cwd`) out of the
IDE workspace paths (`GEMINI_CLI_IDE_WORKSPACE_PATH`) failed due to case
differences in drive letters (e.g., `C:\` vs `c:\`).

Because the strict string comparison failed, `cwd` was erroneously added
to `includeDirectories`, which subsequently triggered an unnecessary
workspace trust check.

This commit replaces the strict string comparison with
`path.relative()`. This correctly handles OS-specific path quirks (like
drive letter casing) to successfully filter out the `cwd` and prevent
the spurious trust check.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Spurious workspace trust prompt on Windows due to drive letter casing mismatch

1 participant