Recipes

Phantom bridge job: fixing Grok judge and Claude quota test fixtures

Discovered from README cross-links · today

Software & DevOps

Patched test fixtures so Grok and Claude CLI suites stop failing on host checks.

What they did

An automated bridge job (RQ-REL2-MACREALIO, pool codex-personal) made a single uncommitted commit on base 2083283e4 in the Phantom repo. The diagnosis: the Grok test cases launch inert Node executables rather than installed vendor CLIs, and their real spawn path now consults live macOS host headroom. Low or unknown memory telemetry refuses launch before fixture output, so judge consideration and producer usage/completion assertions failed for reasons unrelated to I/O. The fix supplies a deterministic healthy headroom decision at that module boundary in both suites, leaving production admission, sandboxing and assertions unchanged; test/host-headroom.test.ts still exercises refusal and hysteresis. Separately, two native Claude quota fixtures did not implement --version, required by the current exact-wrapper security floor; they now report Claude Code 2.1.309 for that probe and emit their original NDJSON only for task execution. The first quota test also explicitly checks persisted 1/1 token counts. No tests were deleted or given new skips. The agent installed the CLI globally under a temp prefix, read docs/AGENT-MCP-CLI.md and repo guides, ran targeted test:ci invocations with HOME=$(mktemp -d), repaired a missing ESLint dependency via npm run install:worktree, and ran typecheck, lint on changed files, check:docs and git diff --check.

How it went

Both native quota cases passed (2 passed, 0 failed under a name filter), host-headroom passed 36/36, and the engines-judges suite went to 54 passed / 12 failed with remaining failures tied to native profile preparation and validation. Typecheck, docs check, diff check and lint on the three changed files all passed cleanly. Net test LOC was +14 (17 additions, 3 deletions), plus 68 lines of bridge notes. Full ci.yml dispatch acceptance was explicitly not demonstrated.

Worth knowing

Changes are uncommitted; no push, tag, publish, release or workflow mutation was made. GitHub authentication was unavailable, so the failed hosted run log could not be read and a full dispatch could not be exercised. Remaining failures in resource-pool-runtime come from blocked loopback networking (fetch EPERM on 127.0.0.1) and sandbox-exec returning exit 71, plus native identity probe failures in the Grok and int4 suites. Repo-wide lint still fails on unchanged files (57 errors, 233 warnings). Local results should not be read as Mac exhaustive acceptance.

Wiring

Work happens on a single uncommitted commit on base 2083283e4. The agent first installed the CLI with npm install -g --prefix /tmp/RQ-REL2-phantom @ashlr/phantom (plain global install hit EPERM), then inspected phm docs --agent --json, phm mcp list --json, phm help and phm --version, and read docs/AGENT-MCP-CLI.md. Test runs use npm run test:ci with HOME=$(mktemp -d) so no real account inference occurs, with logs in /tmp/RQ-REL2-*.log. The fixture change intercepts the host-headroom module boundary in the two Grok suites; the Claude fixtures gain a --version branch gated to the security probe. npm run install:worktree restored a missing ESLint dependency before linting. Verification order: targeted test:ci runs, npm run typecheck, node scripts/verify-changed.mjs, node node_modules/eslint/bin/eslint.js on the three changed files, npm run check:docs, git diff --check. A sanctioned full ci.yml dispatch is required after authorized intake.

Try it yourself

In this repo, the Grok judge tests (test/engines-judges-310b.test.ts) and int4 confine tests (test/int4-confine-engines-310b.test.ts) fail because the spawn path consults live macOS host headroom and refuses launch on low/unknown memory before fixture output. Add a deterministic healthy headroom decision at that module boundary in both suites without touching production admission, sandboxing or assertions, and keep test/host-headroom.test.ts covering refusal and hysteresis. Also update the two native Claude quota fixtures to implement --version reporting Claude Code 2.1.309 for the exact-wrapper security probe while still emitting their original NDJSON for task execution, and assert the persisted 1/1 token counts in the first quota test. Do not delete tests or add skips. Run npm run test:ci with HOME=$(mktemp -d) on the affected files, then npm run typecheck, node scripts/verify-changed.mjs, npm run check:docs and git diff --check. Leave changes uncommitted and report which failures remain due to sandbox or network restrictions.

Source

Tools in this stack