Skip to content

Auto-merge should work without merge queue — direct merge fallback #401

@Trecek

Description

@Trecek

Problem

The auto_merge ingredient (default "true") in implementation and remediation recipes is described as "Enroll the PR in the merge queue automatically after checks pass." This couples auto-merge to merge queue availability.

In route_queue_mode, when auto_merge == "true":

  • If queue_available == true → enables auto-merge and waits for queue (enable_auto_mergewait_for_queue)
  • If queue_available == false → routes to release_issue_success (implementation) / confirm_cleanup (remediation) — PR is left unmerged

This means repos without a merge queue never get their PRs merged automatically, even though the recipe's intent is to merge after CI and review pass.

Desired Behavior

When auto_merge is "true", the recipe should merge the PR regardless of whether a merge queue exists:

  1. Merge queue present: Current behavior — gh pr merge --squash --auto enrolls in the queue, wait_for_merge_queue polls until merged/ejected.
  2. No merge queue: gh pr merge --squash --auto should still be called. GitHub handles this natively — --auto waits for required status checks then merges directly without needing a queue. The recipe should poll for merge completion (PR state = merged) rather than calling wait_for_merge_queue.

The merge queue is largely irrelevant to the agent workflow because:

  • The agent already waits for CI and review to pass before attempting merge
  • If a concurrent merge introduces a conflict, the agent can resolve it and re-push
  • gh pr merge --squash --auto delegates queue-vs-direct to GitHub's branch ruleset automatically

Scope

  • implementation.yaml: Update route_queue_mode to add a direct-merge path when queue_available == false instead of skipping to release_issue_success
  • remediation.yaml: Same change — direct-merge path when no queue
  • Ingredient description: Update auto_merge description from "Enroll the PR in the merge queue" to "Automatically merge the PR after checks pass"
  • Merge completion polling: For the no-queue path, poll PR state for merged (similar to what merge-pr skill does with gh pr view --json state,mergedAt)
  • Ejection/conflict handling: Ensure the no-queue path handles merge failures (e.g., conflict from concurrent merge) with the same resolve-and-retry pattern used in the queue path

Follows from #381 which added the auto_merge ingredient.

Requirements

ROUTE — Recipe Routing Updates

  • REQ-ROUTE-001: When auto_merge is "true" and queue_available is "false", both implementation.yaml and remediation.yaml must route to a direct-merge step instead of skipping to cleanup/release.
  • REQ-ROUTE-002: The direct-merge step must invoke gh pr merge --squash --auto to enable GitHub-native auto-merge regardless of merge queue presence.
  • REQ-ROUTE-003: The direct-merge path must poll PR state for merged completion rather than calling wait_for_merge_queue.

FAIL — Failure Handling

  • REQ-FAIL-001: The direct-merge path must handle merge failures (e.g., conflicts from concurrent merges) with a resolve-and-retry pattern analogous to the queue ejection path.
  • REQ-FAIL-002: If the direct merge fails due to a non-conflict error, the recipe must route to the same cleanup/release path used by the queue timeout case.

DESC — Ingredient Description

  • REQ-DESC-001: The auto_merge ingredient description in both implementation.yaml and remediation.yaml must be updated to reflect that it controls automatic merging after checks pass, not specifically merge queue enrollment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrecipe:implementationRoute: proceed directly to implementationstagedImplementation staged and waiting for promotion to main

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions