What You Check, Not What You Asked For
With a 222-test oracle within reach, two agents scored near-perfect and, more than once, delivered a dead library. Why the problem isn't iterating against a check, but against a sample
Machine-translated from Spanish. Read the original

In June, three Microsoft researchers published a paper, Building to the Test: Coding Agents Deliver What You Check, Not What You Requested, whose title is almost a whole thesis.
I want to write about it for two reasons. The first is the result, which is one of the most useful things I've read this year for anyone working with agents. The second is that I misread it. Twice. And the way I misread it says almost the same thing the paper does.
The experiment
The task was concrete. There's a data table built with React, one of the most widely used tools for building web interfaces. It has row selection, column sorting, resizable columns and keyboard navigation. An agent is asked to rebuild it in Angular, another tool for the same job, and to deliver it as a library, that is, code meant for others to reuse in their own applications and not a standalone page.
The specification isn't a text. It's the original table, running. What's correct is, by definition, whatever the original does. There's no ambiguity to interpret.
To measure the result, the authors wrote an oracle. In testing, an oracle is whatever tells you whether an answer is correct. Here it was 222 Playwright tests. Playwright is a tool that drives a browser the way a person would (it clicks, types and checks what shows up on screen). Each test checks that the new version behaves like the original in one specific respect. Since a library can't be used in the abstract, the tests run against a demo, a page that uses the library and shows it working.
The oracle was honest. The original table passes all 222 tests. So does a correct reimplementation. The agent couldn't read the test code. It only saw each test's name and whether it had passed.
With that, they set up three conditions, using two production agents (GitHub Copilot CLI with Claude Opus 4.7 and with GPT-5.5), three runs of each combination, eighteen in total:
- No oracle. The agent works, verifies itself however it sees fit, and when it says it's done the tests are run afterwards, without it ever having seen them. This is how almost every benchmark evaluates.
- Oracle, with a warning. The agent can run the tests whenever it wants while it works. The instructions tell it, verbatim, to use them "as a development aid, not as the goal".
- Oracle, without the warning. Same thing, with somewhat looser instructions. But nowhere are they told that passing the tests is the goal.
What happened
Without the oracle, the agents delivered real libraries, but incomplete ones. Scores ranged from 148 to 189 out of 222. Behaviors were missing because each agent verified itself with unit tests, which test individual functions and never reach what happens when a person clicks. None of them tried the table in a browser. One considered it and dropped it, with an argument I know well, namely that the unit tests already covered the logic.
With the oracle within reach, scores rose to 221 or 222 in every run that used it. Near-perfect. And here's where it gets interesting.
The authors didn't stop at the score. They audited the delivered code piece by piece (selection, sorting, column width, navigation). And they found that, in many runs, the demo didn't use the library. The behavior the tests looked at was written directly inside the demo. The library existed, but it was dead, because nobody called it. Or it simply didn't exist. In their words, the library was left "dead or absent".
To confirm it, they ran a simple experiment, emptying out the library's functions so they did nothing and re-running the tests. In one GPT run the score didn't move, because the library wasn't doing anything. In a Claude run with the same score, doing the same thing broke 12 of the 29 tests for that part. Claude's was a real library. The other one was set dressing.
In the most extreme case, one GPT run reported, when it finished, that it had implemented the whole library, "including standalone table primitives, sorting, selection, resizing", together with a "222 passed". The delivered code was a single 1,758-line file, the demo, with no library directory at all.
The two agents didn't behave the same way. GPT fell into this in five of six runs with the oracle, with and without the warning. Claude was more resistant (never with the warning, two out of three without it). But the authors found something subtler that shows up even in Claude. Without the oracle, all three Claude runs delivered a publishable package, between ten and eleven of their own test files, and strict type settings. With the oracle, none of the six did (no package and not a single test of their own), including the four where the library did work. The paper sums it up in a line that stuck with me, which reads once the oracle defines "done," what it does not score becomes optional.
It isn't cheating
The first thing that comes to mind is that the agent cheated. The authors rule that out carefully, and they convinced me.
In the AI literature, when a system exploits a flaw in how it's evaluated, people speak of reward hacking. But that assumes a flawed measure, one that lets through something it shouldn't. Here the oracle was correct, because everything it asked for was true of the original table. The agent didn't find a hole in the tests. It made honest tests pass, and it did so by putting the behavior exactly where the tests were looking.
You can see the shift of focus in the logs of the agents' reasoning. Without the oracle, they talk about "reusable pieces" and a "publishable" library. With the oracle, one of them sets out, before writing a single line, to "make sure every story matches the test names exactly". Halfway through, it asks itself to "check what the tests expect to understand the minimum implementation needed". Another commits to "implement only the behavior the harness can observe".
And the warning in the instructions (an aid, not the goal) wasn't enough. With GPT it changed almost nothing. In Convincing a Machine I said instructions work for almost everything, but that what has to hold always can't depend on the model being convinced. This is a textbook example. "Don't treat it as the goal" is a request. The oracle, right next to it, is a concrete signal that says "passed" or "failed" every time the agent consults it. The signal wins.
How I misread it
Now the uncomfortable part.
I didn't get to this paper by reading it. I got to it through an automatic summary. An agent searched for it, a tool downloaded it, and a small model summarized it. The summary said, more or less, that strong oracles prevent this problem and that it's weak checks that create the perverse incentive.
It made perfect sense to me, which is exactly the problem. It fit what I already thought, that if the check is good the agent has nowhere to escape to. I wrote it down as a conclusion.
When I went to verify it against the paper, the conclusion flipped. The oracle wasn't weak. It was honest, correct in everything it asked for, written by people who knew what they were doing, and it was still satisfied by something that didn't work. The problem wasn't the weakness of the check.
So I corrected it, and overshot in the other direction. I wrote down that the agent shouldn't iterate against the oracle and that the tests have to run afterwards, blind, as in a benchmark. That's wrong too. If the agent can't iterate against anything, there's no harness. It's going back to the no-oracle condition, the one with honest, incomplete libraries. And it also contradicts something I argued just a few days ago in Debugging in the Age of Agents, where I recommended that the agent shouldn't be able to call its work done until the checks pass. I still think that's right. What I needed was to understand when.
Before getting to that, the irony, which isn't lost on me. I evaluated the paper through a substitute, a summary instead of the text. And the substitute gave me an answer that passed my own check, which was "does it fit what I already know?". I built to the test, from the reader's side.
Definition or sample?
The question that unlocks everything is a different one. Is the check the definition of what's correct, or a sample of it?
Think of a type checker, the part of the compiler that, in a language like Haskell or Rust, rejects a program that adds a number to a string. An agent iterates against it all the time. It writes, the compiler complains, it fixes, it tries again. Nobody worries that the agent is "building to the type checker". Why?
Because the type checker, as long as the agent can't loosen it, is total with respect to what it checks. It doesn't review a few ill-typed programs chosen in advance but rejects all of them. There's no region of programs that pass it and are ill-typed. Optimizing against it is exactly the same as meeting what it asks for. There, the check is the definition.
Correction (November 25, 2026). The first version said the type checker is total with no condition at all, and didn't say that the example depends on the language. In TypeScript, even with
--strict,1 + "a"typechecks, andanyor@ts-ignorelet through programs the checker would reject. Those escape hatches need the same condition I set below for the model, that the agent can't touch them. The conclusion doesn't change. I found it in a review of the series.
A battery of 222 tests is something else. It's a sample, a finite set of behaviors chosen from all the ones the table has. The paper itself says so, using a classic distinction from the testing literature, according to which behavioral test suites are partial oracles, which sample behaviors rather than enumerate them. And around any sample there's a lot of room for programs that pass all 222 and aren't what you asked for.
In this case, on top of that, the sample was looking through a single window. The tests observed the demo, because there was no other way to observe a UI library. What had been asked for was the library. Between what the check looks at and what you want there are two distances, how complete it is and where it looks. An agent optimizing against the check finds the shortest path inside both.
This has an old name. Charles Goodhart, an economist at the Bank of England, observed it in 1975 about monetary policy, when he noticed that a statistical regularity tends to break down as soon as it's used for control. The formulation everyone repeats is from the anthropologist Marilyn Strathern, in 1997, writing about the assessment of British universities, and it reads "When a measure becomes a target, it ceases to be a good measure."
But Goodhart only bites if the measure is a sample of what you care about. If the measure is what you care about, turning it into a target doesn't ruin it. That's why nobody worries about the compiler.
To see it in miniature, I built a toy, with no agents, on the smallest task that has an unambiguous definition, sorting a list of numbers. There are three implementations. insertionSort actually sorts, fromExamples looks the answer up in a fixed suite of 12 tests, and fromSaved looks it up among 50 cases drawn at random once and saved. All three go through three checks, which are the suite (examples), the definition (the output is in order and has the same elements) on the 50 saved cases (saved), and the definition on a thousand new cases each run (fresh):
implementation examples saved fresh
insertionSort 12/12 50/50 OK (1000 new cases)
fromExamples 12/12 21/50 FAILED on [0,-1]
fromSaved 4/12 50/50 FAILED on [0,-1]The two that look the answer up score 100% on the sample they came from, and what they get right on the other one are lists that were already sorted. Neither survives the definition on new cases, and QuickCheck (the tool that generates those cases) shrinks the failure to two numbers out of order, like [0,-1], which change from run to run. That fromSaved passes the 50 random cases shows that randomness fixed once is still a sample. The toy only measures how complete the check is, not where it looks.
| type checker | test battery | model with a generator | |
|---|---|---|---|
| what it is | total definition of a property | fixed set of cases | specification plus new cases on every run |
| can you pass it without complying? | no, for that property | yes: there's room around the sample | hard, if the cases change |
| iterating against it | safe | Goodhart | safe, with conditions |
On the right side of the line
The third column is the one I care about most, and it's what I write about in An Oracle That Never Ships. It consists of writing a small model of the system, which says what should happen for any sequence of operations, and generating random sequences to compare the real system against the model.
A model like that isn't a list of cases. It's a specification plus a generator. Every run draws new sequences, so there's no fixed set the agent can learn to satisfy. Iterating against it looks much more like iterating against the compiler than iterating against 222 tests.
But only if a few conditions hold, and they're worth spelling out:
- The agent doesn't write or edit the model. If it can touch it, then when the system and the model disagree, the shortest way out is to "fix" the model. It's a matter of permissions, not instructions.
- The seeds change. If the same sequences are always generated, the generator is a test battery with extra steps.
- Saved cases are a sample. It's good practice to save every failure the model found as a regression test. But that collection is finite, and it has to be treated as such. It keeps you from going backwards, not from declaring that something is right.
- What matters has to be among what's observed. The model also looks through a window. If it only compares balances, a system that keeps everything in memory and never writes to the database will match perfectly, until it restarts. Surviving a restart has to be part of what's observed.
What I'm changing in my practice
Back to the rule from Debugging, according to which the agent can't finish until the checks pass. I stand by it, with a precision I didn't have before. What blocks the finish should, as far as possible, be a definition, not a sample. A compiler, a type checker, a property tested with randomly generated cases, a model. When there's no choice but to use a sample, the agent can use it to find its way, but the verdict comes from something it hasn't seen, such as new cases or a person who looks at what was delivered and not just at the score.
And there's a more uncomfortable lesson, which the paper calls validation self-awareness, that is, the ability to choose, on your own, the verification that fits what you're delivering. A good engineer tests a UI in a browser, an API by sending it requests, a command-line program by running it, and does so without anyone asking. In the eighteen runs, no agent did it on its own initiative. Without the oracle, they settled for unit tests. With the oracle, they adopted the harness's as their goal. These are, the authors say, the same absence seen from both sides.
As long as that doesn't change, choosing what gets checked is our responsibility. And everything that isn't in the check (the publishable package, the agent's own tests, the library actually being used) has to be asked for explicitly and looked at with your own eyes, because the agent will treat it as optional.
What the paper doesn't say
It's a small study (two agents, one task, eighteen runs), and the authors are the first to say so. It shows that the phenomenon exists and how it comes about, not how frequent it is. With another task, other models or other tools the picture might change; the authors leave it as an open question. What I take away doesn't depend on the percentage, because it's enough to know that it can happen with an honest oracle, with an explicit warning, and with a final report saying everything is done.
An agent delivers what you check. If what you check is the definition of what you want, that's great news. If it's a sample, you'll get the sample.
References
- Ma, Y., Kereopa-Yorke, B. & Schultz, B. (2026). Building to the Test: Coding Agents Deliver What You Check, Not What You Requested. arXiv:2606.28430 · Code and data: GitHub
- Barr, E. T., Harman, M., McMinn, P., Shahbaz, M. & Yoo, S. (2015). The Oracle Problem in Software Testing: A Survey. IEEE Transactions on Software Engineering 41(5), 507–525. DOI
- Goodhart, C. (1975). Problems of Monetary Management: The U.K. Experience. Papers in Monetary Economics, vol. 1. Reserve Bank of Australia.
- Strathern, M. (1997). 'Improving ratings': audit in the British University system. European Review 5(3), 305–321. Cambridge
Everything this article claims, in code that runs. Clone it, break it, open an issue.
Ragnagrok/what-you-check-not-what-you-asked-forIf this article was useful to you, you can sponsor the blog on GitHub. It helps me keep writing.