Coding and Software-Engineering Agents › Execution feedback

Michael BrenndoerferDecember 1, 20264 min read
Language AI HandbookAll chapters
Part 49 of 67Long-Horizon Agents and Interoperability
Chapter 374Coding and Software-Engineering Agents › Execution feedback
Reading section 5 of 12 · Execution feedback · 4 minSection 5 of 12 · 4 min

Section 5 of 12 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Execution is the agent's verifier and its teacher. As we established in Part XLVII, Ch 5, running the code and reading the result is what separates iterative refinement from one-shot generation. But not all execution feedback is created equal, and the quality of the loop depends heavily on how the feedback is presented to the model.

A raw test runner output can be enormous. A single failing import in a large suite might produce thousands of lines of traceback. If the agent hands that to the model verbatim, the useful signal (which assertion failed, what was expected, what was actual) is buried in noise. Good coding agents pass the model a structured summary: the failing test names, the assertion expression and its expected/actual values, the file and line of the failure, and a truncated stack trace. The model can then read the actual source at the cited line to understand the issue. This is the same "structured tool return" pattern from Part XLVIII, Ch 2.

The principle generalizes: every tool return is a lossy channel from the environment to the model, and the design of that channel is a design decision. A summary that keeps the failing assertion, the expected value, the actual value, and the file:line is nearly always sufficient; a summary that keeps ten thousand lines of framework traceback is nearly always harmful. The rule of thumb is: keep the information a human engineer would read first, and truncate the rest. If the model needs more, it can ask for it with a targeted read of the cited line. The truncation is safe precisely because the environment is queryable: the model can always go back for detail it was not shown.

Truncation has a subtle cost that should be recognized: a summary that drops too much can hide the reason for a failure in a way that sends the agent down the wrong path. A test that fails because of a missing import and a test that fails because of a wrong assertion can look similar in a too-aggressive summary. The design target is not minimalism for its own sake; it is the failure cause, expressed compactly. A good summary answers "what failed, and why, in one line per failure."

There is also a decision about which commands the agent may run. Running the tests is essential; running an arbitrary shell command from a suggestion is dangerous. We will devote real space to this in the safety section, because it is the sharpest risk surface of the whole chapter. For now, note the principle: the agent's action space should include the smallest set of execution capabilities that lets it verify its work, and nothing more.

Signal quality and the "green but wrong" problem

Here is the crux of execution feedback. The signal is crisp but narrow. It tells you exactly whether the tests pass. It says nothing about whether the tests are the right tests, whether they cover the behavior that matters, or whether the change that turned them green is the change the human wanted. There are at least four ways a coding agent can produce a fully green suite and still be wrong:

  • Test tampering: the agent deletes, skips, or weakens the failing test instead of fixing the code. Common, and easy to detect if you forbid edits to test files.
  • Special-casing: the agent makes the specific test input pass while leaving the general behavior broken, for example if input == "2024-02-29": return True.
  • Overfitting to visible tests: the change passes the visible tests the agent can see but fails held-out behavior the human wanted. This is the coding-agent analog of train/test contamination from Part XX, Ch 6, and it is why we evaluate against tests the agent cannot see.
  • Collateral regressions: the change fixes the target test but silently changes behavior the suite doesn't cover.

Keep the visible verifier outside the edit scope and run separate cases against a copied candidate. Compare the complete diff with the original. These checks expose different classes of errors.

Each check answers one question. Stable test contents say something about the verifier, while new cases test behavior outside the examples the proposer used. Reviewing changed paths helps preserve unrelated files.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy