Skip to content

fix(github): Give stacked and queued PRs no merge ask - #4589

Merged
BYK merged 3 commits into
mainfrom
fix/stacked-pr-merge-ask
Nov 27, 2026
Merged

BYK merged 3 commits into
mainfrom
fix/stacked-pr-merge-ask

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Junior gave the requester a "Ready to merge" ask in two cases where no person needs to merge yet.

Stacked PRs. GitHub's mergeStateStatus checks a PR only against its base branch. A PR whose base is the head branch of another open PR reads CLEAN as soon as its own checks and reviews pass. getsentry/toolkit#2520 is an example: its base feat/cli-wizard-scaffold is the head of getsentry/toolkit#2519, which is still a draft.

  • The next-action query also reads baseRefName, baseRef.associatedPullRequests(states: OPEN).totalCount, and the repo's default branch. When the base branch is not the default branch and another open PR has it as its head, baseOpen is set and nextAction gives no merge ask. A review ask still comes. A PR from the default branch, such as a sync into a long-lived branch, does not count.
  • An open merge ask closes with "It merges after the pull request below it."
  • pull_request.edited syncs the action again, but only when changes.base is set. After the base merges, GitHub retargets the PR, and that edit makes the merge ask show.
  • design/github.md states the rule in its own commit.

If the base branch is kept after it merges, GitHub does not retarget the PR above it, and this PR does not handle that case. Junior stores no base branch for its open PRs, so handling the base PR's closed event would need a GitHub read for each merged PR.

PRs in the merge queue. GitHub merges a queued PR, but the read did not check the queue, and no queue webhook synced the action, so the merge ask stayed after the requester queued it.

  • The same query reads isInMergeQueue. A queued PR gets no merge ask, and it is not in limbo, so Junior does not ask for the requester's review either.
  • An open merge ask closes as done with "It is in the merge queue."
  • pull_request.enqueued and dequeued sync the action again. When a PR leaves the queue without merging, the normal rules decide again, so the merge ask can come back.

All of this stays in the one PullRequestNextAction read, with no new request.

Coordination: #4395 generates nextAction from a decision table that must match main. It needs matching baseOpen and inMergeQueue inputs that block merge.

via @BYK.

--

View Session [Sentry]

GitHub's merge state checks a pull request only against its base branch,
so a PR whose base is the head of another open PR read as clean and got a
merge ask. The next-action read now checks for an open PR on the base
branch, and a base change (GitHub's retarget after the base merges) syncs
the action again.

Co-Authored-By: BYK <[email protected]>
@vercel

vercel Bot commented Nov 27, 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 27, 2026 11:50am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Conversation Link Opens Around Event · Mobile
Conversation Link Opens Around Event · Mobile
Changed
Conversation Quick Question Answered · Mobile
Conversation Quick Question Answered · Mobile
Changed
Inbox Item Related Card · Mobile
Inbox Item Related Card · Mobile
Changed
Inbox Item Related Card Light · Mobile
Inbox Item Related Card Light · Mobile
Changed
Inbox Snooze Named Resource · Mobile
Inbox Snooze Named Resource · Mobile
Changed
Inbox Snooze Named Resource Light · Mobile
Inbox Snooze Named Resource Light · Mobile
Changed

@sentry-junior
sentry-junior Bot requested a review from BYK November 27, 2026 11:41
GitHub merges a queued pull request, but the next-action read did not
check the queue and no queue webhook synced the action, so the merge ask
stayed after the requester queued it. The read now includes
isInMergeQueue, and enqueued and dequeued sync the action again.

Co-Authored-By: BYK <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(github): Ask to merge a stacked PR only after the PR below it merges fix(github): Give stacked and queued PRs no merge ask Nov 27, 2026
@sentry-junior
sentry-junior Bot marked this pull request as ready for review November 27, 2026 12:00
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 27, 2026

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

Coordination: #4395 generates nextAction from a decision table that must match main. It needs matching baseOpen and inMergeQueue inputs that block merge.

Can yo make this happen?

@BYK
BYK added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 23e6fd3 Nov 27, 2026
58 checks passed
@BYK
BYK deleted the fix/stacked-pr-merge-ask branch November 27, 2026 12:53

This branch was successfully deployed

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