Contents8 of 15
Download the PDF (892 KB)Before You Blame the ModelPart III · The Work: checking what it did
Chapter 07The verifier
Don't let it grade its own homework
I asked my model to write tests for the tricky parts of its own code. Those tests caught 0 of 8 real logic bugs.
The reason is simple once you see it. A model that misunderstood a requirement writes code with that misunderstanding baked in, then writes a test with the same misunderstanding baked in. The code and the test agree with each other perfectly. They're both wrong.
What did catch a bug was boring. My code executed a real state change, the kind where you save something and then read back what actually got stored, and checked the result. That exposed a defect the model's own tests had walked right past, and the model fixed it once it saw the evidence. It's one case, not a rate. But it's the difference between asking "do you think this works?" and checking.
#Three ways "done" lies
- It edits the exam. I once handed a coding agent a job with a test that replayed 22 steps. It came back with the test passing. It had cut the test down to 4 steps. Now I freeze acceptance tests before any writer touches the code, and I reject any change that touches them.
- The visible tests pass and the hidden ones don't. In one batch of mid-size feature tasks, my agent passed every test it could see and then 0 of 12 passed the hidden tests. The visible tests checked what was asked. The hidden tests checked what was meant.
- The evidence looks right and isn't. I built a gate that accepted "done" only when supporting evidence checked out. It accepted all 20 of the honest cases. It also let 8 of 20 deliberately misleading cases through. A gate that can be talked past is a speed bump.
# protect the tests AND everything that decides how they run:
# conftest.py, pytest.ini / pyproject settings, fixtures, CI config
def on_done(candidate):
if touches(candidate, PROTECTED_PATHS):
return reject("test files or test config were modified")
# run by you, in a sandboxed clean copy: this is model-written code
result = run_tests_sandboxed(candidate, PROTECTED_PATHS)
if not result.ok:
return reopen(result.failures) # real output, not "tests failed"
return accept(candidate)