gemini-cli - ✅(Solved) Fix Bug: Spurious workspace trust prompt on Windows due to drive letter casing mismatch [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25085Fetched 2026-04-10 03:44:43
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1

Root Cause

When launching Gemini CLI from an IDE (such as VS Code) on Windows, the user is incorrectly prompted to trust the workspace folder even if it has already been trusted. This occurs because the CLI fails to recognize that the current working directory is the same as the workspace path provided by the IDE due to a case-sensitivity mismatch in the drive letter (e.g., C:\ vs c:\). Consequently, the directory is treated as a new, unknown path and added to the inclusion list twice, triggering a redundant trust verification.

Fix Action

Fixed

PR fix notes

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

Description (problem / solution / changelog)

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

Changed files

  • packages/cli/src/config/config.ts (modified, +3/-1)

Code Example

> /about
About Gemini CLI│                                                                                                                                                                        │
CLI Version                                               0.39.0-nightly.20260408.e77b22e63Git Commit                                                55e6d6d57                                                                                                    │
Model                                                     Auto (Gemini 3)Sandbox                                                   no sandbox                                                                                                   │
OS                                                        win32                                                                                                        │
Auth Method                                               Signed in with Google (hira.tara@gmail.com)Tier                                                      Gemini Code Assist in Google One AI ProIDE Client                                                VS Code
RAW_BUFFERClick to expand / collapse

What happened?

When launching Gemini CLI from an IDE (such as VS Code) on Windows, the user is incorrectly prompted to trust the workspace folder even if it has already been trusted. This occurs because the CLI fails to recognize that the current working directory is the same as the workspace path provided by the IDE due to a case-sensitivity mismatch in the drive letter (e.g., C:\ vs c:\). Consequently, the directory is treated as a new, unknown path and added to the inclusion list twice, triggering a redundant trust verification.

What did you expect to happen?

The CLI should recognize that the current working directory is identical to the workspace path provided by the IDE, regardless of drive letter casing (e.g., treating C:\ and c:\ as the same). Since the workspace is already trusted, the CLI should proceed without prompting the user for a "trusted folder" confirmation, and the directory should not be duplicated in the inclusion list.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
│ About Gemini CLI                                                                                                                                                       │
│                                                                                                                                                                        │
│ CLI Version                                               0.39.0-nightly.20260408.e77b22e63                                                                            │
│ Git Commit                                                55e6d6d57                                                                                                    │
│ Model                                                     Auto (Gemini 3)                                                                                              │
│ Sandbox                                                   no sandbox                                                                                                   │
│ OS                                                        win32                                                                                                        │
│ Auth Method                                               Signed in with Google ([email protected])                                                                  │
│ Tier                                                      Gemini Code Assist in Google One AI Pro                                                                      │
│ IDE Client                                                VS Code
</details>

Login information

Google Account

Anything else we need to know?

Technical Details & Regression Info

I have identified this as a regression introduced in PR #21380. The workspace path filtering logic implemented in that PR relies on a strict string comparison: resolveToRealPath(trimmedPath) !== realCwd

On Windows, realCwd often resolves with an uppercase drive letter (C:\), while the IDE-provided environment variable GEMINI_CLI_IDE_WORKSPACE_PATH may contain a lowercase drive letter (c:\). This causes the filter to fail, leading to duplicate directory entries in the config.

Relation to Existing Issues

Note: I noticed issue #24916 reports a similar symptom, but this issue is distinct as it specifically addresses the Windows-only drive letter casing mismatch (C:\ vs c:\) introduced in the recent IDE workspace integration.

extent analysis

TL;DR

The Gemini CLI can be fixed by modifying the workspace path filtering logic to perform a case-insensitive comparison of the drive letter.

Guidance

  • Identify the specific line of code in PR #21380 where the strict string comparison resolveToRealPath(trimmedPath) !== realCwd is implemented and consider modifying it to use a case-insensitive comparison.
  • Verify that the GEMINI_CLI_IDE_WORKSPACE_PATH environment variable and realCwd have the same case for the drive letter by logging their values before the comparison.
  • Consider using a library or function that normalizes Windows paths to ensure consistent casing, such as path.resolve() or path.normalize().
  • Test the modified code on Windows with different drive letter casings to ensure the issue is resolved.

Example

const path = require('path');

// ...

const trimmedPath = path.normalize(GEMINI_CLI_IDE_WORKSPACE_PATH);
const realCwd = path.normalize(process.cwd());

if (trimmedPath.toLowerCase() !== realCwd.toLowerCase()) {
  // ...
}

Notes

This fix assumes that the issue is solely due to the case-sensitivity mismatch in the drive letter and may not address other potential causes.

Recommendation

Apply workaround: Modify the workspace path filtering logic to perform a case-insensitive comparison of the drive letter, as this is a targeted fix for the identified regression introduced in PR #21380.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING