Repository navigation
fix(agents): npm-installed Claude CLI fails to launch on Windows - #138504
Conversation
|
Codex review: blocked before merge. Reviewed September 19, 2026, 6:12 AM ET / 10:12 UTC (Revision 5). ClawSweeper reviewWhat this changesResolves Windows CLI launchers through the shared executable resolver, preserves Node script arguments, and adds ordinary-agent launch coverage. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain The Windows launch repair remains necessary and addresses the previous review, but the revised resolution order introduces a home-relative command regression. Priority: P1 Review scores
Verification
How this fits togetherThe shared CLI runner prepares executable commands for plugin-owned agent transports. The Anthropic plugin launches the resulting process and returns its streamed response to OpenClaw. flowchart LR
A[Agent request] --> B[Shared CLI runner]
B --> C[Windows executable lookup]
C --> D[Executable and script arguments]
D --> E[Anthropic process transport]
E --> F[Agent reply]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +25, Tests +355. Total +380 across 5 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:
Copy recommended automerge instructionTechnical reviewBest possible solution: Retain the shared Windows launcher repair while preserving existing home expansion and proving compatibility through the plugin execution boundary. Do we have a high-confidence way to reproduce the issue? Yes: source establishes the Windows launcher failure and the introduced home-relative path regression; the supplied native Windows runs demonstrate the original launch failure and repair. No tests were executed during this read-only review. Is this the best way to solve the issue? The shared-resolver approach is appropriate, but the current ordering must preserve home expansion before converting relative commands into absolute paths. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fba076b49e53. LabelsLabel justifications:
EvidenceAcceptance criteria:
What 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 (4 earlier review cycles)
|
da87a65 to
cc1abcf
Compare
The claude-cli backend handed the Agent SDK the host-prepared command, which on Windows is the bare command or npm's extensionless POSIX shim. The SDK spawns pathToClaudeCodeExecutable directly, so Windows launches failed with ENOENT or EINVAL. Resolve the command through the same PATH/PATHEXT and wrapper-entrypoint resolution the CLI identity layer uses, yielding the package's native claude.exe entrypoint; other platforms are unchanged. Fixes openclaw#138424
cc1abcf to
fdcde1b
Compare
|
@clawsweeper re-review Real Windows behavior proof added to the PR body (Evidence section): on a Windows host (10.0.17763 x64, Node v24.19.0) with the reporter's npm-global layout ( |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
landpr-approve-unrelated-red |
|
Merged as 3039685. Thanks @LiuwqGit for the report, original repair, and Windows evidence. The fix now lives at the current direct CLI launch boundary and preserves the resolved executable plus leading arguments. Real Windows Exact-head review passed with no findings. PR CI completed with 149 successful jobs; its sole failed source job was an independently attributed skills-watcher timeout, documented in the landing approval. The separate Windows proof workflow's three identity-test failures remain disclosed in the PR body; no identity guard or assertion was weakened. |
|
Addressing the review's P1 finding (home-relative commands before Windows cwd resolution) in follow-up commit 283bcaa:
|
…nclaw#138504) Closes openclaw#138424 ## What Problem This Solves Fixes ordinary `claude-cli` agent turns failing to launch on Windows when an npm installation exposes an extensionless shell shim or a `.cmd` launcher. ## User Impact Windows users can complete Claude CLI turns through their npm-installed command without replacing launcher files. Native executables and non-Windows command handling are preserved. No configuration, authentication, or identity-verification policy changes are required. ## Why This Change Was Made The earlier implementation targeted the Agent SDK adapter removed by openclaw#138707. This revision preserves the contributor's commits while applying the repair to the current direct CLI transport. Its launch boundary now uses the existing shared Windows resolver and carries the resolved program together with its leading arguments. Relative commands and PATH entries are resolved against the child working directory; existing identity callers retain their previous behavior. ## Evidence The supported `agent --local --session-id <fresh> --message "Reply with exactly PONG" --json --timeout 60` path was exercised on real GitHub-hosted Windows 2025 with Node 24.20.0, isolated OpenClaw state, an npm-style prefix, and a controlled external CLI speaking the Anthropic transport protocol. No auth-binding callback or exact-version policy normalized the command first; no platform mock or live provider credential was used. | Actual Windows launch | Unchanged main production | Candidate production | | --- | --- | --- | | Extensionless shim plus npm `.cmd` | `write EPIPE`, no run child or reply | Run child launched; final reply `PONG` | | npm `.cmd` resolving to Node plus script | `spawn EINVAL`, no run child or reply | Node and script argument preserved; final reply `PONG` | | Native `.exe` control | Final reply `PONG` | Final reply `PONG` | - [Baseline run](https://github.com/openclaw/openclaw/actions/runs/35431111855): production from `cc262448fa0c`, proof ref `381771f2ca50`. - [Candidate run](https://github.com/openclaw/openclaw/actions/runs/35433705895): `e9f91d13d7e3`, with the same three fixtures and order. All three product cases passed. Publication head `7f7212ac7e6b` changes only the fixture's filesystem-error typing, not production or executable fixture bytes. - A macOS npm-shim control also completed with `PONG`. Focused local checks passed 75 tests, with the native-only case skipped; scoped lint passed. - The candidate Windows workflow is **not wholly green**: three later executable-identity tests failed with `expected undefined to be package-tree`. The baseline stopped before those cases, so this is not claimed as reproduced base-red. Their two-argument resolver calls retain exactly the previous behavior, run outside the changed execution owner, and execute in separate test processes. The identity guards and assertions remain intact. This proves the real OpenClaw command, Windows process launch, direct transport, and final reply boundary with a controlled CLI peer. It does not claim live Anthropic authentication/model traffic, pnpm launcher coverage, or Windows resume-session coverage. Ordinary exact-head PR CI remains the wider validation gate. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #138424
What Problem This Solves
Fixes ordinary
claude-cliagent turns failing to launch on Windows when an npm installation exposes an extensionless shell shim or a.cmdlauncher.User Impact
Windows users can complete Claude CLI turns through their npm-installed command without replacing launcher files. Native executables and non-Windows command handling are preserved. No configuration, authentication, or identity-verification policy changes are required.
Why This Change Was Made
The earlier implementation targeted the Agent SDK adapter removed by #138707. This revision preserves the contributor's commits while applying the repair to the current direct CLI transport. Its launch boundary now uses the existing shared Windows resolver and carries the resolved program together with its leading arguments. Relative commands and PATH entries are resolved against the child working directory; existing identity callers retain their previous behavior.
Evidence
The supported
agent --local --session-id <fresh> --message "Reply with exactly PONG" --json --timeout 60path was exercised on real GitHub-hosted Windows 2025 with Node 24.20.0, isolated OpenClaw state, an npm-style prefix, and a controlled external CLI speaking the Anthropic transport protocol. No auth-binding callback or exact-version policy normalized the command first; no platform mock or live provider credential was used..cmdwrite EPIPE, no run child or replyPONG.cmdresolving to Node plus scriptspawn EINVAL, no run child or replyPONG.execontrolPONGPONG7a932d979442, proof ref381771f2ca50.e9f91d13d7e3, with the same three fixtures and order. All three product cases passed. Publication head7f7212ac7e6bchanges only the fixture's filesystem-error typing, not production or executable fixture bytes.PONG. Focused local checks passed 75 tests, with the native-only case skipped; scoped lint passed.283bcaaaddresses the review's home-relative finding: the cwd-aware Windows lookup now expands the effective home before resolving, so a plugin command like~/bin/tool.exekeeps launching. The new plugin-runner regression (execute-plugin.windows-home-relative.test.ts) failed withCLI backend executable could not be resolved: ~/bin/tool.jsbefore the change; after it, the same ordinary plugin turn spawns the resolved Node program from the effective home and completes with the child's reply. The full focused suite (38 tests), scoped lint,tsgo:core, and theagents-othertest-type shard all pass locally; ordinary exact-head PR CI remains the wider validation gate.expected undefined to be package-tree. The baseline stopped before those cases, so this is not claimed as reproduced base-red. Their two-argument resolver calls retain exactly the previous behavior, run outside the changed execution owner, and execute in separate test processes. The identity guards and assertions remain intact.This proves the real OpenClaw command, Windows process launch, direct transport, and final reply boundary with a controlled CLI peer. It does not claim live Anthropic authentication/model traffic, pnpm launcher coverage, or Windows resume-session coverage. Ordinary exact-head PR CI remains the wider validation gate.