Big Logs, Lost Details
Why This Matters
A 5,000-line CI log may fit in the context window, but that does not mean the one line that matters gets the attention it needs. Details buried in the middle of a long input are the easiest to miss, and they are often exactly the detail that decides the verdict.
Trim in the tool
read_log should never return a whole log by default. Return the lines around the error, and say what you left out:
{
"lines": ["14:03:52 payment-sandbox health: 200", "14:03:55 pod payment-sandbox-7d9f OOMKilled", "14:03:58 connect ECONNREFUSED 10.0.4.17:8443"],
"omitted": { "before": 4210, "after": 820 },
"hint": "Call read_log with from/to to see other parts."
}
The model knows there is more, and how to get it if it needs to.
Summaries with pointers
For very long logs, a cheap first pass can extract only the lines that look relevant (errors, warnings, state changes), each with its line number. The investigator works from that summary and fetches exact ranges when needed. Every claim can still point to an exact line.
Placement
Models use information at the start and end of a long context more reliably than information buried in the middle. This is known as lost in the middle. Within one request:
- the most important evidence near the start or the end, not buried in the middle
- the question last
- the case file (lesson 56) in its own tags near the end
Measure it
Do not take this on faith; test it with your own setup:
- Take a long log (a few thousand lines of realistic noise).
- Hide the decisive line (
OOMKilled) at the start, in the middle and at the end. - Run each version ten times and count how often TestPilot cites it.
- Repeat with the trimmed tool output.
You will see for yourself what trimming buys you, on your data and your model.
Exercise
Run the experiment above and add the result to docs/decisions.md: how TestPilot trims logs, and the numbers that justify it.
Compare with solution/lesson-60-reliability, which covers lessons 54–60 (see docs/exercises.md, module 7).