fix(#3086): apply #2667 .cmd-shim gate to deps.spawn + surface errorCode in review lanes (#3142)

* fix(#3086): apply #2667 .cmd-shim gate to deps.spawn + surface errorCode in review lanes

deps.spawn used shell:false with a bare binary name — on Windows, npm-installed
CLIs (gemini, codex, etc.) are .cmd shims that CreateProcess cannot start,
producing ENOENT + empty stderr. The review path then wrote an empty err file
and emitted a generic 'failed or returned empty output' stub.

Two fixes:
1. deps.spawn: detect .cmd/.bat on win32 and mediate through cmd.exe /d /s /c
   (same gate as runWithTimeout #2667, same explicit argv array).
2. runSpawnLane: surface errorCode (ENOENT, ETIMEDOUT) in the err file so the
   stub explains WHY the lane produced nothing.

* chore(#3086): backfill changeset PR number 3142

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-07 07:43:14 -04:00
committed by GitHub
parent 7ab4556395
commit 4b66bf4560
4 changed files with 63 additions and 2 deletions

View File

@@ -1330,7 +1330,16 @@ function dispatchOverlayCapabilityCommand({ command, args, cwd, raw, error, load
// cannot be interrupted by --test-force-exit and hangs a whole CI chunk to its 10-minute kill.
const deps = {
spawn: (binary, argv, opts) => {
const r = cp.spawnSync(binary, argv, {
// #3086: on Windows, reviewer CLIs (gemini, codex, etc.) are installed
// as .cmd shims. spawnSync with a bare name + shell:false fails with
// ENOENT (CreateProcess cannot start .cmd). Apply the same #2667 shim
// gate used in runWithTimeout: detect .cmd/.bat and mediate through
// cmd.exe /d /s /c with an explicit argv array (no shell:true).
const isWin = process.platform === 'win32';
const winShim = isWin && /\.(cmd|bat)$/i.test(path.basename(binary));
const spawnBinary = winShim ? (process.env.ComSpec || 'cmd.exe') : binary;
const spawnArgv = winShim ? ['/d', '/s', '/c', binary, ...argv] : argv;
const r = cp.spawnSync(spawnBinary, spawnArgv, {
input: opts.input,
encoding: 'utf8',
timeout: opts.timeoutMs,