Skip to content

Do not detach agent CLI spawns on Windows - #507

Merged
currentbits merged 1 commit into
mainfrom
coder/fix-windows-smoke-pass-c-480
Aug 18, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/fix-windows-smoke-pass-c-480

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Summary

Fixes #480. Windows electron/smoke.js dies on pass C: the Claude fake exits 0, the runner records Run error (exit 0), and there is no assistant text, tool card, sessionId, or usage. Pass A/B are green; macOS smoke is green on the same commits. This is the first real signal from the windows-latest smoke job added in #449.

Cause: detached: true + cross-spawn of a .cmd shim is DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP. The parent waits on cmd.exe (exit 0, empty pipes) while the node grandchild's stdout never arrives. gotResult stays false. Pass B works because it spawns node directly.

Fix: agentSpawnOptions in electron/proc.js — attach the child on win32 (windowsHide), still detach on POSIX for process-group kill. Wired through claude.js, codex.js, agent.js, kimi.js, and opencode.js. Did not skip pass C, and did not paper over it by changing the fake.

Related leftover: #481 (npm test hang on win32) is the same hole on killTree (process.kill(-pid) already falls back).

Tests

Mutations in electron/test/claude-spawn.test.js (on the win32 electron list):

  • Fake emits a result line → gotResult === true
  • Same fake without the result line → events still parse, gotResult === false (pass C would still fail)
  • Missing .cmd → not a silent exit 0
node --test --test-timeout=15000 \
  electron/test/proc.test.js \
  electron/test/which-platform.test.js \
  electron/test/claude-spawn.test.js \
  electron/test/fake-bin.test.js

node --test --test-timeout=30000 \
  electron/test/budget-spend.test.js \
  electron/test/codex.test.js \
  electron/test/agent.test.js

62 related electron tests pass. npm run test:smoke on macOS is green through A–E. windows-latest smoke is the remaining proof.

  • PR created by the Grok agent

detached:true + cross-spawn of a .cmd shim is DETACHED_PROCESS on
win32. The parent waits on cmd.exe (exit 0, empty pipes) while the
node grandchild's stdout never arrives, so smoke pass C records
Run error (exit 0) with gotResult false.

agentSpawnOptions keeps the child attached on win32 (windowsHide)
and still detaches on POSIX for process-group kill. Wired through
claude, codex, agent, kimi, and opencode.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit b7e193e into main Aug 18, 2026
3 of 6 checks passed
@currentbits
currentbits deleted the coder/fix-windows-smoke-pass-c-480 branch October 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows smoke pass C: Claude fake exits 0, runner records Run error (exit 0)

1 participant