#6045: fix(auth): fix Gemini CLI path detection for global npm installs on Windows
extensions: google-gemini-cli-auth
Cluster:
OAuth and CLI Fixes
---
Description
Problem:
OpenClaw fails to detect Gemini CLI on Windows because it cannot correctly resolve the global npm package path
structure. The relative path between the binary file and node_modules on Windows differs from Linux/macOS, which
prevents the system from reading oauth2.js to retrieve the OAuth configuration.
Changes:
I have modified extensions/google-gemini-cli-auth/oauth.ts to include specific search path logic for Windows
environments. This allows OpenClaw to correctly locate the Gemini CLI credentials file within the global npm
directory.
---
- [x] AI-assisted (Vibe-coded)
- [x] Fully tested on Windows 11
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `extensions/google-gemini-cli-auth/oauth.ts` to better locate the Gemini CLI’s bundled `oauth2.js` on Windows by adding additional Windows-only candidate paths derived from the resolved `gemini` executable path. The intent is to handle global npm install directory layouts that differ from macOS/Linux so OpenClaw can extract the OAuth client config automatically.
<h3>Confidence Score: 3/5</h3>
- This PR is likely safe to merge, but Windows path resolution assumptions may still miss common global npm layouts.
- Change is localized and gated on `process.platform === "win32"`, but the new logic assumes `dirname(resolvedPath)` is a global npm prefix; when `gemini` resolves to a .cmd/.bat shim in `%APPDATA%\npm`, the actual `node_modules` root may be elsewhere, so the fix might not work for all users.
- extensions/google-gemini-cli-auth/oauth.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10372: Fix google-gemini-cli-auth to work on Windows
by omribahumi · 2026-02-06
86.0%
#7781: fix: resolve Google Gemini CLI auth credential extraction #4585
by ManojPanda3 · 2026-02-03
85.9%
#3521: fix(gemini-auth): handle mise shims and nested node_modules paths
by sebslight · 2026-01-28
80.1%
#9250: Fix: Add shell:true for Windows .cmd files to prevent spawn EINVAL ...
by vishaltandale00 · 2026-02-05
77.4%
#11951: Prepending Windows Node to PATH didn’t help
by tranhoangtu-it · 2026-02-08
76.7%
#12804: fix(daemon): use wrapper script for pnpm global installs in service...
by odinho · 2026-02-09
76.6%
#17912: fix: configure git to use HTTPS instead of SSH for GitHub URLs
by MisterGuy420 · 2026-02-16
76.1%
#23139: test: fix flaky auth tests when OPENCLAW_GATEWAY_TOKEN is present
by Imccccc · 2026-02-22
75.7%
#2657: fix: use TLS 1.2 for gemini-cli and google-antigravity OAuth reques...
by PrentissLiu · 2026-01-27
75.6%
#22425: chore: make prepare git hooks setup cross-platform
by OldFineDev · 2026-02-21
75.4%