Description
On Windows, the env.vars.PATH configuration in openclaw.json is not being applied to the exec tool shell environment. Additionally, the PATH bootstrap logic in src/infra/path-env.ts only adds Unix-specific paths, which don't exist on Windows.
Steps to Reproduce
- Set
env.vars.PATH in openclaw.json with a custom path (e.g., C:\Program Files\GitHub CLI)
- Set
env.vars.GH_TOKEN
- Restart Gateway
- Run:
gh auth status
Expected Behavior
env.vars.PATH should be prepended to the exec shell PATH
- gh command should be found via the custom PATH
Actual Behavior
env.vars.GH_TOKEN works correctly (injected as environment variable)
env.vars.PATH is NOT applied
- The exec shell PATH only contains a minimal set of paths, missing most entries from both Machine and User PATH
- gh command is not found
Root Cause Analysis
The PATH bootstrap logic in src/infra/path-env.ts (function candidateBinDirs) only adds Unix paths:
// src/infra/path-env.ts
function candidateBinDirs(opts: EnsureOpenClawPathOpts): { prepend: string[]; append: string[] } {
// ...
// Common global install locations (macOS first).
if (platform === "darwin") {
prepend.push(path.join(homeDir, "Library", "pnpm"));
}
if (process.env.XDG_BIN_HOME) {
prepend.push(process.env.XDG_BIN_HOME);
}
prepend.push(path.join(homeDir, ".local", "bin"));
prepend.push(path.join(homeDir, ".local", "share", "pnpm"));
prepend.push(path.join(homeDir, ".bun", "bin"));
prepend.push(path.join(homeDir, ".yarn", "bin"));
prepend.push("/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"); // <-- Unix only!
return { prepend: prepend.filter(isDirectory), append: append.filter(isDirectory) };
}
These Unix paths (/opt/homebrew/bin, /usr/local/bin, /usr/bin, /bin) don't exist on Windows, so isDirectory() filters them all out. The result is that Windows gets no additional system paths from the bootstrap logic.
Missing Windows support:
- No handling for
platform === "win32"
- No Windows system paths (e.g.,
C:\WINDOWS\system32, C:\Program Files\...)
- No User PATH merging from Windows registry
Environment
- OS: Windows
- OpenClaw version: 2026.2.15
- Shell: PowerShell 5.1 (Windows PowerShell)
Workaround
Use full path to executable:
& "C:\Program Files\GitHub CLI\gh.exe" <command>
Description
On Windows, the
env.vars.PATHconfiguration in openclaw.json is not being applied to the exec tool shell environment. Additionally, the PATH bootstrap logic insrc/infra/path-env.tsonly adds Unix-specific paths, which don't exist on Windows.Steps to Reproduce
env.vars.PATHin openclaw.json with a custom path (e.g.,C:\Program Files\GitHub CLI)env.vars.GH_TOKENgh auth statusExpected Behavior
env.vars.PATHshould be prepended to the exec shell PATHActual Behavior
env.vars.GH_TOKENworks correctly (injected as environment variable)env.vars.PATHis NOT appliedRoot Cause Analysis
The PATH bootstrap logic in
src/infra/path-env.ts(functioncandidateBinDirs) only adds Unix paths:These Unix paths (
/opt/homebrew/bin,/usr/local/bin,/usr/bin,/bin) don't exist on Windows, soisDirectory()filters them all out. The result is that Windows gets no additional system paths from the bootstrap logic.Missing Windows support:
platform === "win32"C:\WINDOWS\system32,C:\Program Files\...)Environment
Workaround
Use full path to executable: