Skip to content

Commit e8acb9c

Browse files
committed
Use comment-only PR reviews, never approve or request changes (docker#61)
Prevents the bot from granting merge authority on repos without branch protection rules, which was allowing PRs to be merged without human review.
1 parent 90321c9 commit e8acb9c

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

review-pr/agents/pr-review.yaml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ agents:
126126
You MUST always deliver a review, even if no issues were found.
127127
128128
- **GitHub posting mode**: Post via `gh api` (see Posting format below).
129+
ALWAYS use the `COMMENT` event — never `APPROVE` or `REQUEST_CHANGES`.
130+
This ensures the bot never grants merge authority or blocks merging.
129131
- **Console output mode**: Output markdown (see Console format below). Never call `gh api`.
130132
131133
## Verify Line Numbers (REQUIRED)
@@ -134,33 +136,44 @@ agents:
134136
If grep returns a different number than the drafter, use grep's. If the file is not
135137
found on disk, use diff hunk headers instead. Never read the same file more than twice.
136138
139+
## IMPORTANT: Comment-Only Reviews
140+
141+
This action MUST NEVER use `APPROVE` or `REQUEST_CHANGES` events.
142+
ALWAYS use the `COMMENT` event when posting reviews via `gh api`.
143+
Some repositories lack branch protection rules — using `APPROVE` would let PRs
144+
merge without human review, and `REQUEST_CHANGES` would block merging without
145+
human ability to dismiss. The bot provides feedback only, never merge authority.
146+
137147
## Decision Rules (MANDATORY — strict lookup, not a judgment call)
138148
139149
1. **Filter**: Remove findings where `in_changed_code == false` or `in_diff == false`
140-
2. **Decide** based ONLY on the highest remaining severity. Do NOT override:
141-
- ANY high severity CONFIRMED/LIKELY → `REQUEST_CHANGES`
142-
- ANY medium severity CONFIRMED/LIKELY (but NO high) → `COMMENT`
143-
- Only low/DISMISSED or no findings → `APPROVE`
144-
145-
**Example**: 5 medium-severity CONFIRMED findings → `COMMENT` (NOT REQUEST_CHANGES).
146-
The number of findings does not matter. Only use REQUEST_CHANGES if at least one
147-
finding has severity "high". Do NOT escalate based on quantity or your own judgment.
150+
2. **Classify** (for informational labeling in the review summary):
151+
- CRITICAL = high severity CONFIRMED/LIKELY
152+
- NOTABLE = medium severity CONFIRMED/LIKELY
153+
- MINOR = everything else
154+
3. **Label the assessment** (informational only — does NOT change the event type):
155+
- ANY CRITICAL findings → label as "CRITICAL" in the summary
156+
- ANY NOTABLE findings (no CRITICAL) → label as "NEEDS_ATTENTION"
157+
- Only MINOR or no findings → label as "APPROVE"
158+
4. **Post the review**: The GitHub review event is ALWAYS `COMMENT`,
159+
regardless of the assessment label. Never use `APPROVE` or `REQUEST_CHANGES`.
148160
149161
## Posting Format (GitHub posting mode)
150162
151163
Convert each CONFIRMED/LIKELY finding to an inline comment:
152164
```json
153165
{"path": "file.go", "line": 123, "body": "**ISSUE**\n\nDETAILS\n\n<!-- cagent-review -->"}
154166
```
155-
Post: `echo '{"body":"## Review Summary\n\n...","event":"EVENT","comments":[...]}' | gh api repos/{owner}/{repo}/pulls/{pr}/reviews --input -`
167+
Post: `echo '{"body":"## Review Summary\n\n...","event":"COMMENT","comments":[...]}' | gh api repos/{owner}/{repo}/pulls/{pr}/reviews --input -`
156168
157169
The `<!-- cagent-review -->` marker MUST be on its own line, separated by a blank line
158170
from the content. Do NOT include it in console output mode.
159171
160172
## Console Format
161173
162174
```
163-
## Review: [APPROVE|COMMENT|REQUEST_CHANGES]
175+
## Review: COMMENT
176+
### Assessment: [APPROVE|NEEDS_ATTENTION|CRITICAL]
164177
### Summary
165178
<assessment>
166179
### Findings

0 commit comments

Comments
 (0)