Repository navigation
feat(github): Request the requester's review and finish drafts - #3250
Merged
Merged
Conversation
Junior now asks the requester's linked GitHub account, or the reviewers the person names, to review the pull requests it opens. A draft gets the request when it becomes ready for review. The Watch of a draft also gets passing checks, so Junior marks the draft ready when its required checks pass and no decision is open. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 577adcc. Configure here.
BYK
requested changes
Nov 12, 2026
This was referenced Nov 12, 2026
BYK
added a commit
that referenced
this pull request
Nov 12, 2026
…est (#3254) ## Problem No tool reads the required checks or the merge state of a pull request. `github_getPullRequest` returns only the state, draft, head and base. So the approval guidance tells the model to run `gh pr view` and `gh pr checks --required` and to read their text output. @BYK asked for a tool in the #3250 review: #3250 (comment) ## Fix - `github_getPullRequest` gets a `checks` field. One GraphQL query (`PullRequestChecks`) reads the checks of the head commit with `isRequired`, for both `CheckRun` and `StatusContext`. It also reads `mergeStateStatus`, `reviewDecision` and `autoMergeRequest`. - `checks` has these fields: - `required`: `passing`, `failing`, `pending` or `not_reported`; - `failing`, `pending` and `passing`: the names of the required checks; - `merge_state`, `review_decision` and `auto_merge`; - `incomplete`: set when the head has more than 100 checks. - `not_reported` means that no required check has reported yet. The field description says that this does not mean that none are required. Checks that are not required are not listed. - The approval guidance (`MERGE_STATE_CHECK`) now uses the tool. It still runs `gh api .../rules/branches/BASE` to name the rule that blocks a merge. - The draft guidance in #3250 still uses `gh pr checks --required`. It moves to the tool after both PRs merge. - The eval fixture for #691 now has the new GraphQL fields. ## Tests `get-pull-request.test.ts`: - Required checks are passing, failing or pending. Checks that are not required are not listed. `merge_state`, `review_decision`, `auto_merge` and `incomplete` come from GitHub. - A head with no checks, or with only checks that are not required, returns `not_reported`. - The existing case now also expects the GraphQL read. Each new test fails without the change. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Afad6cc3124dd71a9d52b41fcec4308c6 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Afad6cc3124dd71a9d52b41fcec4308c6) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Afad6cc3124dd71a9d52b41fcec4308c6/?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]>
BYK
added a commit
that referenced
this pull request
Nov 12, 2026
## Problem #3235 adds `author_id` and `author_name` to `<current-instruction>` on web Turns. The history fixture still writes a bare `<current-instruction>` for web inputs. So `history.eval.ts` › "matches the rows of a real web turn" fails at row 2: the real row has the author, and the loaded row does not. It failed twice on #3250 (`integration / shard 2/2`). ## Fix `historyUserMessage` now passes `instructionActorFor(actor)` to `renderCurrentInstruction` for web inputs, the same as the web Turn path. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Afad6cc3124dd71a9d52b41fcec4308c6 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Afad6cc3124dd71a9d52b41fcec4308c6) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Afad6cc3124dd71a9d52b41fcec4308c6/?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]>
BYK
approved these changes
Nov 12, 2026
…equester-review Co-Authored-By: BYK <[email protected]>
BYK
pushed a commit
that referenced
this pull request
Nov 12, 2026
## Problem The draft guidance from #3250 runs `gh pr checks --required` and reads its text output. #3254 added a `checks` field to `github_getPullRequest`, and the approval guidance already uses it. ## Fix - The `pull_request.checks.recovered` guidance for a draft calls `github_getPullRequest` and reads `checks.required`. - `passing` with no open decision: mark it ready and report. - `failing`: fix it like a failed check. - `not_reported`: the checks may not have started yet. This does not mean that none are required. - Otherwise: stay silent. - The draft eval fixture now returns `mergeStateStatus`, `reviewDecision` and `autoMergeRequest`, so the `PullRequestChecks` query works for #692, #693 and #694. ## Tests No test asserted the old `gh pr checks` text. The draft evals in `subscriptions.eval.ts` cover the behavior. GitHub plugin tests 371/371, eval harness tests, typecheck, lint and file-length pass. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Afad6cc3124dd71a9d52b41fcec4308c6 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Afad6cc3124dd71a9d52b41fcec4308c6) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Afad6cc3124dd71a9d52b41fcec4308c6/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
23 tasks done
This was referenced Nov 13, 2026
BYK
added a commit
that referenced
this pull request
Nov 13, 2026
….md (#3380) **Why:** since #3250, Junior marks its draft ready once the required checks pass. Two problems: marking a draft ready makes GitHub ask the CODEOWNERS owners to review, so teammates get pinged before the requester has looked. And a repo's `AGENTS.md` can say PRs stay drafts (sentry-javascript: "Always open PRs as draft"), which the auto-ready ignored. Replaces #3350. **What:** - For a draft, `github_getPullRequest` now returns: - `code_owners`: owners of the changed files, read from the base branch's CODEOWNERS file (`.github/`, the root, then `docs/`). It's matched deterministically with the `ignore` package, since CODEOWNERS uses gitignore patterns. The last matching rule wins, and a rule with no owners clears them. If a CODEOWNERS file exists but GitHub doesn't list the changed files, the call fails so the draft stays a draft. - `agents_md`: the root `AGENTS.md` of the base branch. - Both come from one GraphQL query. - After checks pass, Junior marks the draft ready only if the requester said to, or if `code_owners` is empty and `AGENTS.md` doesn't ask for drafts. Otherwise it stays a draft, and Junior tells the requester in the thread that the checks pass and it's waiting for their review, with the reason. - `github-code`: open PRs as drafts unless the requester asks for a ready PR, so the code-owner check above always runs before anyone gets asked. **Known gap:** GitHub matches `docs/*` only to files directly in `docs/`, but gitignore also matches files deeper down. So this can list too many owners, never too few. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC07P2KGJGG0%3A1794567005.164999 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC07P2KGJGG0%3A1794567005.164999) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC07P2KGJGG0%3A1794567005.164999/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Burak Yigit Kaya <[email protected]>
dcramer
added a commit
that referenced
this pull request
Nov 17, 2026
… desk (#3521) Generated docs and openspec grow with each change and stop stating intent. This adds one short design doc per major system. Each doc keeps what code and tests cannot show: the goals the system must meet, where users reach it, the rules they rely on, and the gaps where the product does not meet them yet. ## Change - **`design/`**: `README.md` owns the file contract. Each file has an H1 and one paragraph, then `Intent`, `Entry points`, `Rules`, and, where needed, `Gaps`. There are no behavior lists. The verification map in `.agents/skills/verify-junior/` (in progress in a separate PR) owns behavior as claims with proofs, and a design doc cites a claim only by ID (`automations#run-now`). - **Seeds**: `automations.md`, `github.md`, and `review-desk.md` (the dashboard labels it "Inbox"). Their goals come from the stated intent in #1717, #2052, #2401, #2488, #813, #3250, #3380, and #3469, from maintainer review on this PR, and from an adversarial review against `main`. - **Policy**: `policies/documentation.md` allows intent docs in `design/`. `AGENTS.md` links to `design/`. The skills that write and audit these docs live in getsentry/junior-prod (`create-design-docs`, `maintain-design-docs`, from getsentry/junior-prod#722). A daily Automation in #proj-junior runs the audit once this merges. ## Intent decisions - **Automations**: runs act as Junior with no person present. A Schedule means "at this time, do this work", with reasoning and tools; a fixed message that skips the work is not a goal. Junior records every failure and block and shows it to the creator as a Review item or another notice, never as a post to the Destination. Gaps: creator credentials (the goal is to remove them), failed runs that tell the creator nothing, and the automated-turn pause notice that posts to the Destination. - **GitHub**: changes reach the code only through a PR. For now, Junior never approves or merges; later policies can let it merge some PRs. The requester is the first reviewer unless they name reviewers or ask for a ready PR. Gap: a leftover path can upload a file with the requester's account. - **Review desk**: every item has at least one assignee, and only an assignee answers. When no assignee is left, the item dismisses itself. A notice tells a person something they must know or fix, and never asks. Only the Conversation or plugin that added an item can change it. Gaps: items with no assignees; cross-Conversation edits and reassignment of public items; "Needs you" rows for Conversations that wait for a sign-in. ## Open intent questions - **Workflows Junior triggers**: Junior can dispatch workflows and add labels, and a label can make a workflow push to the default branch (for example a fast revert). Do those count against "changes reach the code only through a PR"? - **What a Turn can read**: today the App's access decides what Junior reads, so anyone who talks to Junior can have it read any repo where the App is installed. Is that the intent, or should reads be limited to the requester's access? - **Edits by someone other than the creator**: anyone can rewrite a public Automation, but its DMs and Review items still go to the creator. Should such an edit tell the creator, or move those to the editor? - **Providers for Junior-only runs**: Sentry, Linear, and Notion writes, plus Hex, Cloudflare, and Wiz, have no Junior access today. The real Automation list still has to show which of these matter. ## Notes - A likely drift in public docs: `packages/docs/.../concepts/automations.md` says completed reminders stay under **Mine**, but the dashboard has no Mine tab. This PR does not change it. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0CHB3YHES2%3A1794853898.594459 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CHB3YHES2%3A1794853898.594459) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CHB3YHES2%3A1794853898.594459/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
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]>
BYK
added a commit
that referenced
this pull request
Nov 25, 2026
…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]>
This branch was successfully deployed
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.

Problem
Junior assigns its pull requests to the requester. It does not ask them for a review. So the "Review requested" ask never starts, and the Inbox shows no pull requests to review.
Junior also leaves its drafts as drafts. It fixes a draft when CI fails. Nothing wakes Junior when CI passes, so the draft stays a draft.
Fix
Review requests
github_createPullRequestgets an optionalreviewersinput (GitHub logins). The model uses it only when the person names who should review.reviewers, Junior asks the requester's linked GitHub account to review. This is the same login that it assigns. Withreviewers, Junior asks those people, and the requester stays the assignee.ready_for_reviewfor a Junior pull request, Junior asks the same people. Named reviewers of a draft go in plugin state for 14 days. The requester comes from the opener store. There is no DB migration./pulls/{n}/requested_reviewers.Drafts
pull_request.checks.recovered, with guidance. When every required check passes and no decision is open, Junior marks the draft ready and says so in the originating thread. When a required check fails, Junior fixes it. Otherwise it stays silent. Marking it ready starts the review request.isDraftmatch field, because a Watch match filters every event of the Watch.github-codeSKILL.md and SPEC.md: name each open decision of a draft in its PR body.Limits
ready_for_reviewasks again. GitHub ignores a request that already exists.Tests
github-plugin.test.ts:pull-request-review-request.test.ts:ready_for_review, and then the requester or the named reviewers get it;coding/subscriptions.eval.ts, with new draft fixtures:Each new test fails without the change. I did not run the evals locally, because this sandbox has no model credentials.
via @BYK.
--
View Session [Sentry]