bug(gate-predicate): a command-exit-zero gate that could not spawn sh is reported as a domain block (runBoundedShell drops the spawn error)
Pre-submission checklist
- I have searched existing issues and this bug has not already been reported (searched
runBoundedShell,evaluateCommandExitZero,command-exit-zero)
GSD Version: 1.14.0 installed; both defects re-verified by reading the v1.15.0 tag sources (latest release, 2026-09-26)
Runtime: Claude Code
Operating System: Windows
Node.js Version: v24.15.0
Installation Method: Updated from a previous version
How often: Every time (100% reproducible) on a host where sh does not resolve
Impact: Moderate — the gate still fails closed, but its verdict is misdiagnosed
What happened?
A command-exit-zero gate predicate that could not run (no sh resolvable on PATH) returns exactly the same verdict object as one that ran and refused: block: true, details.kind: 'command-exit-zero', exit code 127. The evidence that tells the two apart is produced one layer down and then dropped before the evaluator sees it. Two halves of one path:
D1 — runBoundedShell drops the spawn error its producer preserves.
src/check-command-router.cts:1342-1357 forwards five fields from execTool:
const r = execTool('sh', ['-c', opts.command], { cwd: opts.cwd, timeout: opts.timeoutMs });
return { exitCode: r.exitCode, stdout: r.stdout, stderr: r.stderr, signal: r.signal, timedOut: r.timedOut };but the producer, _spawnResult in src/shell-command-projection.cts:635-640, deliberately carries error — and special-cases ENOENT to exit 127 with error attached. The field exists and is discarded at the seam.
D2 — evaluateCommandExitZero has three outcomes and needs a fourth.
src/gate-predicate-evaluator.cts:101-150 branches timedOut → block, exitCode === 0 → pass, everything else → block, and its own comment states the collapse: // Non-zero (incl. null exit from a signal kill) => block. There is no route to onError for "the command never ran".
D2 cannot be fixed without D1: the evidence D2 needs is exactly the field D1 drops.
What did you expect?
A gate whose interpreter is missing should report an instrument failure (routed through the existing onError path), distinct from a domain refusal. The three existing branches should keep their behaviour exactly; only the currently unreachable fourth case gains a name.
Steps to reproduce
- Install a capability declaring a
gates[].check.predicateof kindcommand-exit-zero(any command, e.g.exit 0). - Run it on a host where
shis not onPATH(a stock Windows shell without Git'susr/binon PATH). - Observe the verdict:
block: true, exit 127,details.kind: 'command-exit-zero'— indistinguishable from the command running and exiting 127.
Why it matters
- A missing toolchain reads as a domain refusal, so the operator is sent to fix their code when the fault is a missing interpreter.
- A red-pole test cannot be trusted. A test asserting "the gate blocks when the condition is violated" passes identically on a host where the gate never executed.
- Blocking is fail-closed, which is correct; this is a diagnosis defect, not a safety hole.
Minimal fix
- D1: forward
errorfromrunBoundedShell(or a derivedspawnFailed: Boolean(r.error)), leaving the five existing fields untouched. - D2: with D1 applied, add one branch before the non-zero fallthrough: when the result carries a spawn error, return a distinct outcome through
onErrorinstead ofblock.
Workaround
None from outside the vendor tree: KIND_TABLE (src/gate-predicate-evaluator.cts) is module-private and EVALUATOR_KINDS is exported frozen, so a capability cannot register a predicate kind that distinguishes the cases. We checked that before filing; we are not asking for a plugin API.
Additional context
Not established by us: we have not run the proposed fix against the upstream test suite.
A related trust-disclosure finding in src/capability-trust.cts is being reported separately through a private security advisory, per SECURITY.md.
Privacy Checklist
- I have reviewed all pasted output for PII (usernames, paths, API keys) and redacted where necessary
Source: open-gsd/gsd-core