Contents9 of 15Download the PDF (892 KB)

Before You Blame the ModelPart III · The Work: checking what it did

Chapter 08State and memory

The leaky pipe

My code knew the tests were failing. The prompt told the model they hadn't been run.

2 min read

The model did what any reasonable worker does with bad information: it acted on it, and it looped. The cause was one piece of my code checking the wrong file and writing "not run" into the status line. I only found it by reading the actual request.

Once I started looking, I found this everywhere. My harness knew something the model needed, and the model never saw it, or saw it garbled. Each of these caused real loops or crashes in my runs:

  • what actually happened as a result of the model's last action;
  • the model's own conclusions from a few turns earlier;
  • the exact change it had just applied;
  • the path of the test that was failing.

None of these are hard facts to know. My code had every one of them. They just fell out of the pipe between "my code knows" and "the prompt shows."

Over-thinking is usually a symptom. The model is re-deriving something you didn't hand it.

#The loop that looks like stupidity

One failure fooled me longer than the rest. On tasks touching about ten files, my agent would read file A, then file B, then A again, then B again, and never make an edit. It looked like a model that couldn't hold a plan in its head.

It was my context budget. The prompt couldn't fit all the files at once, so when the model read B, my code quietly pushed A out of view to make room. At one point 9 of the task's files weren't being shown at all. So it read A again, which pushed B out. The model was doing the sensible thing with a view that kept disappearing.

#The best bug detector I know

Take a task a model has already solved in a plain, simple loop. Run it through your harness. If it fails there, the bug is yours. I had exactly this. DeepSeek's V4 Flash wrote the original fixes for a set of my test tasks, working in a basic loop. So Flash could clearly do the work. Yet run through my harness, on one of those same tasks, Flash made 0 edits in 30 requests. The small model I usually test with made its first edit within 8. Flash hadn't hit its limit. It had fallen through a hole in my pipe that the other model happened to step over.

CodePythonSteal this · a delivery audit
# a crude but useful first pass: exact-match facts in the final text.
# expect a few false alarms where you format a fact differently.
rendered = render_text(request)        # the whole prompt as one string
# must_deliver: failing test, last result, open items...
for name, value in must_deliver(state).items():
    if str(value) not in rendered:
        emit("fact_not_delivered", fact=name)
Before You Blame the Model9 / 15