What happened
PR #883 was closed by its author at 15:54 UTC after discovering that PR #798 had already merged the same changes ~6 hours earlier. The second review agent (run 25810407850) continued running until 15:58 UTC — about 4 minutes after the PR was closed. It completed successfully but posted no review, suggesting it either detected the closed state at posting time or completed silently.
What could go better
The review agent could check PR state (open/closed/merged) before beginning its review and again before posting results. This would allow early termination when a PR is closed during review, saving token cost and compute time. Confidence: moderate. The savings per incident are small (~4 minutes of agent compute), but across many PRs this pattern likely recurs — especially for PRs closed quickly due to duplicates, accidental opens, or author self-closes. I'm uncertain whether the current review agent already has this check and simply didn't terminate early enough, or whether it lacks the check entirely (logs were inaccessible due to permissions).
Proposed change
In the review agent definition or skill, add a PR state check at two points: (1) before starting the review (after gathering PR metadata), and (2) before posting the review comment. If the PR is closed or merged at either checkpoint, the agent should log the reason and exit early without consuming further tokens. This could be implemented as a gh pr view --json state check in the review skill or as a pre-check in the harness workflow.
Validation criteria
Over the next 20 review agent runs, any run where the PR is closed before the review completes should terminate within 30 seconds of detecting the closed state, rather than continuing to completion. Observable in run logs as an early-exit message.
Generated by retro agent from #883
What happened
PR #883 was closed by its author at 15:54 UTC after discovering that PR #798 had already merged the same changes ~6 hours earlier. The second review agent (run 25810407850) continued running until 15:58 UTC — about 4 minutes after the PR was closed. It completed successfully but posted no review, suggesting it either detected the closed state at posting time or completed silently.
What could go better
The review agent could check PR state (open/closed/merged) before beginning its review and again before posting results. This would allow early termination when a PR is closed during review, saving token cost and compute time. Confidence: moderate. The savings per incident are small (~4 minutes of agent compute), but across many PRs this pattern likely recurs — especially for PRs closed quickly due to duplicates, accidental opens, or author self-closes. I'm uncertain whether the current review agent already has this check and simply didn't terminate early enough, or whether it lacks the check entirely (logs were inaccessible due to permissions).
Proposed change
In the review agent definition or skill, add a PR state check at two points: (1) before starting the review (after gathering PR metadata), and (2) before posting the review comment. If the PR is closed or merged at either checkpoint, the agent should log the reason and exit early without consuming further tokens. This could be implemented as a
gh pr view --json statecheck in the review skill or as a pre-check in the harness workflow.Validation criteria
Over the next 20 review agent runs, any run where the PR is closed before the review completes should terminate within 30 seconds of detecting the closed state, rather than continuing to completion. Observable in run logs as an early-exit message.
Generated by retro agent from #883