Skip to content

feat(github): Ask the requester in the Inbox to review a held draft - #4306

Merged
BYK merged 5 commits into
mainfrom
feat/github-held-draft-inbox
Nov 25, 2026
Merged

BYK merged 5 commits into
mainfrom
feat/github-held-draft-inbox

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Some Junior drafts stay drafts after their required checks pass: marking them ready would ask CODEOWNERS (#3380), or the repo's AGENTS.md asks 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.

  • Watch: when it keeps a draft, it calls github_updatePullRequest with the new request_review: true and 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.
  • Next action (pull-request-action.ts): a review that GitHub asks for on a draft is a new review_draft action. Its item is Review requested · #N with 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." The next_action column is text, so no migration is needed.
  • Copy: the github-code skill and SPEC now say the Watch asks the requester to review, and do not say that it tells them. They also say that the requester's approval marks a held draft ready.
  • Evals: the code-owner and AGENTS.md draft cases now expect one request_review call and no reply. The draft HTTP fixture serves review requests.
  • Approval marks it ready: on a draft Watch, an approval is no longer a quiet event. When the requester (sender_login is opener_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's AGENTS.md leaves 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 textRepeatsHead text, so the row shows it under the head.

Added sentence for @BYK to check

The draft rule in design/github.md uses the text you confirmed, plus one new last sentence for the approval change:

When the requester approves a draft that Junior held, Junior marks it ready, so GitHub asks its code owners only after the requester has looked.

via @BYK.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 25, 2026 10:27pm UTC

Request Review

@blacksmith-sh

This comment has been minimized.

sentry-junior Bot and others added 3 commits November 25, 2026 18:55
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]>
@sentry-junior
sentry-junior Bot force-pushed the feat/github-held-draft-inbox branch from 2799494 to 9483d94 Compare November 25, 2026 19:02
@sentry-junior
sentry-junior Bot marked this pull request as ready for review November 25, 2026 21:16
@sentry-junior
sentry-junior Bot requested a review from BYK November 25, 2026 21:16
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 25, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

… 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]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ 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.
@BYK
BYK merged commit 645ad6f into main Nov 25, 2026
57 checks passed
@BYK
BYK deleted the feat/github-held-draft-inbox branch November 25, 2026 23:05
Comment on lines +297 to 305
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 =

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reviewerLogin from linkedGitHubLogin(requesterPerson(requester)?.user) after resolveGitHubRequester(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.ts and pull-request-ready-reviewers.ts both derive the requester login from listGitHubPullRequestOpeners + loadGitHubLogin(opener.identityId), and review_draft only when that opener is in requestedReviewers.
  • comment-on-pull-request.ts already refuses to ask unless owner.identity.id === opener.identityId, so this path is the inconsistent one.

Identified by Warden · code-review · DSV-B5H

BYK added a commit that referenced this pull request Nov 25, 2026
… 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]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 79a42aab Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant