Skip to content

fix(github): enqueue a merge-queue PR when the repo disables auto-merge - #24327

Merged
nwparker merged 1 commit into
stablyai:mainfrom
innocarpe:fix-19638-merge-queue-enqueue
Oct 27, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
innocarpe:fix-19638-merge-queue-enqueue

Conversation

@innocarpe

@innocarpe innocarpe commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Some repositories make pull requests wait in a "merge queue", a line that merges PRs one at a time. If a repository also turns off GitHub's auto-merge setting, Orca's "Merge when ready" button always failed with "Auto merge is not allowed for this repository". Now Orca adds the PR to the merge queue directly in that case, so the button works.

What Changed

Before: on a base branch that requires a merge queue, enablePRAutoMerge always ran gh pr merge --auto. gh turns that into the enablePullRequestAutoMerge mutation, and it has no path that calls enqueuePullRequest. GitHub rejects that mutation when the repo has auto-merge disabled, so the user got Failed to enable auto-merge for pull request: GraphQL: Auto merge is not allowed for this repository (enablePullRequestAutoMerge).

After: src/main/github/client/merge/pr-auto-merge.ts

  • resolveMergeQueueAutoMergePath replaces shouldUseMergeQueueAutoMerge, which was only used in this file. It reads the existing cached detectRepositoryMergeMetadata result and returns:
    • 'enqueue' when a merge queue is required and autoMergeAllowed === false
    • 'gh-auto' when a queue is required and auto-merge is allowed or unknown (same as before)
    • null when no queue is required (same as before: the enablePullRequestAutoMerge mutation)
  • New enqueuePullRequest GraphQL call. It sends pullRequestId, plus expectedHeadOid when known, and uses the same gh options and GH_PROMPT_DISABLED as the existing mutation, so local, WSL, SSH and runtime hosts all work the same way.
  • If the enqueue is rejected, the error now reads Failed to add pull request to the merge queue: ... (through the existing classifyPullRequestUpdateError). It no longer looks like the original auto-merge error.

Added one regression test in src/main/github/client-merge-queue-auto-merge.test.ts.

Why

This fixes the bug at its source, the code that picks which merge call to make, and uses repo metadata Orca already fetches. It adds no new requests and no IPC or protocol changes, so mixed client/server versions keep working. An earlier version of this PR also tracked whether a PR is in the queue and showed a queue-specific UI. That part is left for a follow-up. Today's gh --auto path, which can also put a ready PR straight into the queue, has the same gap. The extra per-PR GraphQL read would also use up rate-limit budget for every merge-queue repo.

Known tradeoffs:

  • On these repos, the PR goes into the queue right away. If it doesn't meet the queue's rules yet, GitHub's error is shown instead of the PR waiting.
  • The success toast still says "Auto-merge enabled". This is the same as the existing gh --auto path.

Linked Issue

Fixes #19638

Visual Proof

N/A. The only change is in the main-process GitHub call. No UI changed, and the visible result (the error toast no longer appears) needs a live repo with a required merge queue and auto-merge disabled. The fix was verified with gh mocks (see Testing).

Testing

  • Reproduced on main with a mock where gh rejects --auto because auto-merge is disabled: returns Failed to enable auto-merge ... Auto merge is not allowed for this repository (enablePullRequestAutoMerge) and never calls enqueuePullRequest. The new regression test and the scratch probe cases (classic merge queue, ruleset-only MERGE_QUEUE rule, enqueue rejection) fail on main.

  • On this branch, all probe cases pass. Control cases behave the same as on main: queue with auto-merge allowed, queue with unknown metadata, and no queue with auto-merge disabled.

  • pnpm test src/main/github/client-merge-queue-auto-merge.test.ts: 19 passed. Neighboring GitHub suites (RPC methods, local runtime, SSH/WSL routing): passed.

  • oxlint, oxfmt, ast-grep, and the changed-code quality gates are clean on the touched files.

  • Platforms: macOS (unit tests, platform-independent main-process code). Not tested against a live merge-queue repo.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Reviewed by two agents plus a verify pass. All approved with no blockers. The blocking note from round one (enqueue failures were labeled as auto-merge errors) is fixed.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: no new inputs, and the GraphQL variables are passed as -f args. Cross-platform: the same gh exec wrapper on all OSes. Remote/SSH: this runs on whichever host serves the repo, with no RPC change. Mobile: uses the same server-side code path. Performance: no extra requests, because merge metadata is already fetched and cached.

Original fix by @innocarpe. Narrowed to the core fix in this PR.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds merge-queue enqueue as alternative to auto-merge.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR enqueues a pull request when its base branch requires a merge queue and the repository disallows auto-merge. It also carries queue membership through refresh and shows queued state and accurate success feedback in the UI.

  • Repositories that allow auto-merge retain the existing gh pr merge --auto path.
  • The previous queued-state finding has an explanatory author reply, is resolved, and is addressed by the current membership and presentation changes.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Merge when ready] --> B{Required merge queue?}
  B -->|No or unknown| C[Existing auto-merge path]
  B -->|Yes| D{Auto-merge allowed?}
  D -->|False| E[Enqueue pull request]
  D -->|True or unknown| F[gh pr merge --auto]
  E --> G[Report queued result]
  G --> H[Refresh queue membership and show In merge queue]
Loading

Reviews (5) · Last reviewed commit: "fix(github): accept the merge-queue enti..."

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • Enqueue path for disabled auto-merge: enablePRAutoMerge now calls the enqueuePullRequest GraphQL mutation when the base branch requires a merge queue and the repository disallows auto-merge, instead of the failing gh pr merge --auto.
  • Decision helper: new mergeQueueDisallowsAutoMerge reuses detectRepositoryMergeMetadata to pick between the enqueue mutation and the existing --auto path; unknown metadata and queue-with-auto-merge still fall back to --auto.
  • Test: added coverage asserting the enqueue mutation is invoked and no --auto merge command runs.

I verified the enqueuePullRequest mutation against GitHub's public schema (EnqueuePullRequestInput with pullRequestId: ID! and optional expectedHeadOid: GitObjectID, returning mergeQueueEntry), and confirmed the control stays reachable for this case since canRequestWhenReady short-circuits on mergeQueueRequired === true.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: 21bc876eeb94613870e69b9e06a2dffdfb0d062f
  • Latest commit, not reviewed: a4c44a6

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

When a merge queue is required and auto-merge is disallowed, the auto-merge flow now adds the pull request directly to the queue and returns an enqueued result flag. Pull request lookup can read and propagate queue membership. The renderer presents queued pull requests without direct-merge or auto-merge actions, and success messages distinguish queue enrollment from ordinary auto-merge enablement.

Priority: Normal

Merge Risk: Low · previous review 21bc8

Some fallback paths may still show merge actions for a pull request already in the queue. The main enrollment path works, so this is a bounded UI gap to fix or explicitly accept before merging.

Security architecture risk: Low · up to 21bc8

The new enrollment path uses the existing GitHub execution context and repository controls. No security-control bypass was demonstrated, but recovery after interrupted requests and live merge-queue behavior remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new privileged outcome is enrollment of the selected PR into its repository's merge queue, with potential subsequent merging into its base branch. The inspected request is scoped by the resolved repository, PR node ID, and existing execution context; effective credential permissions were not independently audited.

Trust Boundaries and Controls

  • observed — Renderer callbacks interpret returned state after the existing local or environment mutation call. The main-process path resolves repository identity and passes expectedHeadOid when available to GitHub. GitHub remains the queue-acceptance authority; the client permits omission of the head guard if identity lookup omits it.

Resilience and Maintainability Implications

  • inferred — Local rollback is not evidence that remote enrollment failed. The inspected quiet refresh requires confirmed authority state, so it does not establish recovery for an isolated ambiguous failure. This is an inherited recovery limitation, not a demonstrated PR-introduced authorization bypass.

Hardening Proposals

  • proposed — Consider treating transport failure as an indeterminate enrollment outcome and re-reading membership for the same repository and PR before retry. This would distinguish local rollback from remote queue state without assuming duplicate enrollment is idempotent.
Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed Issue #19638 requires enqueueing a pull request when the base branch requires a merge queue and auto-merge is disallowed. enablePRAutoMerge now uses the GraphQL enqueue mutation with the pull reques…
Out of Scope Changes check Passed The changes remain within issue #19638. Queue metadata lookup, queue membership propagation, enqueue result handling, success messaging, and suppression of actions for queued pull requests support the…
Title check Passed The title names the main change: when a repository disables auto-merge but requires a merge queue, the PR is enqueued directly instead of calling the auto-merge mutation. The changeset matches this (e…
Description check Passed The description follows the template. It has an ELI5 section, a What Changed section with before and after and the mechanism, a Why section with alternatives and tradeoffs, a Linked Issue (Fixes #1963…
Full details: Linked Issues check

Explanation

Issue #19638 requires enqueueing a pull request when the base branch requires a merge queue and auto-merge is disallowed. enablePRAutoMerge now uses the GraphQL enqueue mutation with the pull request ID and optional expected head OID, and returns enqueued: true. The existing auto-merge path remains for other cases. Queue membership propagates through lookup and work-item state, and queued pull requests do not show merge actions. Tests cover enqueue behavior, the success toast, queued state, and mutation state updates.

Full details: Out of Scope Changes check

Explanation

The changes remain within issue #19638. Queue metadata lookup, queue membership propagation, enqueue result handling, success messaging, and suppression of actions for queued pull requests support the required enqueue flow. The changes include regression tests and preserve existing auto-merge and direct-merge behavior. No unrelated change is demonstrated.

Full details: Title check

Explanation

The title names the main change: when a repository disables auto-merge but requires a merge queue, the PR is enqueued directly instead of calling the auto-merge mutation. The changeset matches this (enqueuePullRequest path in pr-auto-merge.ts, the new resolveMergeQueueAutoMergePath helper, and the regression test). The title also follows the conventional commit style and stays under one line. It does not mention the UI or queue-state follow-up pieces, which the description says were removed from scope, but the title does not need to cover every detail.

Full details: Description check

Explanation

The description follows the template. It has an ELI5 section, a What Changed section with before and after and the mechanism, a Why section with alternatives and tradeoffs, a Linked Issue (Fixes #19638), a Visual Proof section that marks N/A with a reason, a Testing section with steps and platforms, an AI Disclosure section (which the template says to leave blank for maintainers, and it is left out here), a Review section, the upstream boundary checkbox, Notes covering security, cross-platform, SSH, mobile, compatibility and performance, and a checklist. The final checklist item for pnpm lint/typecheck/test/build is unchecked, and the description does not state that the full suite was run. The description also says the PR has not been tested against a live merge-queue repository. These gaps are minor, so the check passes.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@innocarpe
innocarpe force-pushed the fix-19638-merge-queue-enqueue branch from 8ddb974 to 2205315 Compare October 1, 2026 09:45
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (2205315506)

Address review: enqueue and auto-merge now share one metadata read. A successful enqueue returns enqueued, the toast says the pull request was added to the merge queue, and a pull request already in the queue no longer offers Merge when ready.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 10b64805-e4d6-4c22-b200-8dc2763b915c

📥 Commits

Reviewing files that changed from the base of the PR and between 8ddb974de3515bedb4b055746b3e01f0b3861d6b and 2205315506b6efc2c003f19e9f69aa0885faf167.

📒 Files selected for processing (25)
  • src/main/github/client-merge-queue-auto-merge.test.ts
  • src/main/github/client/fetch/work-item-fetch.ts
  • src/main/github/client/lookup/pr-branch-lookup.ts
  • src/main/github/client/lookup/pr-number-lookup.ts
  • src/main/github/client/lookup/pr-refresh-outcome-assembly.ts
  • src/main/github/client/lookup/pull-request-lookup-data.ts
  • src/main/github/client/lookup/pull-request-lookup-hydration.ts
  • src/main/github/client/lookup/pull-request-merge-queue-membership.ts
  • src/main/github/client/merge/pr-auto-merge.ts
  • src/preload/api/gh-bridge-mutations-and-projects.ts
  • src/preload/api/github-pull-request-api.ts
  • src/renderer/src/components/github-auto-merge-success-toast.ts
  • src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
  • src/renderer/src/components/github-pr-merge-state.test.ts
  • src/renderer/src/components/github-pr-merge-state.ts
  • src/renderer/src/components/pull-request-page/actions/merge-actions.ts
  • src/renderer/src/components/right-sidebar/HostedReviewActions.tsx
  • src/renderer/src/components/task-page-linear-jira-list-model.tsx
  • src/renderer/src/components/task-page-work-item-signatures.ts
  • src/renderer/src/components/task-page/github/MergeCell.tsx
  • src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
  • src/shared/github/pull-request-types.ts
  • src/shared/github/work-item-types.ts
  • src/shared/hosted-review-github.ts
  • src/shared/hosted-review.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

The new commit does not typecheck. pnpm tc:web (part of pnpm typecheck and pnpm build:desktop) reports three errors introduced by this delta, so the PR cannot build as-is. Per-line fixes below.

Reviewed changes

  • Queue-membership read: added readPullRequestInMergeQueue (GraphQL isInMergeQueue) and threaded inMergeQueue through PR lookup, work-item fetch, refresh assembly, and the shared PRInfo / GitHubWorkItem / HostedReviewInfo types.
  • Queued presentation: presentGitHubPRMergeState now returns an "In merge queue" state and suppresses the auto-merge action when inMergeQueue === true.
  • Enqueue-aware toast: new githubAutoMergeSuccessToast, with successToastFromResult plumbing, so an enqueue reports "Added to the merge queue" instead of "Auto-merge enabled".
  • Decision refactor: shouldUseMergeQueueAutoMerge + mergeQueueDisallowsAutoMerge collapsed into mergeQueueEnqueueDecision ('enqueue' | 'auto' | 'skip') over one metadata read.

🚨 The renderer does not typecheck

node node_modules/typescript/bin/tsc --noEmit -p config/tsconfig.tc.web.json reports exactly three errors, all in the new delta. The main-process project (config/tsconfig.node.json) is clean, so this is renderer-only.

Technical details
# Renderer typecheck fails

## Affected sites
- `src/renderer/src/components/github-pr-merge-state.test.ts:30` — `TS2353`: `{ ok: true }` has no property in common with `{ enqueued?: boolean } | void` (excess property check).
- `src/renderer/src/components/right-sidebar/HostedReviewActions.tsx:96` — `TS2339`: `Property 'inMergeQueue' does not exist on type 'HostedReviewActionInfo'`.
- `src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts:167` — `TS2345`: `typed` (`{ ok?: boolean; error?: string | { message?: string } } | void`) is not assignable to `{ enqueued?: boolean } | void`.

## Reproduction
- `pnpm tc:web` (or `node node_modules/typescript/bin/tsc --noEmit -p config/tsconfig.tc.web.json`).

## Required outcome
- `pnpm tc:web` passes, with the enqueue result still reaching the toast and `review.inMergeQueue` still contributing to the merge state.

## Suggested approach (optional)
- One fix per site; see the inline comments.

ℹ️ Nitpicks

  • presentPullRequestInMergeQueue is a merge-state presentation but lives in github-auto-merge-success-toast.ts, so github-pr-merge-state.ts imports it back from the toast module. The reverse import is type-only (so still acyclic), but the file name now under-describes its contents; a small dedicated module would read better.
  • readPullRequestInMergeQueue is uncached while detectRepositoryMergeMetadata caches for 10 minutes, so each PR refresh on a merge-queue branch adds one GraphQL query per PR. Fine if membership must stay live, but a conscious call for large scans.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@innocarpe
innocarpe force-pushed the fix-19638-merge-queue-enqueue branch from 2205315 to 194b88f Compare October 1, 2026 10:57
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (194b88f103)

The web typecheck accepts an enqueue result. The toast test passes an empty result for the not-enqueued branch, and the hosted review no longer reads inMergeQueue from a type that does not have it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (2205315506), the branch was amended to fix the three renderer typecheck errors it flagged:

  • Fixed the not-enqueued toast test: github-pr-merge-state.test.ts passes {} instead of { ok: true }, which the weak { enqueued?: boolean } | void parameter rejected as TS2353.
  • Dropped the review.inMergeQueue override: HostedReviewActions now relies on the ...githubPR spread (a PRInfo that already carries inMergeQueue), clearing TS2339 without changing behavior — the ?? githubPR?.inMergeQueue fallback was the effective value anyway.
  • Kept enqueued in the mutation result type: both mutate signatures and the typed cast in useTaskPageGitHubWorkItemMutation include enqueued?: boolean, so the enqueue flag reaches successToastFromResult.

Verified at 194b88f:

  • tsc --noEmit for the node, web, and cli projects all exit 0.
  • github-pr-merge-state.test.ts and client-merge-queue-auto-merge.test.ts pass (31 tests).
  • oxlint clean on the three changed files.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@innocarpe
innocarpe force-pushed the fix-19638-merge-queue-enqueue branch from 194b88f to d06b7a5 Compare October 1, 2026 11:44
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (d06b7a598b)

An enqueue result now confirms the task row with auto-merge off and in the merge queue. The button no longer stays on Merge when ready after the pull request was queued.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Add serverEntityFromResult to the shared runner… · task-page-linear-jira-list-model.tsx:173-189

src/renderer/src/components/task-page-linear-jira-list-model.tsx:173-189
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add serverEntityFromResult to the shared runner contract.

MergeCell passes serverEntityFromResult, but TaskPageGitHubWorkItemMutationRunner.run does not declare it. The supported web typecheck therefore fails with TS2353, blocking that typecheck workflow.

Suggested fix
     successToast?: string
     successToastFromResult?: (result: { enqueued?: boolean } | void) => string
+    serverEntityFromResult?: (result: unknown) => Partial<GitHubWorkItem> | undefined
     errorToast: string

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 4b73b577-8d1c-450d-bb07-0d84b4ac8121

📥 Commits

Reviewing files that changed from the base of the PR and between 194b88f10330ab4568c750a934322587324dc263 and d06b7a598b3eb52fb7a08e9c027de689a47f814c.

📒 Files selected for processing (3)
  • src/renderer/src/components/task-page-github-work-item-mutation-lifecycle.ts
  • src/renderer/src/components/task-page-github-work-item-mutation-regressions.test.ts
  • src/renderer/src/components/task-page/github/MergeCell.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

The new commit does not typecheck. MergeCell now passes serverEntityFromResult to a runner whose type never declared it, so pnpm tc:web fails with TS2353 and the renderer/desktop build cannot complete. One-line fix inline.

Reviewed changes

Since the prior pullfrog review (194b88f), the branch was force-pushed into new commits that:

  • Confirm an enqueue as queued: applyServerEntityIfPresent now applies inMergeQueue from the server entity, so a confirmed enqueue clears the optimistic auto-merge flag and the cell shows "In merge queue".
  • Regression test: added a test asserting an enqueue confirms as { autoMergeEnabled: false, inMergeQueue: true } and records autoMerge: false.
  • Pass the queued server entity from MergeCell: handleAutoMerge now supplies serverEntityFromResult, returning { autoMergeEnabled: false, inMergeQueue: true } when the result is enqueued: true. This is the call that does not typecheck.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@innocarpe
innocarpe force-pushed the fix-19638-merge-queue-enqueue branch from d06b7a5 to 21bc876 Compare October 1, 2026 12:25
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (21bc876eeb)

The mutation runner now accepts the queued work item callback MergeCell already passes. The web typecheck is clean.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior pullfrog review (d06b7a5), the only delta is one line:

  • Runner contract accepts the queued server entity: TaskPageGitHubWorkItemMutationRunner.run now declares serverEntityFromResult, matching the hook's input, so MergeCell.tsx:170 typechecks again and the queued { autoMergeEnabled: false, inMergeQueue: true } entity still reaches confirmTaskPageGitHubWorkItemMutation.

Verified at 21bc876e:

  • node node_modules/typescript/bin/tsc --noEmit -p config/tsconfig.tc.web.json exits 0.
  • 47 focused tests pass: task-page-github-work-item-mutation-regressions (16), github-pr-merge-state (15), client-merge-queue-auto-merge (16).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟡 Minor · Hydrate branch lookup fallbacks before exposing merge controls. · pr-branch-lookup.ts:68-70

src/main/github/client/lookup/pr-branch-lookup.ts:68-70
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Hydrate branch lookup fallbacks before exposing merge controls.

getPRByNumber(..., { readQueueMembership: true }) can return null, and the catch path also returns branchData directly. Branch data from the REST/list lookup does not contain inMergeQueue. The no-candidate branch path returns similarly unhydrated data.

A supported non-stacked branch lookup can therefore return a queued PR without membership data. If its merge metadata is clean, github-pr-merge-state.ts sets directMergeAvailable to true. Apply queue-aware hydration to the branch fallbacks before returning them. This requires a branch-specific correction; the number-lookup hydration does not cover these exits.

🟡 Minor · Retain queue membership when merge metadata is unknown. · work-item-fetch.ts:125-132

src/main/github/client/fetch/work-item-fetch.ts:125-132
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Retain queue membership when merge metadata is unknown.

When detectRepositoryMergeMetadata fails, it returns mergeQueueRequired: null. The current === true check then skips readPullRequestInMergeQueue. The REST fallback skips that lookup entirely. An already-queued, mergeable PR can therefore reach the renderer without inMergeQueue and receive direct merge controls.

Read membership when mergeQueueRequired is unknown, and add the same best-effort lookup to the known-repository REST fallback. readPullRequestInMergeQueue already returns undefined on rate-limit, parse, or request failures, so preserve the existing result when membership is unavailable.

Suggested fix
         const mergeMetadata = await detectRepositoryMergeMetadata(ownerRepo, baseRefName, ghOptions)
         const inMergeQueue =
-          mergeMetadata.mergeQueueRequired === true
+          mergeMetadata.mergeQueueRequired !== false
             ? await readPullRequestInMergeQueue(ownerRepo, number, ghOptions)
             : undefined
@@
       )
       const reviewFields = await fetchPullRequestReviewFields(number, ownerRepo, ghOptions)
-      return { ...mapped, ...reviewFields }
+      const inMergeQueue = await readPullRequestInMergeQueue(ownerRepo, number, ghOptions)
+      return {
+        ...mapped,
+        ...reviewFields,
+        ...(inMergeQueue !== undefined ? { inMergeQueue } : {})
+      }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9ec3ee96-3784-4df8-b39a-9d62313c686e

📥 Commits

Reviewing files that changed from the base of the PR and between d06b7a598b3eb52fb7a08e9c027de689a47f814c and 21bc876eeb94613870e69b9e06a2dffdfb0d062f.

📒 Files selected for processing (1)
  • src/renderer/src/components/task-page-linear-jira-list-model.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@innocarpe
innocarpe force-pushed the fix-19638-merge-queue-enqueue branch 3 times, most recently from cc4c574 to 3663516 Compare October 22, 2026 00:28
@nwparker
nwparker force-pushed the fix-19638-merge-queue-enqueue branch from 3663516 to cec1c20 Compare October 27, 2026 04:57
@nwparker nwparker changed the title fix(github): enqueue a merge-queue PR when auto-merge is disabled fix(github): enqueue a merge-queue PR when the repo disables auto-merge Oct 27, 2026
@nwparker nwparker closed this Oct 27, 2026
@nwparker nwparker reopened this Oct 27, 2026
@nwparker nwparker closed this Oct 27, 2026
@nwparker nwparker reopened this Oct 27, 2026
On repos whose base branch requires a merge queue and that disable
auto-merge, gh pr merge --auto always calls enablePullRequestAutoMerge,
which GitHub rejects. Call the enqueuePullRequest mutation directly in
that case and report enqueue failures as merge-queue errors.

Fixes stablyai#19638

Co-authored-by: Neil <neil@stably.ai>
@nwparker
nwparker force-pushed the fix-19638-merge-queue-enqueue branch from cec1c20 to a4c44a6 Compare October 27, 2026 08:24
@nwparker
nwparker merged commit e3affc0 into stablyai:main Oct 27, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: "Merge when ready" fails on repositories with a required merge queue

2 participants