Skip to content

fix(github): Ask for a review again only when every comment of the change request is marked - #3958

Open
sentry-junior[bot] wants to merge 5 commits into
mainfrom
fix/github-review-ask-explicit
Open

sentry-junior[bot] wants to merge 5 commits into
mainfrom
fix/github-review-ask-explicit

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

After a requester asks for changes on a Junior PR, Junior asked them to review again before the PR was ready. On #3941 this happened four times while work on the feedback was still going: right after a merge of main, 40 s after a review of an older head, and after a fix plus a main merge.

There were two causes:

  • Webhook inference. reviewAgainReason and nextAction in pull-request-action.ts counted any Junior push or App comment after the change request as "Junior acted last". That included base-branch merges. The "new commits with no later requester activity" clause also fired when the requester had reviewed an older head.
  • Feedback tool. updatePullRequestFeedback asked again as soon as the review body was marked addressed, even while other inline comments of the same change request were still open.

New rule

Only an explicit signal asks again. Junior must mark every comment of the reviewer's latest change request (the body and each inline comment) addressed or declined with updatePullRequestFeedback. The head commit's required checks must also pass.

  • pull-request-review-again.ts is new, and the tool and the webhook share it. It reads three things: the reviewer's latest review with Junior's reactions on its body and comments, the head checks, and the base branch's required checks (branch protection refUpdateRule plus ruleset required_status_checks). A required check that has not reported yet counts as pending.
  • Tool: when the last comment is marked and the checks pass, the tool asks on GitHub. When the checks have not passed yet, it stores a held ask in plugin state. GitHub sends no webhook for reactions, so the tool must start the ask.
  • Webhook: each sync checks a held ask again, for example when a check suite completes. Once it is ready, Junior asks on GitHub and shows the "Review requested" item. Pending or failing checks keep the hold. The hold is dropped when the reviewer comments or reviews after it, when the PR ends, or when the change request is no longer fully marked.
  • Pushes, base-branch syncs, App comments and replies no longer ask. The webhook still follows a review that GitHub requests and merge readiness, and it closes the item when the requester acts.
  • The event guidance now tells the agent to mark feedback after it answers a question too. That keeps the feat(cli): Stream logs with sentry log tail so -f always means --fresh toolkit#2442 flow working: answer, mark the review body addressed, ask again.

Other changes

  • The item text says what caused the ask:

    • "Every comment on your change request is handled." when the last mark finds the checks already passing.
    • "Checks now pass, and every comment is handled." when passing checks release a held ask.
    • "GitHub asks you to review #N." is the fallback, for example when GitHub itself requests the review.

    The tool saves a short-lived record in plugin state, so the review request webhook can pick the text. The "has new commits" and "has a reply since you requested changes" texts are removed.

  • Removed dead code: push activity, review commit oids, changesRequestedAt, headSha on the merge state, and pull-request-reviews.ts. checkContextState moved out of get-pull-request.ts, so both readers share it.

  • design/github.md states the new rule and removes the closed Gap about asking again before the required checks pass.

Known limits

  • Only check_suite webhooks release a held ask. If a required commit status reports after the last check suite, the ask waits for the next sync event.
  • The webhook reads with a token scoped to checks, contents, metadata and pull_requests, so it may not see status contexts that need the Commit statuses permission. Check runs are not affected.

via @BYK.

--

View Session [Sentry]

…ange request is marked

After the requester requests changes on a Junior pull request, Junior
asked for their review again whenever it acted after them: any push,
including a merge of the base branch, any App comment or reply, and a
commit that predated a review on an older head. The feedback tool also
asked as soon as the review body was marked addressed, while inline
comments of the same change request were still open.

Now only an explicit signal asks again. The feedback tool asks the
author of a change request when every comment of their latest change
request (its body and each inline comment) is marked addressed or
declined, and the required checks of the head commit pass. When the
checks have not passed yet, it holds the ask, and the next webhook,
such as a completed check suite, asks once they pass. A comment or
review by the reviewer after the hold drops it. Failing checks do not
ask.

The next-action webhook no longer infers an ask from pushes, base-branch
syncs, App comments, or replies. It still follows the review that GitHub
requests, merge readiness, and closes the item when the requester acts.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@sentry-junior
sentry-junior Bot requested a review from BYK November 21, 2026 19:31
@vercel

vercel Bot commented Nov 21, 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 21, 2026 8:00pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 21, 2026
…-explicit

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

# Conflicts:
#	packages/junior-github/src/webhooks/pull-request-action.ts

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can also check our "local" state if an agent, task, or subagent is already working on the same PR? This would cut down on the GitHub API request and processing all the comments etc. right?

When the feedback tool asks the requester again, the item says that every
comment on their change request is handled. When passing checks release a
held ask, it says that the checks now pass. Other review requests from
GitHub keep the general text.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@sentry-junior

sentry-junior Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

@BYK It would cut a bit, but not much. In this PR, the GitHub reads for re-asking only happen in two places:

  • The feedback tool does one GraphQL read plus one rules read each time it marks a comment.
  • The webhook does a readiness read only when a held ask exists. Other webhooks keep the same merge-state read they already did on main.

A local "an agent is still working on this PR" check makes more sense as an extra guard than as a way to save API calls. It covers a gap this PR leaves open: the agent marks the last comment, then keeps pushing in the same Turn. It needs a provider-neutral core contract, though, because the plugin can't see Turns or child agents today. So I'd keep it out of this PR and do it as a follow-up. Want me to open the issue?

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

6 screenshot changes — 6 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automations Runs Filters · Desktop
Automations Runs Filters · Desktop
Changed
Conversation Event Log Virtual · Mobile
Conversation Event Log Virtual · Mobile
Changed
Conversations Pinned · Desktop
Conversations Pinned · Desktop
Changed
Conversations Pinned Light · Desktop
Conversations Pinned Light · Desktop
Changed
Inbox Palette Pages · Desktop
Inbox Palette Pages · Desktop
Changed

@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.

…equest

The feedback tool counts the comment it just marked as marked, because
GitHub's GraphQL read can lag behind a new reaction. A "none" read no
longer drops a held ask; each webhook checks the hold again.

When GitHub rejects the review request, the tool holds the ask, and the
webhook keeps a hold until GitHub takes its request, so a later webhook
asks again.

@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 and found 1 potential issue.

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 d20f801. Configure here.

A held ask now saves the comment whose mark made it, and the webhook
counts that comment as marked, so a GraphQL read that still lags does not
drop the hold.

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 96460818 Deployed Nov 21, 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