Repository navigation
fix(agents): resolve Windows bare commands through PATHEXT - #135138
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 7:21 AM ET / 11:21 UTC. ClawSweeper reviewWhat this changesThe PR routes bare Windows CLI backend commands through PATHEXT so executable identity binding selects npm’s Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain No blocking correctness finding: this is a focused, source-supported repair for the linked Windows binding bug. It must remain open because the prior rank-up request is still unmet: the PR has only synthetic tests and no redacted after-fix Windows npm-global binding-and-launch trace. Priority: P1 Review scores
Verification
How this fits togetherBefore a CLI backend can be used, OpenClaw resolves and fingerprints its configured executable as a durable runtime owner. Windows npm global installs provide multiple launcher files, so identity resolution must select the same executable route used by process spawning. flowchart LR
A[Configured bare command] --> B[Executable identity resolver]
B --> C{Windows bare name?}
C -->|Yes| D[PATHEXT launcher lookup]
C -->|No| E[General path lookup]
D --> F[Durable executable identity]
E --> F
F --> G[CLI backend binding and launch]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +49. Total +55 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared PATHEXT resolution rule for Windows identity and spawning, then merge after a redacted real Windows npm-global CLI trace shows bare-command resolution, binding, and launch. Do we have a high-confidence way to reproduce the issue? Yes—source reproducible: current main probes the extensionless shim first and rejects its direct shebang, while the shared Windows spawn path already uses PATHEXT. A reviewer-side Windows execution was not performed. Is this the best way to solve the issue? Yes. Routing the identity lookup through the existing PATHEXT-aware spawn resolver removes the two-resolver disagreement; retrying later in Windows identity handling would duplicate lookup policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6465153422d8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Keep canonical Windows command selection inside the identity owner, preserve explicit and home-path normalization, and reject unresolved bare commands. Exercise the bound native and package invocations in the regular Windows CI shard. Co-authored-by: gaoanze <[email protected]>
66f169b to
966a5f8
Compare
|
Merged via squash.
|
…135138) * fix(agents): resolve Windows bare commands through PATHEXT * fix(agents): verify Windows CLI launcher ownership Keep canonical Windows command selection inside the identity owner, preserve explicit and home-path normalization, and reject unresolved bare commands. Exercise the bound native and package invocations in the regular Windows CI shard. Co-authored-by: gaoanze <[email protected]> --------- Co-authored-by: gaoanze <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…on Windows On Windows, the claude-cli backend cannot launch Claude Code because resolveClaudeAgentSdkOptions passes the bare command string (claude) as pathToClaudeCodeExecutable. The Agent SDK resolves this to npm's extensionless POSIX shim (a shell script), which fails to spawn on Windows. The identity layer already has the correct answer after openclaw#135138: resolveCliExecutableIdentity returns the resolved .cmd path and the actual .exe entrypoint. This fix threads the identity result through to the SDK options resolver so it can use invocation.command on win32. Changes: - Add executableIdentity to CliBackendExecuteContext - Add executableIdentity to PreparedCliRunContext - Store executableIdentity in context when resolved in execute.ts - Pass executableIdentity through to plugin context in execute-plugin.ts - Use identity-resolved path in agent-sdk.runtime.ts on win32 - Add regression tests for Windows and non-Windows paths Fixes openclaw#138424
Closes #134960.
What Problem This Solves
An npm-installed CLI can fail Windows onboarding with
executable cannot be bound to one durable absolute ownerbecause identity lookup selects the neighboring POSIX shim before the Windows launcher. Selecting the.cmdpath explicitly succeeds.Why This Change Was Made
Use the existing Windows PATH/PATHEXT resolver at the command-identity boundary. Keep the relative-PATH and cwd-relative command checks before lookup, reject unresolved bare results, and retain the shared normalizer for explicit and home-relative paths. Artifact hashing, package eligibility, native executable names, and the exact bound child invocation stay with their existing owners. Production gains eight lines; the SDK and generic executable resolver are unchanged.
The existing identity and Windows spawn suites now run in the regular Windows CI shard. Native fixtures use file copies across toolcache/workspace drives and native path canonicalization. The unchanged-launcher check also requires an actual fingerprint before comparing it. POSIX retains its shebang-flag refusal; the Windows package cases verify that an external throwing hook named only in a shebang is never executed by the bound Node invocation.
User Impact
Eligible npm-installed CLI backends can bind using their normal command name while keeping the POSIX launcher available for Git Bash. This changes command selection, not which runtime artifacts qualify for a durable owner.
Thanks @Vasanthdev2004 for the report and reproduction, and @gaoanze888 for the original PATHEXT repair.
Evidence
31944c8. Explicit commands produced identities, then encountered a short-path fixture mismatch; an existing POSIX-only shebang expectation also failed. Those three test issues are corrected separately from the selector repair. The completed job log was preserved before the remaining test-only workflow was canceled.identity-ok, and passed. Home paths, missing PATH, relative paths, unsupported wrappers, and the inert shebang-hook control passed. The tested merge wasfc1d30eaf0e14212201df01180cd9c5262688f5c, integrating the reviewed head into its base; the reviewed source/test/package bytes match exactly.966a5f8b35d186ce8dd2d9f35a03529a3c69f01c: CI run 33536039079 passed 246 checks with 13 skips, including both Windows jobs and the final gate. This head includes the separately landed protocol declaration build repair from fix: restore protocol declaration builds #135360. Fresh managed Codex P0 review and independent source review found no actionable defect.The native tests exercise real command selection, artifact binding, and child processes. CI has no authenticated CLI account, so this does not claim a complete account-authenticated onboarding session.
Review follow-through: the Windows job now verifies selection, binding, and actual child execution, which the earlier fixtures did not. It uses npm-style on-disk layouts; npm installation and account onboarding are not run in CI. The repaired boundary is command lookup, and the published installer contracts were inspected separately.