AI-assisted engineering/Debug the agent trace

The review bot read a finished check run as a passing one

Debug the agent traceHard45 min

A code review bot tried twice to approve a PR that branch protection kept refusing. Its trace is full of red lines, and none of them is the cause.

Your task

Name the span where the bot first went wrong, then fix verdict() so the replay passes.

  • root_cause_span() returns the FIRST span whose plan contradicted what the agent already knew
  • verdict(runs) returns "approve", "request_changes", "rerun", "wait", or "escalate"
  • a run passes only when it is completed with success, neutral or skipped
  • failure asks for changes; timed_out or cancelled earns a rerun; a run not yet completed means wait
  • no runs at all, or a status or conclusion the bot does not know, escalates
  • when runs disagree, the first that applies wins: escalate, request_changes, rerun, wait, approve
  • leave call_tool() and check() alone; branch protection is not the bug

The replay runs your verdict() across sets of check runs at submit, and your named span is checked against the key.