Skip to content

Commit 7ed2d2f

Browse files
committed
fix(skills): bind approvals to current head
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 596858b commit 7ed2d2f

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.agents/skills/pr-review-loop/SKILL.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,34 @@ Any code push after a prior Codex approval invalidates that approval. A material
5454
PR-body edit should restart the loop for the description, but it does not
5555
invalidate the code-head review unless it changes the scope being reviewed.
5656

57-
Check the PR body reactions first, and verify the reacting actor:
57+
Check the PR body reactions first, and verify both the reacting actor and the
58+
reaction's freshness for the current head. The status rollup is scoped to the
59+
current head SHA, so its earliest start time provides a post-push lower bound:
5860

5961
```bash
62+
head_started_at="$(
63+
gh pr view <number> --json headRefOid,statusCheckRollup \
64+
--jq '[.statusCheckRollup[] | .startedAt // empty] | min // empty'
65+
)"
66+
if [ -z "$head_started_at" ]; then
67+
echo "Cannot prove when current-head activity started; body reaction is not approval."
68+
exit 1
69+
fi
70+
6071
gh api "repos/<owner>/<repo>/issues/<number>/reactions" --paginate --slurp \
6172
-H "Accept: application/vnd.github+json" \
62-
| jq '[.[][] | select(.user.login == "chatgpt-codex-connector[bot]")
73+
| jq --arg head_started_at "$head_started_at" \
74+
'[.[][]
75+
| select(.user.login == "chatgpt-codex-connector[bot]"
76+
and .created_at >= $head_started_at)
6377
| {content, created_at, user: .user.login}]'
6478
```
6579

6680
`gh pr view --json reactionGroups` is useful for counts, but it does not show
6781
which user reacted. Use the REST reactions endpoint above to prove Codex left
68-
the thumbs-up on the PR body.
82+
the thumbs-up on the PR body after current-head activity began. If the current
83+
head has no timestamped status/check activity, require a Codex review or issue
84+
comment that names the current head instead of trusting a body reaction alone.
6985

7086
Then check Codex issue comments and confirm the latest "Reviewed commit" matches
7187
the current head prefix:

0 commit comments

Comments
 (0)