A coding agent writes the code, writes the tests, runs them, and tells you they pass.
In a competition, that is the contestant, the organiser and the scoreboard all at once.
Machine learning settled this a long time ago.
On Kaggle you tune against a public leaderboard you can see, and you are ranked on a private one you can’t. Nobody reports their own accuracy, because a score you can see is a score you can tune to.
I was curious, and tried that on coding agents.
Public tests the agent can read and work against. Hidden tests it never sees, and they decide.
One question I couldn’t answer in advance: Kaggle’s host holds the true labels. Who holds them for a ticket?
In practice it is a handful of separate model sessions.
One writes public tests from a spec. Another writes hidden tests from the same spec.
A third writes a reference implementation.
Any hidden test that doesn’t pass on it gets thrown away.
Then the implementing agent works in a sandbox.
It can’t read the hidden suite, and the hidden suite decides whether the work is accepted. It gets one retry, told which rule failed but never shown the test.
None of it is new.
It is a holdout set. It is Goodhart’s law. It is the QA team writing the acceptance tests so that developers don’t mark their own homework.
What changed is the price. Separation of duties used to cost a second team. An independent test writer now costs a few dollars and under half an hour.
My hypothesis was the Kaggle one.
Agents would learn the visible tests and fail the hidden ones. That didn’t happen. The first 90 runs produced one overfit: a real bug, and the public tests just happened to be too short to trip it.
So I wrote harder specs.
Concurrency, compliance rules, a wire protocol I invented. Across the 230 runs I later re-graded, there were three real overfits.
Nobody cheated, either.
In about 2,500 sandboxed runs, no agent edited a test or touched the harness.
A clean negative result: if every rule is written down, a current model implements it, and a held-out set has nothing to catch.
My setup was unrealistic, in the agent’s favour.
I had been handing it a precise spec. Take seven tasks from my own backlog, 15 runs each, and count the runs that pass everything, hidden suite included. From the spec, it barely matters which tests the agent has.
Nobody hands an agent a spec. They hand it a ticket.
So I ran the same seven tasks from the ticket as I had first written it. With the public suite, 81 of 105 runs pass. Without it, 30.
An agent that writes its own tests passes exactly as often as an agent with no tests at all.
Less than a third of the time. It is a small sample, and smaller than it looks: runs of the same ticket aren’t independent, so this is really seven data points.
Every one of those 105 runs finished with its own tests green.
The hidden suite rejected 75 of them.
Almost none of them were mistakes.
A referee model went back through the 75 rejected runs holding only the ticket. 71 of them had broken nothing the ticket says. They failed on what it leaves out.
A ticket about releasing a held payment in two parts doesn’t say what happens when the amount is $0.
My answer: nothing is released, and the task is marked pro bono. One run wrote 21 tests of its own, passed all 21, and failed the hidden suite on that case. So did 14 of the 15 runs.
A ticket about single-use invite codes says nothing about two calls arriving at once.
Without the public suite, every run issued duplicate codes when two were made at the same moment.
A ticket that says “as CSV” leaves the rest open.
Whether there is a byte-order mark, which line endings to use, what to do with a cell that looks like a formula. Nothing passed that one.
The agent wasn’t overfitting to its tests. It was filling gaps.
Then it wrote tests from the same reading that had filled them. Its tests agree with its code because one guess produced both, and more tests from that reading can’t fix it.
I assumed a bigger model would close the gap. It narrows it.
The same tickets on four models, from Haiku 5.5 up to Fable 5.2. All 140 runs ended green by their own tests. The held-out suite accepted 60, and the best model still had 15 of its 35 “done” runs rejected.
Three of the seven tickets failed on every run of every model.
One says old free-text statuses should be normalised. The spec says “live”, “taken” and “done” mean published, claimed and merged. No model can derive that. It is a decision somebody made and never wrote down.
That answered the question I started with, and not the way I wanted.
Kaggle’s hidden labels are facts: a photo either shows a cat or it doesn’t, and the host knows which. A ticket has no such facts. What should happen when the amount is $0 is a decision, and until the owner writes it down it exists only in their head.
If one model drafts the spec and another writes hidden tests from that draft, you are grading one guess against another.
I checked that on real code.
I replayed 23 commits that had already shipped, from one of my repositories and two open-source ones, with the commit message as the ticket. When a model drafted the spec and nobody checked it, the hidden suite passed 3 of them.
After the spec’s open decisions were confirmed, it passed 20.
A big caveat: the “developer” doing the confirming was a model session that had been shown the real diff. That makes 20 a ceiling. I haven’t measured what a busy person would manage.
The drafts were mostly fine, too.
In a hand count over 18 drafted specs, about two thirds of the individual decisions survived untouched. But 16 of the 18 had at least one that didn’t, and one is enough to reject correct code.
This changed what I think the idea is.
I started out believing the hidden tests were the point. They are closer to a by-product. The step that matters is a person answering the questions the ticket left open, and the tests are how those answers get enforced.
A nice side effect.
The three confirmed commits that still failed did so on six hidden tests, and two of the six had found real bugs in code I had already shipped. In one, rankOf("constructor") returned Object.prototype.constructor, not "high".
A pass is not correctness.
When I re-judged the passing runs with a second suite, from a different model family, about one in eight broke a rule the spec states.
A strong model told to game the suite got through on two specs out of four.
It never hard-coded an input. It wrote small, general code, skipped the rules no public test reached, and then listed the skipped rules in its own summary.
Public tests can cause the overfitting they are meant to expose.
On one spec, agents with the public suite did worse than agents with no tests. The public tests went green, and the agents with tests stopped at green. It is the one clear case of what I originally went looking for.
Feedback can’t fix a wrong spec.
On unconfirmed specs, agents that were told which scenario they had failed and given a retry recovered 0 times out of 72. They were being told they had broken a rule their own spec says they passed.
I tried detecting a premature “done” with plain rules and no model.
I checked 50 firings by hand and one held up.
Visible tests are how decisions travel.
Given the public suite, which was written from the confirmed spec, ticket runs went from 30 of 105 passing to 81. The tests told the agent what I meant.
The gap is in the ticket, and a better model doesn’t close it.
Stronger models guess better. They still can’t know a decision that was never written down. Given the public suite, the strongest model passed every run.
No judge is final.
Mine misses things, a second one catches some of them, and the pair still miss things. Get the second opinion from a different model family.
A held-out suite needs a person behind it.
A green run from an agent that wrote its own tests tells you the code is consistent with the agent’s reading of the task. It tells you nothing about whether that reading was yours.
Don’t accept “tests pass” from whoever wrote the tests. We already apply that to people.
Before asking for more tests, ask what the ticket didn’t say. One session that reads the ticket and the diff lists what was left open: about 12 items, for about six cents. It doesn’t know which items matter, but you do.
If you want held-out tests, write them from a spec the owner has confirmed. Not from the code, and not from a model’s draft.
Read a pass as “nothing found”.
What I’m still unsure about.
The headline result rests on seven tickets from one backlog, mine. Models wrote the hidden suites and models refereed them. Confirmation by an actual person, which the whole thing hinges on, is barely measured.
If the method is wrong somewhere, I’d like to know where.
Read the full articleRuns and scripts →