fix(eval): codex exec --skip-git-repo-check so the harness actually launches the agent (age-o9x)

The live eval harness never ran the agent. eval-agent-harness.sh runs each task in
a fresh non-git mktemp dir; modern `codex exec` refuses to launch there ("Not
inside a trusted directory and --skip-git-repo-check was not specified", exit 1)
and the harness swallowed it (`>/dev/null 2>&1 || true`). Net: codex never
executed, wrote nothing, and every cd-* task scored 0 in BOTH arms — the n=1 PILOT
"floor" was launch failure, not timeout/capability.

- add --skip-git-repo-check to both codex exec call sites
- stop swallowing the agent exit; surface a non-zero exit as degraded:true +
  agent_exit:N (distinguishes a launch/timeout failure from an honest grader-fail),
  happy path output unchanged
- bats: degraded-on-nonzero-exit + no-marker-on-clean-exit

Verified end-to-end: real codex via the fixed harness on cd-door9-1 →
{"score":3,"total":3,"pass":true}, deliverable written, EXIT=0.

Bead: age-o9x (blocks RULER age-d16-self-hosting-route-nkr.2)
Evidence: docs/evals/2026-06-16-eval-orchestration-decision.md

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Boden Fuller
2026-06-16 16:12:48 -04:00
parent 3c49d13108
commit e81516c35b
2 changed files with 65 additions and 4 deletions
+37 -4
View File
@@ -109,12 +109,19 @@ run_agent() {
agent_env+=(AGENTOPS_HOOKS_DISABLED=1)
fi
# --skip-git-repo-check (ag-o9x): each task workspace is a fresh NON-git dir;
# modern `codex exec` REFUSES to launch there ("Not inside a trusted directory
# and --skip-git-repo-check was not specified", exit 1) without this flag — so the
# agent never ran and every task scored 0 in both arms. Capture the agent exit
# status (do NOT swallow with `|| true`) and return it, so run_single can mark a
# launch/timeout failure as `degraded` instead of an invisible score-0.
local rc=0
case "$AGENT" in
codex)
if [[ ${#agent_env[@]} -gt 0 ]]; then
env "${agent_env[@]}" timeout "$TIMEOUT" codex exec -C "$workspace" -s workspace-write "$prompt" >/dev/null 2>&1 || true
env "${agent_env[@]}" timeout "$TIMEOUT" codex exec --skip-git-repo-check -C "$workspace" -s workspace-write "$prompt" >/dev/null 2>&1 || rc=$?
else
timeout "$TIMEOUT" codex exec -C "$workspace" -s workspace-write "$prompt" >/dev/null 2>&1 || true
timeout "$TIMEOUT" codex exec --skip-git-repo-check -C "$workspace" -s workspace-write "$prompt" >/dev/null 2>&1 || rc=$?
fi
;;
*)
@@ -122,6 +129,7 @@ run_agent() {
exit 1
;;
esac
return "$rc"
}
run_single() {
@@ -148,7 +156,12 @@ run_single() {
bash "$TASK_DIR/setup.sh" "$workspace" >/dev/null 2>&1
run_agent "$workspace" "$hooks_off"
# ag-o9x: capture the agent exit status (run_agent no longer swallows it). A
# non-zero status means the agent itself failed to run cleanly (e.g. the
# trusted-directory refusal, or a `timeout` kill: 124/137) — that is a DEGRADED
# run, not an honest grader-fail, and must not be counted as a silent score-0.
local agent_rc=0
run_agent "$workspace" "$hooks_off" || agent_rc=$?
local result
result="$(bash "$TASK_DIR/score.sh" "$workspace" 2>/dev/null | tail -1)"
@@ -170,12 +183,32 @@ run_single() {
if [[ -n "$test_output" ]]; then
local retry_prompt="You are in a software project at $workspace. Your previous fix attempt did not fully resolve the issue. Here are the test failures:\n\n$test_output\n\nFix the remaining issues so all tests pass. Do not explain — just fix the files."
PROMPT="$retry_prompt" run_agent "$workspace" "$hooks_off"
agent_rc=0
PROMPT="$retry_prompt" run_agent "$workspace" "$hooks_off" || agent_rc=$?
result="$(bash "$TASK_DIR/score.sh" "$workspace" 2>/dev/null | tail -1)"
fi
fi
fi
# ag-o9x: a non-zero agent exit = DEGRADED run (the agent failed to launch/finish,
# e.g. the trusted-dir refusal or a timeout kill). Mark it so the caller can tell a
# degraded run apart from an honest grader-fail instead of silently scoring it 0.
# Happy path (agent_rc==0) leaves `result` byte-identical to the prior contract.
if [[ "$agent_rc" -ne 0 ]]; then
result="$(printf '%s' "$result" | AGENT_RC="$agent_rc" python3 -c '
import sys, json, os
rc = int(os.environ["AGENT_RC"])
try:
d = json.load(sys.stdin)
except Exception:
d = {"score": 0, "total": 0, "pass": False}
d["pass"] = False
d["degraded"] = True
d["agent_exit"] = rc
print(json.dumps(d))
' 2>/dev/null || printf '{"score": 0, "total": 0, "pass": false, "degraded": true, "agent_exit": %s}' "$agent_rc")"
fi
# ag-zzpy1: clean ONLY a workspace we created. A caller-provided
# CORPUS_DELTA_WORKSPACE (the harness's per-arm sandbox) is the caller's to
# manage — removing it here would delete the isolation sandbox out from under
+28
View File
@@ -55,3 +55,31 @@ teardown() { rm -rf "$TMP"; }
# A green-but-vacuous test would assert coverage it does not have, so it is omitted.
# Tests 1-2 above cover the load-bearing behavior (workspace honoring + ownership)
# with proven teeth (test 1 fails against the pre-fix bare-mktemp).
# ag-o9x: a non-zero agent exit (launch refusal, timeout kill) must surface as a
# DEGRADED run, not a silent score-0 grader-fail. This is the regression that hid
# the harness never launching codex (--skip-git-repo-check missing → exit 1 → `|| true`).
@test "non-zero agent exit marks the run degraded (not a silent grader-fail)" {
# fake codex that REFUSES to run (mimics the trusted-dir launch failure: exit 1, no work)
cat > "$TMP/bin/codex" <<'FAKE'
#!/usr/bin/env bash
echo "Not inside a trusted directory and --skip-git-repo-check was not specified." >&2
exit 1
FAKE
chmod +x "$TMP/bin/codex"
run env -u CORPUS_DELTA_WORKSPACE "$RUNNER" --task cd-am-1 --agent codex --runs 1
[ "$status" -eq 0 ]
# the single-run result must be flagged degraded with the agent's exit code, pass=false
echo "$output" | grep -q '"degraded": *true'
echo "$output" | grep -q '"agent_exit": *1'
echo "$output" | grep -q '"pass": *false'
}
# ag-o9x: the happy path (agent exit 0) must NOT carry a degraded marker — the
# pre-fix output contract is preserved byte-for-shape for clean runs.
@test "clean agent exit (0) carries no degraded marker" {
# default setup() fake codex exits 0
run env -u CORPUS_DELTA_WORKSPACE "$RUNNER" --task cd-am-1 --agent codex --runs 1
[ "$status" -eq 0 ]
! echo "$output" | grep -q 'degraded'
}