fix: resolve Windows Codex spawn failures for local review runs#250
fix: resolve Windows Codex spawn failures for local review runs#250anagnorisis2peripeteia wants to merge 3 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 3, 2026, 6:36 PM ET / 22:36 UTC. Summary Reproducibility: yes. source-reproducible: current main hardcodes Review metrics: 2 noteworthy metrics.
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: Land the narrow Windows-safe Codex launcher update for review-adjacent subprocesses after standard validation, and leave broader repair-lane Windows support to a separate follow-up if maintainers want that scope. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main hardcodes Is this the best way to solve the issue? Yes for the stated local-review failure: the patch follows the Windows AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 74f63a090af7. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat 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
|
7eb79c6 to
9f02387
Compare
On Windows, npm installs codex as a .cmd wrapper. Node's spawnSync cannot execute .cmd files without shell: true, causing ENOENT/EINVAL. Fix: - Add CODEX_BIN env var support (follows existing GIT_BIN pattern) - Add shell: true on win32 for .cmd wrapper compatibility - Keep stdin pipe with '-' flag (documented Codex exec interface)
9f02387 to
13e1c01
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
Extends the Windows .cmd wrapper fix to pr-close-coverage-proof.ts and commit-sweeper.ts, covering all Codex subprocess launchers.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Adds a 'local-review' CLI command that reviews the current branch diff against a base branch using Codex, without requiring a GitHub PR. Includes all prerequisites for local runs: - CODEX_BIN env var support (Windows .cmd wrapper compatibility) - shell: true on win32 for all Codex spawn sites - CLAWSWEEPER_CODEX_LOGIN_METHOD for ChatGPT Pro OAuth login - Applied to all 4 Codex subprocess launchers Merge order: this PR subsumes openclaw#250 (Windows spawn) and openclaw#251 (OAuth login). If this lands first, close those as superseded. If either lands first, this PR needs a trivial rebase (identical changes).
Adds a 'local-review' CLI command that reviews the current branch diff against a base branch using Codex, without requiring a GitHub PR. Includes all prerequisites for local runs: - CODEX_BIN env var support (Windows .cmd wrapper compatibility) - shell: true on win32 for all Codex spawn sites - CLAWSWEEPER_CODEX_LOGIN_METHOD for ChatGPT Pro OAuth login - Applied to all 4 Codex subprocess launchers - Clears stale output before each review run Merge order: this PR subsumes openclaw#250 (Windows spawn) and openclaw#251 (OAuth login). If this lands first, close those as superseded. If either lands first, this PR needs a trivial rebase (identical changes).
Summary
CODEX_BINenv var support following the existingGIT_BINpatternshell: process.platform === "win32"to both CodexspawnSynccall sitesCODEX_BINoverride and stdin prompt deliveryMotivation
On Windows, npm installs
codexascodex.cmd. Node'sspawnSynccannot execute.cmdfiles withoutshell: true, causing ENOENT or EINVAL errors when ClawSweeper tries to spawn Codex for review or assist.Proof
Tested on Windows 11, Node 24.12.0, Codex CLI 0.130.0.
Before (no CODEX_BIN, no shell):
After (CODEX_BIN + shell: true on win32):
Full local review completed against
openclaw/openclaw#89834:Codex consumed the 119k char prompt via stdin (
-flag withinput: prompt), executed the review with--output-schemaand--output-last-message, and produced structured review output with actionable findings. The review correctly identified a missingapplyPluginTextReplacementscall on commentary text in the reviewed PR.Tests
CODEX_BINoverride: platform-aware fake binary (.cmdon Windows, shebang on Unix) receives structured output and produces a valid decisionshell: truechanges stdin handling)Files changed
src/clawsweeper.ts--runCodex()andrunCodexAssist(): addCODEX_BINenv var +shell: win32test/clawsweeper.test.ts-- 2 focused testsTest plan
CODEX_BINtest passes (platform-aware fake binary)shellis false,CODEX_BINdefaults to"codex")