feat: subscribe to pull_request.synchronize and .reopened (Bug #35)#50
Open
feat: subscribe to pull_request.synchronize and .reopened (Bug #35)#50
Conversation
Why: Probot/Octokit-expert agent flagged that the bot only listened to
`pull_request.opened` and `.closed`. Real-world PR lifecycles include:
- force-push / new commits → `synchronize` (bot was silent)
- reopen-after-close → `reopened` (bot was silent)
The bot couldn't re-review on force-push, which was the most-asked-for
behaviour during rivet PR triage.
What:
- Extract `handlePullRequestOpenedOrReopened` so `.opened` and
`.reopened` share one code path (auto-merge enable + AI review +
dependabot config check).
- New `pull_request.synchronize` handler runs only AI review.
`reviewPullRequest` already calls `supersedePreviousReviews`, so the
older bot review is hidden and the PR shows only the latest.
- Bot-authored PRs (dependabot, etc.) are still skipped on synchronize
just like on opened.
Out of scope (deferred to a follow-up): pull_request_review,
pull_request_review_comment, check_run.rerequested,
installation.created, installation_repositories.added — these need
non-trivial behaviour decisions and shouldn't be lumped in.
Test plan:
- 4 new tests in __tests__/integration/app.test.js covering:
subscription registration, synchronize → review, synchronize-bot →
skip, reopened → review.
- Updated `app.on` call-count assertion 6 → 8.
- npm test → 838 pass (was 834).
- npm run lint → clean.
Risk: low — handler shares the same code path as `.opened` for review,
which is exercised in production daily. The synchronize event arrives
on every push so the AI review queue load increases, but the existing
`reviewPullRequest` already throttles via `_reviewTimestamps` and
supersedes previous reviews.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pull_request.synchronizehandler so the bot re-reviews on force-push / new commits.pull_request.reopenedhandler symmetric with.opened(auto-merge + AI review + dependabot check).Why
The bot only subscribed to
.openedand.closed. Force-pushes and reopens were silent.reviewPullRequestalready supersedes prior bot comments, so re-running on synchronize is a no-op visually if the diff is unchanged and a clean replacement otherwise.Out of scope
The bug listed five additional events (
pull_request_review*,check_run.rerequested,installation.*). Those need behavioural decisions (what should the bot do when a human leaves a review?) and are deferred to a follow-up.Test plan
npm test→ 838 pass (was 834, +4 new)npm run lint→ cleanRisk
Low. Same code path as
.openedfor the review side. Synchronize fires on every push, so review load goes up — existing throttling inreviewPullRequest(_reviewTimestamps) handles it.🤖 Generated with Claude Code