Skip to content

fix(core): handle Windows paths under WSL#27025

Open
emersonbusson wants to merge 1 commit into
google-gemini:mainfrom
emersonbusson:feat/wsl-path-handling-clean
Open

fix(core): handle Windows paths under WSL#27025
emersonbusson wants to merge 1 commit into
google-gemini:mainfrom
emersonbusson:feat/wsl-path-handling-clean

Conversation

@emersonbusson
Copy link
Copy Markdown
Contributor

@emersonbusson emersonbusson commented May 14, 2026

Summary

  • Translate Windows drive-letter paths to WSL mount paths when running under WSL.
  • Preserve existing path resolution behavior for non-WSL and native Windows environments.
  • Add focused coverage for WSL path translation and subpath checks.

Validation

  • npm test -w @google/gemini-cli-core -- src/utils/paths.test.ts
  • npm run typecheck --workspace @google/gemini-cli-core
  • npm run lint --workspace @google/gemini-cli-core
  • npm run build --workspace @google/gemini-cli-core
  • git diff --check origin/main...HEAD

Related Issues

Related to #25527
Also related to #25184

@emersonbusson emersonbusson requested a review from a team as a code owner May 14, 2026 02:06
@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 improves cross-platform compatibility by enabling the CLI to correctly handle Windows-style paths when executed within a Windows Subsystem for Linux (WSL) environment. By mapping Windows drive paths to standard WSL mount points, the changes ensure that file system operations remain consistent across different operating system configurations without affecting native Windows or non-WSL environments.

Highlights

  • WSL Path Translation: Introduced a utility to automatically translate Windows drive-letter paths (e.g., C:) to their corresponding WSL mount points (e.g., /mnt/c/) when running in a WSL environment.
  • Environment Detection: Added robust detection for WSL environments using environment variables and kernel version checks, with caching to optimize performance.
  • Integration with Path Helpers: Updated core path utility functions, including toAbsolutePath, isSubpath, and resolveToRealPath, to transparently apply WSL path translation.
  • Test Coverage: Added comprehensive unit tests to verify path translation logic, WSL detection, and compatibility with existing path resolution helpers.
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.

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 introduces support for Windows Subsystem for Linux (WSL) path translation within the core utility functions. It adds logic to detect WSL environments and a translateWindowsPath function that converts Windows drive paths to their corresponding WSL mount points (e.g., /mnt/c/). This translation is now integrated into toAbsolutePath, isSubpath, and resolveToRealPath to ensure consistent path handling when running under WSL. Additionally, a new set of tests has been added to verify these changes. 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 May 14, 2026
@gemini-cli gemini-cli Bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. and removed status/need-issue Pull requests that need to have an associated issue. labels May 14, 2026
@emersonbusson emersonbusson force-pushed the feat/wsl-path-handling-clean branch from 36c8326 to 9e1d589 Compare May 15, 2026 22:46
@emersonbusson
Copy link
Copy Markdown
Contributor Author

Rebased this PR onto current origin/main and reran the validation from the PR description.

Root cause: when the CLI runs under WSL, Windows drive-letter paths can reach the core path helpers, but Linux/Node path resolution does not translate C:\... into /mnt/c/...; that can make absolute path resolution and subpath checks fail for WSL users.

Approach: translate Windows drive-letter paths only when WSL is detected, and preserve existing behavior for non-WSL Linux/macOS and native Windows. The added tests cover WSL translation and existing subpath/path-resolution behavior.

Validation after rebase:

  • npm test -w @google/gemini-cli-core -- src/utils/paths.test.ts
  • npm run typecheck --workspace @google/gemini-cli-core
  • npm run lint --workspace @google/gemini-cli-core
  • npm run build --workspace @google/gemini-cli-core
  • git diff --check origin/main...HEAD

I kept the issue references as Related to #25527 / Also related to #25184 rather than Fixes, because this PR is scoped to WSL Windows-path handling and may not fully close those broader issues. Since this PR has the 🔒 maintainer only label, could a maintainer confirm whether this external contribution is acceptable for that scope?

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 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant