tools/code-exec-harness/harness.py runs isolated code exec --json scenarios
and saves compact evidence under .tmp/code-exec-harness/.
Use it to compare Every Code behavior across prompt, memory, skill, model, and
configuration variants without writing to real GitHub or reusing the real
CODE_HOME.
Agent-specific testing policy lives in AGENTS.md in this directory. In short,
use this harness as the proving ground for effectiveness-adjusted token
efficiency work: prefer fake /v1/responses assertions first, use live tokens
when model behavior is the question, and preserve evidence that future runs can
compare.
The harness defaults code exec to danger-full-access because external tool
shims such as fake gh need to write logs and state outside the fixture
workspace. Run it only with trusted scenarios.
By default, each scenario gets an empty CODE_HOME. Pass --inherit-auth only
when you want a live model-backed run; it copies Code auth and GitHub CLI config
into the isolated run home without copying the rest of your config.
HOME, ZDOTDIR, XDG_CONFIG_HOME, and XDG_CACHE_HOME are also redirected
inside the run directory so shell startup files and home-directory tooling do
not silently use the real user profile. When auth is inherited, GH_CONFIG_DIR
points at the copied GitHub CLI config inside that redirected home.
Run the deterministic no-token smoke suite after ./build-fast.sh:
just harness-smoke
just harness-smoke targets code-rs/target/dev-fast/code by default so the
suite validates the binary built by this checkout, not whichever code happens
to be on PATH. To test another binary, set CODE_EXEC_HARNESS_BIN:
CODE_EXEC_HARNESS_BIN=/path/to/code just harness-smoke
The deterministic suite uses fake /v1/responses fixtures and does not spend
live model tokens. It is the Dogfood Parity 1 P0 gate for code exec --json:
if the built binary is missing, cannot start, stops emitting expected JSONL, or
regresses the covered request-shape contracts, this suite should fail.
Run a single scenario directly when you need narrower evidence:
python3 tools/code-exec-harness/harness.py \ tools/code-exec-harness/scenarios/exec-basic-smoke.json \ --code-bin code-rs/target/dev-fast/code
Run the live GitHub planning smoke only when model behavior is the thing being tested:
python3 tools/code-exec-harness/harness.py \ tools/code-exec-harness/scenarios/github-plan-smoke.json \ --skill-root /Users/cbusillo/Developer/codex-skills \ --inherit-auth
Each run writes:
artifacts/stdout.jsonl: rawcode exec --jsoneventsartifacts/stderr.log: stderr from the runartifacts/summary.json: final answer, token usage, tool commands, fakeghcalls, fake GitHub state, and expectation failuresartifacts/gh-calls.jsonl: fakeghinvocations when the scenario enables itartifacts/gh-state.json: fake issue state after the run
Scenarios are JSON files. Common fields:
prompt: prompt passed tocode execfiles: workspace files to create before the runskill_roots: skill roots copied or symlinked into isolatedCODE_HOME/skillsgh: fake GitHub fixture; when present, the harness prepends a fakeghtoPATHconfig_toml: isolatedCODE_HOME/config.tomlcontentsconfig_overrides:-c key=valuearguments passed tocode execinherit_auth: copy Code auth and GitHub CLI config for this scenarioturns: run multiplecode execturns in one isolatedCODE_HOME; later turns resume the first turn's session idresponses_api: start a local fake/v1/responsesserver and point the run at it with a dummy API key, allowing request-body assertions without spending live model tokens. Whenresponses_apiis set, inherited Code auth is suppressed even ifinherit_authis requested, but inherited GitHub CLI auth still applies.expect: simple assertions over the final answer, commands, fakeghcalls, and exit codeexpect.workspace_files: assertions over files in the isolated workspace after the run, includingexists,equals,contains,contains_all, andnot_containsexpect.workspace_git_status: assertions overgit status --porcelainin the isolated workspace, includingequals,contains_all, andnot_contains
The harness is intentionally black-box: the unit under test is the real code exec binary and its emitted JSONL stream.