Skip to content

fix(source-control): gh pr merge arms auto-merge instead of queueing when merge state is UNKNOWN #6953

Closed as duplicate

Description

@kyle-sexton

Problem

On a branch protected by a merge queue, gh pr merge run while GitHub still reports mergeStateStatus: UNKNOWN (just after a push or a ready flip) enables auto-merge instead of adding the PR to the merge queue. Nothing lands until the state settles and auto-merge fires, and a caller that assumes "queued" reports the wrong thing.

Observed

While landing the Claude Code v2.1.265..v2.1.296 changelog PRs, several merges turned into armed auto-merge; landing workers had to disarm and requeue them.

Expected

The PR-landing steps (/source-control:pull-request landing and any merge helper) wait until mergeStateStatus is known before calling gh pr merge, and then confirm the result (queued vs auto-merge armed) instead of assuming it.

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 11, 2026
  2. github-actions commented on Oct 11, 2026

    @github-actions
    Contributor

    Thanks for the report. Understood: gh pr merge called while mergeStateStatus is still UNKNOWN (right after a push or a ready flip) arms auto-merge instead of adding the PR to the merge queue, and this was observed repeatedly while landing the v2.1.265..v2.1.296 changelog PRs, requiring manual disarm/requeue. The ask is for the merge step to wait until mergeStateStatus settles before calling gh pr merge, and then confirm whether the PR was queued or auto-merge was armed rather than assuming.

    This looks related to #6630 (confirming the PR actually entered the merge queue after merge) and the now-closed #5953 (babysit --auto misreporting auto-merge as queued), but addresses a distinct root cause: the race against an unsettled mergeStateStatus rather than post-merge reporting. Worth checking those for overlap when scoping the fix.

    The report is otherwise complete — no missing information needed from my side.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Oct 12, 2026
  4. added theissue type on Oct 12, 2026
  5. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    ContributorAuthor

    Decision recorded. The owner approved going with independently verified recommendations on 2026-10-13. Two researchers worked this issue separately (code and history; upstream docs and owner intent), and a judge reconciled them.

    Recommendation: Rebase #7075 onto main and add a pre-merge settle step to it: poll mergeStateStatus at the pinned head while it reads UNKNOWN, and merge only on CLEAN. Apply the step on both 4.2 and 4.2.1. Keep the 4.2.2 post-merge confirmation. Then close #6953 as a duplicate of #6630 when #7075 merges.

    Where sources disagreed, decided by: Rule 4 (current gh CLI manual: auto-merge is armed whenever required checks have not passed) over rule 5 (the record's 'close now, covered by #6678/#7075').

    Admission to an agent lane stays with the work-class rules and owner ratification.

    This was generated by AI.

  6. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    ContributorAuthor

    Closing as a duplicate of #6630. #7075 merged and added the pre-merge step: before any merge call on a merge-queue base, it polls mergeStateStatus at the pinned head while it reads UNKNOWN, and merges or enqueues only on CLEAN. That covers this issue's race.

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

    priority: mediumReal value, no hard deadline; normal backlog flow.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions