fix(ci): the tool gate needs node, and an inert gate must say so
deploy / test (push) Failing after 8s
deploy / build (push) Skipped

The first push of the PreToolUse gate failed CI, and the reason is a
property of the gate worth fixing rather than a CI quirk.

The hook parses its JSON payload with `node` — no jq in the runtime image,
and node is guaranteed there because Claude Code is a node program. CI runs
`cargo test --workspace` inside `rust:1.96-slim`, which has no node. The
extraction returned nothing, the gate allowed everything, and the two
"blocks" tests failed.

That is correct behaviour with a dangerous appearance. A gate that cannot
read its input must not block the phase — failing closed on a parse error
denies every tool call, which is what an earlier `case`-syntax bug did. But
allowing silently makes an INERT gate indistinguishable from one that simply
matched nothing, which is this codebase's recurring defect exactly.

So the gate now records `inert` when node is absent, still allowing, and a
test pins both halves: exit 0, and the marker written. The host can check
for that file rather than infer a working gate from an absence of denials.

CI installs nodejs so the shell tests exercise the gate instead of its inert
path. Verified in a rust:1.96-slim container: without node the force-push
payload returns 0, with node it returns 2.

Also confirmed the generated script behaves under dash — Linux /bin/sh —
not only under macOS sh. An earlier apparent dash failure was invalid JSON
in the probe command, not the gate.

Full workspace suite green: 106 binaries.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Omar Sobh
2026-08-20 06:04:56 -07:00
co-authored by Claude Opus 5
parent b653dbfe72
commit 128b423205
2 changed files with 75 additions and 1 deletions
+7 -1
View File
@@ -89,7 +89,13 @@ jobs:
rust:1.96-slim \
sh -c 'set -e
apt-get update -qq
apt-get install -y -qq pkg-config libssl-dev cmake git >/dev/null
# nodejs: cm-api's vm_tool_gate shell tests EXECUTE the generated
# PreToolUse hook, which parses its JSON payload with node (no jq
# in the runtime image; node is guaranteed there because Claude
# Code is a node program). Without it the hook takes its
# allow-and-record-inert path and the two "blocks" tests fail —
# which is how this was found, on the first push that carried them.
apt-get install -y -qq pkg-config libssl-dev cmake git nodejs >/dev/null
git config --global url."https://oauth2:[email protected]/".insteadOf "https://git.redclaw.dev/"
cargo test --workspace'