Auto-Merge
Auto-merge lets Overdeck merge eligible PRs without a human clicking MERGE. Turn off Require UAT and the dashboard’s reconciler tick schedules each eligible PR for merge after a short cooldown window; no Flywheel run is needed. During the cooldown an audible announcement fires and the PR shows as a car in the Merge train section of the Flywheel page, with a Cancel button. When the cooldown expires, the merge runs through the exact same code path as the MERGE button.Enabling
Auto-merge is gated by the globalrequire_uat_before_merge setting in the
dashboard’s app_settings store. Set it to false to turn auto-merge on.
The merge train switch (merge_train_enabled) decides how ready PRs merge,
not whether they do (PAN-4753): with the train off, every ready PR merges on
its own through auto-merge; with it on, normal-priority PRs wait and merge
together in batches, and only high-priority PRs are auto-merged one at a time
(see the note below). OVERDECK_DISABLE_AUTO_MERGE=1 is the switch that stops
every automatic merge.
There is no CLI for these settings. Change them in the dashboard or through
/api/merge-train/config:
GET returns auto_pickup_backlog, require_uat_before_merge,
merge_train_enabled, and the batch window settings batch_size (default 3,
1 to 20) and batch_wait_minutes (default 30, 1 to 1440). POST changes only
the keys in the body; the first three must be booleans, the last two whole
numbers in range.
The same setting is the Require UAT switch in the Flywheel header. Turn it
off to turn auto-merge on. The default is true (auto-merge OFF: operator UAT
required before merge).
When the toggle is false, the dashboard schedules auto-merge for any issue
that satisfies the eligibility predicate. No flywheel run is needed: every
60 seconds, on the UAT batch-train reconciler tick, the primary dashboard walks
each project and takes its open PRs with green checks
on a feature/<id> branch. Strike PRs (strike/<id>) are scheduled once
their expedited review approves the head, ahead of feature PRs, with the same
cooldown. A UAT hold leaves a strike for its Merge button. For each PR it
checks, in order:
- the issue is open in the tracker (the cached tracker row) and opted in to
auto-merge: its
auto-merge/hold-for-uatlabel, then the project default, then this toggle (no forge read); and, while the merge train is on, it is high priority or was dropped from a batch (a normal-priority PR waits for the batch instead); - the merge gate (
evaluateIssueMergeGate) says the PR is ready. Approval is a trustedoverdeck-verdictmarker comment whosesha=is the PR head, or a trusted reviewer’s standing GitHub review approving that exact commit, so a repo without branch protection still qualifies. “Trusted” is the marker rule:OWNER,MEMBERorCOLLABORATOR, or the identity Overdeck posts as. The App’s bot is the installed App’s own (<slug>[bot], from theapp-slugfile beside its credentials in~/.overdeck/github-app/, elseGET /app), matched as a GitHubBotaccount, never by login alone. Its reviews arrive asCONTRIBUTORand count through that match. On a repository the GitHub App covers, an approving marker counts only from the App’s bot: agents hold the operator’sghcredentials and could post one as the owner. On other repositories the verdict is posted as theghuser, and an approving marker counts from any trusted author. If the App’s slug cannot be read, no bot approval counts. The App’s bot also files the follow-up issue for CodeRabbit findings a merge left unsettled, which needs the App’s Issues: Read and write permission; without it Overdeck raises Needs-you instead. A review from any other account never counts, and each reviewer’s latest review stands: a later “Request changes” or a dismissal withdraws an approval. An approval of an older commit, or a marker withoutsha=, never counts. A GitLab MR needs a named approver inapproved_by(whatglab mr approverecords); a green, conflict-free MR nobody approved is not approved, even where the project requires zero approvals; - the issue’s latest auto-merge entry allows a new one.
POST /api/merge-train/auto-merge/schedule.
GitLab projects are skipped, with one log line. OVERDECK_DISABLE_AUTO_MERGE=1
stops the scheduler as well as the executor.
Each entry records the PR head it was scheduled for. A pending or merging entry
is left alone. A cancelled entry stops the issue for good, whatever it is
pushed next: only re-scheduling it through the endpoint starts it again. A
failed entry (the merge was attempted, including the retry circuit breaker)
holds for that PR head only: a new push re-arms the issue. A blocked entry (the
executor refused it before merging, for example because checks went red or the
head moved during the cooldown, or the merge call refused it before any merge
command ran because the merge gate, failing required checks or a conflict said
no) re-arms as soon as the merge gate passes again.
An entry written before heads were recorded never re-arms by itself. The insert
re-checks the latest entry, so a cancel that lands while the scheduler is
reading the forge sticks.
When the cooldown ends, the executor reads the tracker live and blocks the
entry if the issue was closed, and blocks it if the PR head moved. An entry
with no recorded head is blocked, never merged unpinned. The merge is bound to
the approved head and to the PR the gate judged:
- the final gate check reads the issue’s
feature/<id>(orstrike/<id>) PR fresh (no facts cache), and the merge refuses when the PR it would land is not that PR; - a clean PR merges directly only when its live head is the approved head,
pinned to it (
gh pr merge --match-head-commit, the App merge’ssha,glab mr merge --sha); - a PR that needs a rebase is rebased by the server only, and only when the
worktree and
origin/feature/<id>are both at the approved head. The server rebases exactly that commit in its own detached worktree, created at the approved head under a temporary path the work agent never uses and removed afterwards, so nothing the agent commits in its worktree meanwhile can become the rebased head. It moves the work agent’s worktree to the result for local verification (only while that worktree is still at the approved head), pushes the result by sha with a lease on the approved head, and pins the merge to it. It never hands the rebase to the work agent, whose push would merge unreviewed. The pushed head is new, so if verification or the merge then fails, the PR needs a fresh review before it can merge automatically again; - polyrepo merge sets and branches that track
.planning/files are left to the operator: an automatic merge refuses them; - a git read that fails while checking where the merge may start (a
fetchorrev-parsefailure) is retried within the merge retry budget instead of failing that head for good. A head that was read and differs fails it.
Per-project default
Every registered project’s HOME tab includes a Project settings panel, even when the project has no in-flight pipeline issues. Its auto-merge control offers ⚡ Auto, 🔒 Hold for UAT, and Global default, and the collapsed row shows the current auto-merge and swarming values at a glance. The project default applies only to issues without an explicit per-issue auto-merge setting. Changes are saved throughPOST /api/projects/:key/auto-merge-default and stored
in ~/.overdeck/projects.yaml.
The same panel has a per-project Merge train setting
(merge_train: enabled | disabled); set it to Disabled to opt the project
out of the train.
Auto-merge vs. batches (PAN-4970, PAN-4753). This toggle controls per-issue
scheduled auto-merge: Overdeck merging one eligible PR at a time without a
human click. The Merge train switch on the Flywheel header
(
merge_train_enabled) turns on batches. Each ready
feature has exactly one of these two merge paths: a feature auto-merge will
merge never also joins a batch.- Merge train off: every ready PR is auto-merged on its own. Nothing batches.
- Merge train on: normal-priority PRs batch (this needs a workflow named
CIthat runs onuat/**pushes; without one, a batch waits at most 10 minutes for CI, then dissolves and its PRs merge one at a time, and batching pauses for a day with one activity-feed notice). A batch merges whenbatch_sizePRs are ready (default 3) or the oldest has waitedbatch_wait_minutes(default 30), once the batch’s own CI run is green. If that run fails, one PR is dropped from the batch and merges on its own; the rest merge without it. High-priority PRs are still auto-merged one at a time with the 5-minute cancel window: strike branches, and issues labeledcritical,blocks-main,P0,urgent, or bothsubstrate-improvementandbug.
OVERDECK_DISABLE_AUTO_MERGE=1 set batch every ready feature;
auto-merge never schedules there, and only you promote their batches.
Leave require_uat_before_merge at its default (true, auto-merge OFF) when you
want a human to UAT each batch before promoting it.Per-issue override
An issue can carry one of two tracker labels that take precedence over both the project default and the global setting:auto-merge: this issue auto-merges when eligible, whatever the project or global setting says.hold-for-uat: this issue waits for a human batch review, whatever the project or global setting says.
gh issue edit <n> --add-label auto-merge or --remove-label auto-merge). The dashboard reads it
from its cached tracker issues, so a change shows up after the next tracker
refresh.
Only you set these labels. Overdeck agents and the Flywheel cannot add or
remove auto-merge, hold-for-uat, released or vetoed: their gh refuses the write
and tells them to ask you.
Permissions and agent guardrails lists the other actions agents are refused.
The dashboard’s auto-merge toggle (the ⚡ Auto / 🔒 Hold control on an
in-flight issue) shows the result of this resolution: issue label, then project
default, then global setting. Clicking Auto or Hold sets that label on
the issue; clicking the pressed option clears it. The toggle is read-only when
the tracker cannot carry labels.
Eligibility
Overdeck stores no merge-ready flag. Eligibility is computed from the PR’s live facts each time it is checked (isAutoMergeEligible in
src/lib/cloister/auto-merge-eligibility.ts). A PR is eligible for auto-merge
only when all of these are true:
- The PR is open (not closed, not a draft, not already merged)
- The PR is approved on its exact head commit (a trusted reviewer’s standing
GitHub review of that commit, or a trusted verdict marker whose
sha=names it, posted by the GitHub App’s bot when the App covers the repository; on GitLab, a named approver inapproved_by), and no review or marker requests changes - The forge reports CI checks on the PR head, and all of them passed. Pending
checks, failing checks, and no reported checks each make the PR ineligible.
When the project runs
verification.tests: ci, the CI test job must also have run and passed on that head. The test job may be a GitHub Actions check run or a commit status such as a Dagger Cloud check; a Dagger Cloud project must setverification.tests: ciinprojects.yamlexplicitly, since commit-status CI cannot be auto-detected. - The forge reports the PR as
mergeable(no merge conflicts, branch protection satisfied). GitHub recomputes mergeability after the base branch moves, so the gate re-reads an open, green PR whose mergeability is unknown once, 3 seconds later. A PR whose mergeability is still not computed is not eligible, and the reason says so rather than reporting a missing approval. - The issue is not held for UAT (its label, then the project default, then the global setting; see above)
- None of the blocker labels are present on the issue:
needs-designneeds-discussiondo-not-merge
do-not-merge label
while the timer was running) gets surfaced as a blocked entry instead of
merged.
Cooldown
Cooldown is fixed at 5 minutes of wall-clock time from when the scheduler schedules the merge to when the executor fires. The countdown is persisted in SQLite, so it survives dashboard restarts. If the dashboard sleeps through the deadline, the executor still picks the entry up on the next tick and re-validates eligibility before firing. The cooldown is not configurable today; it’s a deliberate single-knob value that gives the operator a predictable cancel window.Cancelling
Three ways to cancel an in-flight auto-merge during its cooldown:- The Merge train section on the Flywheel page lists each car; a car in its cooldown has Cancel, a failed car has Retry.
-
DELETE /api/merge-train/auto-merge/:idagainst the dashboard. The route needs the dashboard’s internal token (thex-overdeck-internal-tokenheader) or a dashboard session. -
The CLI:
This calls the DELETE endpoint, removes the entry from the pending list, drops any waiting entry for the issue from the project merge queue, and emits an
auto-merge cancelled for PAN-123TTS announcement so the operator knows the abort took effect.
merging. Once the executor has started running
the merge there is nothing to cancel: at that point it’s the same code path
as clicking MERGE.
Queue interaction
The dashboard runs at most one merge at a time per project. An automatic merge never joins the project merge queue: when another merge holds the slot,triggerMerge() defers it, and the entry is requeued with a short backoff
(scheduledMergeAt bumped by 60 seconds, status reverted to pending) without
using its retry budget. The next executor tick re-runs every check (the gate,
the head, the labels, the tracker) and tries again. A queued merge would start
later with none of them. Stale merging rows are prevented by this requeue path; the executor
never leaves a row stuck mid-flight when triggerMerge() returns a
non-terminal status.
Inspecting state
Failure handling
When the executor fires and the merge fails (e.g. surface-level rebase conflict raised at merge time), the row is moved tofailed with the failure
reason captured. failed means a merge command ran, or the refusal needs the
operator (a closed PR, a polyrepo merge set, .planning/ files). A refusal the
merge gate re-checks (the gate itself, failing required checks, a conflict)
leaves the row blocked instead. For a failed
row, a TTS announcement plays and the car shows as failed. Fix the cause, then
Retry or cancel.
Related
- Issue pipeline: the one merge gate and the Merge button
GET/POST /api/merge-train/config: read and writerequire_uat_before_merge,merge_train_enabled,auto_pickup_backlog,batch_size, andbatch_wait_minutes(no CLI; the dashboard has the Flywheel header switches and Settings → Merge Train)pan merge cancel <id>: cancel a pending auto-merge- Flywheel: the Auto-pickup, Require UAT and Merge train switches in the page header
- CI integrations: CI test mode, Dagger Cloud, CodeRabbit and the batch workflow