fix(cli): resolve drive letter casing mismatch in workspace trust check#25087
fix(cli): resolve drive letter casing mismatch in workspace trust check#25087hiratara wants to merge 1 commit 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 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
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. Footnotes
|
|
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. |
There was a problem hiding this comment.
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.
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.
55e6d6d to
56ed89c
Compare
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 thecwdfrom the IDE-provided workspace paths. On Windows, the IDE (VS Code) often provides paths with a lowercase drive letter (c:\), while thecwdmight resolve with an uppercase letter (C:\). This mismatch causes thecwdto be erroneously added toincludeDirectoriesa 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(). Sincepath.relative(a, b) === ''handles OS-specific path normalization and case-insensitivity natively, it reliably identifies when an IDE workspace folder matches thecwd, regardless of drive letter casing.Fixes
Fixes #25085