Skip to content

fix(exec): resolve PATH key case-insensitively for Windows pathPrepend#31879

Merged
Takhoffman merged 1 commit intomainfrom
fix/windows-path-case-pr28821
Mar 2, 2026
Merged

fix(exec): resolve PATH key case-insensitively for Windows pathPrepend#31879
Takhoffman merged 1 commit intomainfrom
fix/windows-path-case-pr28821

Conversation

@Takhoffman
Copy link
Contributor

Summary

Describe the problem and fix in 2–5 bullets:

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • On Windows, PATH key resolution is now case-insensitive for path prepend logic, preventing missed PATH updates when env key casing differs.

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS (validation), Windows behavior covered by tests in patch
  • Runtime/container: Node 22 / pnpm
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): N/A

Steps

  1. Use the fix(exec): resolve PATH key case-insensitively for Windows pathPrepend #28821 replacement branch on latest main.
  2. Run full default gates.
  3. Verify no regressions and patch semantics match original.

Expected

  • Full gates pass and Windows PATH case-insensitive behavior fix is present.

Actual

  • pnpm build, pnpm check, and pnpm test:macmini all pass.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: pnpm build, pnpm check, pnpm test:macmini on replacement branch.
  • Edge cases checked: ensured commit content/author of replacement commit matches original patch intent.
  • What you did not verify: separate Windows host manual run.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert this commit.
  • Files/config to restore: src/infra/path-prepend.ts, src/agents/bash-tools.exec-runtime.ts, src/agents/bash-tools.test.ts.
  • Known bad symptoms reviewers should watch for: PATH prepend not applying on Windows when key casing differs.

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: behavior differences in non-Windows env path handling.
    • Mitigation: patch is constrained to case-insensitive key resolution logic and validated by full gate suite.

Attribution

@Takhoffman Takhoffman merged commit 21708f5 into main Mar 2, 2026
10 checks passed
@Takhoffman Takhoffman deleted the fix/windows-path-case-pr28821 branch March 2, 2026 16:14
@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Mar 2, 2026
Linux2010 pushed a commit to Linux2010/openclaw that referenced this pull request Mar 2, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

Fixes Windows PATH environment variable case-sensitivity bug by introducing case-insensitive key lookup. On Windows, process.env stores PATH as Path (mixed case), and when copied to a plain object, the original casing is preserved, causing the code's hardcoded env.PATH access to fail.

Key changes:

  • Added findPathKey() helper that searches for PATH case-insensitively and returns the actual key name
  • Updated applyPathPrepend() and applyShellPath() to use dynamic key lookup instead of hardcoded env.PATH
  • Comprehensive test coverage including Windows-style Path key scenarios
  • Maintains backward compatibility - prefers uppercase PATH when both casings exist

The fix is scoped to functions that receive copied env objects (Record<string, string>). Direct process.env.PATH access doesn't need changes since process.env handles case-insensitivity natively on Windows.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Clean, focused bug fix with excellent test coverage. The implementation is correct, well-documented, and handles all edge cases (missing PATH, mixed-case keys, both casings present). No security implications, fully backward compatible, and the change is isolated to the specific functions that needed fixing.
  • No files require special attention

Last reviewed commit: ae85032

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 2, 2026
* main: (174 commits)
  refactor(gateway): unify control-ui and plugin webhook routing
  fix(exec): resolve PATH key case-insensitively for Windows pathPrepend (openclaw#25399) (openclaw#31879)
  fix(tsgo): unblock baseline type errors (openclaw#31873)
  fix(security): harden sms.send dangerous-node defaults
  fix(gateway): let POST requests pass through root-mounted Control UI to plugin handlers
  fix(browser): fail closed navigation guard with env proxy
  test(perf): reduce timer teardown overhead in cron issue regressions
  refactor: split browser context/actions and unify CDP timeout policy
  test(perf): cache redact hints and tune guardrail scan concurrency
  docs(changelog): credit sessions_spawn agentId validation fix (openclaw#31381)
  fix(agents): validate sessions_spawn agentId format (openclaw#31381)
  fix(agents): add strict format validation to sessions_spawn for agentId
  fix(logging): log timestamps use local time instead of UTC (openclaw#28434)
  test(perf): remove redundant module reset in system presence version tests
  test(perf): avoid module reload churn in config guard tests
  fix(gateway): fail closed plugin auth path canonicalization
  docs(changelog): credit sandbox mkdirp boundary fix (openclaw#31547)
  fix(sandbox): allow mkdirp boundary checks on existing directories (openclaw#31547)
  fix(sandbox): allow mkdirp boundary check on existing directories
  fix: preserve dns pinning for strict web SSRF fetches
  ...
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants