Repository navigation
fix(github): enqueue merge-queue PRs when auto-merge is disabled - #42599
SimonKaran13 wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3eb9b8fa4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }, | ||
| }) | ||
| .pipe( | ||
| Effect.map((result) => result.enqueuePullRequest?.mergeQueueEntry?.pullRequest), |
There was a problem hiding this comment.
Preserve a cancellable pending state for directly queued PRs
When this route enqueues a PR with autoMergeRequest: null (the response modeled in the added test), mapping only its pullRequest causes toPullRequestActionSummary to return autoMergeEnabled: false. The web primary-control resolver consequently shows Merge again, while web/mobile cancellation controls require that flag to be true. Refreshing cannot recover the pending state either: PullRequestCore never reads isInMergeQueue, and a repository-wide search finds dequeuePullRequest only in the schema, not an action handler. This leaves a successfully scheduled merge invisible and uncancellable from T3 while it waits in the queue. Carry queue membership through summary/detail and provide a dequeue path alongside this new enqueue route.
AGENTS.md reference: AGENTS.md:L63-L63
Useful? React with 👍 / 👎.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
On GitHub repositories where the target branch requires a Merge Queue and repository setting Allow auto-merge (
allow_auto_merge) is disabled, merging a ready PR through T3 Code (either from the PR panel or via thepull_request_mergeMCP tool) fails with:Expected behavior: T3 adds the PR to the merge queue using GitHub's
enqueuePullRequestmutation (matching GitHub's Merge when ready button on the web UI), without requiring repository auto-merge to be enabled.Change
autoMergeAllowedtorepositoryinquery PullRequestActionState(packages/source-control-github/src/server/pullRequestReads.graphql).mutation EnqueuePullRequest(packages/source-control-github/src/server/pullRequestMutations.graphql) returningmergeQueueEntry { pullRequest { ...PullRequestActionSummary } }, and regenerated GraphQL bindings (schema/github.graphql.ts,pullRequestReads.graphql.ts,pullRequestMutations.graphql.ts).GitHubPullRequestApi.runPullRequestActionso that whenstate.isMergeQueueEnabled === trueandrepository.autoMergeAllowed === false(foraction === "merge", orenable-auto-mergeon an already-ready PR), it invokesEnqueuePullRequest(preservingexpectedHeadOid) instead ofEnablePullRequestAutoMerge. Repositories withautoMergeAllowed: truekeep existingEnablePullRequestAutoMergebehavior.packages/source-control-github/src/server/GitHubPullRequestApi.test.tscoveringmergeand readyenable-auto-mergeon merge-queue branches withautoMergeAllowed: false(includingexpectedHeadOidforwarding,PullRequestActionSummarydecoding, and empty-payload tolerance).Scope
Fixes #36184 (reproduced at the service layer in
0c95b6cf2band closed because the triage worker lacked a live organization repository with a required merge queue and auto-merge disabled).Verification
pull_request_mergetool against a repository with a required Merge Queue on its target branch and Allow auto-merge disabled:pull_request_mergefailed withAuto merge is not allowed for this repository (at enablePullRequestAutoMerge), while clicking Merge when ready on github.com enqueued the same PR immediately.pnpm --filter @t3tools/source-control-github generate(schema/github.graphql.ts,pullRequestMutations.graphql.ts,pullRequestReads.graphql.ts).pnpm --filter @t3tools/source-control-github typecheck(effect-tsgo tsrs --noEmit) — exited 0 with no errors.vp lintonGitHubPullRequestApi.tsandGitHubPullRequestApi.test.ts— 0 warnings, 0 errors across 206 rules.vp fmt --checkon the modified TypeScript files — passed.pnpm --filter @t3tools/source-control-github test—23/23test files,455/455tests passed, including both newenqueuePullRequesttests (verifyingenqueuePullRequestreceives{ pullRequestId, expectedHeadOid },enablePullRequestAutoMergeis not called, and the returnedPullRequestActionSummarydecodes).schema/github.graphql).Written with Gemini 4 Neon in T3 Code (Antigravity harness).