GenAI Field Guide
1 · Code runs Produces stdout /stderr 2 · Output isshortened Often just head +tail 3 · Intocontext Arrives as a toolresult 4 · Latercompaction May drop theoutput first Write the full output to a file Files survive context compaction
Program output enters the context as a tool result, truncated on the way in and dropped first on compaction.

Two caveats that explain "it forgot the error"

Caveat What happens What good agents do
Truncation Large outputs are cut (head and tail of a log, the first N kilobytes of a file) before they enter the context. The model may not have seen the whole thing. Redirect big output to a file and search it.
Compaction Tool results are the first thing summarized or dropped when the window fills. Write the error, the fix, and the test result to a file or a note.

Try it (needs a coding agent, if your role permits)

Give an agent a small data-cleaning task with a deliberately failing step. Watch the error come back as a tool result. Let the context grow, force a compaction, then ask the agent about the earlier error. Note what survived.