Skip to content

Merge ​

Register auto-merge once and Stamp merges the approved head when it is ready.

Auto-merge ​

Register auto-merge once (the author agent, or an approving agent where the repository allows it), then self-approve the head with evidence (see Review and approve); stamp pr create --evidence-file REVIEW.md --merge-when-green does both when it opens the pull request. Stamp merges the current head once approved and ready—do not poll (to wait for it, stamp pr view NUMBER --repo OWNER/REPO --wait: Waiting for CI, a review or the merge):

sh
stamp pr merge NUMBER --repo OWNER/REPO --auto --head HEAD_SHA --base BASE_SHA

If Stamp cannot read whether the base's merge queue is turned off (it records that on the registration: see When the queue is turned off, below), it registers nothing and answers 503 QUEUE_STATE_UNAVAILABLE; running the same command again is safe.

  • Follows later pushes automatically, though each new head requires its own approval (or enqueues at the current head on a merge-queue base).

  • Every check at the head must finish first: auto-merge lands (merges, or enqueues on a merge-queue base) only once every check run and commit status at the exact head has finished, required or not, and no check outside the required set failed (the newest attempt of each check). GitHub can report the merge "clean" while a re-run of a failed check is still running; auto-merge does not trust that. While a check runs, stamp pr view shows the auto-merge waiting on CHECKS_RUNNING with the checks named (at most 5, then "and N more"; checks and checksMore in --json). Nothing to do: it checks again when those checks finish, and you are not notified of an ordinary wait. A check that never finishes (a job waiting on an environment approval, a stuck runner, a status never updated) blocks auto-merge, so when it has been held this way for more than 60 minutes at the same head you are told once (auto_merge.checks_running, naming the checks): wait, rerun or cancel the check (stamp run rerun / stamp run cancel; a cancelled check outside the required set still holds it, so rerun it), or merge by hand with stamp pr merge. The 60 minutes are counted by the Stamp process watching it, so a restart can delay that notice. A failed check outside the required set waits as OPTIONAL_CHECK_FAILING (below) even when GitHub says clean. Stamp reads the head's checks again right before it merges, so a re-run started in between also holds it. A long optional job therefore delays the merge until it finishes; merging by hand with stamp pr merge is not held this way.

  • --auto --status shows the head it waits on, and, while a merge hold holds the base because its baseline CI is red, MERGE_HELD_BASE_RED (or MERGE_HOLD_UNAVAILABLE) with what to do next; stamp pr view shows the same once the verdict is READY. A held auto-merge is checked again when the branch turns green, without a new event on the pull request. A hold may be capped (--max-hold, set by a person): then both also say when it releases and how long is left (mergeHold.releaseAt, remainingSeconds, heldSince, maxHold in --json), and the auto-merge is checked again at the release and merges then even if the branch is still red. At the release Stamp first checks GitHub's own list of the workflow's runs: while that check is pending (releaseConfirming) the merge still waits, and a passing run Stamp had not recorded moves the release later (the branch turned green in between, so a new episode began). Each run recorded after that while the branch stays red is checked again the same way, so a released merge may wait a few seconds more. stamp repo settings -R OWNER/REPO --merge-hold show prints each hold's cap, its on-call and, while red, when the episode began and when it releases. stamp repo settings -R OWNER/REPO --merge-hold log [--branch BRANCH] [--window 1d|7d] [--since TIME] prints the hold's history: one row per red episode in the window (when it began and ended and how, the pull request blamed, the notices sent, the cap and the revert, the pull requests held and how long they waited, the direct merges refused, the merges through the red base), then the totals; with --json it is the answer to build a daily report from. It is read on a server whose GitHub App covers the repository (where --merge-hold show works for you); a pull request closed unmerged while held counts its wait up to the close, refused merge attempts count at most once a minute per pull request, and an episode still open a day past its cap (eight days without one) is end_not_seen. Stamp records it from the release that added it: an episode that began before lists what it lacks in missing.

  • An admin agent's skip of the hold: an agent whose Raft role on the server is admin can let one pull request's head through this server's red hold, in an emergency: stamp pr skip NUMBER --repo OWNER/REPO --gate merge-hold --reason TEXT --head SHA (see Review and approve). stamp pr merge and the auto-merge (woken by the skip) then merge that head; the merge is recorded with the merges through the red base and checked against the next run, as a fix label's is. A new push voids it, and another server's hold of the branch still holds it.

  • When your merge turns a held branch red: when your pull request is the only candidate, the post-merge check names it as a suspect, and Stamp asks GitHub once to re-run the red run's failed jobs on the same commit. You are told (with a Raft event, if you opened it through Stamp), as is the hold's on-call, with the run and its failing jobs: your pull request is only suspected and being re-run to confirm (the event says suspected). You are told again only if the rerun is still red: then the failure is attributed to your pull request. A rerun that passes is a flaky failure, and nothing is attributed. While Stamp counts GitHub as failing (When GitHub is failing) it does not ask for the rerun, since the red is then most likely GitHub's: it asks once GitHub stops failing, at the next check of an auto-merge the hold holds (with none waiting it is not asked, and the cap opens no revert of your pull request; a rerun someone else starts counts). If GitHub's answer to the request is lost, Stamp reads the run back 2 minutes later and asks once more only if the rerun did not start. If the hold is capped and the branch is still red at the cap, and the rerun was still red by then, Stamp opens a revert pull request of it (a rerun still running at the cap, or one GitHub refused, opens none, and so do failed jobs that passed in a later run by then: see below) (Revert "…", labelled with the hold's label so the hold lets it through) and tells you its link. It is never auto-merged: review it, merge it if your change broke the branch, or close it and fix forward; one is opened per red episode. Stamp records it as opened through Stamp by you (the agent that opened the reverted pull request), so it shows in your stale pull request digest, and your own approval does not count on it. If someone already has an open revert of your pull request, Stamp links that one instead and opens none; if your pull request landed through Stamp's merge queue, GitHub cannot revert it and the notice says so: open the revert yourself if your change broke the branch. When Stamp cannot open the revert (GitHub refuses it, for example on a merge conflict), it also comments on your pull request that it needs a manual revert (once per red episode), and the notice links that comment when it could post it. If your pull request's own run did not stay red (a rerun of it, or a later run of the workflow, passed, and only a later run keeps the branch red), Stamp opens no revert of it and tells only the on-call; so too when every job that failed in it passed in the newest run of the workflow Stamp recorded since (it was fixed forward; a job cancelled, skipped or not run there does not count as passed). Registrations end when the pull request merges or closes, on --auto --cancel, or after 14 days.

  • When several merges could have turned it red: the post-merge check names no one, but a hold with a probe (--merge-hold show prints it) re-runs the newly failing test shards on every commit of the branch since it last passed. If your pull request's commit is the first red one, and a second run of it and of the commit before it agrees, you are told as above (and a comment on your pull request names the shards and the probe runs): the cap's revert of it opens unless the branch turns green first or the jobs that failed pass in a later run by then, so fix it forward if you can. If another candidate's is, you get one line saying the probe cleared yours. A probe that blames nobody (a flaky failure, an unusable run, a second run that disagrees, a first red commit no candidate merged, or two pull requests that landed as one commit) tells only the on-call, and a failure already labelled possibly flaky is never probed. The probe runs are the repository's own probe workflow, dispatched by Stamp; they are not post-merge runs and tell you nothing themselves.

  • When its registrant leaves the server: a registration ends once Stamp records that its registrant was removed from the server (the agent deleted, taken off Stamp's agent list there, or removed; for a CLI agent, the person running it removed; Raft reports some role changes, such as becoming a guest, as a removal too). Stamp cancels it in the registrant's name and leaves one comment on the pull request, and --auto --status reads CANCELLED with cancelReason: registrant_removed. Nothing merges in a removed registrant's name. The pull request stays: an agent still on the server that may register arms it again (stamp pr merge NUMBER --repo OWNER/REPO --auto --head HEAD_SHA --base BASE_SHA).

  • When it merges: you are not sent the pull request's merged notice (it is your own action), but your auto-merge records it once: Auto-merge merged OWNER/REPO PR N as SHA7. followed by the cleanup line (the repository's .stamp/prompts/after-merge.md when it has one). When that line is Stamp's default, the notice is only kept in your stamp inbox history and does not reach Raft: you arranged the merge, and stamp pr merge --auto printed the cleanup line when you armed it. When the repository has its own after-merge prompt, or Stamp could not read it, the notice reaches you as a Raft event about that pull request and wakes you: the prompt may ask for more than a cleanup. On a merge-queue base the queue's merged notice tells you instead, with the same line; when that line is Stamp's default, it may arrive in your Raft inbox without waking you.

  • On a merge-queue base: the pull request enters the FIFO queue when its auto-merge check finds it ready (not at registration time). Check queue progress with stamp pr queue status NUMBER --repo OWNER/REPO: autoRequeue: true on a stale request means the queue re-enqueues it automatically keeping its position—do not re-enqueue. A landed request reports memberCommit (this pull request's commit on the base) and batchTip (landingSha for older readers). Because GitHub marks queue-landed pull requests as closed rather than merged, filter them on GitHub with gh pr list --state closed --label stamp-merged or is:closed label:stamp-merged.

  • Where a queued pull request stands: stamp pr view NUMBER --repo OWNER/REPO prints one merge queue: line while it is queued: the stage (waiting, held while the target is red, or the batch's forming/preparing/testing/publishing), position N of M waiting or the batch and its size, then (for your own request) its hint and next: command, and the stamp pr queue status command (queue in --json: state, position, waiting, batchId, batchSize, heldForBase, baseCiUrl, and for the requester requestId, hint, hintKind, nextCommand). stamp pr queue status items carry waitingCount, batchState, batchSize and nextCommand, the one command to run next when there is a clear one (stamp pr checks N --repo OWNER/REPO after a failure, stamp pr view N --repo OWNER/REPO before a new request after a stale outcome; empty means wait). A request you enqueued yourself is told once when its batch starts testing (merge_queue_request action testing; an auto-merge's request gets auto_merge.batch_testing). While the queue (enabled) holds it at its head, the verdict reads QUEUE_READY, whichever GitHub App installation or act_as grant your view reads through, and its Auto-merge: line says it is in the merge queue with its position (autoMerge.waitingOn ENQUEUED, queueState, queuePosition in --json).

  • Why it was sent back: hintKind failed_alone means it failed when tested alone, so the cause is your change (or flaky CI): read stamp pr checks, fix, enqueue again. failed_on_prefix means the same thing found another way: after its batch failed, the queue tested the batch's first pull requests on their own at once, those ahead of yours passed and landed, and yours failed on top of exactly them (the hint names them): read stamp pr checks, fix, enqueue again. prefix_round means your batch failed and its pull requests are being retested together in one round (the first alone, the first two, and so on, at once; the longest that passes lands), or that such a round landed the ones ahead of yours and your request went back to the front of the queue: nothing to do. member_changed means another pull request in its batch changed (the hint names it); your request went back keeping its position, nothing to do. While the target branch's own CI is red the queue is paused: held and waiting requests get hintKind base_wait and one notice (waiting requests: merge_queue_request action base_wait), naming the red run, the target commit and workflow, and who is fixing it (Fix in progress: #N, or No fix PR is queued: open one labelled fix-red, or a GitHub revert, and queue it; it is tested first).

  • Failed checks and queue runs: stamp pr checks NUMBER --repo OWNER/REPO prints stamp run view RUN_ID --repo OWNER/REPO --job JOB_ID --log-failed (logCommand in --json) under each failed job, followed by merge queue runs: for recent batches containing the pull request (visible on anyone's PR since batches are repository state; under a failed batch it prints stamp run view RUN_ID --repo OWNER/REPO --log-failed; also exposed as queueRuns in pr view --json, and stamp run list --repo OWNER/REPO --branch stamp-mq/BATCH_ID lists a batch branch's runs).

  • When a merge-queue target's queue is not enabled or paused: during first setup (the queue saved, maybe verified, never enabled yet) merges continue directly until the queue is enabled for the first time: the verdict reads READY, and auto-merge and stamp pr merge merge as on a branch with no queue. Once the queue has been enabled, registered queue targets never merge directly via auto-merge or agent CLI. The verdict reports QUEUE_UNAVAILABLE, --auto --status says waiting for the merge queue on BRANCH to be enabled (waitingOn: QUEUE_UNAVAILABLE, notified once, and enqueued as soon as the queue is enabled or resumed), stamp pr queue status reports queueState PAUSED (paused or unconfirmed) or NOT_ENABLED (saved and not enabled yet), and agent stamp pr merge refuses with QUEUE_TARGET_NOT_ENABLED (people can still merge by hand). queueNotEnabledReason indicates the next step:

    • verified_not_enabled: a repository admin runs stamp queue enable OWNER/REPO.
    • not_verified: run stamp queue verify OWNER/REPO --pr NUMBER, then enable.
    • paused / pause_unconfirmed: a repository admin resumes or confirms on the queue page (stamp queue enable refuses with BATCH_QUEUE_PAUSED / BATCH_PAUSE_UNCONFIRMED). A paused queue forms no new batch and takes no new request, but the batch it was running still finishes: it is tested, and lands when its checks pass or fails and is settled.
    • other_installation: reconfigure under the current installation.
    • other_server: the branch is merge-queued on another Stamp server, one this server is not federated with, and that queue is not taking merges from this server (Stamp does not say why: that is the other server's to tell). Have it merged from the server that runs the queue, or ask a person to merge it. The auto-merge waits and you are told once (auto_merge.queue_unavailable); stamp pr merge is refused, as QUEUE_REQUIRED while that queue is enabled. A queue there that was never enabled or is turned off holds nothing, unless a GitHub admin of the repository registered the branch for that server (Register a merge queue target branch): then nothing from this server merges into it directly, whatever that queue's state, until it is unregistered, and a server federated with that one reads other_server too whenever that queue is not enabled.
    • Other values: disabled, state_unreadable (retired is no longer answered: a turned-off queue holds nothing, below).

    A branch the operator registers, or a GitHub admin registered for your server, but for which no queue was ever saved is not a queue target yet: pull requests into it merge directly as before. It becomes one when a repository admin first saves its queue (stamp queue save or the queue page); from then on the rules above apply. Enabling the queue immediately checks up to 25 of the repository's waiting registrations (oldest first); the rest wait for the sweep, which checks 50 every 10 minutes across up to 20,000 live registrations in all repositories, so with N steady (N <= 20,000) a registration is checked (not merged) within ceil(N / 50) x 10 minutes. Above 20,000 there is no bound; event-driven checks are unaffected.

  • When the queue is turned off: turning a queue off ends its gating on every Stamp server, whether or not the operator registers the branch (a branch a GitHub admin registered for another server keeps refusing this server's merges until it is unregistered: other_server, above): pull requests into it merge directly, by hand, with stamp pr merge, or by an auto-merge armed after the turn-off. An auto-merge armed before it relied on the queue's full test, so Stamp cancels it rather than merge it without that test: as soon as the queue is turned off when Stamp's records place the pull request on that branch, else when it would land. You get one auto_merge.queue_retired notice (verdict CANCELLED, branch, rearm: the command that arms it again at the coordinates it was armed at), on whichever server you armed it, and --auto --status reads CANCELLED with cancelReason: queue_off. A merge already on its way when the queue is turned off is refused (AUTO_MERGE_QUEUE_OFF) and the auto-merge cancelled at its next check. Turning off a queue that was never enabled (still in first setup) cancels nothing: it never held a merge. What decides is the queue's state when it is turned off, so an auto-merge armed during first setup is cancelled like any other once the queue was enabled and is then turned off. When the auto-merge had made a request in the queue and Stamp cancels it as the queue is turned off, you get its auto_merge.queue_retired notice only, not the queue's withdrawal notice too; if that auto-merge had already ended, the queue's withdrawal notice tells you. Arm it again (stamp pr merge NUMBER --repo OWNER/REPO --auto --head SHA --base SHA, with the head and base stamp pr view shows) to merge it directly; nothing merges until you do. A queue paused, or saved again and waiting for verification, still holds the branch as above.

  • Unreadable or permanently refused queue state: if Stamp cannot read whether the base is a queue target, auto-merge waits (QUEUE_STATE_UNKNOWN) and direct merge refuses with QUEUE_STATE_UNAVAILABLE (safe to retry). If the queue permanently refuses enqueue (batch_workflow_changed, batch_workflow_invalid, batch_merge_conflict, batch_git_failed), auto-merge ends (QUEUE_REFUSED in --auto --status); update the pull request and re-register, or merge directly with stamp pr merge once approved (see Who can approve). Any other refusal is waited out. A failure the queue did not pin on your pull request never ends auto-merge: while the queue is still checking the cause (hintKind checking_cause) it waits; when the request failed together with others (failed_together, e.g. batch_timeout), auto-merge enqueues it again under a new request id, up to 3 times, and then ends with QUEUE_RETRIES_EXHAUSTED in its notice (the registration reads QUEUE_REFUSED with reason queue_retries_exhausted; it was not refused for good: check stamp queue status OWNER/REPO and register again).

Auto-merge on a pull request routed to you ​

A pull request Stamp did not open has no author agent, so by default only an approver can register its auto-merge, and only where the repository allows approvers to (AUTO_MERGE_APPROVER_NOT_ALLOWED otherwise). When .stamp/routing.yml routed it to you, you may register it as an approver even where that setting is off: approve the exact head first, then run stamp pr merge NUMBER --repo OWNER/REPO --auto --head HEAD_SHA --base BASE_SHA.

  • Only for a head branch in the repository itself: a pull request from a fork is routed to you for review, but you may not register its auto-merge.
  • Only while the pull request has no Stamp creation receipt and the file at its current base still routes it to you (Stamp reads it again when you register).
  • You need your own approval of the exact head, on the pull request's current base (one given before the base was moved onto a branch that does not contain it does not count), and must not have pushed to the branch through Stamp (AUTO_MERGE_APPROVAL_REQUIRED, SELF_APPROVAL_NOT_ALLOWED otherwise).
  • The merge is unchanged: an approval that counts, green required checks and every rule of the repository.

The verdict on a PR ​

stamp pr view prints Stamp's verdict under the title, pinned to the evaluated head and base, and lists who approved that head. The first matching state applies:

  • MERGED, CLOSED, DRAFT, CONFLICT
  • CI_UNREADABLE, CI_FAILING, CI_NOT_EXECUTED (a required check never reported, past the wait for CI to start below, or was skipped in a run where another job failed or was cancelled), CI_PENDING (required checks running, or waiting for CI to start)
    • Until the pull request is approved and .stamp/CODEOWNERS is met, these leave out the required checks that may wait on a review: Stamp's own stamp/approval and stamp/codeowners, which Stamp writes from the approvals and .stamp/CODEOWNERS, and a required check that a rule requires from another GitHub App than GitHub Actions, such as atlantis/apply, that no run has reported while nothing runs at the head (below). These never hide the review state that follows. After that, they count here as any other check does, and a Stamp status not written yet is CI_PENDING until Stamp writes it (below).
  • REVIEW_UNREADABLE (including when GitHub failed the reviews read: then no approval is counted, and pr view says why on an unavailable: line), CHANGES_REQUESTED, CODEOWNERS_STAMP_REVIEW_REQUIRED, STALE_REVIEW, NEEDS_REVIEW
  • QUEUE_READY (approved; lands through Stamp's merge queue)
  • BEHIND (including when the branch must be up to date and the base moved while GitHub still reports clean)
  • BASE_UNREADABLE (GitHub reports clean, but GitHub failed, or refused as too large, the comparison of the base and head, or failed both reads of the base branch's tip, so whether the base moved is not known: pr view says which on an unavailable: line. Not ready for now; stamp pr merge reads everything again itself. See When GitHub fails part of a read)
  • BLOCKED (GitHub blocks the merge; blockedReasons lists any reported causes: REVIEWS_REQUIRED, CODEOWNERS_REVIEW_REQUIRED, LAST_PUSH_APPROVAL_REQUIRED, CHANGES_REQUESTED, SIGNED_COMMITS_REQUIRED, LINEAR_HISTORY_REQUIRED, CONVERSATION_RESOLUTION_REQUIRED, REQUIRED_CHECK_MISSING, DEPLOYMENT_REQUIRED, BRANCH_BEHIND; in stamp pr view, a conversation resolved or a deployment of the head, with nothing else on the pull request changed, can take up to 60 seconds to leave the list, while a merge and auto-merge read it live)
  • OPTIONAL_CHECK_FAILING (approved and required checks passed, but non-required checks failed so GitHub reports "unstable"; listed in optionalFailing. It does not clear on its own: auto-merge waits—fix or re-run those checks, or merge manually with stamp pr merge. Auto-merge also waits on a READY verdict whose optionalFailing is not empty)
  • UNCONFIRMED (GitHub has not confirmed a clean merge yet, including a "blocked" within 2 minutes of the last check while GitHub recomputes, and a merge state GitHub has not computed yet; Stamp re-checks automatically)
  • QUEUE_UNAVAILABLE (ready except its base is a registered queue target whose queue is not enabled)
  • MERGE_APPROVAL_REQUIRED (only for the agent reading it: ready, but the pull request changes .github/workflows/ or .github/actions/ and the repository's workflow guard would refuse this agent's merge; workflowApproval.next names the request Stamp prepared for that workflow content and the stamp request submit command. A person, or the agent once a person approved that content, reads the state beneath)
  • READY

A skipped required check counts as satisfied only when no job in the same workflow run failed or was cancelled. READY also needs GitHub's own mergeable state to be clean. checksRunning lists every check at the head, required or not, still queued or in progress; it does not change the state, but auto-merge waits until it is empty (CHECKS_RUNNING). Any failed run on the head (including workflow_dispatch) counts toward CI_FAILING until its failed jobs are re-run and pass.

A required check that no run has reported at the head, while nothing runs there, waits for CI to start for 10 minutes after GitHub was last asked to start CI at that head: the head pushed (by anyone, a force-push included), or the pull request opened or reopened, as Stamp knows it from GitHub's events and from pushes and reopens through Stamp. Meanwhile the verdict is CI_PENDING, stamp pr view says waiting for CI to start and until when, and requiredNotReported carries checks, waitUntil, note and, when Stamp knows what asked CI to start, since and event (push, opened or reopened). Past that, or when Stamp does not know when CI was asked to start, the check did not run: CI_NOT_EXECUTED, whose requiredNotReported.note and pr view say what to do when the checks should run here. GitHub may have lost the event that starts them: close and reopen the pull request (stamp pr close, then stamp pr reopen; its approvals stay), and if you had set auto-merge, set it again after reopening. If no run has started a few minutes later, push a new commit (an empty one is fine); the new head may need approving again, as approvals are tied to the head.

That way to start CI again is only for checks GitHub Actions runs: requiredNotReported.restartable lists them, the required checks that the base branch's rules require from GitHub Actions or from no particular GitHub App. A check a rule requires from another App, such as atlantis/apply, is only said not reported since then, with no remedy: reopening or pushing does not start it. When no run has reported it and nothing runs at the head, it may be one that App holds back until a review (Atlantis reports atlantis/apply only after an approval and an apply) or one whose event was lost; Stamp can neither start it nor tell which. While a run is still in progress at the head, it may still come after that run, and it is pending like any other check. Stamp's own stamp/approval and stamp/codeowners are never said not reported: Stamp writes them itself, from the approvals and .stamp/CODEOWNERS, so one not written yet is pending. So, until the pull request is approved and .stamp/CODEOWNERS is met, neither these nor such an App's check with nothing running at the head hides the review state (NEEDS_REVIEW, CHANGES_REQUESTED, ...), whatever they say. After that they read as described here. When an approved head is still missing one of Stamp's own statuses, Stamp schedules writing it again when it reads the pull request live (an agent's stamp pr view or --wait, the auto-merge sweep, the queue status, or a person opening its page; not for a draft, and not from the Raft card or another stored view), at most about once every 30 minutes for a head, and the pull request waits on it (CI_PENDING) until then. Stamp never writes stamp/codeowners on a base without .stamp/CODEOWNERS (Code owners), nor stamp/approval while the repository's approval status is turned off (The stamp/approval status), so a rule that requires one of them there holds every pull request.

A required check's pass in a workflow run GitHub does not evaluate for a pull request does not count. GitHub's docs ("Troubleshooting required status checks", section "Checks from some workflow jobs are not evaluated") count only runs started by push, pull_request, pull_request_review, pull_request_target, deployment and deployment_status, plus merge_group for a merge queue; GitHub's own dynamic runs (code scanning's default setup) show in the pull request's checks and count too. A manual run (workflow_dispatch), a schedule run or a repository_dispatch run does not count for the pull request's merge, so neither does the verdict. The check reads as not reported (waiting for CI to start, then CI_NOT_EXECUTED), and requiredUncountedRuns names the run and its event (pr view: go passed only in a manual (workflow_dispatch) run, which GitHub does not count for this pull request, or ... only in a schedule run, ...). Start the pull request's own run as above instead.

The Checks: line of stamp pr view (ciStatus: passing, failing, pending or none) summarizes every check at the head, required or not, and gates nothing: read the verdict for that. A cancelled or stale run does not make it failing when another check run of the same name succeeded or is still running (editing a description can cancel a run and start it again). A name with neither still counts as failing, and any run still running keeps the line at pending unless something fails. stamp pr checks, the pull request page's list of checks and the failing count in the web pull request list read such a run the same way. It stays listed as superseded (cancelled (superseded) in stamp pr checks, "superseded": true with --json) and counts as neither failed nor pending, so the exit code is 0 when everything else passed, 8 while a run is still running and 1 when something failed. The pull request card's passed-of-total count, the page's "since you last looked" line, the comparison of a self-approval's evidence with CI (ci_failed_after) and stamp pr list --mine --open --refresh still count it as failed.

Waiting for CI, a review or the merge ​

Do not run stamp pr view again and again while a pull request waits: each view reads the pull request from GitHub anew. Let Stamp wait for you:

sh
stamp pr view NUMBER --repo OWNER/REPO --wait 3m
  • It returns once something material changes: the verdict, the checks' summary (ciStatus), the head, or the pull request is merged or closed. It prints the new view and exits 0. A new comment, a review that leaves the verdict as it was, or one check of several finishing does not end the wait.
  • When the time runs out (--wait DURATION: 90s, 3m, 1h, from 10 seconds to an hour; --wait alone is 10 minutes), it prints the view as it is then and the line Nothing material changed in 3m ... Run the same command to keep waiting., and exits 8 (as stamp pr checks exits 8 while checks are pending).
  • It waits only while the pull request waits on someone else: required checks running or CI starting (CI_PENDING, CI_UNREADABLE), GitHub's comparison (BASE_UNREADABLE, unless GitHub refused it as too large), a review or approval (NEEDS_REVIEW, STALE_REVIEW, REVIEW_UNREADABLE, CODEOWNERS_STAMP_REVIEW_REQUIRED, MERGE_APPROVAL_REQUIRED), GitHub (BLOCKED, UNCONFIRMED), the pull request it is stacked on (BLOCKED_BY_BASE), Stamp's merge queue (IN_QUEUE, QUEUE_UNAVAILABLE), or an armed auto-merge. In any other state (merged, closed, a draft, conflicts, failing checks, changes requested, ready for you to merge) it prints the view at once with Nothing to wait for: ... and exits 0: the next step is yours.
  • In those states stamp pr view ends with the line Waiting for CI, a review or the merge? stamp pr view NUMBER --repo OWNER/REPO --wait returns when this pull request changes; no need to check it again meanwhile.
  • It returns within a few seconds of the time you give: keep that under your tool's command timeout (with a 2-minute timeout, --wait 90s; with 10 minutes, --wait 9m).
  • Stamp waits on its side without reading GitHub: it learns that a pull request changed from GitHub's events and its own writes (approvals, auto-merge, the merge queue), reads the pull request again then, and at least every 2 minutes in case an event was late or lost. While only other things change (each check run of a CI run is a change), it reads it at most every 30 seconds, so it may return up to about 30 seconds after the change. With --json the view is the document (changeToken, and wait: how Stamp's wait ended), and the line about nothing changing goes to stderr.
  • A refusal for now (429: your GitHub budget in debt, GitHub's quota) or a failure on the way (502, 503, 504, a dropped connection) is asked again 30 seconds later, up to 3 times in a row; any other error ends the wait with that error.
  • An upstream pull request, a public repository's that your server's App does not cover, and a GitLab merge request send Stamp no events: --wait reads them again every 2 minutes.

Merge queue (agents) ​

An agent with the server owner or admin role can configure, verify, enable and turn off Stamp's merge queue for a registered target branch. A branch is a registered target when the Stamp operator registered it, or when a GitHub admin of the repository registered it for your server on the repository's Settings → Merge queue page (where this Stamp lets people register branches). Registering is a person's step, never an agent's: see Register a merge queue target branch. Any agent may run setup, the read-only discovery, and status. An agent without that role proposes instead and a person approves: add --request [--note TEXT] to save, verify, enable or turn-off (without it they are refused QUEUE_SETUP_ROLE_REQUIRED, which says so):

sh
stamp queue setup OWNER/REPO --branch BRANCH [--workflow ID]
stamp queue save OWNER/REPO --branch BRANCH --workflow ID --ci-policy head|all --max-batch N --wait SECONDS --timeout SECONDS [--protect GLOB... | --protect-none] --confirm
stamp queue verify OWNER/REPO --pr NUMBER
stamp queue enable OWNER/REPO
stamp queue turn-off OWNER/REPO
stamp queue save|verify|enable|turn-off OWNER/REPO ... --request [--note TEXT]
stamp queue status OWNER/REPO
stamp queue fixer OWNER/REPO [--set @HANDLE | --me | --clear]
  • setup discovers workflows, jobs, branch-required checks, and the confirmation digest (--workflow names the primary Test workflow only; branch-required checks it lacks are found in other workflows on the same head, listed as additional workflow: and sampled from recent green runs, and every candidate must pass them too).
  • save confirms the configuration (--protect GLOB replaces protected paths, --protect-none clears them, omitting both keeps existing paths). An agent may only keep or tighten a saved queue: removing a protected path, changing --ci-policy from all to head, choosing another workflow (or other additional workflows), changing the mode, and turning on a queue that was turned off are refused BATCH_PERSON_ONLY_CHANGE; a person with admin on the repository makes those changes on the settings page.
  • verify runs the saved CI on an approved pull request without merging it (requires a GitHub approval or a non-author Stamp approval at the current head; author self-approval does not count for verify; the pull request's head must be a branch of the repository itself, a fork's head is refused BATCH_VERIFICATION_FORK_HEAD). A queue runs at most 3 verifications an hour (BATCH_VERIFICATION_RATE_LIMITED, 429, with the time to retry). enable requires a passing verification.
  • Setup refuses a target branch whose rules ask for something the queue does not check (BATCH_PR_RULE_UNSUPPORTED, naming the rule: required conversation resolution, required deployments, code scanning, signed commits), and a batch about to land is refused the same way (batch_pr_rule_unsupported) if such a rule was added since.
  • One requester holds at most 20 waiting requests in a queue; the next stamp pr queue enqueue is refused BATCH_REQUESTER_QUEUE_FULL.
  • The merge queue's candidate branches (stamp-mq/*) are Stamp's: a push that creates, moves or deletes one is refused REF_RESERVED_FOR_STAMP.
  • status (--json) reports the active batch plus baseWait (when waiting on a red target branch's CI: batchId, base, workflowId, runId, runUrl, since, waitingSeconds, nextCheck) and stalled (reason: batch_overdue | base_wait_long | waiting_no_batch, since, batchId, ageSeconds, which sends one merge_queue_stalled notice—do not re-enqueue; contact the maintainer or operator).
  • CI and protected-path changes: a pull request that modifies a configured workflow, .github/actions, a local action/reusable workflow it uses, or a --protect path is tested alone in a single-PR batch ("tested alone because it changes the CI definition (PATH)") and judged by the workflow as its own merged tree defines it. When it lands (or when the workflow changes on the target branch outside the queue), the queue re-pins the workflow automatically (workflow_repinned:PATH:OLD->NEW). Only when a configured workflow file is deleted, no longer runs on pull requests, or stops reporting required checks do requests fail with batch_workflow_invalid naming the file (a candidate that would leave the workflow in that state is refused the same way), and an admin must re-run setup, save, and verify. Verification itself refuses pull requests that touch CI or protected paths (batch_workflow_changed).
  • Merge conflicts: a pull request that does not merge onto the target branch fails alone with batch_merge_conflict (its receipt's reasonPath names the first conflicting file when git reports one); the other pull requests of its batch go back to the front of the queue and are batched again without it, with nothing for their requesters to do. Rebase or merge the target into it, push, and enqueue again. One that conflicts only with another pull request ahead of it in the batch is not failed: it is tested again after that one lands. A failure to build the candidate that is not a conflict (git, GitHub or Stamp itself failing) is retried by the queue (after 10 s, 30 s, 60 s, then every 2 minutes) and does not fail a request, unless the same git step fails the same way at one pull request's head 3 times in a row: that one request fails alone with batch_git_failed (its hint and gitStep name the git command and exit status) and the others go on without it; its auto-merge ends (QUEUE_REFUSED, the notice names the git step). Push a new head and enqueue again (or register auto-merge again).
  • Workflow content approved, then changed: a pull request you queued under a person's approval of its workflow content is checked again as its batch is built. If, since you queued it, the target branch changed a file of that approval, or a workflow file you change too, it fails alone with batch_workflow_approval_stale (reasonPath names the file) and its auto-merge ends; the others go on without it. Bring the target branch into it, push and enqueue again: the workflow guard checks it again and prepares a request for the new content if one is needed. If only a pull request ahead of it in the batch made the change, it is not failed: it waits at the front of the queue for that one's outcome. On a branch whose queue is GitHub's own merge queue ("Existing GitHub merge queue"), such a pull request is refused batch_workflow_content_github_queue, when you queue it or before Stamp hands it to GitHub: GitHub builds the merge group itself, and nothing there holds it to the approval. A person merges it on GitHub, or the queue's admins move the branch to Stamp's own queue.
  • Fix lane while the target is red: while the queue holds requests because the target branch's own CI is red (baseWait), a pull request labelled fix-red (or the branch's merge hold label; any case) or a GitHub revert (title Revert ") is tested first, in its own batch of fix requests only (several fixes are batched together), instead of waiting for the target to recover. Add the label before or after enqueueing (read again at the hold's once-a-minute check); removing it makes the request ordinary again. The request still needs every required check green; its receipt carries fixLane (label:fix-red or revert), its requeued notice reason fix_lane, and status marks the batch fixLane (the held batch is under held). The held requests keep waiting for the target's own CI to pass. While the target is green the label changes nothing.
  • The queue's fixer: one agent per queue is on call when its target goes red or the queue stalls. stamp queue fixer OWNER/REPO shows it; --me volunteers you (while nobody else live is on call), --clear steps down (yourself; a server owner or admin clears anyone), --set @HANDLE names another agent of your server (a server owner or admin only, person or agent). The fixer gets one merge_queue_fixer notice per red-target hold (action base_red: the red commit, workflow and run, how many requests are held and waiting, and what to do) and one per stall episode. When you get one: open a pull request that fixes or reverts the breaking change, label it fix-red (or keep GitHub's Revert "…" title), get it approved and queue it with stamp pr queue enqueue NUMBER --repo OWNER/REPO --request-id ID --head SHA --base SHA; it is tested first, in the fix lane, and the queue resumes once the target is green. Watch with stamp queue status OWNER/REPO. Everyone else's base_wait hint names the fixer on call (plain text, not a mention). stamp queue status, stamp pr queue status and stamp settings -R OWNER/REPO (merge_queue_fixer) show who it is.
  • Ask a person (--request): without the role, stamp queue save ... --confirm --request runs every check save runs (coverage, registered target, native mode, discovery, the confirmation and the queue's revision) and, instead of saving, files a merge_queue_setup request with the full configuration and the revision you read; the output (request in --json: id, url, notified, approvedRevision, loosens, next) gives its id and link and says a person who is an owner or admin of the server must approve it. Stamp messages the server's owners and admins it confirms are admins of the repository on GitHub, every one of them when it finds none, and names no one (notified is empty): next says so, and you send the link only if they ask. When next says nobody was messaged, send them the link. A change an agent's own save would be refused for (BATCH_PERSON_ONLY_CHANGE) can be proposed this way: loosens names it and the approver sees it. Filing the same thing again returns the pending request; something else while one is pending is MERGE_QUEUE_REQUEST_PENDING (close it with stamp request close ID --reason TEXT first). The approver, who must also be an admin of the repository on GitHub, saves it as themselves at exactly that revision. You are told when it is decided. Once it is approved you may run stamp queue verify OWNER/REPO --pr N and then stamp queue enable OWNER/REPO yourself, without the role, for that revision only and within 7 days: any later change of the queue's configuration (another save, or the enable itself) ends it, so one approval enables once. verify --pr N --request and enable --request ask to verify and enable a configuration a person already saved. stamp request get ID shows where a request stands.
  • Turning the queue off (turn-off): stamp queue turn-off OWNER/REPO does what a repository admin's Turn off the merge queue does, under the gate enable has: the server owner or admin role, or a person's approval of your turn-off --request. You are recorded as who turned it off. Every waiting request is withdrawn (canceled, reason withdrawn; its requester is told, and its hint and hintKind (queue_retired, or queue_retired_auto_merge for an auto-merge's request) say what happens next), and so is every request of a batch the queue would still have put back in line (one that went stale, failed as a combination, or is held while the target branch is red; it goes to history); history and receipts are kept. A queue in first setup (saved, never enabled) is turned off like any other. It is refused BATCH_QUEUE_ACTIVE (with batchId and batchState) while a batch is testing or publishing (or preparing while a task builds it): wait until it lands or fails and run it again; a person can pause the queue first so no new batch forms after it (a paused queue still finishes its running batch). If the queue's own turn holds it for a moment, Stamp keeps trying for a few seconds before answering QUEUE_BUSY (503: try again in a moment; nothing was turned off). Turning it off again changes nothing (turnedOff: false; the CLI says it was already off). What it leaves: the branch is no merge-queue target any more, on every Stamp server, though the operator registers it: pull requests into it merge directly, and each armed auto-merge that relied on the queue is cancelled and its author told to re-arm (above: When the queue is turned off). Turning a queue back on stays a person's: your own save or enable of a turned-off queue is refused BATCH_PERSON_ONLY_CHANGE. The answer (--json) is status's with turnedOff, withdrawn, autoMergeCancelled, authorizedBy (via role, or request with requestId and revision) and next. Only Stamp's own (native) queue on a registered target (QUEUE_MODE_AGENT_UNSUPPORTED, QUEUE_TARGET_NOT_REGISTERED); a queue with no setup is BATCH_CONFIGURATION_MISSING. turn-off --request files a merge_queue_setup request of step turn_off (nothing is turned off yet); once a person approves it you may run stamp queue turn-off OWNER/REPO yourself for 7 days, while the queue stays at the revision you read (a save in between ends it: QUEUE_TURN_OFF_APPROVAL_STALE, ask again), and it turns the queue off once, since only a person's save or enable turns it back on. A request for a queue that is already off is BATCH_QUEUE_RETIRED. stamp queue status prints turn off: you may turn this queue off with stamp queue turn-off OWNER/REPO (...) when you could now, or turn off: refused while batch B is testing; once it settles ... while a batch would refuse it (turnOff in --json: via, command, for an approval requestId, revision, until, and waitFor with batchId and batchState while a batch refuses it).
  • Scope: only registered queue targets on covered repositories using Stamp's queue mode are supported (else QUEUE_TARGET_NOT_REGISTERED, whose next step names who registers the branch, REPOSITORY_NOT_COVERED, or QUEUE_MODE_AGENT_UNSUPPORTED; a repository whose queue a GitHub admin registered for another Stamp server is BATCH_REPOSITORY_OWNED, naming no server; a push to a registered branch is refused QUEUE_TARGET_REQUIRES_PR on every server, yours included; status lists the registered targets).

Merge it yourself ​

sh
stamp pr merge NUMBER --repo OWNER/REPO --head HEAD_SHA --base BASE_SHA

After Merged … the CLI prints what is left for you: clean up what you made for the pull request (its worktree, branch and temporary files), or the repository's own words from .stamp/prompts/after-merge.md. You are not sent a merged notice for your own merge, so this is where you read it. In --json (and the PUT /v1/repositories/OWNER/REPO/pulls/N/merge answer) the same line is the cleanup field, one line as the merged notice says it; afterMerge is the repository's file text as written (absent without the file).

When the same merge was started moments ago: if your auto-merge (or an earlier identical stamp pr merge of yours) started merging this pull request in the last 30 seconds and Stamp has no result for it yet, the merge is refused with 409 MERGE_IN_PROGRESS. Your request sent nothing. Stamp does not know yet whether the earlier merge landed, is still on its way or failed, so do not send the merge again yet: check the pull request with stamp pr view NUMBER --repo OWNER/REPO. The answer carries mergeStartedAt, mergeStartedSecondsAgo, checkCommand, autoMerge: "registered" when your auto-merge is registered for the pull request, and retryAfterSeconds (also the Retry-After header): if the pull request is still open after that long, send the identical merge again (a registered auto-merge does on its next check), and it merges at most once. 503 PR_WRITE_OUTCOME_UNKNOWN is kept for an earlier merge GitHub did not confirm, or one started more than 30 seconds ago with no result: re-read the pull request before doing anything.

When the base moves while Stamp merges: GitHub merges into whatever base the pull request has when the merge reaches it, so right before it merges Stamp reads the pull request again and refuses 409 PR_BASE_MOVED (nothing sent; currentBase in the answer) when it is now on another base branch, or its base branch was rewritten (the new base commit does not contain the one your --base named). A base branch that only moved on (other pull requests merged into it) is not a move: the merge goes ahead onto its tip. After a refusal, read the pull request again before you merge: an approval given at the old base may not count at the new one. While your merge is on its way, a base change sent through Stamp (stamp pr edit --base, or stamp api with PATCH pulls/N and a base, or GraphQL updatePullRequest with a baseRefName) is refused at once with 409 PR_CHANGE_IN_PROGRESS, nothing changed, and so is your merge while such a change or another merge of the pull request is on its way: run it again in a few seconds. stamp pr queue and auto-merge do the same (auto-merge checks again shortly by itself). A base change a person makes on GitHub itself is not held back.

When GitHub fails your merge ​

When GitHub fails the merge call itself (503 PR_MERGE_OUTCOME_UNKNOWN: GitHub answered 5xx or timed out, so the merge may have landed; 503 PR_MERGE_NOT_SENT: GitHub was too slow to send it in time) and you are the pull request's author, Stamp keeps the merge and finishes it by itself, whether or not it counts GitHub as failing. The status and code stay; the next step says so, with the fields kept: "auto_merge", keptHead, keptUntil and cancelCommand. Stamp writes an auto-merge in your name pinned to the head you asked to merge (it does not follow later pushes) for 6 hours. It reads GitHub first, so it never merges twice, and it merges once GitHub answers again and the pull request passes what an auto-merge waits for, which is more than stamp pr merge asks: an approval at that head (the verdict READY), every check at that head finished and none failing, the checks that are not required included (OPTIONAL_CHECK_FAILING waits until they pass), no push to the branch that is not on GitHub yet, and no merge hold; on a merge-queue base it enqueues that head instead (and waits while the queue is unavailable or its state cannot be read). The merge itself then checks everything stamp pr merge checks. You get your auto-merge's notices: a wait that will not clear by itself (auto_merge.waiting for OPTIONAL_CHECK_FAILING, auto_merge.checks_running after 60 minutes, and the others above), auto_merge.merged when it merges, or auto_merge.kept_ended when it ends without merging (the lost merge landed after all, the pull request was closed, its head moved, or the 6 hours passed). A head that moved or a pull request closed unmerged ends it for good, and you are told once that is recorded: a push back to that head or a reopen does not bring it back (--auto --status then says Stamp ended the merge it kept because the head moved or the pull request was closed: CANCELLED with cancelReason: kept_ended). stamp pr merge NUMBER --repo OWNER/REPO --auto --status says it is the merge Stamp kept after GitHub failed it, pinned to its head, and until when (--json: kept, keptUntil). The answer's cancelCommand (stamp pr merge NUMBER --repo OWNER/REPO --auto --cancel --head HEAD --base BASE, run as printed: the head and base it is pinned to) withdraws it from Stamp's own records, so it works while GitHub is still failing; once Stamp has recorded the pull request merged or closed, it answers as any withdrawal does. Running the same merge command again is safe but not needed. Not kept, answered as before: another agent's merge (an approver's), a merge with --subject/--body, one through an act-as grant, or one whose pull request an auto-merge already holds (another agent's, or your own --auto, which sends the merge itself).