Skip to content

Commit 03519c1

Browse files
TimDettmersclaude
andcommitted
docs: Add existing-review checks to dispatch and PR review guides
Agents were recommending PRs for review without checking whether reviews had already been posted, leading to wasted effort. Added Step 0 to dispatch_guide.md and Section 3.2.1 to pr_review_guide.md requiring agents to query the GitHub reviews API before proceeding. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8c4cfa0 commit 03519c1

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

agents/dispatch_guide.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ python3 agents/fetch_issues.py
1212

1313
Read `agents/github_tools_guide.md` for the full reference on how to use the query tools.
1414

15+
## Step 0: Check Existing Reviews on Open PRs
16+
17+
Before looking at issues, check whether there are open PRs from external contributors that need review. But **do not assume a PR needs review just because it is open** — check whether a review has already been posted.
18+
19+
```bash
20+
# List open PRs
21+
gh pr list --state open --limit 30
22+
23+
# For each external contributor PR, check for existing reviews
24+
gh api repos/bitsandbytes-foundation/bitsandbytes/pulls/<NUMBER>/reviews \
25+
--jq '.[] | "\(.user.login) | \(.state) | \(.submitted_at)"'
26+
```
27+
28+
A PR only needs a new review if:
29+
30+
- **No review exists at all** from a maintainer or agent
31+
- **The author has pushed new commits** since the last review (check commit dates vs review dates)
32+
- **The author has responded to review feedback** and the review needs a re-review
33+
34+
If a review already exists and the author has not responded or pushed changes, the ball is in the author's court — skip that PR. Do not generate a prompt to re-review work that has already been reviewed.
35+
1536
## Step 1: Find Candidate Issues
1637

1738
Start by getting the landscape of open issues:

agents/pr_review_guide.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@ From the metadata, note:
148148
- **Existing reviews and comments**: Has anyone already reviewed? Are there unresolved
149149
threads?
150150

151+
### 3.2.1 Stop If Already Reviewed
152+
153+
Before proceeding with a full review, check whether a substantive review has already been posted — by you, another agent, or a maintainer:
154+
155+
```bash
156+
gh api repos/bitsandbytes-foundation/bitsandbytes/pulls/<NUMBER>/reviews \
157+
--jq '.[] | "\(.user.login) | \(.state) | \(.submitted_at) | body_len=\(.body | length)"'
158+
```
159+
160+
**Do not duplicate an existing review.** If a review with substantive feedback (body length > 500 characters) already exists and the author has NOT pushed new commits or responded since that review, stop here — the PR does not need another review. The ball is in the author's court.
161+
162+
A new review is warranted only if:
163+
164+
- No substantive review exists yet
165+
- The author has pushed commits after the last review (compare commit dates with review `submitted_at`)
166+
- The author has responded to feedback and the reviewer requested re-review
167+
168+
This check prevents wasted effort reviewing PRs that are already waiting on the author.
169+
151170
### 3.3 Size Calibration
152171

153172
Use the PR size to calibrate your review depth:

0 commit comments

Comments
 (0)