Skip to content

[Bug]: PR Merge fails when a merge queue is required and auto-merge is disabled #36184

Closed as not planned

Description

@leozitor

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Use a GitHub repository with Allow auto-merge disabled and a merge queue required on the target branch.
  2. Open a PR against that branch and let all required checks and reviews pass.
  3. Open the PR in T3 Code and click Merge.

This happened in a private organization repository that allows squash merges only.

Expected behavior

T3 adds the PR to the merge queue, as GitHub's web UI does, without requiring repository auto-merge to be enabled.

Actual behavior

The Merge action fails.

In the current code, runPullRequestAction routes a merge through EnablePullRequestAutoMerge whenever state.isMergeQueueEnabled === true, regardless of whether the repository allows auto-merge.

The action-state query does not read repository.autoMergeAllowed. T3 already uses that setting to hide Enable auto-merge when it is disabled, but the Merge action still takes the auto-merge route on merge-queue branches.

Code references, checked at 2d8a843e:

Calling enqueuePullRequest directly successfully queued the same PR while repository auto-merge remained disabled. The PR then merged. This may be useful when investigating a fix. Behavior when required checks are still pending has not been verified.

Impact

Major degradation or frequent failure

Version or commit

Observed on T3 Code desktop Nightly on November 6, 2026; the exact failing build was not recorded. The same routing is present in checkout 2d8a843e.

Environment

macOS, T3 Code desktop Nightly, GitHub.com, gh authentication.

Logs or stack traces

The T3 error text was not captured. Running gh pr merge on the same PR failed with the following output; this is CLI output, not a T3 log:

! The merge strategy for main is set by the merge queue
GraphQL: Auto merge is not allowed for this repository (enablePullRequestAutoMerge)

Workaround

Use GitHub's enqueuePullRequest GraphQL mutation directly:

gh api graphql \
  -f query='mutation($id:ID!){ enqueuePullRequest(input:{pullRequestId:$id}){ mergeQueueEntry{ position state } } }' \
  -f id="$(gh pr view <N> --json id --jq .id)"

Activity

  1. juliusmarminge commented on Nov 13, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Not reproduced in a running app: that needs a GitHub organization repository with a required merge queue and repository auto-merge disabled, and the shared worker account has none. Reproduced at the service layer on origin/main c7a3f02 instead. Added a test in packages/source-control-github/src/server/GitHubPullRequestApi.test.ts: the action-state read reports isMergeQueueEnabled=true, mergeStateStatus=CLEAN, autoMergeAllowed=false, and the mocked GitHub refuses enablePullRequestAutoMerge with 'Auto merge is not allowed for this repository' (the same error the reporter's gh pr merge printed). Running vp test run src/server/GitHubPullRequestApi.test.ts -t "merge queue when the repository" fails: runPullRequestAction('merge') returns 'GitHub returned an error: Auto merge is not allowed for this repository (at enablePullRequestAutoMerge)' and never calls enqueuePullRequest. Pushed as commit 0c95b6c on factory/repro-36184.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  2. leozitor commented on Nov 13, 2026

    @leozitor
    Author

    @juliusmarminge I reproduced this again on T3 Code desktop Nightly 0.1.10-nightly.20261113.4630, on macOS.

    The affected repository has:

    • Allow auto-merge disabled
    • A required merge queue on main
    • Squash merging as the only allowed merge method

    Steps I followed:

    1. Open a PR targeting main.
    2. Wait for the required checks and reviews to pass.
    3. Open the PR in T3 Code and click Squash and merge.

    Actual result: T3 displays:

    Could not merge this pull request
    GitHub returned an error: Auto merge is not allowed for this repository (at enablePullRequestAutoMerge)
    

    The PR is not added to the queue. GitHub's web UI successfully queued the same PR with repository settings unchanged.

    The PR's API state was isMergeQueueEnabled: true, mergeStateStatus: CLEAN, and repository.autoMergeAllowed: false, with the review approved. This matches the conditions in your service-layer reproduction, commit 0c95b6cf2b.

    The affected repository is private, so I can't provide public access. A possible independent reproduction is a public organization repository with the settings above, although I haven't tested that fresh-repository setup.

    Could you reopen this based on the reproduction details above? I can provide additional redacted evidence if needed.

  3. SimonKaran13 commented on Nov 25, 2026

    @SimonKaran13

    Note

    🤖 Gemini 4 Neon responding on behalf of SimonKaran13

    Still reproduces on current main via both the PR panel and pull_request_merge on a repository with a required Merge Queue and allow_auto_merge: false: runPullRequestAction("merge") calls enablePullRequestAutoMerge and fails with Auto merge is not allowed for this repository (at enablePullRequestAutoMerge), while GitHub's Merge when ready button enqueues the PR directly.

    Opened a focused fix in #42599 that reads repository.autoMergeAllowed in PullRequestActionState and routes merge-queue merges to GitHub's enqueuePullRequest mutation when auto-merge is disabled.

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