Skip to content

[Bug]: After the merge queue merges only the bottom of a stack, the lowest open PR keeps the merged PR's branch as its base #601

Open

Description

@niyaznigmatullin

Describe the bug

The merge queue merged the bottom four PRs of a stack and removed the fifth after its checks failed.
The fifth PR, now the lowest open one, was neither retargeted to the trunk nor rebased. It still
targets the fourth PR's head branch, still carries the fourth PR's original commits, and conflicts
with the trunk. Enqueueing it again fails with merge_conflict.

Unlike #581, PR 5's branch contains PR 4's final head commit.

Affected command

None: the merge queue on github.com (the stack was enqueued from the web UI)

gh-stack version

gh stack version 0.2.0 at the time of the merge (now 0.3.0)

GitHub CLI version

gh version 2.102.1 (2026-10-20)

Operating system

macOS 26.7.1

Shell

fish

Steps to reproduce

  1. Repository: merge queue required on main, squash merges, Automatically delete head branches off.
  2. A stack of 10 PRs on main. PR 5's branch contains PR 4's head commit.
  3. From the web UI, enqueue PRs 1–7 of the stack together.
  4. PR 5's merge group, built on PR 4's squash commit, fails a required check (one flaky test).
  5. The queue removes PR 5 (failed_checks) and merges PRs 1–4. PRs 6 and 7 leave the queue unmerged.
  6. Inspect PR 5, then enqueue it again.

Expected behavior

PR 5 becomes the bottom of the stack on main: it is retargeted to main and rebased onto
the squash commits of PRs 1–4, as happens after a partial merge with Merge stack in the web UI (see #585).

Actual behavior

PR 5 after PRs 1–4 merged Expected Actual
Base branch main PR 4's head branch
Base-change event in timeline automatic_base_change_succeeded none
Head branch rebased onto PR 4's squash commit unchanged, still holds PRs 1–4's original commits
Trial merge into main clean conflicts in 3 files
Enqueued again merge group created removed after 16 s, reason merge_conflict

Replaying only PR 5's own commits onto main applies cleanly.

Terminal output

Merge-queue events on PR 5 (GraphQL timelineItems):

2026-10-27T19:25:09Z  AddedToMergeQueueEvent
2026-10-27T19:44:20Z  RemovedFromMergeQueueEvent  reason: failed_checks
2026-10-27T20:04:17Z  AddedToMergeQueueEvent
2026-10-27T20:04:33Z  RemovedFromMergeQueueEvent  reason: merge_conflict

PRs 1–4: merged at 2026-10-27T19:44:20Z.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions