Can't merge the stack: either stuck while merging via GitHub UI, or getting false-negative error via CLI
See the stack up to https://github.com/react/react/pull/37498. All PRs were approved.
When I've attempted to merge it via UI, the merging was just stuck and never finished. When attempted to merge via CLI, always received this error:
gh stack merge 37498 --yes --squash
Merging #37503, #37500, #37498 into main via squash...
✗ merge failed: protected branch 'main' check failed:
Waiting on 1 reapproval from someone other than the last pusher. Review from eps1lon is stale because it was submitted before the merge base changed.
Stack merges are atomic, so nothing was merged
This is incorrect, because merge based didn't change after the approval.
I was able to merge the bottom PR of the stack, but this extremely painful, because after that the base actually changes, and now I need to get re-approval from the reviewers. Please, could you finally fix the stacks?
Same failure on v0.1.1, 4-PR stack into a protected trunk. Isolated to two pull_request ruleset params.
All four PRs approved, CLEAN, APPROVED, each approval submitted after that PR's last force-push (verified via the timeline API). Panel shows all four "Ready".
Changing one param at a time on the trunk's rulesets:
require_last_push_approval: false→ error changes toAt least 1 approving review is required. So the evaluation sees zero valid approvals, not stale ones.- also
dismiss_stale_reviews_on_push: false→ merges cleanly, all four.
Looks like the atomic merge evaluates each PR against the merge base it will have after the ones below it squash — a base that doesn't exist when reviewers approve, so no approval can predate it. If so, no trunk with either param enabled can merge a stack of 2+, and the "Ready" badges never show it because they're computed per PR against its own base (for upper PRs, an unprotected feature branch).
Another data point on v0.1.1 — corroborates the two-parameter analysis above.
Private repo, 2-PR stack into a protected trunk. Both PRs MERGEABLE / CLEAN / APPROVED, all required checks green, zero unresolved threads.
gh stack merge <top> --squash --yes
Merging #<bottom>, #<top> into <trunk> via squash...
✗ merge failed: Repository rule violations found
Waiting on 1 reapproval from someone other than the last pusher. 4 reviews
are stale because they were submitted before the merge base changed.
Stack merges are atomic, so nothing was merged.
Trunk ruleset (pull_request rule):
require_last_push_approval: true
dismiss_stale_reviews_on_push: true
required_approving_review_count: 2
required_review_thread_resolution: true
Two observations that I think support the "evaluated against a base that doesn't exist yet" theory:
-
The stale count equals the number of distinct approvers on the top PR (4), and every one of those approvals was submitted after that PR's last force-push — verified through the timeline API, comparing each
submitted_atagainst the lasthead_ref_force_pushedevent. So there is no reading of "stale" under which those four qualify, relative to any base that currently exists. -
Collecting a genuinely fresh approval changed nothing. The whole stack had been rebased earlier in the day, which did legitimately stale the bottom PR's approvals. I got a new approval on it afterwards, from someone other than the last pusher — the bottom PR's own gate cleared (
mergeStateStatus: CLEAN), and the stack merge failed with the identical message and the identical count of 4. The error's wording points at the exact condition that had just been satisfied.
I can't run the toggle experiment from the comment above — no admin on the repo — but the configuration matches, and with required_approving_review_count: 2 the bottom-up fallback is expensive: merging the bottom PR retargets the top one, dismiss_stale_reviews_on_push voids its four approvals, and it needs two fresh ones.