Repository navigation
feat(github): Backfill next actions and ask for reviews on Junior PRs in limbo - #4310
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This comment has been minimized.
This comment has been minimized.
4ea08d7 to
fb00d48
Compare
fb00d48 to
43ae985
Compare
BYK
left a comment
There was a problem hiding this comment.
Check and address Warden comments. Also plan for the removal of this one-time backfill when we are done with it?
ca2ef60 to
71c3671
Compare
71c3671 to
d6158c5
Compare
|
There is one Warden finding on this PR, ZAN-4M6, and I declined it. A pending request for someone else or a team doesn't take a PR out of limbo, because the confirmed rule in The removal plan is in #4388. Once this ships and the backfill sets its done key, delete the backfill file, its task registration and heartbeat start, its tests, and the options only it uses ( |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d6158c5. Configure here.
4f56ea4 to
6bba487
Compare
6bba487 to
4f56ea4
Compare
The next action of a Junior pull request derives only when a webhook that can change it arrives. A pull request that went quiet before a derivation rule shipped keeps no action and no Inbox item for it. A one-off started task now syncs each open Junior pull request once, one page per heartbeat, through the webhook sync path. Started plugin tasks get Inbox items and stored identities, as plugin routes do, so the task can show items and map the requester's GitHub login. Co-Authored-By: BYK <[email protected]>
…imbo A ready Junior pull request can wait on nobody: its action is none, GitHub does not ask the requester for a review, the requester has not reviewed or commented since the last push, and no reviewer approved it or requests changes. The one-off backfill now asks only the requester's review on GitHub for such a pull request, and the sync then shows its review item. The next-action read now gives the head commit time, and the review outcome for every open pull request, not only one that GitHub can merge. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]>
… its PRs A webhook that holds a pull request's sync claim checks it again without askInLimbo, so the backfill skipped that pull request's limbo ask. The sync now returns the pull requests it could not claim, and the backfill keeps its cursor and runs the page again on the next heartbeat. Co-Authored-By: BYK <[email protected]>
The ready-sync claim returned undefined both when another webhook held the check and when Junior has no row for the pull request. The backfill counted both as busy, so an untracked pull request ran its page again forever. The claim now returns held for a check that another webhook runs.
4f56ea4 to
10695ba
Compare
…er answers (#4317) Stacked on #4316, on top of #4310, which backfills the PRs that are in limbo now. This PR keeps new PRs out of limbo, and it decides what counts as the requester's answer to a review ask. It applies to webhooks and to the #4310 backfill. Every ask goes only to the requester, through `requestPullRequestReviewers`, the call #3250 makes on `ready_for_review`. The next read shows the normal "Review requested" item. ## 1. Ready PRs that wait on nobody New PRs can still enter limbo: - The requester links GitHub after Junior opens the PR, so the request at open and the request on `ready_for_review` had no login to ask. - The request at open or on `ready_for_review` fails. Both only log a warning. `inLimbo` in `pull-request-action.ts` decides it. A PR is in limbo when its derived action is none and all of these are true: - It is open, not a draft, and auto-merge is off. - No review ask for the requester is open: GitHub does not ask them, and no comment-only review keeps an ask open (see 2). - The requester has not commented, approved, or requested changes since the last push. - No reviewer approved it, so it does not wait only on others, and no reviewer requests changes, so Junior does not act next. - The requester did not remove their own review request since the last ask (see 3). A pending request for another person or a team does not take a PR out of limbo. It asks nothing of the requester. When a PR is in limbo and the base branch's required checks pass, the sync asks for the requester's review. A webhook asks only a requester who has not commented or reviewed, so a push never asks again. The one-off backfill also asks one who acted before the last push (`askAfterRequesterActed`). Review-again already reads the required checks, so that reader is now shared as `readGitHubRequiredChecksPass`. Until the checks pass, each `check_suite` webhook syncs again. An ask counts only once Junior sends it, so a later check in the same sync can still ask. Each limbo sync costs one more GraphQL read and one REST branch-rules read until the requester is asked. ## 2. A comment-only review is not an answer A comment-only review neither approves nor requests changes, but GitHub drops the pending request on it. GitHub also records a reply in a review thread as a comment-only review. Now the ask stays open (`askStaysOpen`): the requester was asked, then left a comment-only review, and has not approved, requested changes, or removed their own request since. While the ask is open: - The derivation treats the requester as asked, so the PR keeps its "Review requested" item until they approve or request changes. - The limbo check counts the ask as pending, so Junior sends no new GitHub request. A plain PR comment still means Junior acts next, as before. A change request still follows the review-again flow. ## 3. A removed request stays removed The requester can remove their own review request. GitHub records this as a `review_request_removed` timeline event with the requester as both actor and reviewer. After that, neither the backfill nor a webhook asks them again, until someone asks them again on GitHub. If another person removes the request, it does not count. The next-action read now includes `ReviewRequestRemovedEvent` in its timeline. ## design/github.md This PR adds the rule text that BYK confirmed: - The change-request bullet now reads "When the requester comments, approves, or requests changes, Junior acts next, and the Inbox stops asking." - "A comment-only review is not an answer to a review ask. The ask stays open: the PR keeps asking the requester to review in the Inbox, and Junior does not ask again on GitHub." - "A ready Junior PR always has an Inbox ask or a pending GitHub review request for its requester. When it asks nothing of the requester, Junior asks for the requester's review on GitHub once the required checks pass. A push does not ask a requester who has already reviewed or commented." - "When the requester removes their own review request, Junior does not ask them again until someone asks them again on GitHub." <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A6eedb91e2d3dfa1fd070e65575e7799d --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A6eedb91e2d3dfa1fd070e65575e7799d) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A6eedb91e2d3dfa1fd070e65575e7799d/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>

The next action of a Junior pull request ("Review requested", "Ready to merge", or the held-draft ask from #4306) is derived only when a webhook that can change it arrives. Two groups of open PRs have no item:
cleanand not approved. With feat(github): Ask to merge a PR that GitHub can merge with no review #4304 they derivemerge, but no webhook will come to derive it.This is a one-off run with a done key, not a recurring poll. A new started task,
backfillPullRequestActions, does the run. It follows therepository-name-repairone-off (#4192):syncGitHubPullRequestActions, with the same claim and the same concurrency limit of 5. A PR that no person asked for returns before any GitHub read.pull-request-action-backfill:v1:donein plugin state, and the heartbeat never starts it again. To run it again after a later rule ships, bumpVERSIONinpull-request-action-backfill.ts.Limbo
inLimboinpull-request-action.tsuses only whatnextActionalready reads, plus the head commit time. An open Junior PR is in limbo when all of these are true:committedDate).For each PR in limbo, the backfill asks for the requester's review on GitHub. It uses
requestPullRequestReviewers, the same call that #3250 makes onready_for_review. It asks only the requester, and never code owners or teams. The next read then derives the normal "Review requested" item. To show approval on a PR that is notclean, the merge-state read now computesreviewOutcomefor every open PR.nextActionstill reads it only forcleanPRs.Side effect: after deploy, the backfill sends one GitHub review request to the requester on each PR in limbo, for all users. GitHub data from 11-25: 98 open, ready Junior PRs, from 21 requesters, have an assignee that GitHub does not ask for a review, are not approved, have no change request, and have auto-merge off. This is an upper bound. PRs that derive
merge, PRs where the requester commented after the last push, and PRs with no stored requester or linked login are not asked. BYK has 34 of these PRs. About 14 of them derive "Ready to merge" under #4304, so BYK gets about 20 review requests.Dismissed items stay dismissed. The sync changes an item only when the derived action is different from the saved one. getsentry/sentry-rust#1400 has
mergesaved, so its dismissed "Ready to merge" item does not come back. A PR in limbo has no saved action, so asking for its review cannot bring back a dismissed item.Started plugin tasks now get
inboxItemsandusers.readIdentity, as plugin routes do. The task needs them to show items and to map the requester's linked GitHub login.PRs that go into limbo after this one-off are handled by the PR stacked on this one.
Proposed design/github.md rule (not edited here)
via @BYK.
--
View Session [Sentry]