Skip to content

Feature: gh pr merge remove from merge queue #14593

Open

Description

@A4-Tacks

Describe the feature or problem you’d like to solve

Add a option --remove-from-queue for gh pr merge, remove pr from merge queue

Proposed solution

How will it benefit CLI and its users?

I use gh pr merge --disable-auto, but pr added to merge queue, I needs open web

And if pr added to merge queue, gh pr merge --disable-auto use code 0 exit, I think should exit by 1 code

Additional context

Add any other context like screenshots or mockups are helpful, if applicable.

Activity

  1. added
    needs-triage
    on Oct 4, 2026
  2. cli-triage commented on Oct 4, 2026

    @cli-triage

    Thanks for the report! I'm suggesting enhancement and gh-pr, since this is a request for new functionality on gh pr merge rather than a confirmed bug.

    Looking at the current code, --disable-auto calls disableAutoMerge, which only invokes the disablePullRequestAutoMerge GraphQL mutation. That mutation disables auto-merge but has no effect on merge-queue membership, which is governed separately (see shouldAddToMergeQueue and the enqueuePullRequest-based flow in merge()). This matches the reporter's observation that --disable-auto doesn't remove a PR already in the queue, and explains why a --remove-from-queue-style option (likely needing a new dequeuePullRequest mutation call) isn't currently exposed. I did not find an existing issue specifically requesting this capability, so I'm not flagging it as a duplicate. On the separate point about exit codes, I'd treat that as part of the same feature discussion rather than a distinct bug, since --disable-auto is documented/intended to act on auto-merge only, not merge-queue status — a maintainer should confirm the intended semantics before deciding on exit-code behavior.

    Generated by Issue Triage (skills-driven) for #14593 · copilot · auto · 42.4 AIC · ⌖ 1.67 AIC · ⊞ 10.9K · ◷

  3. nightingale-develop commented on Oct 4, 2026

    @nightingale-develop

    Hi @A4-Tacks ! I'd like to work on this if the proposed direction is acceptable. Could you please assign this issue to me?

  4. A4-Tacks commented on Oct 4, 2026

    @A4-Tacks
    ContributorAuthor

    I have no objection.
    I don't have the permissions to assign

  5. babakks commented on Oct 5, 2026

    @babakks
    Member

    Thanks for the suggestion, @A4-Tacks! 🍻 And thanks for your interest in contributing, @nightingale-develop! 🙏

    I do not think this should expand the behavior of --disable-auto for several reasons:

    1. Automatic merge and merge queue membership are separate states backed by separate mutations.
    2. Before a pull request enters the queue, --disable-auto cancels the pending transition into the queue and leaves the pull request open. After the pull request has entered the queue, that transition is complete and the queue controls what happens next.
    3. A pull request can be added directly to the queue through the web interface, the API, or another integration without auto merge being involved. Using --disable-auto to remove such an entry would not match how it was created.
    4. Making --disable-auto also remove an active queue entry could unexpectedly cancel a merge when the user only intended to disable auto merge.
    5. Successfully disabling auto merge should continue to exit with status 0 even when the pull request remains queued. Changing that established exit status would risk breaking scripts that rely on the current behavior.

    However, I agree that adding a --dequeue option to gh pr merge makes sense. --dequeue matches the GraphQL API terminology and clearly describes the operation. The usual pull request resolution should remain unchanged, including selecting the pull request associated with the current branch when no argument is provided. --dequeue should be a narrowly isolated action. It should not be combined with --auto, --disable-auto, --admin, a merge strategy, or any other option that controls how a pull request is merged. If another merge option is provided alongside --dequeue, the command should reject the combination rather than attempt to infer the user's intent.

    The --dequeue operation should follow the API result:

    1. Exit with status 0 only when the mutation successfully removes a pull request from the queue.
    2. If the branch has no merge queue, surface the API error and exit with status 1.
    3. If the pull request is not queued or was already dequeued, surface the API error and exit with status 1.

    We confirmed that the API returns an UNPROCESSABLE error both when no merge queue exists and when the pull request has no queue entry. The exact messages differ, but the CLI should not inspect error text to reinterpret either response as success.

    The CLI could technically query the queue state before attempting the mutation, but that would introduce an additional request and a race between checking and removing the entry. I think the clearest contract is that success means the dequeue mutation was effective, while an API rejection remains a failure.

    For triage, I am marking this as an enhancement a request to improve CLI and will also add the core This issue is not accepting PRs from outside contributors because we are not yet ready to accept contributions for this and the team needs to discuss the design further.

  6. added
    enhancement
    core
    gh-pr
    on Oct 5, 2026
  7. github-actions commented on Oct 5, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  8. removed
    needs-triage
    on Oct 5, 2026
  9. nightingale-develop commented on Oct 5, 2026

    @nightingale-develop

    @babakks Thank you for a reply. I will wait until the design discussion is complete and I will be glad to help if needed

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

    coreenhancementgh-prstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions