fix(process): resolve Windows commands when env aliases are blank#111716
fix(process): resolve Windows commands when env aliases are blank#111716LZY3538 wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 20, 2026, 9:42 PM ET / July 21, 2026, 01:42 UTC. Summary PR surface: Source +47, Tests +74. Total +121 across 5 files. Reproducibility: yes. source-reproducible with high confidence: provide a Windows-style environment containing blank Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Rebase or update the branch onto current Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: provide a Windows-style environment containing blank Is this the best way to solve the issue? Yes. Sharing the core Windows environment lookup removes the divergent first-match behavior from the safe child-process path, while the SDK keeps its owner-local fallback semantics without adding configuration or changing intentionally empty search paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 97130060dfdd. Label changesLabel justifications:
Evidence reviewedPR surface: Source +47, Tests +74. Total +121 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
e5ad373 to
9397107
Compare
2c081cc to
a14aa44
Compare
a14aa44 to
10c77be
Compare
What Problem This Solves
Fixes an issue where Windows process and agent launch paths could fail to resolve an executable when an injected environment contained a blank
PATHorPATHEXTentry alongside a usable differently-cased alias.Why This Change Was Made
Windows environment keys are case-insensitive, including arbitrary mixed-case spellings. Resolution now scans all own entries whose keys case-fold to
PATHorPATHEXT, chooses the first nonblank value, and preserves the existing deterministic preference forPATH/PATHEXT, thenPath/Pathext, before other spellings. If all matching entries are blank, the explicit empty search configuration remains authoritative instead of falling back to the host process.This PR is AI-assisted. I reviewed the full resolver, its callers, sibling Windows command and executable-path implementations, adjacent tests, and the official Node.js
process.envWindows contract.User Impact
Windows commands and shims remain discoverable for every environment-key casing, including injected plain objects with mixed-case aliases, without overriding callers that intentionally provide an empty search path.
Evidence
Original base:
46ceb21b895d58ca6268dee84de2fc5e7c12dd5bExact head:
a14aa44fc01b4e023914d1f449a35f2948c2bb1fOriginal regression proof:
Review regression proof against the previous PR head with
pAtHandpAtHeXt:Focused tests after the fix, covering arbitrary-case
PATH, arbitrary-casePATHEXT, canonical duplicate precedence, and explicit-empty behavior:Sibling Windows command baseline before adding the new regression:
Real Windows production-path probe using arbitrary mixed-case aliases:
Official runtime contract: Node.js documents that environment variables are case-insensitive on Windows: https://nodejs.org/api/process.html#processenv
Current-head clean-install CI proof:
checks-windows-node-test).checks-node-compact-small-11), including the newresolveSafeChildProcessInvocationmixed-casePATH/PATHEXTregression and the existing non-WindowsPathcontract.check-prod-types,check-test-types).The overall CI gate is currently red only because
test/scripts/pr-wrappers.test.tsfails inchecks-node-compact-small-1; that file and its wrapper behavior are outside this PR's five-file diff. The same isolated failure reproduced on two successive PR heads, while the currentmainCI run is green. The contributor account cannot rerun upstream jobs.Formatting and whitespace validation:
The first revised CI head exposed
TS18048in the new entry collector. The implementation now collects narrowed[string, string]tuples explicitly. A fresh local core tsgo run reports no error inwindows-spawn.ts; it stops later on two unrelated missing exports from the linked worktree's stale shared@openclaw/fs-safe/advanceddependency. GitHub CI on this exact head is the authoritative clean-install typecheck.The linked-worktree changed-check classifier attempted to delegate its broader lane but could not start because pnpm tried to reconcile the linked
node_modulesand stopped withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY. No dependency installation or purge was performed.