Who Tests the AI That Tests the AI?
While I was building a personal project in early October, the AI that tested the code was the AI that wrote it. I had an AI agent build a small system to be my personal project manager and assistant. It wrote the system to generate a dashboard built from an Obsidian vault, along with 38 tests to prove the code worked. All 38 passed. First, 38 tests for a simple dashboard is overkill. Second, I didn’t trust the test results because my personal tasks were missing. I used a second AI that had seen none of that work to read the code, and it found three real bugs. Neither AI agent could tell me whether the dashboard did what I wanted.
Thirty-Eight Passing Tests
The dashboard code was intended to read markdown files of both my open work and personal tasks. It would sort each item into one of three columns: outstanding, current, or upcoming. I had an agent write the design and create a development plan for my review. After my first read through, I approved it and it built the script one task at a time, writing the tests first. When it finished, it ran the script against my real files, and all 17 of my open work items came out where they belonged. Since all the tests passed, the agent thought the work was done. It told me its own checking stopped at the server’s reply, because it had no browser to look at the page. When I opened the dashboard, my personal tasks were nowhere to be found, though they were in the files. The script never read them, because I had left them out of my description, and every test the agent wrote checked the description it was given.
The process I was using included a review by a second AI that started cold, with no memory of the design or the build. It reported nothing critical and three bugs affecting the data loading and item rendering. The first bug exposed raw scheduling tags in the headline of any item written as a bare line of text, with no link and no bold title. This just happened to be the shape the personal items I had added to the task file are written in. The second was caused by a heading at the wrong level which let checkboxes from a different section of the file appear on the dashboard. Finally, if a section heading was ever renamed, the script wrote an empty dashboard and still reported success.
Each bug was an input the author, me in this case, hadn’t pictured, and the tests came out of the same picture. A test suite only checks the cases its author thought of. If nobody pictured the input issue, it is now an input nobody tests. In “When Code Is Free, Verification Is Expensive” I said the tests a tool writes for its own code “tell me the code does what the code does,” which is exactly what these 38 did. The third bug is the one that would have really hurt, because a task dashboard with an empty list looks like good news.
Seen to Fail
In January, in a post called “AI-generated tests as ceremony,” Mark Seemann argued that a test earns trust when somebody has watched it fail, and that without a person engaged, generated tests are “mere ceremony.” “Tests work best when you have seen them fail,” he wrote. My agent wrote its tests first, the way test-driven development is supposed to work, but the agent was the only one watching them fail. For new behavior written test-first, I want to see the test fail before the implementation makes it pass. Otherwise, I don’t know whether the test ever proved anything.
On October 10, Satya Nadella published an essay on his blog called “Models as Insider Risks in the Super Intelligence Era.” One of its principles reads, “Validation must be independent of the intelligence being validated.” The second agent I ran met that test because I hadn’t used it to write the design. It came to my file with no saved context and came up with different guesses about what could be in it. The three bugs were sitting in the gap between its guesses and the first agent’s attempts.
I’ve seen this happen with no AI involved. In late 2009, while contracting at a regional bank, one of my components was scheduled for release. I found two potential bugs while reviewing my own code before release, after it had gone through testing. One bug had to do with putting data in the wrong fields in a table, and the other was a security hole. I had to go to my direct supervisor to have her pull the plug on it. It delayed the release by approximately two weeks. While the management wasn’t necessarily happy, they did appreciate the fact that they didn’t get egg on their face from a botched deployment of a financial system.
Who Checked the Reviewer
While my second agent pass on the dashboard project found real bugs, an independent checker can also be wrong in the other direction. Anthropic wrote recently, in an account of rebuilding its own source control system, that adversarial review, which it uses heavily, “can also be myopic.” One review was so wary of another internal service that the model ended up adding “excessive validation and complexity,” and skilled engineers had to steer it back. This harkens back to my earlier point about excessive tests being built for simple systems, and to Anthropic’s review over-testing the wrong part of the system. Tests are worth nothing if they aren’t properly testing the right code.
Nadella writes that models should be used to adversarially test and verify each other, and then warns that “you can then end up with an opaque model inside an opaque orchestration layer, watched by another opaque model.” This describes what I had with the two agents until I looked at the results for myself. I had read the script and reviewed the tests and thought all was good. It wasn’t until I opened the dashboard in a browser that I found the main issue. On a build like this, I now read the design and requirement documents from an aggressive, antagonistic point of view, looking for where the system will break and how, because if I can think of one way, there are at least three others I’m not thinking of. Then, once the AI has built it and another has reviewed, I test it as if I were an uninformed, non-technical user who doesn’t really understand computers.
I made sure the second AI was independent of what the first one designed and coded. Unfortunately, it wasn’t independent of me. Both agents worked from the descriptions I gave them, so anything I left out was invisible to both. The number of extra reviewers wouldn’t have changed that in any way. A second agent should still test the work of the first, which was the purpose of code reviews before the AI era. On my build, this practice earned its place by finding additional gaps. The check against what I actually wanted is still mine, and I haven’t found a way to hand it off.