← All Labs Lab 19 / 28 The coding grader tells a fix from a partial fix and from cheating
Lab 19 · Code & ship · Learned

The coding grader tells a fix from a partial fix and from cheating

Grading a pi-durable coding agent's isolated git checkout with held-out tests gives a full score only to a complete fix, fails partial fixes, and scores 0 when the agent edits and commits a protected test.

Learned Needs: tool-calling Smoke: pnpm exec tsx examples/19-coding-grader/run.ts --smoke Run: pnpm exec tsx examples/19-coding-grader/run.ts Source: examples/19-coding-grader
zsh
pnpm exec tsx examples/19-coding-grader/run.ts --smoke

Each task in benchmarks/coding-fixtures/<id>/ is a repo at a fixed state, a prompt, visible tests and held-out tests. runCodingBenchmark copies the repo into a temporary git checkout, runs a pi-durable Harness with CodingTools (read, write, edit, bash) on it, then restores protected tests from the baseline commit, overlays the held-out tests and grades. This lab drives it with scripted faux agents, so it checks the grader, not a model.

CheckWhat it shows
full-fixes-passThe reference fix scores full marks on all six tasks
partial-fixes-failTwo agents that fix only some tasks, or part of one, fail the rest
committed-tamper-scores-zeroAn agent that replaces test/public.test.ts with a no-op and commits it is marked as cheating with score 0

It also prints a known gap: the visible tests pass on the unfixed code for every task, so only the held-out tests decide. See FINDINGS.md.

Break it

Put back the grader from before the baseline fix (git show fa3a494^:packages/evaluation/src/coding/workspace.ts). It compares against HEAD, so the committed tamper scores 1/10 with cheated=false and the smoke exits 1.

Files

  • run.ts: the smoke.
  • mock-solutions.ts: the scripted agents (full, partial, tamper-commit).
  • tasks.ts: loads the fixtures.

Running real models over the fixtures, with the model matrix and the results table the site shows, is the benchmark in _coding-bench/ (pnpm run bench:code).

Prompt

Coding-Agent Prompt · Ready to Paste
Build `examples/19-coding-grader/run.ts`: an offline check that `@umwelten/evaluation`'s coding grader (`runCodingBenchmark`, `packages/evaluation/src/coding/`) tells a complete fix from a partial one and from cheating.

Each task in `benchmarks/coding-fixtures/<id>/` has `task.json` (prompt, visible and hidden test commands, protectedPaths), `repo/` and `hidden/`. The grader copies `repo/` into a temporary git checkout, runs a pi-durable Harness with CodingTools on it, restores protected files from the checkout's baseline commit, overlays `hidden/` and scores.

Drive it with scripted faux agents (`mock-solutions.ts`, passed as `targetOverrides`): one applies the reference fix to every task; two fix only some tasks or part of one; one replaces task 01's `test/public.test.ts` with a no-op test and commits it through `bash` without fixing anything. Print one PASS/FAIL line per check and exit 1 on any failure: full-fixes-pass (reference fixes pass every task with full score); partial-fixes-fail (each partial agent fails at least one task); committed-tamper-scores-zero (the tamper run is marked cheated, fails and scores 0). Write outputs to a temp dir. Strict TypeScript, no `any`.
Works in Pi, Claude Code, Codex & Antigravity Offline mock first → --live opt-in

What we learned

The answer

The grader tells a complete fix from a partial one and from cheating: the reference fixes score full marks on all six tasks, the partial agents fail 2 and 4 of them, and an agent that edits and commits a protected test scores 0. With the benchmark CLI (now _coding-bench/) the whole path also works through Mycel. DeepSeek V4.1 Flash, run live as a pi-durable coding agent on 01-ledger-rounding, fixed most of the bug: 5/10, with 5 of 6 held-out tests passing, in 15 turns and 23 tool calls, for $0.0487 and 65.6 s. The grader tells full fixes from partial ones: the scripted full fixes score 6/6 and the scripted partial fixes fail.

What going through it found

  • The lab tested a model, not the grader. Its claim was "a model fixes a multi-file bug", which the one live run didn't meet (5/10), and its smoke was the benchmark CLI with a model matrix and a site report. The lab is now the grader; the CLI, matrix and report moved to examples/_coding-bench/.
  • The commit bypass is now a lab check. A scripted agent edits and commits test/public.test.ts; with the grader from before the baseline fix it scores 1/10 with cheated=false, and the smoke exits 1.
  • The visible tests catch nothing. On the unfixed fixtures every task's visible tests pass, so an agent that runs them learns nothing, and every partial fix in the smoke passes its visible tests. The score rests on the held-out tests alone. The smoke prints this as a known gap; the fixtures need visible tests that fail before the fix.
  • The smoke checked nothing. --mock --fresh printed a score table and always exited 0, so a grader that passed everything, or nothing, would have looked fine. It now ends with two PASS/FAIL checks: full-fixes-pass (the scripted full fixes pass every task) and partial-fixes-fail (every scripted partial model misses at least one), and exits 1 if either fails.
  • The smoke rewrites a tracked report. Every mock run writes reports/data/coding-bench-mock.json, and only timing fields (tokPerSec, a few cache-write tokens) change. Revert it after a smoke unless the tasks or mocks changed.
  • A live run replaces the live report. --live writes reports/data/coding-bench-live.json, which the site publishes. A one-task run like the one above would replace the published results, so it was not committed.
  • Committing hid test tampering. The grader found protected-file edits with git status against HEAD, so an agent could edit test/public.test.ts, run git commit -qam x through bash, and get a passing score with cheated=false. The grader now diffs against the checkout's recorded baseline commit (git diff <baseline> plus untracked files) and restores protected files from that baseline. A regression test covers the commit case.

Not tested

  • More than one task live, or any model besides DeepSeek V4.1 Flash.
  • Building a lab from its PROMPT.md with this agent, which is where the bench is meant to lead.

Known gaps

  • bash can read the held-out tests. createRepoScopeExtension limits the file tools to the checkout but does not scope bash, so an agent can read benchmarks/coding-fixtures/*/hidden by absolute path. A path check cannot close this. It needs a sandbox, such as a container that does not mount the fixtures.

Smoke run

Visual Target Wireframe ASCII Layout
anthropic:claude-fable-5-2             high     6/6 (100%) 10/10   4      $0.2854   1.8s
google:gemini-4-hydrogen               low      4/6 (66.7%) 7.17/10 3.7    $0.0131   1.6s
ollama:inkling-2-mini:latest           off      2/6 (33.3%) 4.83/10 3.5    $0.0000   0.8s

  PASS  full-fixes-pass: scripted full fixes passed 6/6
  PASS  partial-fixes-fail: gemini-4-hydrogen 4/6, inkling-2-mini:latest 2/6

Lab smoke (run.ts --smoke):

Visual Target Wireframe ASCII Layout
  KNOWN GAP  visible tests passed on failing runs for 4/6 tasks (02-cron-dst-scheduler, 03-wal-kv-recovery, 04-reactive-dag-engine, 06-sql-mini-planner); they don't catch the bugs

  PASS  full-fixes-pass: reference fixes passed 6/6 with full score
  PASS  partial-fixes-fail: gemini-4-hydrogen 4/6, inkling-2-mini:latest 2/6
  PASS  committed-tamper-scores-zero: edited and committed test/public.test.ts: cheated=true, score 0/10

  3/3 passed