Skip to content

Gemini CLI detection fails on Windows (npm global path mismatch) #28625

@Skrblik

Description

@Skrblik

Summary

Latest (main)

Steps to reproduce

  1. Install @google/gemini-cli globally on Windows: npm install -g @google/gemini-cli
  2. Attempt to use the Gemini extension in OpenClaw.
  3. The extension fails to detect the CLI because it looks for oauth2.js in the wrong path relative to the binary.

Expected behavior

The Gemini CLI should be detected correctly on Windows by checking multiple candidate roots relative to the binary path.

Proposed Fix:
Update extractGeminiCliCredentials to check multiple candidate roots:

  1. dirname(binDir) (Linux/macOS)
  2. join(binDir, "node_modules", "@google", "gemini-cli") (Windows global npm)

Reference code:

    const binDir = dirname(resolvedPath);
    const candidateRoots = [
      dirname(binDir), 
      join(binDir, "node_modules", "@google", "gemini-cli"),
      join(binDir, "..", "node_modules", "@google", "gemini-cli"),
    ];

Actual behavior

Detection fails on Windows because the package root is not two levels up from the binary (it's in node_modules relative to the bin dir).

OpenClaw version

Latest (main)

Operating system

Windows 11

Logs, screenshots, and evidence

Onboarding:
o Model/auth provider
| Google
|
o Google auth method
| Google Gemini CLI OAuth
|
o Google Gemini CLI caution ------------------------------------------------------------+
| |
| This is an unofficial integration and is not endorsed by Google. |
| Some users have reported account restrictions or suspensions after using third-party |
| Gemini CLI and Antigravity OAuth clients. |
| Proceed only if you understand and accept this risk. |
| |
+----------------------------------------------------------------------------------------+
|
o Continue with Google Gemini CLI OAuth?
| Yes
|
|
o Gemini CLI OAuth -----------------------------------------------+
| |
| Browser will open for Google authentication. |
| Sign in with your Google account for Gemini CLI access. |
| The callback will be captured automatically on localhost:8085. |
| |
+------------------------------------------------------------------+
o Gemini CLI OAuth failed
|
o OAuth help ------------------------------------------------------------+
| |
| Trouble with OAuth? Ensure your Google account has Gemini CLI access. |
| |
+-------------------------------------------------------------------------+
Error: Gemini CLI not found. Install it first: brew install gemini-cli (or npm install -g @google/gemini-cli), or set GEMINI_CLI_OAUTH_CLIENT_ID.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions