#10708: fix: handle Windows PATH case-sensitivity in exec environment
agents
stale
Cluster:
Windows Path and Exec Fixes
## Summary
- On Windows, the system PATH variable is `Path` (mixed case), not `PATH`
- `applyPathPrepend` and `applyShellPath` hardcoded `env.PATH`, creating a duplicate key that shadows the real system path
- Add `resolvePathKey()` helper for case-insensitive PATH key resolution
## Test plan
- [x] Unit tests for resolvePathKey logic (5 cases)
- [x] All existing tests pass
Closes #10560
Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Fixes Windows `PATH` case-sensitivity by resolving the existing PATH key (e.g., `Path`) before prepending/merging.
- Updates `applyPathPrepend` and `applyShellPath` to write back to the resolved key to avoid shadowing.
- Adjusts gateway shell-path fallback gating to treat any case-variant of PATH in `params.env` as “provided”.
<h3>Confidence Score: 3/5</h3>
- This PR is mostly safe to merge, but the added test currently does not validate the production implementation it claims to cover.
- Core code change is small and localized (PATH key resolution and a safer check for user-provided PATH), but the new unit test duplicates the algorithm inline rather than asserting behavior of the actual `resolveKey` used in production, reducing confidence that future refactors won’t break Windows PATH handling unnoticed.
- src/agents/bash-tools.exec.resolve-path-key.test.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#10714: fix: handle Windows PATH case-sensitivity in node register invoke
by Yida-Dev · 2026-02-06
92.3%
#19931: Config: merge PATH env vars and bootstrap Windows bins
by Kemalau · 2026-02-18
83.8%
#21733: security(exec): platform-aware allowlist matching and restricted sa...
by Esubaalew · 2026-02-20
79.9%
#5496: Fix: Windows path separators stripped in Gateway scheduled task
by giuliozelante · 2026-01-31
79.5%
#5168: Fix: force UTF-8 for Windows exec
by ManojINaik · 2026-01-31
79.0%
#11529: fix(wizard): strip shell-style backslash escapes from workspace paths
by mcaxtr · 2026-02-07
79.0%
#20330: Fix SSH tunnel startup on Windows by resolving ssh from PATH
by graysurf · 2026-02-18
78.0%
#13848: fix(test): normalize paths in source-display test for windows
by gengmao · 2026-02-11
77.6%
#9250: Fix: Add shell:true for Windows .cmd files to prevent spawn EINVAL ...
by vishaltandale00 · 2026-02-05
77.6%
#23142: fix(test): Windows CI — use path.join for XDG path assertions in qm...
by ihsanmokhlisse · 2026-02-22
77.0%