Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Partial merge leaves stale stack base and Rebase stack replays merged commits

Open
#485 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
git, github, go
Domain
api, cli

Research direction

Start by tracing the merge-queue admission and Rebase stack paths, focusing on how the Stack object's base SHA is updated after a partial merge. Reproduce the eight-PR scenario and inspect the reported base ref and SHA before and after Rebase stack. Done means the remaining stack targets the current main commit, admits a verified suffix, and does not replay merged commits.

Written by the indexing model from the issue text.

Description

Reproduction

  1. Create a stack with a merge queue on main.
  2. Merge a bottom prefix of the stack, leaving eight pull requests open.
  3. Rebase the eight remaining branches locally onto the current main, then force-push them as one atomic ref update.
  4. Verify that the lowest open branch is one commit ahead of main, zero commits behind, and that every higher branch contains the branch below it.
  5. Verify that every open pull request is approved and has passing required checks.
  6. Enqueue the remaining stack from its top pull request.

All eight pull requests entered the queue within one second. Eighteen seconds later, the lowest open pull request was removed with:

github-merge-queue removed this pull request from the merge queue due to invalid changes in the merge commit

Every higher pull request was then removed because an earlier pull request in the stack was removed. No merge_group workflow was created.

The stack merge box reported that the stack was out of date with main. The pull request API reported stack.base.ref = main, but stack.base.sha still identified the last layer of the already-merged prefix rather than the current main commit.

  1. Click Rebase stack in the GitHub UI.

The UI reported that all eight branches were rebased and that the stack had a linear history. The actual lowest branch changed from one commit ahead and zero behind to 16 commits ahead and 15 behind. Commits already present on main reappeared in the pull request.

Expected

After a partial stack merge, GitHub updates the remaining stack's base to the current main commit and retargets the lowest open pull request to main, as described in Merging stacked pull requests.

A locally verified linear suffix based on current main should enter the merge queue. Rebase stack must use the current base commit and must not replay commits that already landed.

Actual

The remaining stack retains a stale base SHA after the partial merge. Merge-queue admission rejects a correct branch graph before creating a merge group. Rebase stack then rewrites the branches against the stale anchor and reintroduces already-merged commits.

Recovery requires restoring every branch ref, removing the stale Stack object, retargeting the lowest open pull request to main, and linking the same pull requests into a new stack.

Environment

  • GitHub Stacked Pull Requests public preview.
  • GitHub merge queue.
  • Original stack: 26 pull requests, with 18 merged and eight open.
  • All open pull requests approved and required checks passing.
  • gh stack v0.1.0.
  • gh 2.96.0.
  • git 2.50.1.
  • macOS arm64.

Related

  • #174 concerns approval invalidation after a partial merge. Approvals remained valid in this reproduction.
  • #444 concerns a pull request being closed at a merge-group boundary. The remaining pull requests stayed open in this reproduction, but the stack base remained stale.
Dominant language
Go
Stars
1.5k
Forks
73
Avg merge
1d 8h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/gh-stack

All issues in github/gh-stack

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.