Trace-driven debugging — turn a 4-hour panic into a 20-minute investigation — step 9 of 9
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill. You have three traces from this morning's on-call queue.
Each fits one of the three failure patterns from this lesson. Write
classify(trace) that returns one of "loop", "bloat", "clean"
based on these rules:
"loop"if any 3-row window has identical(tool, args)"bloat"if the last turn'stokensis more than 3× the first turn'stokens"clean"otherwise
(Note: routing bugs don't surface as a trace pattern alone — they need the tool result content to detect, which is out of scope here.)
Three traces run. Expected output:
loop
bloat
clean
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Final drill. You have three traces from this morning's on-call queue.
Each fits one of the three failure patterns from this lesson. Write
classify(trace) that returns one of "loop", "bloat", "clean"
based on these rules:
"loop"if any 3-row window has identical(tool, args)"bloat"if the last turn'stokensis more than 3× the first turn'stokens"clean"otherwise
(Note: routing bugs don't surface as a trace pattern alone — they need the tool result content to detect, which is out of scope here.)
Three traces run. Expected output:
loop
bloat
clean
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.