In this lesson, you followed a hiker’s report of a wrong answer to its trace, read the trace step by step, and found the first step that went wrong. In Record a Trace per Request, you glanced at this trace and suspected retrieval. Checking every step in order confirms that suspicion.
Key Points
- A wrong answer can look fine everywhere else. At 03:08 UTC, a hiker asked “Is the Forcella path open tomorrow?” and the assistant quoted the July 3 report calling it open, though the wardens had closed it after a rockfall. The request’s log line said
"status":200, and the answer passed its checks, so nothing flagged it. - The run in the video uses stand-ins: the stand-in model and the stand-in retrieval from Watch a Trace Unfold, over the wardens’ reports from the simulated July season. It keeps every trace. With your sample rule, an answer nothing flagged has a trace only if the sample picked it.
- Find the trace from the report. Search the request log for the minute the hiker gives. Here, one
/askline matched 03:08, and its request ID is the trace ID. Searching the trace file for that ID gives the request’s whole trace: four lines,retrieve,model,streamAnswerandchecks. - Read the steps in order, and ask of each one: was its input right, and did it do the right thing with it?
- Retrieval: its input is the hiker’s question, and it searches the wardens’ reports in
data/reports.json. It returned one report, the hut 4 warden’s from July 3, saying the path was open. - What retrieval missed: the reports hold a newer one: on July 9, the hut 5 warden closed the route to hut 4 after rockfall. Both reports cover the stretch between hut 4 and hut 5, so that’s the Forcella path. The closure report is in
data/reports.json, the file retrieval searched, so retrieval had it to find. Retrieval got the right input and returned the wrong report. - The tool: there’s no tool line, and a question about a path needs no hut beds, so that’s right.
- The input as sent: the
modelspan’srequestholds the instructions, which say to answer only from the reports given, and an input with the question and the July 3 report. The closure never reached the model. - The output and the stop reason: the output says the latest report is from July 3 and the path is open, which is what its input said. The stop reason shows the answer wasn’t cut off.
- The code after: the
streamAnswerspan records only timing, not the text. The hiker’s message quotes the answer they got, and it matches the model’s output. Thechecksspan’sfailedlist was empty: the answer cited its date and gave no go/no-go verdict. But it still told the hiker the path was open when a newer report said it was closed, and that’s the wrong part. - Every step after retrieval did the right thing with what it got. The model answered faithfully from stale context.
- The number: the retrieved report was 6 days older than the closure report.
- The first step that did the wrong thing with the right input is where the answer went wrong. Here, that’s retrieval. Reading a trace only gives you a suspect, since you haven’t yet seen the answer change when the model gets the closure report. Confirming a suspect before you fix it is the habit Debugging Code You Didn’t Write builds, too.
The Fields With Your Provider
The stand-in fills 05’s neutral fields its own way: model holds its role in your config, capable, and its stop reason for a finished answer is end. With your provider, the same fields hold the model the response names and the provider’s own stop reasons: