Repository navigation
feat(github): Ask the requester in the Inbox to review a held draft - #4306
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This comment has been minimized.
This comment has been minimized.
ae16397 to
279e841
Compare
1055ec7 to
746114e
Compare
746114e to
2799494
Compare
A draft that stays a draft because marking it ready would ask its code owners, or because AGENTS.md asks for drafts, now asks only the requester to review it on GitHub. The next-action item for a draft says to review it and mark it ready. The Watch no longer posts about the hold. Co-Authored-By: BYK <[email protected]>
Tool search matched "search code" to github_updatePullRequest through the new param's "code owners" text. Co-Authored-By: BYK <[email protected]>
A draft that Junior held for its code owners or AGENTS.md waits for the requester's review. Their approval now starts a Turn on the draft Watch, and the Watch marks the draft ready, so GitHub asks the code owners only after the requester has looked. A draft that the requester asked to keep, or that AGENTS.md leaves for a person to mark ready, stays a draft. design/github.md gets the draft rule that BYK confirmed, and its Gaps line keeps only the watched-issue half. Co-Authored-By: BYK <[email protected]>
2799494 to
9483d94
Compare
… held draft A comment-only review or an approval ends GitHub's review request, which closes the requester's Inbox item, and request_review then refused to ask again. Now it skips only after a change request, which the review-again flow owns. A draft that AGENTS.md leaves for a person to mark ready asks the requester again after their approval, so their Inbox says to mark it ready. Co-Authored-By: BYK <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 05da3c9. Configure here.
A later comment-only review hid a change request from request_review, and asking again after an approval left a review request that outlived marking the draft ready. request_review now reads only reviews that approve or request changes, and asks nobody whose latest one does. A draft that its requester approved but that stays a draft, such as one that AGENTS.md leaves for a person to mark ready, gets the new mark_ready action: its Inbox item says to mark it ready, with no new review request.
| const reviewerLogin = update.request_review | ||
| ? linkedGitHubLogin(requesterPerson(requester)?.user) | ||
| : undefined; | ||
| if (update.request_review && !reviewerLogin) { | ||
| throw new PluginToolInputError( | ||
| "The person who asked for this pull request has no linked GitHub account, so GitHub cannot ask for their review. Do not retry: tell them in the thread where they asked.", | ||
| ); | ||
| } | ||
| const currentBody = |
There was a problem hiding this comment.
request_review asks the Turn work owner, not the PR opener
Held-draft request_review resolves the GitHub login from resolveWorkOwner() (conversation root on Watch turns) instead of the opener identity Inbox already uses, so when those differ GitHub notifies the wrong person and the opener never gets a review_draft item.
Evidence
- The hunk sets
reviewerLoginfromlinkedGitHubLogin(requesterPerson(requester)?.user)afterresolveGitHubRequester(ctx)/resolveWorkOwner(). work-owner.ts: a system Watch turn uses the conversation root person, while PR create records the opener as the person who ran the create turn (recordGitHubPullRequestOpener).pull-request-action.tsandpull-request-ready-reviewers.tsboth derive the requester login fromlistGitHubPullRequestOpeners+loadGitHubLogin(opener.identityId), andreview_draftonly when that opener is inrequestedReviewers.comment-on-pull-request.tsalready refuses to ask unlessowner.identity.id === opener.identityId, so this path is the inconsistent one.
Identified by Warden · code-review · DSV-B5H
… in limbo (#4310) 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: - Quiet PRs that went silent before a rule shipped. Example: #2382, where GitHub asked for the requester's review on 11-12, before #3395, and no webhook has come since. About 14 of BYK's PRs are `clean` and not approved. With #4304 they derive `merge`, but no webhook will come to derive it. - **PRs in limbo:** ready PRs that ask nothing of their requester, because no one ever asked for the requester's review. They were opened ready, or became ready, before #3250, or the requester linked GitHub later. **This is a one-off run with a done key, not a recurring poll.** A new started task, `backfillPullRequestActions`, does the run. It follows the `repository-name-repair` one-off (#4192): - After deploy, the GitHub heartbeat starts one page per tick: 50 open Junior PRs, in GitHub id order. Each page has its own task key. - Each page goes through the webhook sync path, `syncGitHubPullRequestActions`, with the same claim and the same concurrency limit of 5. A PR that no person asked for returns before any GitHub read. - After the last page, the task sets `pull-request-action-backfill:v1:done` in plugin state, and the heartbeat never starts it again. To run it again after a later rule ships, bump `VERSION` in `pull-request-action-backfill.ts`. ## Limbo `inLimbo` in `pull-request-action.ts` uses only what `nextAction` already reads, plus the head commit time. An open Junior PR is in limbo when all of these are true: - The derived action is none. - It is not a draft, and auto-merge is off. - It has a stored requester with a linked GitHub login. - GitHub has no pending user review request for the requester. A pending request for another person or a team does not count, because it asks the requester for nothing. - The requester has not reviewed or commented since the last push (the head commit's `committedDate`). - No reviewer approved it. Such a PR waits only on others. - No reviewer, the requester included, requests changes. On such a PR, Junior acts next. For each PR in limbo, the backfill asks for the requester's review on GitHub. It uses `requestPullRequestReviewers`, the same call that #3250 makes on `ready_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 not `clean`, the merge-state read now computes `reviewOutcome` for every open PR. `nextAction` still reads it only for `clean` PRs. **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 `merge` saved, 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 `inboxItems` and `users.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) > 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, but not after a push when the requester has already reviewed or commented. <!-- 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]>

Some Junior drafts stay drafts after their required checks pass: marking them ready would ask CODEOWNERS (#3380), or the repo's
AGENTS.mdasks for drafts. Today the Watch only posts a Slack message about these drafts. It adds no Inbox item, so the PR lands in Code · Mine's "Drafts" pile and never shows in "Waiting on you". getsentry/sentry#131267 is one example.With this change, a held draft gets the same one ask as any other Junior PR. It is a GitHub review request to the requester only, and the Inbox item follows from it. Nobody else is pinged, and the item gives one step.
github_updatePullRequestwith the newrequest_review: trueand posts nothing in the thread.request_review: asks only the requester's linked GitHub login to review. It does nothing when GitHub already asks them, or when they already reviewed, so after a change request only the review-again flow asks again. A dismissed review counts as no review. GitHub requests the code owners only when the PR is marked ready, so they are not asked.pull-request-action.ts): a review that GitHub asks for on a draft is a newreview_draftaction. Its item isReview requested · #Nwith the text "#N is a draft. Review it, then mark it ready for review." When the draft becomes ready, the same item changes to the usual "GitHub asks you to review #N." Thenext_actioncolumn is text, so no migration is needed.request_reviewcall and no reply. The draft HTTP fixture serves review requests.sender_loginisopener_username) approves a draft, the Watch marks it ready, so GitHub asks the code owners only after the requester has looked. A draft that the requester asked to keep, or that the repo'sAGENTS.mdleaves for a person to mark ready, stays a draft. Whether Junior held the draft is in the Conversation, so the agent decides from the Watch guidance.design/github.md: the Gaps line now covers only the watched-issue half, and Rules has the new draft rule.There is no dashboard UI change. The new item text is not the plain
textRepeatsHeadtext, so the row shows it under the head.Added sentence for @BYK to check
The draft rule in
design/github.mduses the text you confirmed, plus one new last sentence for the approval change:via @BYK.
--
View Session [Sentry]