gh-stack icon indicating copy to clipboard operation
gh-stack copied to clipboard

Can't merge a stacked PR with no clear reason (all PRs show mergeable)

Open mr04vv opened this issue 4 months ago • 44 comments

Environment

  • develop branch are protected by a repository ruleset with:
    • require_last_push_approval: true
    • dismiss_stale_reviews_on_push: true
    • required status checks
    • No merge queue.

Reproduction

  1. Create a 3-level stack: develop <- A <- B <- C.
  2. Approve every PR after its latest push. All three show MERGEABLE / CLEAN / APPROVED, all checks green.
  3. On the top PR (C), the native GitHub "Merge stack (3)" box shows "Able to merge as a stack". Click it (merge method: Create a merge commit) and confirm.

Expected

All three PRs merge into develop, or the operation stops before anything merges.

Actual

  • UI shows "Merging stack… / 3 pull requests are being merged" briefly, then rolls back to "Able to merge as a stack". Nothing merges.
  • The PR event log records repeated auto-merge was automatically disabled — "Pull Request is not mergeable".

(In the image, the bottom PR has been merged, but the behavior remains the same even if it is not merged.) Image Image Image

Notes

  • Root cause not confirmed — the above are observed events only. One hypothesis is that merging the bottom PR moves the merge-base of the PR above it, invalidating its latest-push approval, but this has not been verified.
  • Reproduces without a merge queue, which differs from #174 (scoped to merge-queue branches, describes a hang rather than a rollback). Filing separately because the trigger and symptom differ; feel free to consolidate into #174 if preferred.

mr04vv avatar Jul 27 '26 06:07 mr04vv

@ValentinRLL You basically have two options:

  1. You can use merge queues, which support keeping Dismiss stale pull request approvals while merging an entire stack
  2. You accept you must merge the PRs one by one

GitHub has only acknowledged the issue by attaching the "bug" label to this issue. You can see a stacked PRs PM added a label to the issue. I have raised the issue to GitHub, but didn't receive an acknowledgement.

I believe all this confusion can be solved by adding a tooltip saying what I said above ^^^ even if they don't actually fix the issue.

Also recapping earlier comments:

  • turning off Dismiss stale pull request approvals is not an option for the majority of companies for compliance reasons

joyhchen avatar Oct 01 '26 18:10 joyhchen

Merge queues do not support keeping Dismiss stale pull request approvals. See https://github.com/github/gh-stack/issues/174.

josh-acay avatar Oct 01 '26 21:10 josh-acay

Hmm, it worked in our repos and there are other reports of merge queues supporting it with Dismiss stale pull request approvals. It sounds like there is some other setting impacting this. LIke maybe there is something in other folks' CI config. In any case, merging the entire stack works inconsistently.

joyhchen avatar Oct 01 '26 22:10 joyhchen

We changed the setting for "Dismiss stale pull request approvals" to keep working with gh-stack.

itdhsc avatar Oct 28 '26 15:10 itdhsc