Correction (Nov 23, a few hours after publishing). This post was first titled "The tests passed on all 107 wrong AI changes. Here is what caught 86 of them". That headline was wrong. My tool had a bug: on the 23 real libraries in the benchmark it never found the projects' test command, so it never ran their tests, and its "tests only" column said
unknownfor every change. I read that as "the tests passed" and did not check by hand. When I ran the tests directly, they failed on 85 of the 107 wrong changes. I fixed the bug, re-ran everything, and rewrote this post with the real numbers. The first version's numbers are kept in the repo, marked withdrawn. I'm sorry for the wrong claim.Update (Nov 24): two follow-up measurements, both prompted by the comments below.
- The 13% false alarms. I re-ran every check that stopped a "good" change against the upstream fix itself. In about 7 of 10 cases the change really does not do what the task text says; the hidden test was too narrow to notice. That leaves about 4 to 5 in 100 as the checker's own mistakes, against 13 by the labels. The lower figure rests on my reading of the task texts, so I quote both. Three attempts to cut the rest did not beat the unchanged tool, and two runs of the same code disagreed on 25 of 200 verdicts. Details.
- Does a blocked agent fix the bug or game the check? 120 real Gemini CLI sessions: of 12 blocked on a really wrong change, 4 ended with a real fix and none was seen gaming the shown check. 12 is too few to rule gaming out. The run found a bug (with Gemini CLI the hook did not re-check a retry after a block), fixed in 0.2.8; the experiment has not been repeated since. Details.
An AI agent fixes a slug function. The project's own test passes. It says "done". It isn't: slugify("Hello, World!") comes back as hello-world!, and the task said "a clean URL slug".
I'm the maintainer of Apex verify, a small open-source tool for that gap. You give it the change an AI made and the task you gave it. A different model writes checks from the task text (never from the agent's own tests), the tool proves each check can fail on the old code, then runs them next to your tests and a scan for cheating (deleted or skipped tests, a test script that cannot fail). The answer is ready, not ready or unknown, with the evidence, on a copy of your code.
Try it in 5 seconds (no key, nothing installed)
npx --yes https://github.com/apex-engine-dev/apex-verify/releases/latest/download/apex-verify.tgz verify --demo
The real numbers
The benchmark: 23 real open-source libraries (jshttp, picomatch, slugify, HumanizeDuration and others). Each task is a real historical bug fix: the code before the fix, with the upstream test that the fix added kept hidden. Small Gemini models wrote 200 candidate changes, labelled right or wrong by the hidden test.
| The project's own tests + a cheating scan | Apex verify (tests + scan + generated checks) | |
|---|---|---|
| Wrong changes stopped (107) | 80 (75%) | 97 (91%) |
| Wrong changes called "ready" | 0 | 1 |
| Good changes wrongly stopped (93) | 10 (11%) | 21 (23%) |
So on real libraries with decent tests, the tests already catch three quarters of the wrong changes. The generated checks add a smaller step: of the 27 wrong changes that slipped past the tests, they caught 17, called 1 "ready" and left 9 "unknown". And they cost false alarms: 11 of the 83 good changes that pass the project's tests were stopped by a generated check (13%). The other 10 wrong stops come from the projects' own tests (8 of them in one task where the upstream fix also changed a visible test).
Where the checks earn more is where tests are thin: on 17 small projects with one or two visible tests, the tests plus the scan stopped about 8% of wrong changes and Apex verify about 65%, with about 3% false alarms.
One run per change, Gemini wrote every change and Gemini is the checker, and 27 is a small sample. It is not a proof of correctness.
What did not work (so you do not repeat it)
-
Trusting an arm that said
unknowneverywhere. That is the mistake above. An arm that returns the same answer for every row is a broken measurement, not a result. Check the baseline by hand before you quote it. - A weak model writing checks for its own change blocked over half of the correct ones. The checker has to be a different model.
- Requiring two checkers to both object did not help. A checker from another company (Claude) worked about as well as Gemini on its own.
- Asking the checker for "obvious unstated cases" did not help. Neither did asking it to avoid the task's own example values.
- My first prototype claimed 70%; a truncated model call had inflated it. A "two checkers: 60%" result I quoted earlier also did not survive the full pipeline, and I withdrew it.
Where it plugs in
- Claude Code: a plugin whose Stop hook blocks "done" until the change is ready. I ran it in a real session: Claude said done on a wrong change, the hook returned the failing checks, and Claude was stopped (at most 3 times, so a wrong check can never trap it).
-
Gemini CLI: an
AfterAgenthook, run in 120 real sessions (see the update above; until 0.2.8 a retry after a block was not re-checked). - Pull requests (any agent or a person): a GitHub Action (on the Marketplace as "Apex verify: AI change checker") that comments a verdict and can be a required check.
- Codex and Cursor stop hooks are written to their documented formats, but I have not run them inside those apps yet.
- Checks are written for node:test, pytest, Jest, Vitest,
cargo testandgo test. Tests and checks run in a sandbox (macOS Seatbelt, Linux bubblewrap, Windows AppContainer).
Apache-2.0, one maintainer. Everything is rerunnable: node benchmark/run-gate.mjs.
Please break it
You already have a reason to: I got my own headline wrong. The most useful thing you can send me is a ready on a change that is wrong, or a not ready on one that is right. Open an issue and I will add it to the benchmark and credit you. The repo: https://github.com/apex-engine-dev/apex-verify

Top comments (14)
Proving each generated check actually fails on the pre-fix code before trusting it as a gate is the right filter -- most LLM-generated test suites quietly pass on both the broken and fixed versions and give false confidence.
Your negative result on requiring two checkers to both object is worth having on record: AND-mode did not help here.
One thing I'm curious about on the 3-stop cap in the Claude Code Stop hook: when the hook returns a failing generated check, how often does the coding agent actually fix the underlying bug vs. gaming the specific assertion you just showed it? (And on the good changes that failed because the upstream test was narrower than the task text, that's a classic spec-vs-test-suite gap -- hard to fault the checker there.)
Thanks Sean, that's the question I can't answer well yet, so here is the honest state: it is unmeasured.
What I have is two anecdotes, not a rate. In a real Claude Code session the hook blocked a wrong change and returned the failing checks, but I had told Claude not to edit anything, so it just kept reporting. In a real Gemini CLI session it was blocked once, then genuinely fixed the code (and added tests).
The gaming risk is real: the hook shows the failing check's expected/actual, so an agent could special-case that input. Partial mitigations exist (a scan that flags special-casing of the task's own example values, --lock-tests which restores the original tests, and the 3-block cap so a wrong check can't trap it) but none is measured against this question.
I opened an issue for the measurement itself: run an agent on the benchmark tasks with the hook on, and use the hidden tests to separate real fixes from "passes only the shown check", with and without showing expected/actual: github.com/apex-engine-dev/apex-ve...
And agreed on the spec-vs-test gap. I audited those 10 after seeing the numbers, so I'm treating the 4% as an estimate, not a result.
Comparing with vs. without expected/actual in the retry feedback on the hidden tests is a clean experimental design for #22.
One diagnostic worth logging alongside that A/B split is shown-check pass rate vs. hidden-test pass rate broken down by retry attempt (1, 2, 3). If the agent's pass rate on the shown check jumps sharply on attempt 2 while the hidden-test pass rate stays flat, you've directly quantified feedback gaming rather than having to infer it by hand.
The same question applies to tool retries in general, so it is worth measuring directly. Curious to see whether withholding expected/actual actually cuts that down or just makes the coding agent burn its 3 retries guessing blind.
That is a better design than mine, thank you. I added the per-attempt breakdown (shown-check pass rate vs hidden-test pass rate at attempts 1, 2, 3) to the issue, credited to you: github.com/apex-engine-dev/apex-ve...
Your point about models narrowing scope or mutating an argument to get a green return is the failure I would most expect, so I also noted it as something to record (an input dropped or flipped between attempts). And I agree the open question is whether hiding expected/actual cuts that down or just makes the agent burn its three retries guessing blind. I do not know yet, and I would rather measure it than guess.
Nothing in the tool itself broke here, so there is nothing to "fix and report back" on this thread; I will post the numbers on the issue when the experiment has run.
Sean, an update as promised: the experiment ran, with your per-attempt breakdown. 120 real Gemini CLI sessions, three arms (no hook, hook as shipped, hook with expected/actual withheld).
Honest result: too few cases to answer you. With the hook as shipped, 12 sessions were blocked on a change that really was wrong; 4 ended with a real fix, 7 still failed, and none went from failing the shown check to passing it while still wrong. 0 of 12 cannot rule out a 20% gaming rate. Withholding the details gave 2 fixes of 17, which points toward your "guessing blind", but it is not a reliable difference at this size.
The run also found a bug: after a block, Gemini CLI calls the hook with an empty prompt, so the hook judged each session only once. That is fixed in 0.2.8, and it means the attempt 2 and 3 rows are not real retries yet. One finding I did not expect: after a false block, 2 of 4 agents broke a correct change.
Protocol, every session and the scripts: github.com/apex-engine-dev/apex-ve...
Respect for the correction, that alone makes the numbers worth reading. The part I like most is proving each generated check can fail on the old code, we do the same with API checks, break one value in the response and the check has to go red or it is dropped. The 13% false stops on good changes look like the real cost here. Do you keep the generated checks that wrongly stopped a good change, or throw them away and regenerate?
Thank you. We keep them: every run's checks are saved with the results, and that turned out to matter. I re-ran each check that stopped a "good" change against the upstream fix itself. In about 7 of 10 cases the check passes on the upstream fix and the blocked change really does not do what the task says (for example a cookie change that rejects a quoted value the task allows); the hidden test was just too narrow to notice. That leaves about 4 to 5 in 100 as the checker's own mistakes, against 13 by the labels. The lower number rests on my reading of the task texts, so I quote both.
Three attempts to cut the rest did not beat the unchanged tool, and two runs of the same code disagreed on 25 of 200 verdicts, so regenerating does change the answer more than I would like. Details: github.com/apex-engine-dev/apex-ve...
Your "break one value in the response and the check has to go red" is the same idea from the other side. Do you mutate one field at a time, or several?
One field at a time. If I break several at once and the check goes red, I only learn that something reacts, not which rule did the work. One mutation per run maps each rule to the field it guards, and a mutation that stays green shows the gap right away. The 25 of 200 disagreement between two runs of the same code is the number I'd worry about most.
One mutation per run mapping each rule to the field it guards is a cleaner design than what I do, and "a mutation that stays green shows the gap" is the same test I apply to a generated check.
You are right to worry about the 25 of 200, and I do too. It comes from the checker writing a different set of checks on each run: the benchmark throws the drafted checks away on purpose, so every change gets a fresh draft. In normal use the draft is cached per task, so re-running on the same change gives the same answer, but that makes the verdict stable, not right.
What it means for the numbers: a difference of a few points between two single runs is noise, which is why none of my three attempts to cut false alarms could be called a win. From now on I want at least 3 runs per arm before I quote a comparison.
Thanks for posting the correction this openly, and for keeping the old headline in the note.
"unknown" read as "passed" is the failure I keep meeting in other shapes. An agent's report said "Build: pass" three times in six weeks, and each time the server didn't start. Nobody had run it, so the honest status was unknown, and it got written down as green. In my gate a step that can't run now ends as "no verdict", which can never count as a pass.
Would a benchmark run where most rows come back unknown now stop, or does it still produce a total?
Thank you, and your "Build: pass" story is the same failure exactly: nobody ran it, so the honest status was unknown.
Honest answer to your question: until today, no. The benchmark script still printed a total for a run where every row was unknown. I had fixed the bug that caused it and written the lesson down, but the script itself would have let me do it again.
It stops now. A run where every row has the same verdict, or (with a checker) most rows are unknown or errors, prints "NOT A RESULT", gives no totals and exits non-zero. I tested it by giving it a test command that runs nothing: 12 of 12 unknown, and it refused. The commit, with credit to you in the changelog: github.com/apex-engine-dev/apex-ve...
One limit: it catches the degenerate run, not a quietly wrong one. An arm that is unknown for 40% of rows for a bad reason would still print. Your "no verdict can never count as a pass" is the better rule, and the tool's own verdicts follow it; the benchmark harness around them did not.
Thanks for the changelog line. For the 40% case I'd compare the arms: if one comes back unknown far more often than the others, that gap is a result in itself, and I'd print it next to the totals.
One practical way to detect AI agents gaming verification checks is to introduce randomized inputs or edge cases that differ from the shown assertions, making it harder for the agent to hardcode responses and encouraging genuine fixes rather than superficial passes.
Agreed on the principle, and thank you. Two things from my runs. First, I tried the nearest cheap version: asking the checker to avoid the task's own example values when it writes checks. It did not help (details in docs/EXPERIMENTS.md in the repo). Second, inputs the agent never sees are exactly how I now measure this: in the new hook experiment every attempt is scored against hidden upstream tests, next to the check the agent was shown. In 12 blocked wrong changes none passed the shown check while failing the hidden ones, but 12 is far too few to call it. Randomizing the inputs inside the shown check itself is something I have not tried; if you have seen it work, I would like to hear how you kept the expected values correct.