--- title: "omni-queue — OmniRoute's own merge queue" --- # omni-queue: OmniRoute's own merge queue `omni-queue` is the merge queue OmniRoute runs on its own GitHub Actions minutes, built to replace the Mergify queue described in [MERGE_TRAIN.md](MERGE_TRAIN.md). It ships **inert**: nothing runs until the repository variable OMNI_QUEUE_ENABLED is `true` (set it only after the `omni-queue` environment exists, see [Before OMNI_QUEUE_ENABLED is set](#before-omni_queue_enabled-is-set)), and the `mode` in `config/merge-queue/config.json` ships as `live` (green candidates land). Since the cut-over (see [Cut-over and rollback](#cut-over-and-rollback)) the queue label is how a pull request lands on a release branch, and the status door of the [Ruleset](#ruleset) refuses any commit there without the land status. `shadow` (compose and test, never land) is still a supported mode: the queue ran in it before the cut-over, and a switch back to it is a way to stop landing without stopping the queue (see [Shadow mode and live mode](#shadow-mode-and-live-mode) and [Before a mode change or a stop](#before-a-mode-change-or-a-stop)). > **2026-11-19: the Mergify merge queue is retired** (owner's decision; step 1 of > [Cut-over and rollback](#cut-over-and-rollback)). `.mergify.yml` no longer defines a queue and > refuses the Mergify commands that merge or rewrite a pull request. From then until omni-queue ran > in live mode, release PRs were merged by hand under the repository ruleset "Require green gates on > the active release" (`Gate / CI` + `Gate / Quality`); mentions below of Mergify as the current > merge path describe the state before 2026-11-19. ## Why - **Cost.** Mergify bills per active contributor seat, and batching with automatic bisection is a paid feature ("Cannot use Merge Queue batch" on the free plan, #7220). omni-queue costs the CI minutes it uses and nothing else. - **Throughput.** One CI run validates a batch of up to `batch.maxSize` PRs (12 in the shipped config, where the batch size starts at 6 and adapts; see `batch.adaptive`). With 6 green PRs per batch, 30 PRs land in about 5 full CI runs instead of 30. A red batch costs roughly log2(N) extra runs to isolate the culprit. - **The tested tree is the tree that lands.** The default landing mode pushes the exact candidate commit that CI validated. No intermediate, untested tree ever reaches the base. - **PRs stay "Merged" with their contributors' credit.** Every PR head becomes an ancestor of the base, so GitHub marks each PR as merged by its own author's commits. - **House rules no product sees**: release freeze (Hard Rule #21), agent-instruction surfaces, `hold` labels and a red base are all part of the eligibility rules below. ## Design at a glance ```text approver labels the PR `omni-queue` │ (pull_request_target: labeled) ▼ job "approval" ── approve.mjs writes commit status omni-queue/approval = success on the head SHA of the labeled event, the head the approver saw (App token, creator [bot]) │ ▼ job "tick" (every 5 min, on queue-relevant PR events and when a candidate's CI completes; one global concurrency group omni-queue-tick: a running tick is never cancelled; a newer waiting tick replaces an older waiting one, which shows up as a "cancelled" omni-queue run and is harmless) 1. load state/.json from branch omni-queue-state (compare-and-swap) 2. nothing in flight, no pause → a hotfix or base-repair PR alone (lanes), else pick up to the batch size (batch.maxSize, or the adaptive window) eligible PRs, FIFO by approval time (under a base-red pause: a base-repair PR alone, or nothing) 3. compose in a scratch bare repository: git merge-tree --write-tree + git commit-tree, one merge commit per PR, base first-parent chain 4. push the candidate as a NEW branch omni-queue//- → ci.yml + quality.yml run their full profile (as for merge_group today) 5. later ticks read the candidate's checks: green → check composition, queue-refs protection and base tip, then write omni-queue/land and land (merge-ff push), or record "would-land" (shadow) red → re-run its failed jobs once (flakyReruns), then classify: infra retry | base check | bisect | culprit timeout → infra path 6. judge the queue's health, regenerate the dashboard issue, and save state (CAS) when it changed or once per hour as a heartbeat ``` The entry points are `scripts/merge-queue/tick.mjs` (one idempotent tick, the only writer of queue state) and `scripts/merge-queue/approve.mjs` (binds a label to a head SHA), both run by `.github/workflows/omni-queue.yml`, and `scripts/merge-queue/watchdog.mjs`, run by `.github/workflows/omni-queue-watchdog.yml` with the default token, limited to `contents: read`, `issues: write` and `pull-requests: read` (it reads the state files and the open PRs carrying the queue label, and keeps one issue, `omni-queue: the queue is not making progress`, open while one of its signals fires: see [Who is told, and when](#who-is-told-and-when)). Every module under `scripts/merge-queue/` uses Node built-ins only: the queue workflow never runs `npm ci`, so no third-party install script runs next to the App token. | File | Responsibility | | ---------------------------------------- | ------------------------------------------------------------------ | | `scripts/merge-queue/contracts.mjs` | shared names, state shape, ref naming, merge-commit trailers | | `scripts/merge-queue/config.mjs` | loads and validates `config/merge-queue/config.json` | | `scripts/merge-queue/eligibility.mjs` | which PRs may enter a batch, and why not | | `scripts/merge-queue/checks.mjs` | verdict of a candidate's check runs | | `scripts/merge-queue/classify.mjs` | infra vs base-red vs PR-red | | `scripts/merge-queue/compose.mjs` | builds and pushes candidates without a working tree | | `scripts/merge-queue/land.mjs` | `merge-ff` push and `squash-api` landing with the tree guard | | `scripts/merge-queue/bisect.mjs` | bisection state machine | | `scripts/merge-queue/state.mjs` | state document on `omni-queue-state` with compare-and-swap | | `scripts/merge-queue/github.mjs` | minimal REST client (retries, pagination, comment-once) | | `scripts/merge-queue/dashboard.mjs` | the per-base dashboard issue | | `scripts/merge-queue/candidate-base.mjs` | base SHA of a candidate push, read by `ci.yml` / `quality.yml` | | `scripts/merge-queue/cli.mjs` | `npm run queue -- …` for the owner and the skills | | `scripts/merge-queue/apply-ruleset.mjs` | applies the release and the queue-refs rulesets | | `scripts/merge-queue/gitexec.mjs` | the one way the queue runs git (no shell, token in env, redaction) | | `scripts/merge-queue/refs-guard.mjs` | reads whether GitHub enforces the queue-refs ruleset | | `scripts/merge-queue/history-map.mjs` | maps landed commits to their PR for the release scripts | | `scripts/merge-queue/watchdog.mjs` | the issue opened when the queue is not making progress | ### Candidates - **Ref name**: `omni-queue//-`, for example `omni-queue/release-v3.8.55/b42-0123456789ab`. The SHA suffix makes every distinct candidate a new branch, so the queue **never force-pushes**. An infra retry of the same SHA gets a new batch id (`b42-r1`), a CI run on the bare base gets `omni-queue//basecheck-`, and its infra retry `basecheck--r1` (the SHA is named once). - **Merge commits**: one per PR, subject `Merge PR #N: (@author)` (title flattened and truncated by `sanitizeTitle`), followed by machine-readable trailers: `Omni-Queue-PR`, `Omni-Queue-Head`, `Omni-Queue-Author`, `Omni-Queue-Base`, `Omni-Queue-Target`, `Omni-Queue-Batch`. Nothing is written into the tree: CI reads the base SHA from the `Omni-Queue-Base` trailer of the top commit (`scripts/merge-queue/candidate-base.mjs`). - **Skip markers are disarmed**: GitHub skips push workflows when the head commit message carries `[skip ci]`, `[ci skip]`, `[no ci]`, `[skip actions]` or `[actions skip]`. A PR title with one of them would silence CI on its candidate, so `sanitizeTitle` puts each marker in parentheses (`[skip ci]` → `(skip ci)`) before the title reaches a merge commit. - **Stacked PRs**: a PR whose head is already contained in another PR of the same batch gets no merge commit of its own; it lands with the batch and is reported as merged with it. - **CI profile**: `ci.yml` and `quality.yml` treat a push to `omni-queue/**` like a `merge_group` event (full profile, hosted runners). Deploy and publish workflows never run on that prefix. What differs from Release-Green is in [One check profile for candidates and Release-Green](#one-check-profile-for-candidates-and-release-green). - **Never stricter than a pull request**: the gates that are base-relative on a pull request (`check:file-size`, `check:complexity-ratchets`, `check:dead-code`, `check:boundary`, `check:ts7-diagnostics-ratchet`) compare a candidate with its base (`--base-ref` = the candidate base), and the i18n docs drift check is advisory against that base, as it is on a pull request. Drift the base picked up mid-cycle therefore never reds a candidate; the absolute and strict verdicts stay on `main`, `merge_group` and Release-Green. - **AI attribution over the whole range**: with `merge-ff` the contributors' own commits land unchanged, so `ci.yml` runs `check:ai-attribution` over `<candidate base>..<candidate>` (Hard Rule #16), not only over the PR metadata. - **Release numbers**: `npm run release:reconcile` maps each landed commit to its PR through the `Omni-Queue-PR` trailer, writes one changelog bullet per PR, and counts a PR landed by the queue as one commit in "Release by the numbers" and in the Top 25 ranking, so `merge-ff` cycles stay comparable with squash-only ones (`landingUnits` in `scripts/release/reconcile-changelog.mjs`). ### Landing modes (`landing.mode`) | Mode | How | Trade-off | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `merge-ff` (default) | `git push --force-with-lease=refs/heads/<base>:<tip read> origin <candidateSha>:refs/heads/<base>`, no `+`. The lease is the compare-and-swap: a base moved, rewound or deleted since that read is refused (`stale info` → `land-rejected`); the tick recomposes. | Atomic; the landed tree is the tested tree; PRs become "Merged" automatically. History gains merge commits (`git log --first-parent` stays readable). The land status is written right before the candidate is landed, not when the candidate branch is pushed (see [Who lands](#who-lands-landingactor)). | | `squash-api` | Checks that the base tip is still the composed base, then `PUT /repos/{owner}/{repo}/pulls/N/merge` with `merge_method=squash` and `sha=<head>` for each PR in order, then compares the base tree with the candidate tree. | One commit per PR, like Mergify. The writes are not atomic and the intermediate trees were never tested. A tree mismatch pauses the queue (`tree-divergence`) and opens an issue. | ### Who lands (`landing.actor`) The `landing` block of `config/merge-queue/config.json` also says who performs the landing and which commit status the release rulesets require (`scripts/merge-queue/config.mjs`): | Key | Values | Meaning | | --------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `actor` | `app` (the default when absent) or `owner` | `app`: the App's token pushes or merges. `owner`: the owner's token (`OMNI_QUEUE_LAND_TOKEN`) does, and the queue's merge commits carry `landing.identity`. | | `identity` | `{name, email}`; the email ends in `@users.noreply.github.com` | Required when `actor` is `owner`, refused otherwise. | | `statusContext` | `[A-Za-z0-9._/-]{1,100}`, starting with `omni-queue/`; default `omni-queue/land` | The commit status the release ruleset requires. It must not equal a name in `requiredChecks` or `aggregateChecks`, nor an approval context (`omni-queue/approval`, `omni-queue/protected-approval`). | | `signing` | `none` (the default when absent) or `ssh` | `ssh`: every merge commit the queue composes is signed with the owner's SSH key (see [Signed merge commits](#signed-merge-commits-landingsigning)). Refused unless `actor` is `owner`. | With `actor: "owner"` (the value in the shipped config): - the merge commits of a candidate carry `landing.identity`; - right before landing, the tick writes the land status with the **App's** client (never the land token), then lands with `OMNI_QUEUE_LAND_TOKEN`: the fast-forward push with `merge-ff`, each per-PR API merge with `squash-api`. Everything else the tick does, composing and pushing the candidate included, still uses the App token, and the land token reaches only the tick step of the workflow; - the land status is all the App contributes to the landing. The push itself is the owner's, so the base's activity shows a push by the owner. **Identity of the merge commits**, first match wins (`createTickDeps` in `scripts/merge-queue/tick.mjs`): 1. `OMNI_QUEUE_GIT_NAME` and `OMNI_QUEUE_GIT_EMAIL`, both set (tests and the sandbox only; the workflow never sets them); 2. `landing.identity`, when `landing.actor` is `owner`; 3. `OMNI_QUEUE_BOT_NAME` and `OMNI_QUEUE_BOT_EMAIL`, both set: the App's bot user, which the workflow resolves in the step "Resolve the bot identity"; 4. the bot identity derived from `appSlug` (`<appSlug>[bot]`). That identity is on the merge commits the queue composes. Only `merge-ff` lands them. With `squash-api` they never reach the base: GitHub writes one squash commit per pull request and chooses its author from the pull request author's account, whatever `landing.identity` says (measured in a sandbox rehearsal: one squash commit per PR, the contributor as author). **When the landing does not complete**, the queue withdraws the land status: it writes `failure` on the same commits. Every commit is attempted even when GitHub refuses one, and a refused withdrawal never stops the pause or the failure that follows. The tick also saves the in-flight stage `landing` before it writes the land status. At the end of every tick (every mode, never in a dry-run), when a batch that was at that stage is no longer kept there (dropped, recomposed, retried, isolated as culprit, candidate lost, paused), the tick reads the newest land status the App created on its commits and turns a `success` into `failure`; this also covers a tick that died after the blessing. Only the App's statuses count, as for the release ruleset: a later `omni-queue/land` status posted by anybody else neither hides the App's `success` nor stands for one. A status whose creator GitHub does not report (missing or null) may be the App's, and may only add a reason to withdraw, never remove one: the tick writes `failure` when the App's newest status is `success`, or when the newest of the App's and those statuses is `success` (a withdrawal only ever writes `failure`, so this side is the safe one). A batch that is **held** at that stage instead of landed goes back to the stage `testing`, so the same tick withdraws its status too: a manual pause, a release-freeze that holds the green batch, or checks that went back to pending. The batch is blessed again only right before it lands (after the resume, when the freeze lifts, when the checks are green again). A paused base whose tick does not process the batch in flight sends it back to `testing` the same way, whatever the pause reason (a base-repair batch blessed under a `base-red` pause whose lane no longer runs, for example): a paused base never holds a batch at the landing stage. Before any of this, every tick (every mode, `merge-ff`) first checks whether a batch stored at the landing stage is already the tip of the base: then it landed and its tick lost the state save. The tick records it as landed (`landed` event, counters, the green verdict of the new tip, and in live mode the labels and comments of a landing) and writes no `failure` on the tip. A pause tick or a shadow tick that meets such a batch records it the same way; shadow mode lands nothing, but it records a landing a live tick made. A withdrawal GitHub refuses while the landing withdraws its own blessing (the landing ended with a verdict other than landed) is tried once more by the pass that runs right after the batch in flight is handled (below); other refusals wait for the next tick. Every refused write is recorded with an `error` event, detail `<batch>: could not withdraw <landing.statusContext> (<why>) on <sha12> (<error>)`, and stored in the state field `landWithdrawals` (see [State](#state)). Every later tick that visits the base, on a paused base too, retries the stored withdrawals before it handles the batch in flight: it reads the land statuses of each stored commit, writes `failure` where the same rule finds a `success` (the App's newest, or the newest of the App's and those without a readable creator), and drops the entry once that write succeeds or neither is `success` any more (or there is no status: GitHub answers an empty list for a commit it does not know, so such an entry leaves at its next retry). A refused retry keeps the entry and counts an attempt, and so does a failed read. A tick whose only change is that count does not save the state (the hourly heartbeat, or any other change of the same tick, writes it), so `attempts` counts the failed retries of the ticks that saved, a lower bound. No count drops an entry: the queue never gives up on withdrawing a blessing. A stored withdrawal is queue work (`hasQueueWork` in `scripts/merge-queue/contracts.mjs`): a tick run without a base visits its base through the base's open dashboard issue even when no labeled PR targets it (`discoverBases` in `scripts/merge-queue/tick.mjs`; see [State](#state)), and the watchdog judges that base (see [Who is told, and when](#who-is-told-and-when)). An entry first refused more than 60 minutes ago makes the queue stalled (`STALL_WITHDRAWAL_MINUTES`, see [Health](#health)): one alert mentions the approvers. An entry refused for a day (`WITHDRAWAL_ALERT_MINUTES` in `scripts/merge-queue/tick.mjs`, 1,440 minutes from its `since`) adds one `error` event that names the commit and its list and says the queue keeps retrying. While an entry is stored, the candidate ref of its batch (`omni-queue/<sanitized-base>/<batchId>-<sha12>`) is kept, so GitHub still knows the commit when a later tick writes `failure` on it; once the entry is gone, the next cleanup deletes the ref. A read or a write that fails with a rate limit stops the retries of that tick: the rest of both lists waits for the next tick. A commit the tick blesses for landing, a commit that lands, or a commit an approver blesses by hand leaves both lists. Shadow mode retries the stored withdrawals too, and withdraws the status of a batch stored at the landing stage, so a switch from live to shadow strands no blessing (see [Before a mode change or a stop](#before-a-mode-change-or-a-stop)); a queue that was never live has nothing to withdraw. A batch the tick loaded at the landing stage and no longer keeps there loses its blessing once, right after the batch in flight is handled, before the queue snapshot and any composition (which could hang until the job's timeout). The end of the tick runs the same pass again, which writes only for a batch that left the landing stage later in the tick (a pause that a full withdrawal list caused, for example). A tick that throws (any error but a lost compare-and-swap; never in a dry-run) saves no state of its own after the error; what it saved before (the landing stage and its count, written before a blessing) stays. Before it fails, it withdraws the land status of the batch it found stored at the landing stage, unless it landed that batch, the batch's candidate is the base tip (it landed; the next tick records it), or the tick made its own landing attempt. Then the failure path of `main()` saves, in the same save as the `error` event (whose detail is the error message, cut at 500 characters) and the failed-tick count (`failedTicks`, see [Health](#health)): that batch back at the stage `testing` with its `landAttempts` kept, the withdrawals GitHub refused during the tick (stored as above), and the stored withdrawals the tick settled (dropped). So a run of throwing ticks writes `failure` once, on the first, and a batch whose blessing such a tick withdrew is never stored at the landing stage afterwards (a base that moved and whose recomposed candidate cannot be pushed, tick after tick, ends there). A tick that throws during its own landing attempt (stored at the landing stage and counted just before its blessing) withdraws its own blessing before it fails, and its batch stays stored at the landing stage, withdrawn, with its `landAttempts`: that count, kept by both cases, is how the attempts limit (below) ends landings that fail without a verdict, also when they alternate with ticks that fail before landing. A lost compare-and-swap is redone by `main()` up to three times; after the third, `main()` records the error (and counts a failed tick) without anything the tick did (no withdrawal record): the next tick reads the stored state again. A tick whose stored document is invalid cannot record anything: `main()` prints `could not record the error` and nothing is saved (see [State](#state)). The list holds at most 20 entries (`LAND_WITHDRAWALS_LIMIT` in `scripts/merge-queue/contracts.mjs`). Nothing is ever dropped from it. A refusal that finds it full is stored in the state field `landWithdrawalsOverflow` (same entries, at most 20 more), and both lists are retried by the same code on every tick that visits the base, in every mode. A full main list means GitHub is refusing the App's status writes, so a base that is not paused yet is paused with reason `error`; the detail starts with `landWithdrawals is full` and says how many entries each list holds. Only a NEW entry in the overflow is that condition: a refusal of a commit the overflow already holds is not. A base already paused for a reason that neither lifts by itself nor blesses (`manual`, `error`, `infra`, `tree-divergence`) keeps its pause (reason, time); an `error` event records the full list. A `base-red` pause is replaced by the full-list pause, whose detail says the base was also paused as base-red: under a base-red pause the base-repair lane is still blessed, and the pause lifts by itself when the base tip moves. Only a refusal that fits in neither list is kept nowhere: its commit is named in full, after the words `Kept nowhere (both lists full)`, in `paused.detail` whatever the pause (appended to a kept pause's detail), and in that `error` event, whose detail is cut at 500 characters: it names the commits that fit and how many more `paused.detail` holds (see [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full)). The state has no bound on `paused.detail`; the dashboard (300 characters) and `npm run queue -- status` (200) show it cut. In live mode: - **No land token** (`actor: "owner"` and `OMNI_QUEUE_LAND_TOKEN` empty): nothing is blessed and the base is paused with reason `error`. The message is `landing needs OMNI_QUEUE_LAND_TOKEN (landing.actor is "owner")`. In shadow mode nothing lands, so the token is not needed. - **The landing is refused for authentication** (expired or revoked token, missing permission: a git `Authentication failed` or `Permission to … denied`, or a REST 401, or a 403 that is not a rate limit): the base is paused with reason `error`. When the owner lands (`actor: "owner"`), the message ends with `(check OMNI_QUEUE_LAND_TOKEN: landing.actor is "owner")`; with `actor: "app"` it has no such suffix. Replace the token in the environment (see [Installing the GitHub App](#installing-the-github-app)), then `npm run queue -- resume <base>`. The pause dropped the batch in flight; its PRs keep their labels and are composed again in a new batch after the resume. - When a `merge-ff` push is refused with `GH013` because the ruleset still expects the land status just written, the tick waits five seconds and retries once. If the ruleset refuses the push again, the tick withdraws the status and pauses the base with reason `error`. - Any other failure of the landing, without a verdict, fails the tick: the status just written is withdrawn and the tick ends with an error. A rate limit belongs here, not to the authentication case: the credential is fine. That is an error the GitHub client marked as a rate limit (a 429, or a 403 with a `Retry-After` header, `x-ratelimit-remaining: 0` or the words `rate limit`), or any error whose message says `rate limit`. The next tick looks at the base again, recognizes a landing that did happen, or writes the status and lands again. Each such attempt is counted in `inFlight.landAttempts` and saved before its blessing, so a tick that died after the blessing counts too. It also counts in `landingsWithoutVerdict`, the base's run of landings without a verdict whatever the candidate (see [Health](#health)). After `LANDING_ATTEMPTS_LIMIT` (3, in `scripts/merge-queue/tick.mjs`) attempts without a verdict, counted since the candidate was composed or the queue was last paused or resumed by hand (they can be days apart), the batch is not blessed again and the base is paused with reason `error` (see [Landing paused after three attempts](#landing-paused-after-three-attempts)). The count belongs to the candidate, not to the stage: checks back to pending, a re-run, a release-freeze hold, an infra retry and a failed tick keep it; only a new candidate (a recomposition, a new batch) and an operator's pause or resume start it again. Shadow mode never checks the limit (it blesses nothing), so a count carried from live mode never pauses a shadow tick. - **A per-PR merge call of `squash-api` that fails** is a verdict, `merge-failed`, and the base is paused with reason `error`, except for a rate limit on the first merge call. The GitHub client retries a rate-limited call within its own limits (4 retries, waits of at most 120 seconds); when they run out, `landSquashApi` keeps the client's mark on its result. When nothing was merged yet, the tick handles it as a landing without a verdict (the item above): the status is withdrawn, the tick fails with `landing <batchId> hit a rate limit (<detail>)`, nothing is paused, no token hint is added, and the attempt counts. When a PR of the batch was merged before the limit, the base holds part of the batch: the base is paused with reason `error`, the `merge-failed` detail and the `error` event name the merged PRs, and no token hint is added (the mark says it is a rate limit). For any other refused merge, the token hint is decided on the text of the pause detail: with `actor: "owner"` a detail that says `rate limit` never gets `(check OMNI_QUEUE_LAND_TOKEN: landing.actor is "owner")`; any other 401 or 403 gets it. The land token is fine-grained and valid for 90 days: write the date it expires next to the secret and rotate it before then. ### Signed merge commits (`landing.signing`) With the shipped `landing.signing: "ssh"`, the queue signs every merge commit it composes: batch candidates, bisection halves and recompositions, in shadow and in live mode (`composeCandidate` in `scripts/merge-queue/compose.mjs`, `git commit-tree -S`). The commits carry `landing.identity`, so `signing: "ssh"` is refused unless `landing.actor` is `owner`: GitHub verifies a signature against the signing keys of the committer's account, and the App's bot user has none. **Where the key lives.** The private key is the environment secret OMNI_QUEUE_SIGNING_KEY (environment `omni-queue`, next to the land token). Only the tick job reads it, in one step, "Write the merge-commit signing key", which writes it to `$RUNNER_TEMP/omni-queue-signing/signing-key` (directory `0700`, file `0600`); the job's last step, "Remove the merge-commit signing key" (`if: always()`), deletes the directory whatever happened before it. The tick process never holds the key: it reads the file's path (`signingKeyPath` in `scripts/merge-queue/compose.mjs`) and hands it to git as configuration of the `commit-tree` call alone (`gpg.format=ssh`, `user.signingkey=<path>`), through the environment (`GIT_CONFIG_COUNT`/`KEY`/`VALUE`), never as an argument. Neither the key nor its path is written to a log line, an event, the state, a comment or an error message. The step's script, which GitHub prints, names `$RUNNER_TEMP/omni-queue-signing/signing-key` unexpanded. **A missing key or a failed signature never blocks the queue.** When signing is configured and the file is not there (no secret, a write that failed), or git cannot sign (a key that is not a valid unencrypted SSH private key, for example), the batch is composed unsigned, exactly as without signing, and one `error` event per batch says so: `<batchId>: <n> merge commit(s) composed unsigned: <cause>`, where the cause is `no signing key file in the job (is the OMNI_QUEUE_SIGNING_KEY secret set?)` or `git could not sign a merge commit (exit <code>)` (see [Merge commits composed unsigned](#merge-commits-composed-unsigned)). This "degrade and alert" choice keeps the queue landing when the key breaks; an unsigned queue merge commit then lands without the Verified badge. **What verifies a candidate does not read signatures.** `verifyComposition` and every other reader of a candidate (`mergedPrsBetween`, `candidate-base.mjs`, `history-map.mjs`) read trees, parents and messages (`%B`, which never contains the `gpgsig` header): a signed candidate verifies exactly as the unsigned composition of the same inputs, and a signed commit with another tree, other parents or other trailers is refused as before (`tests/unit/merge-queue/integration/compose-signing.test.mjs` signs with a real ed25519 key and checks the result with `git verify-commit`). **The owner's setup**, once, before `signing` is set to `ssh` (GitHub's rules: [About commit signature verification](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification), [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account), [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key)): 1. Generate a dedicated key, used for nothing else, without a passphrase (the job cannot type one): `ssh-keygen -t ed25519 -N "" -C "omni-queue merge commits" -f omni-queue-signing`. 2. On the account of `landing.identity` (Settings → SSH and GPG keys → New SSH key), add the public key `omni-queue-signing.pub` with the key type **Signing Key**. A key added as an authentication key does not verify commits; the same key used for both must be added twice, and this one should be a signing key only. 3. Store the full contents of the private key file `omni-queue-signing` as the environment secret OMNI_QUEUE_SIGNING_KEY of the environment `omni-queue` (never at repository level). 4. Delete both local files. The key exists only in the secret and, as a public key, on the account. 5. In a separate change, set `landing.signing` to `ssh`. GitHub shows a commit as **Verified** when its signature verifies against a signing key of the account; the committer of the queue's merge commits is `landing.identity`, the account's `@users.noreply.github.com` address. With vigilant mode on (Settings → SSH and GPG keys → "Flag unsigned commits as unverified"), every unsigned commit with that committer shows **Unverified**: a batch composed unsigned (above) would land so; GitHub advises vigilant mode only to people who sign every commit. The badge can only be proven on real GitHub: rehearse a landing in the rehearsal repository before production turns signing on. **Rotation.** Generate a new key (step 1), add its public key as a signing key (step 2), replace the secret (step 3), delete the files, then remove the old public key from the account. GitHub keeps a verification record of every commit it verified: per the first page above, "once a commit signature is verified, it remains verified within its repository's network", "even if signing keys are rotated, revoked". If the key leaks, remove it from the account and rotate at once. ### Who speaks (`voice`) The top-level `voice` key (shipped `owner`) chooses whose token performs the queue's writes that people read on GitHub (`scripts/merge-queue/voice.mjs`). With `app`, every one is the App's (`omni-queue[bot]`). With `owner`, they go out with the owner's `OMNI_QUEUE_LAND_TOKEN`, the token the tick already holds for the landing (no second token secret), whatever `landing.actor` says. The full list is in [What appears as the owner and what appears as the App](#what-appears-as-the-owner-and-what-appears-as-the-app). - **Reads stay the App's.** Every read (comments, issues, pull requests, statuses) uses the App's token; the owner's makes only the writes, plus one `GET /user` per run that reads the owner's login from the token itself. - **The queue still recognises its own comments.** A comment marker (the hidden key of `commentOnce`, which makes each comment once) counts only when the comment's author is `<appSlug>[bot]` or, with `voice: "owner"`, that login read from the token. A marker in anybody else's comment never counts. Switching `voice` back to `app` makes the owner's earlier comments unknown again: a comment the owner already posted may be posted once more by the App. - **Never a lost message.** Without `OMNI_QUEUE_LAND_TOKEN`, or when GitHub answers 401 or 403 to an owner write (or to the login read), the same write is made with the App's token at once. Each such write is a line in the tick's decisions (`owner voice: <write> written with the App's token (<cause>)`), and the first of the tick is an `error` event, `owner voice unavailable, written with the App's token instead: <cause>`, not repeated while the newest such event names the same cause (a token missing for days adds one event, not one per tick). A refused owner write never fails the tick. Any other error (a 5xx, a timeout) is handled as the App's own errors are: the next tick redoes the write. The failure path of a failed tick (the stalled alert, a missing dashboard) writes the same way and logs the fallback. See [Owner voice unavailable](#owner-voice-unavailable). - **Shadow mode** still writes nothing on a pull request. It writes the dashboard issue, its stalled alert and the base-red comments, so with `voice: "owner"` shadow mode uses the token too: without it those writes fall back to the App, with the event above. - **The approval job is the exception**: it never receives the owner's token (it runs on label events with minimal permissions), so its "not an approver" comment stays the App's. The tick's own `not-approver` comment for the same pull request then finds that one by its marker and posts nothing. - **Dashboard migration.** A tick finds the dashboard issue of a base by its exact title and the label `omni-queue-dashboard` among the open issues (the oldest wins), never by its author, and the queue never closes or recreates an issue by itself. An open dashboard opened by the App stays the App's issue: with `voice: "owner"` the owner edits its body and posts its comments. To have a dashboard opened by the owner: set `voice` to `owner`, close the old dashboard issue by hand, then dispatch a tick for that base (`workflow_dispatch`, action `tick`, its `base`). That tick opens a new dashboard with the configured voice. Dispatch it at once: a tick run without a base finds a base with no labeled pull request only through its open dashboard issue (`discoverBases` in `scripts/merge-queue/tick.mjs`), so until a tick of that base runs, a base whose only work is a pause or stored withdrawals is not visited. ## Eligibility A PR can enter a batch only when **all** of these hold (`scripts/merge-queue/eligibility.mjs`; reason codes come from `INELIGIBLE_REASONS` in `scripts/merge-queue/contracts.mjs`): | Rule | Reason code when it fails | | --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | open and not a draft | `not-open`, `draft` | | base matches `bases` (default `^release/v\d+\.\d+\.\d+$`) | `base-mismatch` | | carries `label` (shipped `omni-queue`) | `no-label` | | no label from `blockLabels` (`hold`, `hold-vps`, `do-not-merge`, `wip`) | `blocked-label` | | no open `release-freeze` issue citing the base (Hard Rule #21) | `base-frozen` | | the label was applied by a login in `approvers` | `label-not-by-approver` | | a `success` status `omni-queue/approval`, created by the App bot, exists on the **current** head SHA | `approval-missing`, `head-changed-after-label` | | when the diff touches `protectedPaths`: also `protected-approved`, bound the same way (`omni-queue/protected-approval`) | `protected-approval-missing` | | GitHub does not report the PR as conflicting with its base | `conflicting` | | every check in `prChecksRequired` (`Gate / CI`, `Gate / Quality`, `API Route Typecheck`) is green on the head, except for a base repair | `pr-checks-not-green` | | not already settled in shadow mode at this exact head, not already in flight | `shadow-processed`, `in-flight` | Right before a green batch lands, the tick reads every PR again and re-runs these rules, except `prChecksRequired`: the PR gates are not read again then, so they never drop a PR from a batch whose candidate is green. A PR whose head moved, or whose base changed (retargeted to another release branch during CI), is dropped from the batch, so a retargeted PR never lands on the branch it left. **Truncated file list.** GitHub lists at most 3,000 files of a PR. When the tick receives fewer files than the PR's `changed_files` (or no count at all), a protected path may be among the missing ones, so the PR is treated as a protected surface: it needs `protected-approved` too (`protected-approval-missing`, detail `file list incomplete`). **What `protectedPaths` covers.** Besides the agent-instruction surfaces, the list holds the queue's own control plane: `.github/workflows/**`, `.github/actions/**`, `scripts/merge-queue/**`, `config/merge-queue/**` and `.mergify.yml`. The privileged jobs run that code and read that config from the default branch, and a candidate runs the workflows of its own tree with repository secrets, so a PR that changes any of them could add an approver, switch `mode`, empty `requiredChecks` or read a secret. Such a PR needs `protected-approved` on top of the queue label. **Label names live in two places.** `label`, `protectedApprovalLabel`, `blockLabels` and the two `lanes` labels are read from the config by the scripts, but the job filters of `.github/workflows/omni-queue.yml` (see [Kill switch](#kill-switch)) cannot read a file, so the same names are repeated there as literals. Renaming or adding a label means changing both; `tests/unit/merge-queue/workflows.test.mjs` fails when they differ. **Why commit statuses.** "The label was applied after the last push" cannot be decided from commit dates: they are set by the author and trivially forged. Instead, the `approval` job writes a commit status on the head SHA that was current when an approver applied the label. A new push creates a new SHA without that status, so the PR silently stops being eligible until an approver labels it again. In live mode, removing the label writes `failure` on the same context (approval withdrawn); in shadow mode a removal writes nothing (see [Shadow mode and live mode](#shadow-mode-and-live-mode)). A label applied by anyone else gets no status and, in live mode, one comment (in shadow mode it is only logged). - **The status goes on the head of the event**, not on the head the job finds when it runs: a push that lands between the label and the job must not inherit the approval. - **Level-triggered**: the jobs of a quick label/unlabel pair can run in either order, so the job re-reads the PR first. `labeled` writes `success` only while the label is still there, and `unlabeled` (live mode) writes `failure` only while it is still absent. - **Waiting for the status**: a labeled PR without its approval status is simply not eligible (`approval-missing`, no action) for up to 6 hours after the label (`APPROVAL_STATUS_SKEW_SECONDS`), which absorbs a backed-up Actions queue. After that the queue concludes the head changed after the label (`head-changed-after-label`): in live mode it removes the label with one comment (in shadow mode, a `would-dequeue` event). - **Already in the base**: a PR whose head is already reachable from the base (its commits entered some other way) leaves the queue for good, with both labels removed and one comment (in shadow mode, a `would-dequeue` event). ### Automatic labeling for the derived refresh Only the `derived-refresh-autoland` workflow may apply the `omni-queue` label automatically. It labels only the `chore/derived-refresh` robot PR in this repository, targeting the highest `release/vX.Y.Z` branch. Every changed file must belong to a derived family and have an unprotected path. Any open `release-freeze` issue blocks labeling. An open `base-red` issue blocks its target branch. `Gate / CI` and `Gate / Quality` must pass on the current head. The PR must be open and ready for review, with no queue or blocking label. Every other label application requires the owner's approval for that PR. No other session, script or loop may apply the label on its own. Set the repository Actions variable `DERIVED_REFRESH_AUTOLAND` to `true` to enable labeling. Clear it or set a different value to return to dry-run mode. Labeling requires a queue approver's token. See the [workflow configuration](../../.github/workflows/derived-refresh-autoland.yml). The workflow reports its decision in the run summary, including in dry-run mode. In `live` mode the queue can land the labeled PR after its usual checks. In `shadow` mode the queue reports its verdict and landing is manual. ### The PR's own gates (`prChecksRequired`) What the operator sees: a labeled, approved PR that stays on the dashboard with the reason `pr-checks-not-green` and a detail such as `Gate / CI failure; Gate / Quality missing` (each gate of `prChecksRequired` that is not green, with its state: `failure`, `pending` or `missing`). What it means: a PR enters a batch only when each check in `prChecksRequired` (`Gate / CI`, `Gate / Quality` and `API Route Typecheck` in the shipped config) is green on its current head. `API Route Typecheck` (`.github/workflows/api-route-typecheck.yml`) runs on every pull request to `main` and `release/**`, with no path filter, on `opened`, `synchronize`, `reopened`, `ready_for_review` and a base change (`edited` with `changes.base`, a retarget); a draft pull request runs it too. A title/body edit (`edited` without a base change) runs no job of it, nor of `ci.yml` and `quality.yml`, and leaves no check under a gate's name (see [`docs/architecture/QUALITY_GATES.md`](../architecture/QUALITY_GATES.md#pr-titlebody-edits-and-retargets)). A head on which it never ran reads `API Route Typecheck missing` and waits like any other gate that is not green. It stays missing for good in two cases: a fork's run that waits for a maintainer's approval, and a head with merge conflicts (GitHub runs no `pull_request` workflow then). What to do: approve the fork's run, or resolve the conflict (or push a commit, or close and reopen the pull request). Nothing is done about it by the queue: the label stays, no comment is posted, and the PR becomes eligible by itself once its gates turn green. The reason is computed by every tick and shown on the dashboard only; it is never stored in the state. `npm run queue -- why <PR>` reads the PR gates the same way and prints each gate's state, so it agrees with the dashboard. How a gate is read, per head (the check runs of the PR's current head SHA): - only check runs named exactly like the gate count. Of each check suite only its newest run counts (a re-run of failed jobs stays in its suite and supersedes the attempt before it); - a run not completed is `pending`; a `success` counts only from GitHub Actions (a success from another app is ignored); any other conclusion (`skipped` and `neutral` included) is `failure`; - when several suites report the gate (another workflow with a job of the same name, a newer run of the same workflow), the worst state wins (failure, then pending, then success); - only when those suites disagree does the tick list the head's workflow runs (`listWorkflowRuns`): a suite that belongs to a run superseded by a newer run of the same workflow and the same event on that head (a newer `pull_request` run after a retarget cancelled the older one) is dropped. A `workflow_dispatch` run never supersedes a `pull_request` run, nor the other way round. A run that concluded `skipped` (every job skipped: the run of a title/body edit) supersedes nothing, so the real runs on that head keep counting; while it is still in progress it supersedes like any run. Until the newest run's gate job has started, the previous run's result is what counts. A listing that fails keeps every suite, the stricter reading. The PR gates are read when the queue is built, not again right before a green batch lands, and never for a PR of the base-repair lane (see [Batch selection](#batch-selection)). The candidate's own CI still decides whether anything lands. What to do: nothing, unless the gate stays red. Then the author fixes the PR, or a gate that failed for no reason of the PR's is re-run on the PR. ## Batch selection A new batch starts only when nothing is in flight and the base is not paused (the one exception is the base-repair lane under a `base-red` pause, below). The tick then picks, from the eligible PRs: 1. a lane batch of one PR, when a PR is in a lane (below): a hotfix first, then a base repair; 2. otherwise a FIFO batch: the eligible PRs ordered by approval time (`labeledAt`, ties by PR number), with `preferGreenPrChecks` the PRs whose latest `prGreenCheck` (`Gate / Quality`) run is green first. It takes at most the batch size: `batch.maxSize`, or the adaptive window (below). A PR of the base-repair lane is never in a FIFO batch. A FIFO batch waits while fewer PRs than the batch size are eligible and the oldest approval is younger than `batch.maxWaitMinutes`; it never starts with fewer than `batch.minSize` PRs. The dashboard's queue table shows why a PR is not eligible; why eligible PRs wait is a decision line of the tick's log (`waiting: …`). ### The adaptive batch size (`batch.adaptive`) With `batch.adaptive` (the shipped config: `true`, `batch.startSize` 6, `batch.maxSize` 12, `batch.minSize` 1) the batch size is a window, stored in the state field `batchWindow`. A state without it uses `batch.startSize`. The window read is always clamped to `batch.minSize` .. `batch.maxSize`, so lowering `batch.maxSize` takes effect at once. The dashboard's header line shows `batch window W (max M)`; the `batch-started` event of a FIFO batch names `window W`; a tick that moves it logs `batch window <before> → <after> (<why>)`. - **It grows by one** when a root batch (not a bisection segment, not a lane batch) that held at least as many PRs as the window lands, or would land in shadow mode, up to `batch.maxSize`. - **It halves** (rounded down, not below `batch.minSize`) when a root batch is red on its own PRs: classified PR-red against a base verdict (the bare base is green, or red with other failures). A batch of one counts too (its PR is the culprit). - **It is not halved** for a suspected hang (`hang-suspected`: a job that hit its time limit, not a failing test), for a PR-red verdict that rests on a base check that timed out (the parked batch that base check settles, and any later batch on that base), for a base-red verdict, for an infrastructure failure or a timeout of the candidate, and for a batch that is green after its failed jobs were re-run (that batch lands, and grows the window when it was full). - **It never moves** for a lane batch (hotfix or base repair) or a bisection segment, green or red. Shadow mode moves the window the same way. Without `batch.adaptive` every FIFO batch takes up to `batch.maxSize` and no `batchWindow` is written. ### The two lanes (`lanes`) Two labels put one PR ahead of the FIFO: `lanes.hotfixLabel` (`omni-queue-hotfix` in the shipped config) and `lanes.baseRepairLabel` (`omni-queue-base-repair`). Without the `lanes` key there are no lanes. - **Who can apply them.** Anyone who can label the pull request can add or remove a lane label, but a lane label counts only when its latest `labeled` event on the PR is by a login in `approvers`. A lane label is not an approval: the PR still needs the queue label, its approval status on the current head and every other rule of [Eligibility](#eligibility). A PR that carries both valid lane labels is in the base-repair lane. - **What a lane changes.** At the next batch start the oldest eligible PR of a lane (by approval time) is composed alone, ahead of the FIFO, a hotfix before a base repair. A lane batch never waits (`batch.maxWaitMinutes`, `batch.minSize` and the window do not apply), never moves the window, and never replaces the batch in flight. Its `batch-started` event names `lane hotfix` or `lane base-repair`; the dashboard shows the lane of the batch in flight. A red lane batch follows the ordinary red path (re-run, base check, culprit), except a base repair that fails like the base (below). - **Hotfix.** The PR gates (`prChecksRequired`) still apply. Under any pause nothing is composed, hotfixes included. - **Base repair.** Its PR gates (`prChecksRequired`) are not required. Under a `base-red` pause it is the only work of the base: the tick follows a repair in flight (and the base check of a red repair) and composes a new repair batch. Under any other pause reason (`manual`, `infra`, `error`, `tree-divergence`) nothing is processed, lanes included. In live mode a repair that lands lifts the `base-red` pause: a `resumed` event with the detail `base repaired by #<n>`. A `base-red` pause loaded together with entries in `landWithdrawalsOverflow` is replaced by the full-list pause before the lane runs, so no repair is blessed under it. In shadow mode the repair would land only, and the pause lifts when the real tip moves. A repair whose CI fails for infrastructure after its `infraRetries` retries is dropped and the `base-red` pause stays as it was, with one `error` event (`<batchId>: base repair #<n> failed for infrastructure after <k> retry(ies) (<detail>): dropped; the base-red pause stays`); the PR keeps its labels, so the lane composes it again, as a new candidate, in the same tick or a later one, until that head has been dropped `infraRetries` + 1 times on the base tip the pause names (`repairInfraDrops` in the state). Then the lane stops composing it until the PR's head changes or the base moves; removing and re-adding the base-repair label does not retry it. The PR gets one comment (key `repair-infra:<head12>:<base12>`; not in shadow mode), and the dashboard shows `Base repair #<n> stopped: its CI failed for infrastructure <d> times on base <sha12> (head <sha12>); the lane tries it again when its head or the base moves.` - **A repair that does not repair.** A repair candidate that fails like the base (classified base-red) is recorded in the state field `repairTried` (PR number → head SHA), and that head is never composed again. A base that was not paused yet is paused as `base-red`. In live mode the PR keeps its labels and gets one comment (key `repair-not-fixing:<sha12>`), unless its head moved after the candidate was composed. The comment names the two ways out, which are also the operator's: push a fix to the PR (a new head is tried again), or remove the base-repair label (the PR goes back to the FIFO, where its PR gates apply). An entry of `repairTried` goes away when the PR's head changes or the PR is no longer queued for base repair (closed, merged, retargeted, the queue label or the base-repair label removed). A repair candidate that is red for another reason is a culprit like any batch of one. - **Labels are read when the batch starts.** A lane label removed while its candidate is in CI does not drop the candidate (lane labels, like the PR gates, are not re-read before landing); removing the queue label still does. The two lane labels are repeated as literals in the tick's job filter of `.github/workflows/omni-queue.yml` (see [Eligibility](#eligibility), "Label names live in two places"). ## Accepting a candidate `scripts/merge-queue/checks.mjs` mirrors the `merge_conditions` the Mergify queue uses today, for check runs only. Mergify's `#check-failure` and `#check-pending` also count commit statuses; the queue deliberately reads none (see below): - every name in `requiredChecks` (`Gate / CI`, `Gate / Quality`, `Merge integrity (changelog + generated skills)`) concluded `success` on the candidate SHA; - no other check run in `failure`, `cancelled`, `timed_out`, `action_required`, `startup_failure` or `stale`, except the names in `advisoryChecks` (`Build (advisory)`); - nothing pending. Only the latest run per check name counts (re-runs report several). A later run of the same name in another check suite never replaces an earlier one (two workflows can have jobs of the same name, and a failure of one is never hidden by the other); a re-run of failed jobs stays in its run's suite and does; - a required check counts only as a check run of the `github-actions` app; - a check run whose name starts with `omni-queue/` is not part of the verdict; - commit statuses are not part of the verdict at all: the tick does not read them for it, whoever created them (another App, a user's token, the queue's own App) and whatever their context or state. A status in `failure` or `error` does not make a candidate red, a `pending` one does not keep it pending, and a required name that exists only as a status counts as missing. The queue's own statuses (`omni-queue/approval`, `omni-queue/protected-approval` and the land status) are read by their own code paths, never by the verdict; - only the check runs produced by the push of the candidate ref are read. The tick lists the `push` workflow runs of that branch and SHA (`listWorkflowRuns` in `scripts/merge-queue/github.mjs`) and keeps the check runs that belong to their check suites. Everything else on the SHA is ignored: a run of the same SHA on another branch (the base's own push, the previous ref of an infra retry) and the CI of a pull request somebody opened on the candidate commit, from a fork or from a branch of this repository. The candidate SHA is public, so without this rule that PR's author could cancel, fail or re-run checks on it at will. Check runs that come from no Actions workflow run (other apps) are not read either. Until GitHub lists a push run for the ref, the verdict stays pending; - inside those suites, only the check runs of the push runs' **real jobs** count. The tick lists the jobs of each push run of the ref (`listWorkflowRunJobs`: `GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs?filter=all`, every attempt, so the jobs a re-run adds still count) and keeps the check runs those jobs name (each job's `check_run_url`), but only for a listed entry that is a real job of that run (`isRealWorkflowJob` in `scripts/merge-queue/contracts.mjs`). Any token with `checks: write` (the `GITHUB_TOKEN` of any workflow run in the repository) can create a check run, with any name and conclusion, on the candidate SHA. Measured on 2026-11-19: GitHub files it in one of the commit's Actions suites and **lists it among the jobs** of the workflow run that owns that suite, with that run's id and workflow name, but with `html_url` `https://github.com/<owner>/<repo>/runs/<check run id>`, no runner (`runner_id` null), no labels and no steps. A real job's `html_url` is `https://github.com/<owner>/<repo>/actions/runs/<run id>/job/<job id>` (at a re-run's later attempt too), and its job id is its check run's id. A real job that was skipped has no runner and no steps either, so the runner alone does not tell them apart. The tick counts a listed entry as a job only when its `html_url` path ends in `/actions/runs/<run id>/job/<job id>` for the run it listed and the entry's own id, and the entry's check run is that id; a `success` also needs a runner. Anything else, a missing or unreadable `html_url` included, is not a job. Such a check run is ignored for the verdict (neither green nor red: a forged failure takes no PR out, a forged success never stands in for a required job nor replaces a real failure as if it were its re-run), and the first tick that meets it for a batch records one `error` event, ``check runs on the candidate that are not jobs of its push runs, ignored for the verdict: `<name>` (app `<slug>`), …``. A job listing that fails fails the tick: nothing is blessed. The listing costs one request per push run of the ref and tick (two today: `ci.yml` and `quality.yml`), one more per 100 jobs; - no GitHub Actions run at all `NO_RUN_TIMEOUT_MINUTES` (45) after the push → `timeout` with reason `no-ci-run` (the push triggered nothing), handled like an infra failure; - not decided after `checksTimeoutMinutes` (240) → `timeout`, handled like an infra failure. A required check concluded `skipped` or `neutral` is red, not green. ## One check profile for candidates and Release-Green A candidate runs the same gates as the nightly Release-Green of the release branch; what follows is where the two differ. For the external-state gates, the `check:test-masking` step and the candidate's AI-attribution range, a candidate is a `push` to `omni-queue/**` and only that event: a `workflow_dispatch` on such a ref runs the external-state gates blocking, as any other run does, and skips the two candidate-only steps (`Detect test-masking against the omni-queue candidate base` and `AI attribution in the omni-queue candidate range (Hard Rule #16)`). Older conditions of `ci.yml` and `quality.yml` test the ref alone (the candidate base, the base-relative ratchets, the advisory i18n drift path), so a dispatch on such a ref takes those. **External-state gates are advisory on a candidate.** Three gates read state from outside the tested tree, so their verdict can change while the tree does not. They carry `"externalState": true` in `config/quality/release-green-static-profile.json`, which is where that is decided: - `audit:deps` (the npm advisory database); - `check:vuln-ratchet` (osv-scanner and the OSV database); - `check:codeql-ratchet` (the repository's open code-scanning alerts; an exclusion of the profile: Release-Green does not run it). Their own steps carry `continue-on-error: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/omni-queue/') }}`, which is true on a candidate only; in the gate loop of `Fast Quality Gates`, where the OSV ratchet runs next to tree-only gates, the list `EXTERNAL_STATE_GATES` (filled on a candidate only) does the same for that one gate. What the operator sees when one is red: a failed step inside a green job (`Lint` for `npm run audit:deps`, `Quality Ratchet` and `No new ESLint warnings` for `CodeQL alerts ratchet (blocking)`, `Quality Gates (Extended)` for `Vulnerability ratchet (osv-scanner, ratchet, blocking)`), or, in `Fast Quality Gates` of `quality.yml`, the line `::warning::check:vuln-ratchet failed (external state, advisory on an omni-queue candidate)`, after which the closing `gate(s) failed` line does not name it. `Gate / CI` and `Gate / Quality` stay green, so the batch lands and the queue does not pause. On a pull request and on `main` the same gates still block. What follows: the nightly Release-Green still holds `audit:deps` and `check:vuln-ratchet` as hard gates, so it reds the release branch after such a batch lands. The fix is the one a pull request would need: bump the dependency, or re-baseline `metrics.vulnCount` in `config/quality/quality-baseline.json` with a justification. Whether Release-Green should treat these gates as drift instead is an open decision of the owner. **`check:test-masking` runs against the candidate base.** On a pull request it runs in `PR Test Policy`, which never runs on a push; on a candidate it runs in `Lint`, step `Detect test-masking against the omni-queue candidate base` (`GITHUB_BASE_SHA` is the candidate base). A batch whose changed and renamed test files number more than 300 (`TEST_MASKING_MAX_CHANGED_TESTS`, default 300 in `scripts/check/check-test-masking.mjs`) skips the per-file diff subchecks and says so in its log; the scan of every tracked test file still runs. **Derived-content gates judge a candidate in gate mode `pr`.** `scripts/check/lib/gateMode.mjs` resolves a `push` to `omni-queue/**` to `pr`, as for a pull request: a gate that compares derived content (translations, generated files, managed counts) judges only what the batch changed (the i18n completeness gates print `SKIP reason=pr-mode`). Release-Green runs them in `release` mode. **Scanner versions.** `ci.yml` (`Quality Gates (Extended)`) and `quality.yml` (`Fast Quality Gates`) install the same pinned versions of gitleaks, osv-scanner and oasdiff, so a gate cannot give two verdicts on one candidate. Bump them in both files together; `tests/unit/merge-queue/workflows.test.mjs` fails when they differ. ## Red candidates: classification, base check, bisection `scripts/merge-queue/classify.mjs` turns every failing run into a signature (the check name with the matrix shard suffix removed, plus the failing test or gate from its annotations) and decides as follows. Before items 2 and 4 act on a batch, its failed jobs are re-run once and those items apply only when it is red again (see [Re-running the failed jobs before blaming](#re-running-the-failed-jobs-before-blaming-flakyreruns)): 1. **Infra** — every failure carries positive evidence of infrastructure trouble (runner lost, `CreateArtifact` 404, "No space left on device", `startup_failure`, a job that hit its time limit, a cancellation without any failure annotation). The aggregate gates in `aggregateChecks` (`Gate / CI`, `Gate / Quality`) run with `if: always()` and fail whenever a job they need failed, so next to the failure of any other check a gate failure that names no test is left out; a gate that fails alone still blocks. The same SHA is retried under a new ref up to `infraRetries` times (once in the shipped config); the infra failure that comes after the last retry (with `infraRetries: 0`, the first one) pauses the base with reason `infra`, except when every run of the candidate only hit a job time limit (see 5), and except for a base repair under a `base-red` pause: that batch is dropped and the `base-red` pause stays (see [The two lanes](#the-two-lanes-lanes)). 2. **Needs a base check** — the batch is red on a base SHA that has no finished verdict (green, red or timeout). The tick pushes a `basecheck-<sha12>` candidate with the bare base SHA (same CI profile), records `base-check-started` and parks the red batch in `inFlight.pendingRed`. This does not depend on the `🔴 Release branch not green: <base>` issue: the system that writes it does not cover every check the queue requires. The tip the queue lands itself is recorded as a green verdict, so only a tip that arrived from outside the queue (a hotfix, a sync-back, a manual push) starts a red batch without one. While a base check for that SHA is pending, no second one starts. A base check whose runs fail for infrastructure reasons follows item 1 (up to `infraRetries` retries, then an `infra` pause on the failure after the last one). A base check that ends with no verdict after its retries (no CI run at all, or no result within `checksTimeoutMinutes`) is stored as `timeout` for that SHA, and the parked batch is then treated as PR-red (item 4). That verdict is not redone for the same SHA: the ref is named by the SHA and the queue never force-pushes. 3. **Base-red** — the base check is red and every non-infra failure of the batch also fails there: same check, and each failing test or gate is compared on its own across all shards of that check (shards re-balance, so failures grouped differently still match). The batch is not guilty: the base is paused with reason `base-red` and the pause lifts by itself when the base tip moves (someone landed the fix), or, in live mode, when a PR of the base-repair lane lands (`resumed`, detail `base repaired by #<n>`). A `base-red` pause never stands together with entries in `landWithdrawalsOverflow`: a tick that finds both (a hand-edited state) replaces it with the full-list pause first (see [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full)). While it lasts the queue processes only that lane (see [Batch selection](#batch-selection), which also says what happens to a base-repair candidate that fails like the base). When a `🔴 Release branch not green: <base>` issue is open, the queue comments on it. 4. **PR-red** — anything else: the base is green on this SHA, or its check timed out, or some failure of the batch does not fail on the base. A batch of one: that PR is the culprit, loses the queue label and gets a comment with the failing checks (in shadow mode it keeps its label and gets no comment). If the culprit's head moved after the candidate was composed, the label (which may approve the new head) stays and no comment is posted; only the `culprit-found` event records it. A larger batch is **bisected**: it is split in halves (first half = ceil(n/2), order preserved) and the first half is tested on the base as it is at that moment. A green half lands (or would land in shadow) and the next segment is tested; a red half is split again. Two culprits in one batch are found the same way. 5. **Suspected hang** (`hang-suspected`) — a job that hits its time limit (conclusion `timed_out`, or `cancelled` with GitHub's "exceeded the maximum execution time" annotation) on **every** run of a candidate points at a hanging test, not at the machine, and a retry would only cost another full timeout. When the retry is used up the tick records `hang-suspected` and classifies the batch like any red batch, with a signature that names the job and no test: a base check first when the base has no verdict, then, unless the base explains it, the PR-red path of item 4 (a batch of one is the culprit; a larger batch is bisected as a hang bisection). Inside a hang bisection a segment whose job times out is not retried: one timeout is enough to treat the segment as red. The culprit comment then names the job that timed out. If any run of the candidate failed for another infrastructure reason (runner lost, startup failure, a plain cancel), nothing of this applies and item 1 does: up to `infraRetries` retries, then an `infra` pause on the failure after the last one. Hang evidence on the base only matches a hang of the candidate in the same job, never an ordinary test failure. A base check whose job times out on every run is recorded as a red verdict with that hang, so a batch that hangs on the same job is paused as `base-red` instead of blamed. ### Re-running the failed jobs before blaming (`flakyReruns`) What the operator sees: a red batch whose `checks-red` event is followed by `flaky-rerun` (`re-running the failed jobs of <batch> once (<jobs>) before <bisecting|a base check|dequeuing #n>`, five job names at most), and nothing else for a while. Then either `checks-green` with the detail `green after re-running <jobs> (flaky)` and an ordinary landing, or a second `checks-red` and the classification above. What it means: before the queue tests the base (item 2) or blames a PR (item 4), it re-runs the failed jobs of the candidate's runs once, so that one flaky test does not cost a base check, a bisection or a dequeued PR. With `flakyReruns: 1` (the default and the shipped value) this applies to a batch or a segment of an ordinary bisection, at its first run (not an infra retry, not a base check, not a segment of a hang bisection), when the verdict would be `needs-base-check` or `pr-red`. An `infra` verdict keeps the infra path and a `base-red` verdict blames nobody: neither is re-run. `flakyReruns: 0` turns it off. How it goes, tick by tick: 1. A candidate turns red at its first failed job while the rest of its CI still runs, and GitHub re-runs the failed jobs of a finished workflow run only. So the tick first waits for every push run of the candidate's ref to conclude; its log says `waiting for <n> run(s) of <ref> to conclude before re-running the failed jobs`, and nothing is classified yet. 2. Then it asks GitHub to re-run the failed jobs of each failed push run that is at its first attempt (`POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs`, with the App's token), records `checks-red` and `flaky-rerun`, and stores `inFlight.rerun` (the ref, the time of the request, the runs and the jobs). The red batch is counted once in the red-batch counter, however the re-run ends. 3. It waits for the re-run of those runs only (not another run of the ref that someone re-ran earlier). A re-run that does not show as a second attempt within `RERUN_START_MINUTES` (30) of the request is taken as never started, and the old failure is classified. A second attempt that is running is waited for, never cut short by those 30 minutes. 4. Every wait ends at `checksTimeoutMinutes` (240) from the candidate's start: past it, a candidate whose runs have not concluded is classified without a re-run, and a re-run that has not concluded is classified without its result. 5. Green after the re-run: the batch lands as usual. Red again: it is classified (base check, bisection, culprit) and never re-run a second time. A running second attempt of any push run of the ref (a re-run started by a person, or by a tick that died before its save) is adopted: stored as `inFlight.rerun` and waited for, without a call and without a `flaky-rerun` event. A refused call (or a list of runs the tick cannot read) adds `; re-run refused (<status or reason>)` to that tick's `checks-red`; when no re-run was accepted, the batch is classified in the same tick, as with `flakyReruns: 0`. A batch at the landing stage that turns red goes back to `testing` and its land status is withdrawn. Shadow mode re-runs too: it is one of the few things it writes. A dry-run only says it would. The cost: a real failure is blamed later, after the rest of the CI run plus the re-run. Jobs that often turn green on their re-run are flaky tests to fix. **The App needs Actions: Read and write.** The tick job asks for `permission-actions: write` when it mints its token. Grant it to the App, and accept it on the installation, before a tick runs with this version of the workflow (see [Installing the GitHub App](#installing-the-github-app), step 4). Without it GitHub mints no token at all. Asked for a permission the installation does not hold, `POST /app/installations/{id}/access_tokens` answers 422, "The level of access for permissions requested are not granted to this installation.", for the job's whole permission set (measured on 2026-11-17 against an installation with `actions: read`). So every tick fails at the step that mints the token, not only the re-run, and no state is saved; the watchdog reports each base with work after 90 minutes. A re-run GitHub refuses for any other reason ends the `checks-red` detail with `; re-run refused (<status>)`, and the batch is classified in the same tick. **Known limits.** These are accepted trade-offs of the current design, not bugs to work around: - **Bisection on an unverified base.** When a base check gives no verdict (`timeout`), the batch is bisected although nothing showed that the base passes, so a PR can be removed from the queue although the base fails the same check. - **One timeout removes a PR in a hang bisection.** A single PR is declared the culprit after one timeout of its own run, with no retry. Combined with the previous limit, that can happen on an unverified base. - **The land status is not per base.** Every release ruleset requires the same context (`landing.statusContext`), so a commit blessed for one release branch, by a landing or by a bless, also carries it for every other managed base: a pull request from that commit can be merged into another release branch the door protects. - **The queue-refs check reads rule types, not bypass actors.** Before a blessing the tick reads the rules GitHub enforces on `omni-queue-state` and on the batch's candidate ref and requires `creation`, `update` and `deletion` on both (`QUEUE_REF_RULES` in `scripts/merge-queue/refs-guard.mjs`; see [Before the land status is written](#before-the-land-status-is-written)). It does not read who may bypass those rules: the App's token has no Administration permission, and anyone who can edit a ruleset's bypass list can disable the ruleset as well. A rule that comes from another ruleset with the same types counts as protection. - **A landing that always fails on a base that keeps moving is never paused.** Each time the base moves, the batch is recomposed: a new candidate with no landing count. With a landing that fails without a verdict every time, each new candidate is blessed once, its tick fails and withdraws it, and the next tick finds the base moved and recomposes. No pause: the attempts limit counts per candidate. But every blessing also counts in `landingsWithoutVerdict`, the base's run of landings without a verdict (ended by a landing that answers, a `landed` batch, or an operator's pause or resume), and at 3 the queue is stalled (see [Health](#health)): one alert mentions the approvers. The `land-blessed` event of these blessings is never stored: the tick records it after its mid-tick save, then fails, and the failure path of `main()` saves only its own `error` event (and the failed-tick count) onto the stored document, which holds what the mid-tick save wrote. What the stored history shows, repeated, is `checks-green`, then `error` (the error the landing threw, such as `land: commit <sha> is not available from origin`), then `land-rejected` (`base moved: …; recomposing`), then `batch-started`. - **A base without labeled PRs is found only through its open dashboard issue.** A tick run without a base visits a base for its labeled PRs or, through its open dashboard issue, for a batch in flight, a pause, a stored withdrawal, a `stalled` episode or a `failedTicks` count (`discoverBases` in `scripts/merge-queue/tick.mjs`). Do not close a dashboard issue. Every tick that completes creates a new one when none is open, and so does a tick that fails while its state stores withdrawals or has an alert to post; but if a person closes it after the last tick, a base with work and no labeled PR is not visited until a tick is dispatched for it (workflow `omni-queue`, inputs `base` and `action` `tick`). Its state then stops moving, and after 90 minutes the watchdog reports the base (see [Who is told, and when](#who-is-told-and-when)). - **"Already landed" is tip equality, and only with `merge-ff`.** A batch whose landing went through while its state save was lost is recognized only when its candidate is still the base tip. If the base moved again after that (a merge by hand on top), the batch is taken as not landed: the App's `failure` is written on a commit that is in the base but no longer its tip, no `landed` event is recorded and the counters are short by one; its PRs are merged, so they are not batched again. With `squash-api` such a batch is never recognized: a pause or a later tick writes `failure` on its PR heads (merged already) and records no `landed` event. - **The tree recomposition depends on the runner's git.** The composition check recomposes each merge commit of the candidate with `git merge-tree` on the tick's runner. A different git version on the runner that composed the candidate and on the runner that checks it could, in principle, give another tree for the same merge, and the queue pauses a legitimate batch with a message about state tampering or corruption. Shadow mode runs the same check, so it is where the rate of such false mismatches is measured before `mode: "live"`. - **A check that keeps failing to run stalls a live queue without a pause.** In live mode a failed rules read or a git error while recomposing fails the tick, and the next tick tries again: an error that persists fails every tick, with an `error` event each time. Nothing pauses the base; after three failed ticks in a row (`failedTicks` in the state) the `queue-stalled` alert is raised (see [Health](#health)). To get out: pause the base (`npm run queue -- pause <base>`, a paused base does not check its batch), fix the cause, then `npm run queue -- resume <base>`. Removing the queue label from a pull request drops it from the batch at the next tick, and the rest is recomposed. - **Only the candidate's verdict tells a forged check run from a job.** A check run that a workflow token creates through the Checks API is from the `github-actions` app, like a real job (see [Accepting a candidate](#accepting-a-candidate)). The candidate's verdict ignores it, and that verdict is the one that decides a landing. Two other readings cannot make the distinction: the PR gates (`prChecksRequired`, read on the PR's head by name and app, see [The PR's own gates](#the-prs-own-gates-prchecksrequired)), so a forged `success` there can let a PR into a batch and a forged `failure` can keep it waiting; and GitHub's own required status checks, which match a check by name and, at most, by the app that created it (`integration_id`). A PR let in that way still lands only through a candidate whose real jobs are green. - **Test-level matching needs a key on both sides.** A failure of the batch matches the base's only when the same check fails there and either both failures carry a test-level key (the candidate's tests must all fail on the base) or neither does (a match on the check name alone, reported as such). When only one side has a key the failures cannot be shown to be the same, and the batch is treated as PR-red. In this repository node:test and vitest emit no failure annotations, so the check-name match is the usual one. ## State The queue state lives on the branch `omni-queue-state` (`STATE_BRANCH`), one JSON file per base: `state/<sanitized-base>.json`, for example `state/release-v3.8.55.json`. It holds the pause, the candidate in flight (refs, SHAs, PRs, stage, attempts, bisection), the last 10 base checks, the shadow bookkeeping, counters and the last 200 history events. Optional fields, each absent until it is needed: | Field | What it holds | Explained in | | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | | `inFlight.landAttempts` | landings of the candidate that ended without a verdict | below, and [Who lands](#who-lands-landingactor) | | `inFlight.rerun` | the re-run of the candidate's failed jobs | [Re-running](#re-running-the-failed-jobs-before-blaming-flakyreruns) | | `inFlight.lane` | the lane of a lane batch (`hotfix` or `base-repair`) | [Batch selection](#batch-selection) | | `inFlight.freezeHold` | a green batch held by a release freeze (`since`, `endedAt`) | [Health](#health) | | `landWithdrawals` | refused `failure` land statuses, retried | below | | `landWithdrawalsOverflow` | the same, for refusals that found `landWithdrawals` full | below | | `batchWindow` | the adaptive batch size | [Batch selection](#batch-selection) | | `repairTried` | base-repair heads that failed like the base (PR number → head SHA) | [Batch selection](#batch-selection) | | `repairInfraDrops` | infrastructure drops of a base-repair head under a base-red pause (PR number → `head`, `baseSha`, `drops`) | [The two lanes](#the-two-lanes-lanes) | | `failedTicks`, `failedSince`, `stalled` | the count of failed ticks in a row, and the open stalled episode (with `stalled.quietTicks` while an episode of failed ticks is held) | [Health](#health) | | `landingsWithoutVerdict` | the base's run of landings that ended without a verdict (`count`, `since`) | [Health](#health) | Three fields belong to the land status (see [Who lands](#who-lands-landingactor)): - `inFlight.landAttempts`: the number of ticks that blessed the candidate without reaching a verdict. It belongs to the candidate, at either stage: a hold, checks back to pending, a re-run, an infra retry and a failed tick keep it; a new candidate (a recomposition, a new batch) and an operator's pause or resume start it again. At `LANDING_ATTEMPTS_LIMIT` (3) a live tick pauses instead of blessing it again; shadow mode never checks it. - `landWithdrawals`: present only when it is not empty. Each entry is a commit whose `failure` land status GitHub refused to write (`sha`, `batchId`, `candidateSha`, `why`, `since`, `attempts`), oldest first, one per SHA, at most 20. Later ticks retry them. - `landWithdrawalsOverflow`: the same entries, for the refusals that found `landWithdrawals` full; at most 20, no SHA of the main list, retried alike, present only when it is not empty. A document without these fields loads as before, and code that predates them loads a document that has them (`validateState` ignores fields it does not know), but that code does not act on them (see [Cut-over and rollback](#cut-over-and-rollback)). **Where to read what.** The state file is the full record: every field, every stored event, each detail as the tick wrote it (some event details are cut at 500 characters when they are written; `paused.detail` has no bound). Every other view cuts: | Where | Events | `paused.detail` | Other text | | ------------------------------ | ---------------------------------------------- | --------------- | ------------------------------------ | | the dashboard issue | the last 20, each detail cut at 160 characters | 300 characters | a PR's reason detail: 120 characters | | `npm run queue -- status` | none | 200 characters | PR titles: 200 characters | | `npm run queue -- history` | the last 20 (`--limit` up to 9999), 200 each | not shown | | | the log of an `omni-queue` run | that tick's decisions, not the stored events | in its decision | every line cut at 2,000 characters | Read `state/<sanitized-base>.json` on `omni-queue-state` whenever a decision depends on the whole text (a pause detail that names commits, an error that names several PRs). - **Why not `omni-queue/state`**: `ci.yml` and `quality.yml` run their full matrix on every push to `omni-queue/**`. Keeping the state branch outside that prefix means a state write never starts CI. No workflow triggers on `omni-queue-state`. - **Compare-and-swap**: writes go through the Contents API with the blob SHA that was read. A concurrent writer makes the save fail, and the tick re-reads and redoes its work (never a force push, never last-write-wins). Every network side effect happens before the save that records it, and repeating a tick is safe. - **An unchanged state is not written again**: most ticks change nothing (idle queue, candidate checks still pending), and a commit per tick would add hundreds of commits a day to the state branch. A tick saves only when the document changed (the `attempts` count of a stored withdrawal alone is no change). When it did not, the tick writes a heartbeat at most once per hour (`STATE_HEARTBEAT_MINUTES` in `scripts/merge-queue/tick.mjs`), which only moves `updatedAt`. A tick run without a base (every tick but a dispatch that names one) visits a managed base that has open PRs with the queue label (drafts included), and a base whose **open** dashboard issue leads to a state with a candidate in flight, a pause, a stored land-status withdrawal, a `stalled` episode or a `failedTicks` count (a completed tick clears the count, and the episode once nothing is stalled: at once, or after two completed ticks in a row for an episode that failed ticks opened; then a base without work drops out). Do not close a dashboard issue (see the known limits in [Red candidates](#red-candidates-classification-base-check-bisection)). A dispatch with a base visits that base whatever it holds. For a visited base, an `updatedAt` older than an hour plus one tick interval means no tick is completing (see [Health](#health)). - **Invalid documents are never reset silently**: the tick fails loudly, and so does the failure path that would record its error (nothing is saved; the watchdog reports the file, see [Who is told, and when](#who-is-told-and-when)). Do not edit the state branch while the queue is enabled; pause first, then fix it with an ordinary commit. Once the queue-refs ruleset is applied (see [Ruleset](#ruleset)), only the App can write that branch: the ruleset has to be disabled first for a commit by hand. ## Dashboard One issue per base, titled `🚦 omni-queue: <base>` and labelled `omni-queue-dashboard`. Every tick that completes renders its body, a paused base's ticks included, and rewrites the issue only when the body changed (the `Last change` footer line aside). From top to bottom: - the mode (`Mode: shadow` or `Mode: live`) and one line with the landing mode, the batch size (`batch ≤ M`, or `batch window W (max M)` with `batch.adaptive`) and the queue label; - **Health**: the status (`ok`, `idle`, `waiting` or `stalled`), its reasons and the heartbeat line (see [Health](#health)); - the pause banner, when the base is paused: reason, since, the detail (cut at 300 characters), the base tip when paused, the issue, and what to do. For `base-red` it reads "Resumes automatically when the base tip moves.": the pause lifts when the tip moves (see [Red candidates](#red-candidates-classification-base-check-bisection), item 3); whether the new tip is green is decided by the next red batch, if any. A `base-red` pause never stands together with entries in `landWithdrawalsOverflow` (a tick replaces it with the full-list pause). While `landWithdrawalsOverflow` holds entries, the banner says a resume is refused and how many entries remain; - under a `base-red` pause, one line per base repair its lane stopped composing (see [The two lanes](#the-two-lanes-lanes)); - the stored land-status withdrawals, when either list holds entries: `Stored land-status withdrawals (retried on every tick): <n> in landWithdrawals, <m> in landWithdrawalsOverflow.`; - **In flight**: the batch or base check, its lane, stage, start and infra retries, the candidate with a link to its checks, the base, the PRs, a parked red batch and a bisection; - **Queue**: every labeled PR, eligible first, with the reasons of each PR that is not eligible; - **Recent events**: the last 20, newest first; - **Metrics**: PRs landed, CI runs per merged PR, red batches, bisections, and the median and p90 time from approval to landing (to `would-land` in shadow mode). A tick that fails creates the dashboard issue only when none is open and it has a stalled alert to post or its state stores land-status withdrawals (so the next scheduled tick finds the base); that body says the queue was not read and its heartbeat line is `Heartbeat: none: a tick that failed wrote this dashboard`. A dashboard that stopped changing is an incident (see [Dashboard stopped updating](#dashboard-stopped-updating)). ## Health Each tick judges whether its base is making progress (`assessHealth` in `scripts/merge-queue/dashboard.mjs`) and writes the verdict in the dashboard's Health section. **The heartbeat line.** `Heartbeat: ticks completing as of <YYYY-MM-DD HH>:00Z` names the hour of the last tick that completed. It changes once per hour, so it is the one line of an idle queue's dashboard that moves; an hour that stopped moving means no tick of that base has completed since. **Stalled.** The queue is stalled when any of these holds (each limit exclusive): | Rule | Holds when | Constant | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | | paused | the base has been paused for more than 120 minutes, whatever the reason (a manual pause too: it may be forgotten); a pause with reason `error` or `tree-divergence` at once, from the first tick, since nothing but an operator lifts it | `STALL_PAUSED_MINUTES`, `STALL_AT_ONCE_PAUSE_REASONS` | | in flight | a candidate has been in flight for more than `checksTimeoutMinutes` + 60 (300 in the shipped config), counted from its start | `STALL_INFLIGHT_GRACE_MINUTES` | | waiting | eligible PRs, nothing in flight and no pause, for more than `batch.maxWaitMinutes` + 30, counted from the oldest eligible approval or the last event that is not `error` or `queue-stalled`, whichever is later | `STALL_WAITING_GRACE_MINUTES` | | ticks fail | 3 ticks in a row failed (`failedTicks`) | `STALL_ERROR_STREAK` | | withdrawal | an entry of `landWithdrawals` or `landWithdrawalsOverflow` was first refused more than 60 minutes ago (since: the oldest such entry's `since`) | `STALL_WITHDRAWAL_MINUTES` | | landings | 3 landings in a row ended without a verdict and none landed since (`landingsWithoutVerdict`, counted before each blessing whatever the candidate) | `STALL_LANDINGS_WITHOUT_VERDICT` | A green batch held by a release freeze is waiting, not stalled: `inFlight.freezeHold` records the hold (`since`, set by the first held tick; `endedAt`, set by the first tick that does not hold it again: the freeze lifted, its checks run again, a pause, or its landing). An infra retry drops the record: the retry is a new run with a new start. While the hold is open the in-flight rule does not apply; after it ends, the in-flight rule counts from `endedAt`. **`failedTicks`.** A tick that throws is recorded by `main()`, which adds one to `failedTicks` (and sets `failedSince` on the first) in the save of its `error` event. A tick that completes deletes both. The count starts again at 1 when the stored state was last saved more than 90 minutes before (`WATCHDOG_LIMIT_MINUTES`). Ticks that complete and append `error` events (a landing pause, a refused withdrawal) do not count. **One alert per episode.** The first stalled verdict opens an episode: the state field `stalled` (`since`, `reasons`, `openedAt`), one `queue-stalled` event whose detail lists the reasons, and one comment on the dashboard issue that mentions the approvers. Until that comment is posted (`notified` in `stalled`), every tick, completed or failed, tries again; a failed tick creates the dashboard issue when there is none. While the episode lasts, a reason that only changes its words or numbers raises nothing. A cause of another kind (the rule that fired: a pause of a given reason, a candidate in flight, eligible PRs waiting, failed ticks, a stored withdrawal, landings without a verdict; `kinds` in `stalled`) that begins after the episode opened opens a new episode: its own `queue-stalled` event and comment, keyed by that cause's start (an error pause during an episode of failed ticks, a withdrawal refused for an hour during a long pause). A completed tick whose verdict is not stalled ends it (the field goes), except an episode that failed ticks opened (its reasons name `ticks in a row failed`): that one ends only after two completed ticks in a row found no stall (`STALL_CLEAR_COMPLETED_TICKS` in `scripts/merge-queue/tick.mjs`; `quietTicks` in `stalled` counts them, and a failed tick or a stalled verdict in between starts the count again), so failures broken by one completed tick are one episode with one comment. A failed tick never ends one. A base whose queue stalls again later gets a new episode and a new comment. **`landingsWithoutVerdict`.** The tick counts each landing attempt in the save before its blessing (`count`, and `since` at the first) and deletes the field when a landing answers (any verdict: landed, refused, the base moved), when a batch lands (also one the next tick finds landed), and on an operator's pause or resume. A landing that throws or a tick that dies after the blessing leaves it counted, whatever the candidate, so a base that keeps moving under a landing that keeps failing is reported although each new candidate starts its own `landAttempts`. Who else is told, and when: the watchdog workflow and its issue, see [Who is told, and when](#who-is-told-and-when). What to do for each reason: see [The queue stalled](#the-queue-stalled). ## Events Every event of a base's history (`npm run queue -- history`, the dashboard's last events) has one of the types of `EVENT_TYPES` in `scripts/merge-queue/contracts.mjs`. A state document whose history holds a type the code does not know is refused, which matters for a rollback (see [Cut-over and rollback](#cut-over-and-rollback)). `tests/unit/merge-queue/runbook.test.mjs` fails when this table and `EVENT_TYPES` differ. | Event | When it happens | What the operator does | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `batch-started` | A candidate was composed and pushed: a new batch, a recomposition or a bisection segment. The detail names the PRs and the base, and for a root batch with `batch.adaptive` the window it was cut to (`window W`). A lane batch names its lane instead of a window (`lane hotfix` or `lane base-repair`). | Nothing. Its CI is linked from the dashboard. | | `pr-skipped-conflict` | A PR conflicts with an earlier PR of the same batch. It is left out of this candidate and stays queued for a later batch. | Nothing. If it repeats, the author rebases the PR over the one it conflicts with. | | `pr-dequeued` | A PR left the queue: `base-conflict` (it no longer merges into the base: label removed, comment), `already-in-base` (both labels removed, comment), or `withdrawn: <why>` before composition (label, head or approval changed). In shadow mode the first two are `would-dequeue` events instead. | For `base-conflict` the author updates the branch and an approver labels it again; the other cases need nothing. | | `checks-green` | Every required check of the candidate (or of a base check) concluded `success`. | Nothing. The landing (or `would-land`) follows. | | `checks-red` | A check of the candidate failed. The detail names the failing checks; on a base check it starts with `base-check red`. It ends with `; re-run refused (<status or reason>)` when the re-run of the failed jobs was refused. A batch red again after its re-run records a second one. | Nothing yet: classification follows (a re-run of the failed jobs, infra retry, base check, bisection or culprit). | | `flaky-rerun` | A red batch or bisection segment that would be bisected, tested against the base or dequeued: its failed jobs are re-run once after its runs end (`flakyReruns`). Detail: `re-running the failed jobs of <batch> once (<jobs>) before <bisecting\|a base check\|dequeuing #n>` (five jobs at most). A green re-run's `checks-green` reads `green after re-running <jobs> (flaky)`. | Nothing. A real failure is blamed later: after the rest of the CI run and the re-run. Jobs that often turn green on the re-run are flaky tests to fix. | | `checks-timeout` | No verdict after `checksTimeoutMinutes`, or no CI run at all after 45 minutes (`no CI run for candidate`). | For `no CI run`, check the Actions policies and the `omni-queue/**` triggers of `ci.yml` / `quality.yml` (see [Infra failure or timeout](#infra-failure-or-timeout)). | | `land-blessed` | Live mode: the App wrote the land status (`landing.statusContext`, `success`) on the commits about to land, right before the landing. | Nothing. A `landed` event should follow; if a pause follows, the status was withdrawn. | | `manual-bless` | An approver's `bless`: the App wrote the land status on one chosen commit. The detail names who and why. | Push or merge that commit yourself (see [Land status and manual bless](#land-status-and-manual-bless)). | | `landed` | Live mode: the batch reached the base (the `merge-ff` push or every `squash-api` merge). | Nothing. | | `would-land` | Shadow mode: a green batch that live mode would have landed. The detail can add `merged meanwhile by another path`, `live mode would pause: queue refs unprotected (…)` and, after the name of a check, `could not run (…): live mode would fail the tick`. | Compare with what Mergify merged. Both notes must be gone before `mode: "live"`: apply the queue-refs ruleset, or fix the check that could not run. | | `would-dequeue` | Shadow mode: live mode would have removed this PR from the queue (label kept, no comment). The detail gives the reason code(s). | Nothing during shadow. | | `land-rejected` | The batch was not landed: the base moved (`base moved…; recomposing`: the same PRs are recomposed on the tip), the batch changed before landing (`batch changed before landing: …`: the PRs left are recomposed), or a release-freeze holds it (`base-frozen: …; <batch> waits for the freeze to lift`, once per batch: it stays in flight, not recomposed, and lands after the freeze). | Nothing for an occasional one; frequent ones mean something else merges into the base (see [Recomposition when the base moves](#recomposition-when-the-base-moves)). | | `bisect-split` | A red batch (or a red segment of a bisection) is split; the detail names the segment tested next. | Nothing. | | `culprit-found` | Bisection or a batch of one isolated the PR that fails. Live: label removed, comment. Shadow, or a head that moved: label kept. | The author fixes the PR and an approver labels it again. | | `base-check-started` | A red batch on a base with no verdict: the bare base is pushed as a `basecheck-<sha12>` candidate. | Nothing. | | `base-red-paused` | The base check is red with the same failures as the batch: the base is paused with reason `base-red`. | Fix the base (see [Base-red](#base-red)). The pause lifts when the tip moves. | | `hang-suspected` | A job hit its time limit on every run of the candidate: treated as a hanging test (base check, then bisection) instead of an infra pause. | Nothing yet; look at the culprit comment when one is named. | | `infra-retry` | Every failure is infrastructure (or the checks timed out): the same SHA is retried under a new ref (`-r1`, `-r2`, …), while retries of `infraRetries` are left. The detail reads `retry <n>/<infraRetries>: …`. | Nothing. | | `infra-paused` | An infrastructure failure (or a timeout) with no retry of `infraRetries` left: the base is paused with reason `infra`. With the shipped `infraRetries: 1` that is the second failure; with `0`, the first. When every run only hit a job time limit, the outcome is `hang-suspected` instead (see its row). A base repair under a `base-red` pause is dropped instead, with an `error` event, and the `base-red` pause stays. | Check the Actions status and the candidate's run, then `npm run queue -- resume <base>`. | | `paused` | A manual pause (`npm run queue -- pause`, or `action=pause`). The detail is the reason, on one line, cut at 200 characters. | `npm run queue -- resume <base>` when ready. | | `resumed` | A manual resume (`manual resume (was <reason>)`, followed by `; the pause it cleared named commits kept nowhere (both lists full), check their <landing.statusContext> by hand: <sha> (<batchId>), …` when that pause named such commits), a `base-red` pause lifted because the base tip moved (`base moved <sha12> → <sha12> after a base-red pause`), or, in live mode, a `base-red` pause lifted because a PR of the base-repair lane landed (`base repaired by #<n>`). Neither automatic lift happens while `landWithdrawalsOverflow` holds entries: a tick replaces such a `base-red` pause with the full-list pause. | For a detail that names commits kept nowhere: check their land status by hand (see [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full)). Otherwise nothing. | | `tree-divergence` | `squash-api` only: the base tree after the merges differs from the candidate tree, or an open divergence issue stops a landing. The base is paused with reason `tree-divergence`. | Compare the trees, fix the base, close the issue, resume (see [Tree divergence](#tree-divergence-squash-api-only)). | | `error` | A tick failed (the detail is its error message); a landing pause (reason `error`: land token, landing refused, composition mismatch, queue refs, base not found, attempts limit); a land-status withdrawal GitHub refused (`<batchId>: could not withdraw …`); a stored withdrawal refused for a day (`… has been refused for more than 24 h, since …; the queue keeps retrying it`); a refused withdrawal that found the `landWithdrawals` list (20) full, kept in `landWithdrawalsOverflow` (`landWithdrawals is full …`; it pauses a base that is not paused, or replaces a `base-red` pause, also one a tick loads together with overflow entries); a refused resume (`resume refused: …`, the pause stays); a candidate gone from origin (`… is gone from origin; recomposing …`), whose PRs are recomposed; check runs on the candidate that are no job of its push runs (`check runs on the candidate that are not jobs of its push runs, ignored for the verdict: …`, once per batch); a base repair dropped after an infrastructure failure under a `base-red` pause (`… failed for infrastructure after … dropped; the base-red pause stays`); a batch composed unsigned although `landing.signing` is `ssh` (`<batchId>: <n> merge commit(s) composed unsigned: …`, once per batch); the owner voice falling back to the App's token (`owner voice unavailable, written with the App's token instead: …`, at most once per tick). A tick that hit a rate limit while landing fails with `landing <batchId> hit a rate limit (…)`. The detail says which. | Read the detail: each pause detail, and each other `error` detail an operator must act on, has an entry in [Incidents](#incidents). A landing that fails on every tick ends in the pause after three attempts. | | `queue-stalled` | The queue stopped making progress: paused for more than 120 minutes (with reason `error` or `tree-divergence`, at once), a candidate in flight for more than `checksTimeoutMinutes` + 60, eligible PRs and nothing started for more than `batch.maxWaitMinutes` + 30, three ticks in a row that failed, a stored withdrawal refused for more than 60 minutes, or three landings in a row without a verdict. One per episode, with one comment on the dashboard issue that mentions the approvers (see [Health](#health)). The detail lists the reasons. | See [The queue stalled](#the-queue-stalled). | ## Configuration keys `config/merge-queue/config.json`, validated by `validateConfig` in `scripts/merge-queue/config.mjs`. The workflow reads the copy on the default branch. Every key without a default is required, except `landing.identity`, which is required or refused depending on `landing.actor` (see its row), and `landing.signing: "ssh"`, which needs `landing.actor: "owner"`. An unknown key, top-level or in `batch`, `landing`, `landing.identity` or `lanes`, is refused. "Shipped" is the value in the config file of this repository. `tests/unit/merge-queue/runbook.test.mjs` fails when this table and the keys `validateConfig` reads differ. | Key | Type | Default | Effect | | ------------------------ | ------------------------------------------------------------ | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `schemaVersion` | `1` | none; shipped `1` | Version of the config format. | | `mode` | `shadow` or `live` | none; shipped `live` | `shadow` composes and tests but never lands or changes a PR; `live` lands (see [Shadow mode and live mode](#shadow-mode-and-live-mode)). | | `label` | label name | none; shipped `omni-queue` | The queue label. Repeated as a literal in the job filters of `omni-queue.yml` (see [Eligibility](#eligibility)). | | `protectedApprovalLabel` | label name, different from `label` | none; shipped `protected-approved` | Second label a PR that touches `protectedPaths` needs. Also repeated in the job filters. | | `approvers` | list of logins, at least one | none; shipped `["diegosouzapw"]` | Whose queue, protected-approval and lane labels count; also who may dispatch a `bless`. | | `appSlug` | App slug | none; shipped `omni-queue` | The App whose bot (`<appSlug>[bot]`) must have created the approval statuses. | | `bases` | anchored RegExp source | none; shipped `^release/v\d+\.\d+\.\d+$` | Which base branches the queue manages. | | `blockLabels` | list of label names | none; shipped `hold`, `hold-vps`, `do-not-merge`, `wip` | A PR with one of them is not eligible (`blocked-label`). | | `batch.maxSize` | integer 1 to 32 | none; shipped `12` | Most PRs in one batch. With `batch.adaptive` the ceiling the window can grow to. | | `batch.adaptive` | boolean | `false`; shipped `true` | The batch size is a window (`batchWindow` in the state): halved after a root batch whose own PRs made it red, one more after a full root batch lands or would land. A lane batch or a bisection segment never moves it; a suspected hang (a job that hit its time limit) does not halve it; nor does a red verdict that rests on a base check that timed out (see [Batch selection](#batch-selection)). `false`: every batch takes up to `batch.maxSize`. | | `batch.startSize` | integer from `batch.minSize` to `batch.maxSize` | `batch.maxSize`; shipped `6` | With `batch.adaptive`, the window of a state that has none yet. | | `batch.minSize` | integer 1 to 32, not above `batch.maxSize` | none; shipped `1` | Fewest eligible PRs to start a batch. Below it the queue waits, whatever `batch.maxWaitMinutes` says. | | `batch.maxWaitMinutes` | integer 0 to 1440 | none; shipped `10` | With fewer eligible PRs than the batch size (`batch.maxSize`, or the window with `batch.adaptive`), how long the oldest approval waits for more before a smaller batch starts. | | `landing.mode` | `merge-ff` or `squash-api` | none; shipped `merge-ff` | How a green batch lands (see [Landing modes](#landing-modes-landingmode)). | | `landing.actor` | `app` or `owner` | `app`; shipped `owner` | Whose token lands: the App's, or `OMNI_QUEUE_LAND_TOKEN` (see [Who lands](#who-lands-landingactor)). | | `landing.identity` | `{name, email}`, the email a `@users.noreply.github.com` one | none; required with `actor: "owner"`, refused otherwise | Identity of the queue's merge commits when the owner lands. | | `landing.signing` | `none` or `ssh` | `none`; shipped `ssh` | `ssh` signs every merge commit the queue composes with the key of the secret OMNI_QUEUE_SIGNING_KEY; refused unless `landing.actor` is `owner` (see [Signed merge commits](#signed-merge-commits-landingsigning)). | | `landing.statusContext` | `omni-queue/<name>`, `[A-Za-z0-9._/-]{1,100}` | `omni-queue/land`; shipped `omni-queue/land` | The land status the release ruleset requires. Must not be a required, aggregate or approval context. | | `requiredChecks` | list of check names, at least one | none; shipped three checks | Checks that must conclude `success` on a candidate (see [Accepting a candidate](#accepting-a-candidate)). | | `advisoryChecks` | list of check names, none in `requiredChecks` | none; shipped `Build (advisory)` | Checks whose failure does not make a candidate red. | | `aggregateChecks` | list of check names | none; shipped `Gate / CI`, `Gate / Quality` | `if: always()` gates left out of the classification next to another failure (see [Red candidates](#red-candidates-classification-base-check-bisection)). | | `checksTimeoutMinutes` | integer 10 to 1440 | none; shipped `240` | A candidate without a verdict after this long is a `checks-timeout`, handled like an infra failure. | | `infraRetries` | integer 0 to 5 | none; shipped `1` | Retries of the same SHA after an infrastructure failure before the `infra` pause. | | `flakyReruns` | `0` or `1` | `1`; shipped `1` | Re-runs of a red batch's failed jobs before it is bisected, tested against the base or dequeued (`flaky-rerun`); `0` turns them off. | | `preferGreenPrChecks` | boolean | none; shipped `true` | When choosing a batch, PRs whose `prGreenCheck` is green come first. | | `prGreenCheck` | check name | none; shipped `Gate / Quality` | The PR-level check `preferGreenPrChecks` looks at. | | `prChecksRequired` | list of distinct check names | `[]`; shipped `Gate / CI`, `Gate / Quality`, `API Route Typecheck` | Green on a PR head to enter a batch: worst of the suites reporting it; if they disagree, a run superseded by a newer run of the same workflow and event drops ([Eligibility](#eligibility)). | | `protectedPaths` | list of globs, at least one | none; shipped the agent-instruction surfaces and the queue's control plane | A PR that touches one also needs `protectedApprovalLabel` (see [Eligibility](#eligibility)). | | `lanes.hotfixLabel` | label name, distinct from every other label of the config | no `lanes` = no lanes; shipped `omni-queue-hotfix` | Applied by an approver to an eligible PR: at the next batch start it is composed alone, ahead of the FIFO. Never replaces what is in flight. Repeated in the tick's job filter. | | `voice` | `app` or `owner` | `app`; shipped `owner` | Whose token posts the queue's comments, removes its labels and writes its issues: the App's, or `OMNI_QUEUE_LAND_TOKEN`, with a fallback to the App's (see [Who speaks](#who-speaks-voice)). | | `lanes.baseRepairLabel` | label name, distinct from every other label of the config | no `lanes` = no lanes; shipped `omni-queue-base-repair` | Applied by an approver: composed alone (PR gates not required), the only work of a `base-red` pause; its landing lifts the pause. Never in a FIFO batch. Repeated in the tick's job filter. A repair that fails like the base is not composed again at that head (`repairTried`): push a fix (a new head is tried again), or remove this label (anyone who can label the PR can): the PR rejoins the FIFO. | ## CLI `npm run queue -- <command>` (`scripts/merge-queue/cli.mjs`) uses the GitHub CLI token (`gh auth token`). It reads state but never writes it: the workflow is the single writer. ```bash npm run queue -- status [--base <branch>] # queue, in-flight candidate, pause npm run queue -- add <PR...> # apply the queue label npm run queue -- remove <PR...> # remove the queue label npm run queue -- pause <base> [--reason <text>] # workflow_dispatch action=pause npm run queue -- resume <base> # workflow_dispatch action=resume npm run queue -- bless <base> --sha <sha> --reason <text> # workflow_dispatch action=bless npm run queue -- why <PR> # eligibility verdict and reasons npm run queue -- history [--base <branch>] [--limit <n>] ``` `add` only applies the label: the approval is recorded by the `approval` job, under the identity of whoever ran the command. It counts only if that login is in `approvers`. What the read commands show: - `status` prints, per base, the pause (its detail cut at 200 characters), the counts of the two withdrawal lists when either holds entries, the batch in flight with its stage, the counters, the age of the last state save, and the labeled PRs (drafts marked `[draft]`). The save line adds `STALE: no tick has saved it for more than 90 min while the base has work` when the base has a candidate in flight, a pause, a stored withdrawal or a labeled PR and its state is older than 90 minutes (`STATUS_STALE_MINUTES`). - `history` prints the last 20 events (`--limit` from 1 to 9999), newest first, each detail cut at 200 characters. - `why` evaluates the eligibility rules for one PR, with the local config, as a tick does: the PR gates (`prChecksRequired`, read from the head's check runs as the tick reads them) and the lane (a base repair's PR gates do not apply). It prints the verdict, the reasons, the approval, `PR gates (prChecksRequired): <gate> <state>; …`, `lane: <hotfix|base-repair|none>` and the actions the next tick would take. `pause` without `--reason` records the detail `paused from the CLI`. The tick stores a reason on one line, cut at 200 characters (`OPERATOR_REASON_CHARS` in `scripts/merge-queue/tick.mjs`), with the words `Kept nowhere` written `Kept-nowhere`, so that no reason can be read as the queue's own `Kept nowhere (both lists full)` clause. `pause`, `resume` and `bless` dispatch the workflow and then wait until the base's state document shows the action applied (a new `paused` event, no pause left, or a new `manual-bless` event for that SHA; see [Land status and manual bless](#land-status-and-manual-bless)). The dispatched run waits in the tick's concurrency group behind any running tick, and a newer tick can replace it there (it ends `cancelled`); the CLI then dispatches again. The command prints `<action> applied to <base>` (a bless prints its own line) only after that confirmation. It exits `1` when the run ends any other way without applying the action (for example `skipped` while the kill switch is off), or after 20 minutes without confirmation; in that case check `npm run queue -- status --base <base>` and the `omni-queue` runs before retrying. A `resume` names the pause it saw (`expect-pause:<since>` in the dispatch reason), and the tick clears only that pause. On a base that is not paused the CLI sends nothing. So a resume that waited behind a running tick never clears a pause recorded later (a safety pause), and sending the same request twice is harmless. When the targeted pause is gone but the base was paused again, the CLI says so and leaves it paused. A resume dispatched by hand in the Actions tab, with no reason, clears whatever pause is there, under the rule below. A `resume` is refused while `landWithdrawalsOverflow` holds entries (entries of `landWithdrawals` alone do not block it; `resumeRefusal` in `scripts/merge-queue/contracts.mjs` is the one rule the tick, the CLI and the dashboard use). The CLI refuses at once, without dispatching, and exits `1` with the reason: from the CLI, wait one tick (its retry pass may empty the overflow) and run `npm run queue -- resume <base>` again. The tick decides after its own retry pass, so a resume dispatched from the Actions tab once GitHub accepts the App's writes again succeeds when that tick empties the overflow; otherwise the tick leaves the pause exactly as it was and records one `error` event, which starts with `resume refused` and names both counts. The CLI's wait loop stops on such an event when it is newer than the ones it saw before dispatching, and exits `1` with it. A resume from the Actions tab that the tick refuses ends as a green run: look for the decision line `resume refused: …` in the run's log, the `error` event that starts with `resume refused` (`npm run queue -- history --base <base>`), and the dashboard's pause banner. There is no flag to force a resume: an entry GitHub refuses for good is handled by the last resort of [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full). The dashboard's pause banner says to wait, with the number of overflow entries, instead of how to resume. A `base-red` pause, which lifts by itself, never stands together with overflow entries: the queue never writes both, and a tick that loads both (a hand-edited state) replaces the `base-red` pause with the full-list pause before anything could lift it or bless its repair lane; that pause lifts only through a resume, under the rule above. A repair that a tick finds already landed at its start (its landing save was lost) is recorded before that replacement, and does not lift the `base-red` pause while the overflow holds entries either. The CLI evaluates eligibility with the local config file (`config/merge-queue/config.json`, or the file in OMNI_QUEUE_CONFIG, an override for the sandbox and the tests that the workflow never sets), so `status` shows the mode of your checkout, not necessarily the one on the default branch. `--repo <owner/repo>` points it at another repository (default: `gh repo view`). The same `pause`, `resume`, `dry-run` and `bless` actions are available from the Actions tab: workflow `omni-queue` → "Run workflow" → inputs `base`, `action`, `reason` and, for `bless` only, `sha`. `dry-run` observes and decides, prints the plan and writes nothing. Who may do what: a `pause` or a `resume` needs only the right to dispatch the workflow (write access to the repository); the tick checks no approver for them. Only `bless` checks that the dispatcher and the triggering actor are both in `approvers`. A resume never blesses anything by itself: the batch in flight is followed again, and before it is blessed every check of [Before the land status is written](#before-the-land-status-is-written) runs again. ## Shadow mode and live mode - **`shadow`**: the queue composes candidates, runs the full CI on them, bisects and classifies exactly as in live mode, but never lands and never changes a pull request. A green candidate produces a `would-land` event; each PR head settled that way is skipped until it changes. Use it to compare the batches the queue would land with the merges Mergify actually performs. - **`live`** (the shipped mode): green candidates land through `landing.mode`. - During shadow, the queue label is `omni-queue`, distinct from Mergify's `queue`, so the two never act on the same PR by accident. ### What shadow mode writes, and what it does not Shadow mode observes. The PRs it reads are the ones Mergify still lands, so it leaves them alone. | Shadow mode writes | Shadow mode never writes | | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | candidate branches `omni-queue/<base>/…` (pushed, then deleted) | a label removal, on any path (culprit, conflict, head changed after the label, head already in the base) | | the state file on `omni-queue-state` | a comment on a pull request from the tick (culprit, conflict, not eligible, protected surface, frozen base) | | the dashboard issue: its body, and one comment per stalled episode ([Health](#health)) | a `failure` status when a label is removed: the `approval` job writes nothing for `unlabeled` | | a comment on the `base-red` issue when it pauses a base as `base-red` | the `repair-not-fixing` and `landed` comments | | the `success` approval status when an approver applies a label (the `approval` job) | a landing, a merge, or any push to a base | | a `failure` land status, only as a withdrawal (below the table) | a `success` land status of its own (a `bless` an approver dispatches still writes one) | | a re-run of the failed jobs of its own candidate (`flaky-rerun`) | the "not an approver" comment of the `approval` job: a label from a non-approver is only logged | Shadow mode writes a `failure` land status only to withdraw one: on the commits of a batch stored at the landing stage whose land status is `success` by the rule of [Who lands](#who-lands-landingactor) or cannot be read (unknown: withdrawn anyway), and on the commits of stored withdrawals (`landWithdrawals`, `landWithdrawalsOverflow`). Only live mode stores a batch at the landing stage. A shadow tick stores a withdrawal too, when GitHub refuses its own withdrawal of such a batch, but every stored withdrawal comes from a batch live mode blessed: a queue that was never live writes none. What live mode would have done is recorded instead: - **Culprit**: the `culprit-found` event is recorded as in live mode and its detail ends with `shadow mode: label kept, no comment`. - **Would-dequeue**: a `would-dequeue` event names the PR, its head and the reason: `base-conflict` or `already-in-base` from the composition, or the eligibility reason codes when the rules asked for the label to go (`conflicting`, `head-changed-after-label`). One event per head. - **Not batched again**: a culprit, a base conflict and a head already in the base are remembered per head SHA in `shadow.processed`, next to the heads that would have landed. The PR shows up on the dashboard as `shadow-processed` until its head changes. A PR the eligibility rules reject stays out by its own reason for as long as that reason holds. - **Merged meanwhile**: Mergify may merge a PR of the batch while the candidate CI runs. When it merged the head the candidate tested, the green batch still counts: the `would-land` event ends with `merged meanwhile by another path: #N`. A PR merged at another head, closed, or whose label or approval went away drops out as in live mode and the rest is recomposed. - **Live-mode locks**: the first two checks that run before a blessing, the composition and the queue-refs protection, run in shadow mode too (see [Before the land status is written](#before-the-land-status-is-written)); the base-tip check, the landing-attempts limit and the land-token check are live only. Unprotected queue refs do not pause shadow mode: the `would-land` detail ends with `; live mode would pause: queue refs unprotected (<ref>: <rule>, …)`. A composition mismatch does pause the base in shadow mode as well, with reason `error`, and records no `would-land`. A check that cannot run (a git error while recomposing, a failed rules read) does not fail a shadow tick: the `would-land` detail ends with `; <composition check|queue refs check> could not run (<why>): live mode would fail the tick`, where `<why>` is the error on one line, cut to 200 characters. Removing a label without a `failure` status is safe: without the label the PR is not eligible, a label put back by someone who is not an approver does not count, and after an approver labels again only a status created no earlier than 60 seconds before that label approves the head (`approvalFor` in `scripts/merge-queue/eligibility.mjs`). `config/merge-queue/config.json` is read from the **default branch** by the workflow, so a mode change takes effect when it is merged there. ### Before a mode change or a stop A live tick can leave the land status `success` on commits of a batch that did not land: a tick that died after the blessing leaves its batch stored at the in-flight stage `landing`, and a withdrawal GitHub refused is stored in `landWithdrawals` or `landWithdrawalsOverflow` (see [Who lands](#who-lands-landingactor)). Every later tick withdraws them, in shadow mode too (a shadow tick sends a batch stored at the landing stage back to `testing` and turns its `success` into `failure` first), but no tick runs while the kill switch is off. So before switching a live queue to shadow (or shadow to live), turning the kill switch off or rolling back: 1. Pause each base: `npm run queue -- pause <base> --reason "<text>"`. The pause tick sends a batch at the landing stage back to `testing` and withdraws its land status; a paused base's ticks still retry the stored withdrawals. A pause that lasts more than 120 minutes raises the stalled alert once (see [Health](#health)): expected during a planned change. A batch at stage `landing` whose candidate is already the tip of the base did land (its push went through and the state save was lost). With `merge-ff`, the pause tick (and a shadow tick too) checks that first, logs `<batchId> is already the tip of <base>: it landed, its save was lost`, records a `landed` event and writes no status on the tip. A batch that did not land is sent back to `testing` and its status withdrawn (`omni-queue <batchId>: landing withdrawn (left the landing stage)`). With `squash-api` there is no such check: a batch whose merges went through and whose save was lost is taken as not landed, so the pause writes `failure` on its PR heads (already merged: harmless) and no `landed` event is recorded (see the known limits in [Red candidates](#red-candidates-classification-base-check-bisection)). Compare the PRs of a batch at stage `landing` with the base first if the history matters. 2. Check that no batch is at stage `landing` (`npm run queue -- status --base <base>` prints `stage <stage>` for the batch in flight) and that both `landWithdrawals` and `landWithdrawalsOverflow` are empty: the fields are absent from `state/<sanitized-base>.json` on `omni-queue-state` (an empty list leaves no field). While entries remain, wait for the next ticks to retry them and check again: ticks visit a paused base, and a base that stores withdrawals, through its open dashboard issue (see [State](#state)). Also read `paused.detail` in that file for the words `Kept nowhere (both lists full)`, and the history (`npm run queue -- history --base <base> --limit 200`, every stored event, each cut at 200 characters there; the whole detail is in `history[]` of the same file) for `error` events that start with `landWithdrawals is full`: each commit named after those words may still carry the App's `success` (see [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full)). Your own pause of step 1 keeps those words of the pause it replaced, so they stay in `paused.detail`. 3. Only then make the change. After a mode change, resume each base (`npm run queue -- resume <base>`). A resume is refused while `landWithdrawalsOverflow` holds entries (see [CLI](#cli)): wait until it is empty. ## Kill switch Every job of `.github/workflows/omni-queue.yml` is skipped unless the repository variable OMNI_QUEUE_ENABLED is exactly `true` (Settings → Secrets and variables → Actions → Variables). Setting it to anything else stops new ticks from being admitted: nothing new is composed, a candidate still waiting on its CI stops being followed, and a `bless` dispatch is skipped like any other run. It is not an immediate stop: the variable is read only when a job starts, so a tick already running (and possibly one already pending) finishes and can still land a green candidate. Pause the base first (`npm run queue -- pause <base>`) and check that no batch is at stage `landing` and that `landWithdrawals` and `landWithdrawalsOverflow` are empty (see [Before a mode change or a stop](#before-a-mode-change-or-a-stop)): with the variable off no tick runs, so nothing withdraws a land status left by a tick that died. Then flip the variable, cancel the in-progress and pending `omni-queue` runs in the Actions tab, and confirm with `npm run queue -- history` and the base tip that nothing landed after the cut. Forks never inherit repository variables. The same variable gates `.github/workflows/omni-queue-watchdog.yml`: with the kill switch off the watchdog does not run either, and an issue it opened stays as it is. The workflow and the orchestrator must exist on the **default branch**: `schedule`, `workflow_run` and `pull_request_target` always run the default branch's copy of the workflow. `pull_request_target` fires for every pull request of the repository, and each job mints an App token, so the jobs' `if:` keep only the events the queue cares about. The `approval` job starts only when the label added or removed is `label` or `protectedApprovalLabel`. A pull request event starts a tick only when that label is one of those two, one of `blockLabels` or one of the two `lanes` labels, when the pull request carries the queue label, or when the event is the merge of a pull request (a base moved). Both jobs run only for pull requests whose base starts with `release/v`: the queue manages release bases only, and no App token is minted for any other pull request. A label on, or a push to, a pull request that is not queued starts nothing. The 5-minute `schedule` trigger only acts on `cheaper-inference/OmniRoute`: both jobs skip a scheduled run in any other repository (a fork, or the sandbox used for the rehearsal). There, ticks come from the pull request events above, from a candidate's CI finishing (`workflow_run`), and from a manual "Run workflow". GitHub may also take a long time to start a cron in a new repository (none fired during the first hour of the rehearsal sandbox), so the cron is a safety net, never the main driver: a batch whose window has passed is composed by the next queue-relevant pull request event, the next candidate CI completion or a manual tick. ## Actions event policy (`pull_request_target` in public repositories) The `approval` job runs on `pull_request_target`: it is the only trigger that gives a labeled fork PR a job with the App secrets, and the job never checks out PR code. GitHub announced that **from December 2, 2026, `pull_request_target` is blocked by default in public repositories** unless an Actions policy explicitly allows it, with brownouts before that date ([changelog](https://github.blog/changelog/2026-11-02-pull_request_target-blocked-by-default-december-2), [docs](https://docs.github.com/en/actions/how-tos/administer/control-workflow-execution)). A blocked run does not execute: it ends with the status `Startup failure`, no jobs and an error annotation. With no jobs it has no check run either, so it does not appear among the pull request's checks, only in the Actions tab. Blocked approvals fail closed: no status is written, so no labeled PR becomes eligible and the queue lands nothing. To run the queue in a public repository, the owner creates an Actions policy (Settings → Actions → Policies, or the organization's) that targets only the workflow file `.github/workflows/omni-queue.yml` and allows its events. Policy rules are an allowlist, so list every trigger of the workflow, not only `pull_request_target`: `pull_request_target`, `schedule`, `workflow_dispatch` and `workflow_run`. The rehearsal sandbox runs with exactly this policy, created through the REST API by a repository admin (Team plan): ```bash gh api -X POST -H "X-GitHub-Api-Version: 2026-03-10" \ repos/cheaper-inference/OmniRoute/actions/policies --input policy.json ``` ```json { "name": "Allow omni-queue workflow events", "enforcement": "active", "conditions": { "workflow_path": { "include": [".github/workflows/omni-queue.yml"], "exclude": [] } }, "rules": [ { "type": "restrict_action_events", "parameters": { "allowed_events": ["pull_request_target", "schedule", "workflow_dispatch", "workflow_run"] } } ] } ``` The policy only targets the queue workflow: `ci.yml`, `quality.yml` and every other workflow keep running as before. ## Installing the GitHub App The queue pushes with a GitHub App installation token: refs pushed with the `GITHUB_TOKEN` do not trigger workflows, so a candidate pushed with it would never get CI. Creating the App is an owner action. 1. Organization settings → Developer settings → GitHub Apps → **New GitHub App**. 2. **GitHub App name**: `omni-queue`. The slug must match `appSlug` in `config/merge-queue/config.json` (the queue trusts statuses created by `<appSlug>[bot]`); if the name is taken, change `appSlug` to the slug GitHub assigns. 3. **Homepage URL**: the repository URL. **Webhook**: untick "Active" (the queue needs no webhook). 4. **Repository permissions**: | Permission | Access | What the queue does with it | | --------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Contents | Read and write | tick: push candidate branches, read and write `state/<base>.json` on `omni-queue-state`, delete candidate branches, read base tips and commits; with `landing.actor: "app"`, the landing push or merges too. approval: read | | Pull requests | Read and write | tick: read each queued PR (head, base, files, mergeability); write: only the per-PR merge of `squash-api` with `landing.actor: "app"` (`PUT /repos/{owner}/{repo}/pulls/{n}/merge`). Labels and comments on PRs go through the issues endpoints. With the shipped config (`owner`, `merge-ff`) no call of the App uses write here. approval: read the PR | | Issues | Read and write | tick: the dashboard issue and its stalled comment, comments on the `base-red` issue, the tree-divergence issue, reading `release-freeze` issues and PR timelines, removing labels from and commenting on PRs (live mode only); with `voice: "owner"` the App makes these writes only when the owner's token is missing or refused. approval: the "not an approver" comment | | Commit statuses | Read and write | approval: write `omni-queue/approval` and `omni-queue/protected-approval`. tick: read them, write and withdraw the land status, `bless` | | Workflows | Read and write | tick: push a candidate (and, with `landing.actor: "app"`, land it) when a PR of the batch changes a file under `.github/workflows/` | | Checks | Read-only | tick: the check runs and annotations of a candidate, and the PR gates of a PR head | | Actions | Read and write | tick: list the workflow runs of a candidate ref and of a PR head (read); re-run the failed jobs of a red candidate (write, `flakyReruns`) | | Metadata | Read-only | always granted | Each job mints its token with only part of this (the `approval` job: contents and pull requests read, issues and statuses write; the `tick` job: everything above). The tick also reads the rules GitHub enforces on `omni-queue-state` and on a candidate ref (`GET /repos/{owner}/{repo}/rules/branches/{branch}`); a sandbox rehearsal on 2026-11-15 showed that its token can. No organization or account permissions. No events to subscribe to. **Workflows** is needed because GitHub refuses a push that adds or changes a file under `.github/workflows/` unless the token has that permission: without it, every candidate (and every `merge-ff` landing) that contains a PR touching a workflow would be rejected. **Actions** write lets the tick re-run the failed jobs of a red candidate (`flakyReruns`), and the `tick` job of the workflow asks for it when it mints the App token (`permission-actions: write`). Grant "Actions: Read and write" to the App, and accept the new permission on the installation, **before** a tick runs with this version of the workflow: before OMNI_QUEUE_ENABLED is set or, where the queue is already enabled, before this version reaches the default branch. In the other order GitHub refuses to mint the tick's token (HTTP 422 for the job's whole permission set, measured on 2026-11-17), and every tick fails at that step, not only the re-run. The watchdog does not use the App: its workflow's own token has `contents: read`, `issues: write` and `pull-requests: read`. 5. **Where can this GitHub App be installed?** → "Only on this account". Create the App and note the **Client ID** and the numeric **App ID** shown on its page. The workflow mints the token with the Client ID (the secret OMNI_QUEUE_APP_CLIENT_ID, step 8); the numeric App ID is used only by `scripts/merge-queue/apply-ruleset.mjs --app-id` (see [Ruleset](#ruleset)) and is not a secret of the workflow. 6. **Private keys** → "Generate a private key". A `.pem` file downloads. It is the key of the production environment and of nothing else: keep it in the vault and delete the local copy after step 8. When you create it, revoke every other key of the App that was ever stored anywhere else (a rehearsal repository, a repository-level secret, a file). 7. **Install App** → the organization → "Only select repositories" → the production repository. Shadow mode already needs the App there: both jobs mint its token. **One App per repository that holds its key.** An App's private key is valid for every installation of that App: whoever holds it can mint a token for any repository the App is installed on. So a rehearsal repository gets a GitHub App of its own, never this one. If one App is shared for a while, the key stored in the rehearsal repository is a way into production: it can write the land status on any commit of the production repository. Before `mode: "live"` the App's key exists in this repository's `omni-queue` environment only (see [Cut-over and rollback](#cut-over-and-rollback), step 9). 8. In the repository, create the environment `omni-queue` (Settings → Environments → New environment) and its configuration: ```text Environment omni-queue Deployment branches: "Selected branches and tags", ONE rule: the default branch, by its exact name (for example release/v3.8.55), never a pattern Required reviewers: none Secrets: OMNI_QUEUE_APP_CLIENT_ID the Client ID from step 5 OMNI_QUEUE_APP_PRIVATE_KEY the full contents of the .pem from step 6 OMNI_QUEUE_LAND_TOKEN the owner's fine-grained token (see below) OMNI_QUEUE_SIGNING_KEY optional: the owner's SSH signing key, only for landing.signing "ssh" (see Signed merge commits) Repository variable (Settings → Secrets and variables → Actions → Variables) OMNI_QUEUE_ENABLED "true" only when the queue should run ``` The secrets live in the environment, **not** at repository level (see [Before OMNI_QUEUE_ENABLED is set](#before-omni_queue_enabled-is-set) for the order, and for deleting repository secrets of the same names). `OMNI_QUEUE_LAND_TOKEN` is a fine-grained personal access token of the owner, limited to this repository, with the permissions Contents: read and write, Pull requests: read and write, and Workflows: read and write, valid for 90 days; write the expiry date down and rotate it before then. GitHub requires the Workflows permission for a push of commits that change files under `.github/workflows/`, and the landing is made with this token: without it, the landing of every batch that touches a workflow is refused. The token is optional while the queue runs in shadow mode (see [Who lands](#who-lands-landingactor)), unless `voice` is `owner`. With `voice: "owner"` ([Who speaks](#who-speaks-voice)) the same token also needs **Issues: Read and write**: opening and updating an issue (the dashboard, the tree-divergence issue) and commenting on an issue (the dashboard, the `base-red` issue) are Issues endpoints. Comments on pull requests and the removal of a label from a pull request are already covered by Pull requests: Read and write. GitHub's table of [permissions required for fine-grained personal access tokens](https://docs.github.com/en/rest/authentication/permissions-required-for-fine-grained-personal-access-tokens) lists `POST /repos/{owner}/{repo}/issues` under Issues (write) only; `PATCH /repos/{owner}/{repo}/issues/{issue_number}`, `POST /repos/{owner}/{repo}/issues/{issue_number}/comments`, `DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}` and `DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}` under both Issues (write) and Pull requests (write), marked as needing additional permissions, which on an issue are Issues. The tick also reads the owner's login with `GET /user`, which that table does not list. A missing permission is a 403: the write is made by the App (see [Who speaks](#who-speaks-voice)), and the `error` event names it. Both jobs of `.github/workflows/omni-queue.yml` declare this environment with `deployment: false`: they get its secrets and its branch policy, and no deployment record is created per run. **Why the branch policy admits the default branch only.** `schedule`, `workflow_run` and `pull_request_target` always run the copy of the workflow on the default branch, but `workflow_dispatch` runs the workflow file of the ref it is dispatched on. With a pattern such as `release/v*`, anyone with write access could create a matching branch carrying an edited workflow, dispatch it and read the App's private key. That key is the root of trust of the status door (see [Ruleset](#ruleset)): whoever holds it can write the land status on any commit. With the default branch as the only admitted ref, a run from any other branch is refused by the environment before a step starts. That policy does not stop the queue from serving a pull request whose base is another managed release branch: a `pull_request_target` run is evaluated against the default branch, whatever the pull request's base. This was rehearsed in the sandbox repository on 2026-11-15, with one branch rule naming the default branch: a pull request into another release branch got the queue label, and the `Approval` job ran in the environment and wrote the approval status with the App. In the same rehearsal both jobs declared the environment with `deployment: false`, used its secrets, and no deployment record was created in the repository. **Release rollover.** The rule names a branch, so it changes whenever the default branch changes. Do it in this order: 1. apply the door to the new release branch (`--kind release --base <new branch>`, see [Ruleset](#ruleset)); 2. make the new branch the default branch; 3. replace the environment's branch rule with the new branch's exact name (replace it, never add a second rule); 4. delete the door ruleset of the previous (frozen) release branch. With the environment admitting only the new branch, even a manual `bless` cannot write `omni-queue/land` for the frozen branch, so its door would block the release captain's closing commits. The ruleset "Protect release branches" still prevents deletion and force-push, and only the release captain merges there during the freeze. The new branch must have its door before it becomes the default branch or is admitted by the environment. Without the door, anyone with write access could push an edited `omni-queue.yml` there, and the next scheduled run would read the App's private key. 9. Create the labels if they do not exist yet: the queue label (`label`, `omni-queue`), the protected-paths approval label (`protectedApprovalLabel`, `protected-approved`), the two lane labels (`lanes.hotfixLabel`, `omni-queue-hotfix`; `lanes.baseRepairLabel`, `omni-queue-base-repair`) and the dashboard label (`omni-queue-dashboard`, fixed in `scripts/merge-queue/contracts.mjs`). The queue also reads labels it does not own: `blockLabels`, `release-freeze` and `base-red`. The workflow mints a short-lived token per job with `actions/create-github-app-token` and narrows it to what that job needs (the `approval` job writes statuses and comments only). ### Before OMNI_QUEUE_ENABLED is set The environment is a prerequisite of enabling the queue, shadow mode included, not a step of the cut-over. Both jobs of the workflow name the environment `omni-queue` and read the App's credentials from it, and a run only happens while OMNI_QUEUE_ENABLED is `true` (the `if:` of both jobs). In this order: 1. create the environment `omni-queue` with its deployment-branch policy (the default branch, by exact name, step 8 above); 2. put its secrets in it: OMNI_QUEUE_APP_CLIENT_ID and OMNI_QUEUE_APP_PRIVATE_KEY, and `OMNI_QUEUE_LAND_TOKEN`. A shadow run never lands, so it works without the land token, but a live landing needs it: have it in place at the latest before `mode: "live"`, and before `voice` is set to `owner` (shadow mode writes the dashboard issue with it). OMNI_QUEUE_SIGNING_KEY only before `landing.signing` is set to `ssh`; 3. check that the App's installation has every permission of step 4 above, Actions: Read and write included, and that the labels of step 9 exist; 4. in a public repository, create the Actions policy that allows the events of `.github/workflows/omni-queue.yml` (see [Actions event policy](#actions-event-policy-pull_request_target-in-public-repositories)). Shadow mode needs it too: the `approval` job runs on `pull_request_target`, and without its approval statuses no PR becomes eligible; 5. apply the ruleset of the queue's own refs (see [Ruleset](#ruleset)); on the production repository: `OMNI_QUEUE_ALLOW_PRODUCTION_RULESET=1 node scripts/merge-queue/apply-ruleset.mjs --kind queue-refs --repo cheaper-inference/OmniRoute --app-id <app-id>`. This is needed in shadow mode too. Every tick loads the state document of `omni-queue-state` as it is (a pause, a batch in flight, stored withdrawals) and follows the candidate ref that document names (see [Before the land status is written](#before-the-land-status-is-written)). Without the ruleset anyone with write access can plant either: in shadow mode that falsifies what shadow measures before live, and the same plants are what the composition check and the refs check stop in live mode. The App is already the only legitimate writer of `omni-queue-state` and `omni-queue/**`, so shadow mode is not affected; 6. only then set OMNI_QUEUE_ENABLED to `true`. The same variable turns on the watchdog workflow. This cannot be left to GitHub: a job that names an environment that does not exist makes GitHub create it with no branch policy, and the first run would then read the secrets in an unprotected environment. **If the queue is already enabled with a workflow version that has no `environment:`** (the secrets are at repository level), do 1 and 2 first, before the change that adds `environment:` reaches the default branch. After the first successful run in the environment, delete the repository-level secrets of the same names. **If the environment still holds `OMNI_QUEUE_APP_ID`** from a workflow version that minted the token with the numeric App ID: add OMNI_QUEUE_APP_CLIENT_ID before the change that reads it reaches the default branch, and delete `OMNI_QUEUE_APP_ID` from the environment after the first successful run. The numeric id stays useful only on your machine, for `apply-ruleset.mjs`. **What the security design assumes**, in one place: - the environment `omni-queue` exists before the first run of the workflow; - it has one deployment-branch rule, of type branch, naming the default branch by its exact name; - no repository-level secret has the name of one of its secrets; - the App's private key is stored in no other repository (a rehearsal repository has an App of its own); - the ruleset of the queue's own refs (`omni-queue refs protection`) is active before OMNI_QUEUE_ENABLED is set. ## Ruleset Two templates under `config/merge-queue/` are applied by `scripts/merge-queue/apply-ruleset.mjs`, one per `--kind`. **`ruleset.release.json`** (`--kind release`, the default) is the door of **one** release branch, named `omni-queue release protection: <base>`: - `deletion` and `non_fast_forward`; - **no `pull_request` rule** and **no bypass actor**: nobody, the owner's admin role and the App included, puts a commit on the branch unless the commit carries the land status; - `required_status_checks` with **one** check only: the context `landing.statusContext` (default `omni-queue/land`), pinned with `integration_id` to the queue's GitHub App (`--app-id`), so a status of that name written by anyone else does not count. Not strict, and the ruleset does not require the PR's own checks: the queue reads them before a PR enters a batch (`prChecksRequired`) and validates the candidate before it lands. The queue's App writes the land status on the commit it is about to land, and `bless` writes it on one chosen commit (see [Land status and manual bless](#land-status-and-manual-bless)). The landing push or merge is then made as `landing.actor`. The App's private key is therefore the root of trust of the door, which is why it lives in a protected environment (see [Installing the GitHub App](#installing-the-github-app)). **`ruleset.queue-refs.json`** (`--kind queue-refs`) protects the queue's own refs, `omni-queue-state` and `omni-queue/**`, with the fixed name `omni-queue refs protection`. It has the rules `creation`, `update`, `deletion` and `non_fast_forward`, and one bypass actor: the App (`Integration`, bypass mode `always`). Only the App creates, updates or deletes the state branch and the candidate branches. Its include patterns are `refs/heads/omni-queue-state` and `refs/heads/omni-queue/**/*`: in GitHub's ruleset patterns a trailing `**` matches one path segment only, and a candidate ref has two (`omni-queue/<base>/<batchId>-<sha12>`), so `omni-queue/**` left the candidates unprotected (measured against GitHub on 2026-11-15); do not simplify the pattern. Two consequences: - once it is applied, a candidate rehearsal can only be started through `workflow_dispatch` of the `omni-queue` workflow: a user token can no longer push an `omni-queue/**` ref; - a commit by hand on `omni-queue-state` (see [State](#state)) and the deletion of leftover candidate branches (see [Cut-over and rollback](#cut-over-and-rollback)) need the ruleset to be disabled first. Rulesets stack, and **a ruleset's bypass list only covers that ruleset's own rules**. Two other repository rulesets still match release branches. The table also records the former default-branch ruleset for rollback. | Ruleset (id) | Matches | Rules | Effect on the landing push | | ------------------------------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | "Protect release branches" (15605329) | `refs/heads/release/*` | `deletion`, `non_fast_forward` | None: nobody can delete or force-push a release branch, and the landing push is a fast-forward. | | "Require PR on default branch" (21899981) | `~DEFAULT_BRANCH` | `pull_request`, no bypass actors | **Rejected it** on whichever release branch was the default branch (the active release): it had no bypass actor, and a ruleset of ours could not lift it for the landing actor. | | "Require green gates on the active release" (27616259) | `~DEFAULT_BRANCH` | `required_status_checks`: `Gate / CI` and `Gate / Quality`, pinned to GitHub Actions (`integration_id` 15368), not strict; no bypass actors | None: the landing push (`merge-ff`) pushes the candidate itself, and the queue lands a candidate only after its verdict saw both checks green on it from GitHub Actions. The landing-path check accepts it and prints it as an `info` line. | The status door replaced "Require PR on default branch" at cut-over (see [Cut-over and rollback](#cut-over-and-rollback)). If that ruleset is restored, the landing-path check below reports it. `apply-ruleset.mjs` creates the ruleset, updates it when its normalized content drifted, or leaves it alone, printing a readable diff: ```bash # preview: prints the diff and the REST body, writes nothing node scripts/merge-queue/apply-ruleset.mjs --base release/v3.8.55 --dry-run \ --repo <owner>/<rehearsal-repo> --app-id <app-id> # apply the door of one release branch on the rehearsal repository node scripts/merge-queue/apply-ruleset.mjs --base release/v3.8.55 \ --repo <owner>/<rehearsal-repo> --app-id <app-id> # apply the ruleset of the queue's own refs (no --base) node scripts/merge-queue/apply-ruleset.mjs --kind queue-refs \ --repo <owner>/<rehearsal-repo> --app-id <app-id> ``` - `--kind` is `release` (the default; `--base` is required) or `queue-refs` (takes no `--base`). - `--repo` defaults to `GITHUB_REPOSITORY`, `--app-id` to the environment variable `OMNI_QUEUE_APP_ID` of the shell that runs the script. It is the numeric App ID, not the Client ID the workflow uses, and it is not a secret of the workflow. A real apply of either kind without an App id is refused: the id pins the land status to the App (release) or is the only bypass actor of the queue's refs (queue-refs). A `--dry-run` without it warns and leaves that part out of the preview. - The land status context and the landing actor come from `config/merge-queue/config.json` (`landing.statusContext`, `landing.actor`). - The token comes from `GITHUB_TOKEN`, else from `gh auth token`; it needs administration access to the repository. - **Production lock**: a real apply of either kind on `cheaper-inference/OmniRoute` (or its old name `diegosouzapw/OmniRoute`) is refused unless `OMNI_QUEUE_ALLOW_PRODUCTION_RULESET` is `1`. The `--repo` string is checked before any API call; before any write the repository is also resolved through the API (`GET /repos/{repo}`, which follows renames and transfers) and the check repeats on the returned full name. `--dry-run` is always allowed. - **Landing-path check** (`--kind release` only): after the apply (or the preview) it reads every rule GitHub enforces on the branch (`GET /repos/{repo}/rules/branches/{base}`, all pages, org rulesets too) and lists the rules from **other** rulesets that would reject the landing push (`pull_request`, `required_status_checks`, `update`, `required_linear_history`, `required_signatures`, and the other types in `LANDING_BLOCKING_RULE_TYPES`) because the landing actor is not a bypass actor of that ruleset. For `landing.actor: "app"` the App must be an `Integration` bypass actor in mode `always` or `exempt`; for `"owner"` the repository admin role (`RepositoryRole` 5) or `OrganizationAdmin` in mode `always`. On `--dry-run` this is a warning; on a real apply the script exits `1`, after writing its own ruleset, until those rulesets are fixed. Its hint is to remove them: the status door replaces them. Rules whose ruleset is not readable with the token count as not bypassed. One exception, whoever lands: a `required_status_checks` rule the candidate already satisfies does not block. GitHub lets a commit reach a branch under such a rule when it was pushed to another branch first and its checks passed there, and the landing pushes the candidate whose checks the queue's verdict saw green. The rule is accepted only when `strict_required_status_checks_policy` is `false`, it has no parameter other than that one, `do_not_enforce_on_create` and `required_status_checks`, and every required check has only `context` and `integration_id`, with a context listed in `requiredChecks` (compared exactly) and an `integration_id` that is absent, `null` or 15368 (GitHub Actions, the only app whose run turns a required check green in the queue's verdict). Each accepted rule is printed as an `info` line naming its ruleset, and it never changes the exit code. A strict rule, a check outside `requiredChecks` or a check pinned to another app still blocks. - Exit codes: `0` ok, `1` failure (API error, or a foreign rule blocks the landing push), `2` usage error or refused. - Run `--kind release` once per new release branch, after the branch is cut and before it becomes the default branch (see the release rollover in [Installing the GitHub App](#installing-the-github-app), step 8), and `--kind queue-refs` once per repository, before the queue is enabled. ## Land status and manual bless **The land status** is the commit status `landing.statusContext` (`omni-queue/land` by default). The release ruleset requires it in `success`, from the queue's App, on the commit that reaches the branch. - **Who writes it.** The queue's App, through the tick's own App client (never the land token). The tick writes `success` right before it lands: on the candidate with `merge-ff`, on each PR head with `squash-api` (the `land-blessed` event). If the landing does not complete, the tick turns the status of the same commits into `failure`. `bless` (below) is the only other writer. In shadow mode nothing lands, so no batch is blessed (a `bless` still writes `success`, in any mode). A shadow tick writes `failure` only to withdraw a `success` that live mode left before a switch to shadow (see [Before a mode change or a stop](#before-a-mode-change-or-a-stop)); a queue that was never live reads and writes no land status for its batches. - **Who reads it.** The release ruleset. The queue's own verdict on a candidate reads no commit status at all (see [Accepting a candidate](#accepting-a-candidate)). ### Before the land status is written The tick trusts two things it reads back from the repository: the batch in flight on `omni-queue-state` and the candidate commit under `omni-queue/**`. Before a green batch is blessed (and, in shadow mode, before it is recorded as `would-land`), after its pull requests are re-read (see [Eligibility](#eligibility)), the tick checks, in this order: 1. **The candidate is the composition of the stored batch** (`verifyComposition` in `scripts/merge-queue/land.mjs`, live and shadow). The first-parent chain from the stored base to the candidate holds one queue merge commit per pull request (stacked pull requests excepted), with the `Omni-Queue-PR` and `Omni-Queue-Head` trailers and the second parent the batch names, and nothing else. Each merge commit's tree must be what its two parents merge to: the tick recomposes it with `git merge-tree`, the call the composition makes. Each merge commit must also carry exactly one `Omni-Queue-Base`, equal to the stored base: the candidate's CI takes its base from that trailer (`scripts/merge-queue/candidate-base.mjs`), and a second line with that key, in any paragraph of the message, is a mismatch (the queue never writes two). The tick reads each commit's whole message, as the CI does: output of `git log` that does not split into whole commits is a mismatch too, never skipped. With `squash-api` the candidate's tree must also be the stored one. The check does not compare the subject line, the other trailers (`Omni-Queue-Author`, `Omni-Queue-Target`, `Omni-Queue-Batch`) or the commits' author and committer. A mismatch blesses nothing, records no `would-land` in shadow mode, and pauses the base with reason `error` and this detail: ```text the stored in-flight batch <batchId> does not match its candidate <sha12>: <what differs> (state tampering or corruption: not landed, not retried) ``` For a tree, `<what differs>` reads `merge commit <sha12> of #<n>: tree <sha12>, recomposing gives <sha12 or conflict>`. For the base trailer it reads `merge commit <sha12> of #<n> carries Omni-Queue-Base <sha12>, the batch's base is <sha12>`, `merge commit <sha12> of #<n> carries no Omni-Queue-Base trailer`, or `merge commit <sha12> of #<n> carries <count> Omni-Queue-Base trailers`. A chain that cannot be read reads `the first-parent chain cannot be read as whole commits` or `the first-parent chain cannot be read past commit <n>`. A git error while recomposing (an object the tick's scratch repository cannot fetch) is not a mismatch. In live mode it fails the tick, which blesses nothing (the next tick checks again). In shadow mode the tick goes on and the `would-land` detail ends with `; composition check could not run (<why>): live mode would fail the tick`. 2. **GitHub protects the queue's refs** (`readQueueRefsProtection` in `scripts/merge-queue/refs-guard.mjs`). The tick reads the rules GitHub enforces on `omni-queue-state` and on the batch's candidate ref (`GET /repos/{owner}/{repo}/rules/branches/{branch}`, once per tick) and requires `creation`, `update` and `deletion` on both: the rules of the `omni-queue refs protection` ruleset (see [Ruleset](#ruleset)). In live mode, when one is missing, nothing is blessed and the base is paused with reason `error`: ```text queue refs are not protected (<ref>: <rule>, …): not blessed, not landed; apply apply-ruleset.mjs --kind queue-refs, then resume ``` In shadow mode nothing pauses: the `would-land` detail ends with `; live mode would pause: queue refs unprotected (<ref>: <rule>, …)`. A failed read is never taken for protected or unprotected. In live mode it fails the tick (the next tick reads again); in shadow mode the `would-land` detail ends with `; queue refs check could not run (<why>): live mode would fail the tick`. 3. **The base tip is the stored base** (live mode only). The tick reads the base tip once, at the start of the landing, and it must equal the base the batch was composed on: a stored base that is not the tip (planted in the state, or rewound away) would otherwise let a blessed candidate carry it into the branch by a manual fast-forward. If the base moved, nothing is blessed: a `land-rejected` event with the detail `base moved: base <base> is at <tip>, expected <stored base>; recomposing`, and the same pull requests are composed on the tip. If the base branch does not exist, the base is paused with reason `error` and the detail `base <base> not found: not blessed, not landed`. Then, in live mode only, the landing-attempts limit (see [Who lands](#who-lands-landingactor)) and the land token are checked, the landing stage is saved and the land status is written. Shadow mode judges a batch on its stored base: there the base moves all the time and nothing lands. A manual bless does none of this: it does not use the batch in flight, and the approver chooses the commit. **Manual bless** is the explicit exit for a commit that has to reach a release branch without going through a batch. It writes the land status on one commit of your choosing. ```bash npm run queue -- bless release/v3.8.55 --sha <40-hex sha> --reason "sync-back of main" ``` The CLI takes the base as a positional argument. It dispatches the `omni-queue` workflow with `action=bless` (from the Actions tab you fill the workflow inputs `base`, `action`, `sha` and `reason` yourself; the tick receives them as `--base`, `--action`, `--sha` and `--reason`) and waits for the `manual-bless` event of that SHA before it reports the bless as applied. It needs OMNI_QUEUE_ENABLED to be `true`, like any run of the workflow. Dispatch a bless through the CLI, not from the Actions tab. The run waits in the tick's concurrency group (`omni-queue-tick`), where GitHub keeps one pending run: a newer tick can replace the pending bless, and that run ends `cancelled` without writing anything. The CLI sees it, dispatches the bless again and keeps waiting for the `manual-bless` event; a bless dispatched by hand is lost the same way and nobody dispatches it again (see [CLI](#cli)). The tick checks, in this order, **before anything is written**: 1. both the person who dispatched the run (`github.actor`, passed to the tick as `GITHUB_ACTOR`) and the person who triggered this run of it (`github.triggering_actor`, passed as `GITHUB_TRIGGERING_ACTOR`) are in `approvers`. They differ on a re-run, which keeps the inputs of the original dispatch; when either variable is missing the bless is refused; 2. `--sha` is a full 40-hex, lower-case commit SHA; 3. a reason is given (whitespace is collapsed); 4. the repository's Git commits endpoint (`GET /repos/{owner}/{repo}/git/commits/{sha}`) returns a commit with that SHA. The check proves that GitHub can read the commit through this repository, not that the commit is on one of its branches. The base (the CLI's positional argument, the `base` input of the workflow) must also be matched by `bases`. A refused bless writes nothing: no status, no event, no state change, and it does not count as a failed tick. The run ends failed and the CLI reports that the run ended without applying the bless. An accepted bless: - writes `omni-queue/land` in `success` on that commit, with the description `manual bless by @<login>: <reason>` (cut to GitHub's 140 characters), or `manual bless by @<dispatcher> (re-run by @<re-runner>): <reason>` when the two logins differ; - records a `manual-bless` event in the base's history (`npm run queue -- history`) with the SHA, the login and the reason, and saves the state; - drops a stored withdrawal of that commit from `landWithdrawals` and `landWithdrawalsOverflow` (otherwise the next tick would turn the blessing into `failure`), and touches nothing else: no in-flight batch, no pause, no pull request, no dashboard. After it, **you** push or merge that commit yourself. The queue lands nothing for a bless, and the rules of the release ruleset that stay (`non_fast_forward`, `deletion`) still apply, so a push has to be a fast-forward of the branch. The commit is not validated by the queue: the bless is a maintainer's decision, not a CI verdict. The three uses: - **Hotfix**: a commit that cannot wait for a batch. - **Sync-back landing**: the `main → release/vX+1` merge commit, pushed as the merge commit it already is (see AGENTS.md → "Sync-back landings are merge commits, never squash"). - **Base repair**: a fix to a red base that the maintainer lands directly instead of through a batch. A bless works in shadow mode and while the base is paused: the code checks neither the `mode` nor the pause. While no ruleset requiring the status is applied to the branch (the case in shadow mode before the cut-over), a bless changes nothing about what can be pushed: it only records the status and the event. ## What appears as the owner and what appears as the App The table reflects the shipped config (`landing.actor: "owner"`, `voice: "owner"`, `landing.signing: "ssh"`). | On GitHub | Appears as | | ------------------------------------------------------------ | ----------------------------------------------- | | "merged by" on a landed pull request (the `merge-ff` push) | the owner (`OMNI_QUEUE_LAND_TOKEN`) | | author and committer of the queue's merge commits | `landing.identity` (the owner), signed with SSH | | comments the tick posts on pull requests and label removals | the owner | | new dashboard issues, dashboard body edits and comments | the owner | | comments on the `base-red` issue, the tree-divergence issue | the owner | | commit statuses (`omni-queue/land`, both approvals, a bless) | the App, always | The tick uses the App for the third to fifth rows when `voice` is `app` or when the owner's token is missing or refused. With `landing.signing: "none"`, the merge commits are unsigned. **Always the App, whatever the config**, and why: - every commit status: `omni-queue/land` (the release ruleset's door pins it to the App's integration id), `omni-queue/approval`, `omni-queue/protected-approval`, a `bless`; - candidate branches `omni-queue/**` and the `omni-queue-state` branch (the queue-refs ruleset admits the App only); - re-runs of a candidate's failed jobs; - every read, including the comment listings the markers are checked against; - the `approval` job's "not an approver" comment: that job never receives the owner's token; - a write the owner's token cannot make (missing token, 401 or 403): the App makes it instead, and an `error` event says so. **The watchdog speaks as `github-actions[bot]`**: its issue and comments use the workflow's own token on purpose, so it works when the environment's secrets fail. ## Security posture - **No PR code runs in the queue workflow.** Both jobs check out the default branch (sparse: `scripts/merge-queue` and `config/merge-queue`) and run zero-dependency Node scripts. PR content is handled only as git objects in a scratch bare repository (`git merge-tree` / `git commit-tree`); no working tree of PR code is ever created. - **Candidates run with repository secrets** (not those of the `omni-queue` environment), the same posture as Mergify's draft PRs today: a candidate contains fork code and `ci.yml` / `quality.yml` run on it. The approver's label is the authorization, so review a PR before labelling it. - **Hosted runners only.** The queue jobs run on `ubuntu-latest`, never on a self-hosted runner, and the candidate CI uses the hosted lanes of the `merge_group` profile. - **No deploy or publish on `omni-queue/**`**: VPS deploy, Docker and npm publication never trigger on candidate branches. - **Least privilege**: one App token per job with only the permissions that job needs; the workflow's own `GITHUB_TOKEN` is read-only. The owner's `OMNI_QUEUE_LAND_TOKEN` reaches only the tick step; the landing uses it with `landing.actor: "owner"`, and the queue's comments, label removals and issues with `voice: "owner"` (never a commit status, a ref, the state branch or a re-run). The `approval` job never receives it. - **The signing key** (OMNI_QUEUE_SIGNING_KEY, `landing.signing: "ssh"`) reaches one step of the tick job, which writes it to a `0600` file under `RUNNER_TEMP`; the job's last step removes it (`if: always()`). git gets the path as per-command configuration through the environment, never as an argument; no log line, event, state, comment or error message holds the key or its path. A signature changes nothing the queue verifies (see [Signed merge commits](#signed-merge-commits-landingsigning)). - **Comment markers are trusted by author**: only markers written by `<appSlug>[bot]`, or by the owner's login read from the owner's token itself, count; a marker anybody else writes is ignored. - **The App key is the root of trust of the status door.** Whoever can use it can write the land status on any commit. Both jobs run in the `omni-queue` environment, which holds the App's credentials and the land token and admits the default branch only, so a workflow on a candidate branch, or on a branch someone creates and dispatches, cannot read them (see [Installing the GitHub App](#installing-the-github-app), step 8). - **Untrusted text**: PR titles are flattened by `sanitizeTitle` before they reach a commit message and escaped in the dashboard; git runs through `scripts/merge-queue/gitexec.mjs` (no shell, token in the environment as an HTTP header, OMNI_QUEUE_TOKEN and `OMNI_QUEUE_LAND_TOKEN` removed from the environment of every git process, redacted errors). - **One thing still speaks as `github-actions[bot]`**: the watchdog (`.github/workflows/omni-queue-watchdog.yml`, `scripts/merge-queue/watchdog.mjs`) uses its workflow's own token on purpose, so it keeps working when the environment's secrets fail. - **Approvals are bound to SHAs**, never to commit dates (see [Eligibility](#eligibility)). ## Incidents ### Base-red What you see: the dashboard banner "⏸️ Queue paused — reason `base-red` since <time>", its detail (`all <n> failure(s) also fail on base <sha12>`, or `<batchId> failed like the bare base`), the banner line "Resumes automatically when the base tip moves.", a `base-red-paused` event and, when a `🔴 Release branch not green: <base>` issue is open, a comment on it that starts "🔴 omni-queue paused `<base>`". The batch is innocent and stays queued. Fix the base through its own `fix/release-vX.Y.Z-basereds` PR (AGENTS.md → "Base-green check"); the pause lifts by itself when the base tip moves. That fix reaches the paused base one of two ways: - through the queue: an approver applies the queue label and the base-repair label (`lanes.baseRepairLabel`) to the fix PR. It is composed alone, without its PR gates, and in live mode its landing lifts the pause (see [Batch selection](#batch-selection)); - by hand, once the door is applied (see [Ruleset](#ruleset)): bless the head of the fix PR (`npm run queue -- bless <base> --sha <head> --reason "base repair"`), then merge it (see [Land status and manual bless](#land-status-and-manual-bless)). If the failure turns out to be flaky and the tip will not move soon, resume by hand: `npm run queue -- resume <base>`. A `base-red` pause older than 120 minutes raises the stalled alert (see [Health](#health)). ### Base-repair lane What you see, in live mode, on the repair PR: a comment that starts "🔴 omni-queue: this PR is in the base-repair lane of `<base>`, but its candidate failed with the same failures as the base". The two ways out are in [The two lanes](#the-two-lanes-lanes). A repair whose CI fails for infrastructure after its retries is dropped and the `base-red` pause stays (an `error` event that ends `dropped; the base-red pause stays`); the lane composes the repair again, a new candidate, at most `infraRetries` + 1 times for the same head on the same base tip (two candidates of two runs each with the shipped `infraRetries: 1`). Then it stops, says so once on the PR ("the CI of this base repair failed for infrastructure <d> times …") and on the dashboard, and the `base-red` pause, which becomes a stalled queue after 120 minutes, stays. What to do: check the Actions status and the repair's runs; once the outage is over, push a commit to the repair PR (a new head is tried again) or land the fix by hand (bless its head, then merge it), which moves the base. An `error` pause reached while a repair is in flight (a landing that cannot go on, a full withdrawal list) replaces the `base-red` pause, as for any batch. After the resume the repair is taken again; if it lands there is no `resumed` event `base repaired by #<n>`, because no `base-red` pause was left; without a valid repair, the next ordinary batch on the red base is classified base-red again from the recorded verdict. A lane label removed while its candidate is in CI does not drop the candidate (lane labels, like the PR gates, are not re-read before landing); removing the queue label still does. In shadow mode a repair that does not fix the base posts no comment on its PR: the record is the `repairTried` entry, the events of its red candidate, and `base-red-paused` when the base was not paused yet. ### Pause and resume What you see: the dashboard banner "⏸️ Queue paused — reason `manual` since <time>", its detail (your reason; `paused manually` from the Actions tab without one, `paused from the CLI` from the CLI without one), a `paused` event, and the banner line "Resume with `npm run queue -- resume <base>` once the cause is fixed.". `npm run queue -- pause <base> --reason "<text>"` freezes one base (reason `manual`): its ticks neither follow the candidate in flight nor compose or land anything, and that candidate is picked up again after `npm run queue -- resume <base>`. A paused base's ticks still run: they retry the stored land-status withdrawals (see [Who lands](#who-lands-landingactor)), take the PR snapshot and run eligibility (dashboard, eligibility comments and label removals), delete stray candidate refs, judge the queue's health and update the dashboard. A pause of more than 120 minutes is a stalled queue (see [Health](#health)): one alert mentions the approvers. The pause tick itself sends a batch at the landing stage back to `testing` and withdraws its land status (with `merge-ff`, a batch whose candidate is already the base tip is recorded as landed instead; when that batch was a segment of a bisection, the next segment is not composed under the pause: the bisection ends there, and its PRs keep their labels and come back through the FIFO after the resume). The reason is stored on one line, cut at 200 characters, with `Kept nowhere` written `Kept-nowhere`. A pause or a resume needs only the right to dispatch the workflow (no approver check; see [CLI](#cli)). To stop every base, use the kill switch, and cancel any running `omni-queue` run (see [Kill switch](#kill-switch)). ### Recomposition when the base moves A `land-rejected` event whose detail starts with `base moved` means the base is no longer where the batch was composed (a manual merge, a sync-back, a hotfix). In live mode the tick compares the base tip with the stored base before it blesses anything (`base moved: base <base> is at <tip>, expected <stored base>; recomposing`), so in the ordinary case nothing was blessed. Between that read and the landing the base can still move. With `squash-api` the landing refuses any move, forward ones included; with `merge-ff` the push refuses a base that moved anywhere other than towards the candidate. A refused landing withdraws the status written for it, records `land-rejected` and loses nothing: the same PRs are composed on the new tip and CI runs again. One exception, `merge-ff` only: a tip that moved forward to a commit between the stored base and the candidate (one of the batch's own PR heads, for example) is not refused, and the push lands the exact tested tree, with no `land-rejected`. Frequent `land-rejected` events mean something else merges into a managed base; route those merges through the label instead. A tip the queue did not expect and nobody pushed (a rewind, a commit named in the state that never was the tip) is worth a look at the base's history before anything else. ### Landing paused: base not found What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>" with the detail below. The detail `base <base> not found: not blessed, not landed` means the release branch did not exist when the tick read it. Nothing was blessed. Find out what happened to the branch (deleted, renamed, a release rollover done out of order) and restore it before `npm run queue -- resume <base>`: the pause dropped the batch, and after the resume its PRs are composed again on the tip. ### Tree divergence (`squash-api` only) What you see: the dashboard banner "⏸️ Queue paused — reason `tree-divergence` since <time>", its detail (`squash-api landing of <batchId> produced tree <sha>`, or `divergence issue #<n> is open: close it, then resume the queue`), a `tree-divergence` event and the issue `🛑 omni-queue tree divergence: <base>`. The base tree after the squash merges differs from the candidate tree. The queue pauses with reason `tree-divergence` and opens an issue. Compare the two trees (`git diff <candidateSha> <base>`), fix the base by PR if needed, close the `🛑 omni-queue tree divergence: <base>` issue, then resume (`npm run queue -- resume <base>`). While that issue is open, every `squash-api` landing pauses the base again. Prefer `merge-ff`, which cannot diverge. ### Infra failure or timeout What you see: the dashboard banner "⏸️ Queue paused — reason `infra` since <time>", its detail `<batchId>: <what failed>` (for example `<batchId>: checks timed out after 240 min`, `<batchId>: no CI run for candidate after 45 min` or `<batchId>: all <n> failure(s) are infrastructure`), and an `infra-paused` event. Up to `infraRetries` retries under a new ref (`-r1`, `-r2`, …; one in the shipped config); the failure after the last retry pauses the base with reason `infra`, unless every run of the candidate only hit a job time limit: that is a suspected hanging test (`hang-suspected`) and ends in a base check and a bisection, not a pause (see [Red candidates](#red-candidates-classification-base-check-bisection)). Check the Actions status page and the candidate's run, then resume. A `checks-timeout` event whose detail says "no CI run for candidate" means GitHub never started a workflow for the candidate push: check the Actions policies and that `ci.yml` / `quality.yml` still trigger on `omni-queue/**`. ### Who is told, and when What you see: a comment that starts "🚨 The omni-queue of `<base>` has stalled" on the dashboard issue, or the issue `omni-queue: the queue is not making progress`. The approvers (`approvers` in the configuration) are told in two places. The watchdog is the backup of the dashboard comment, so usually only one of them speaks for a cause; both can, when a comment that could not be posted for 30 minutes is posted after the watchdog opened its issue: - the dashboard issue of the base: one comment per stalled episode (`queue-stalled`), posted by the tick that records it or, when that fails, by the next tick, completed or failed, that can (`notified` in `stalled` once it is posted); - the watchdog issue, `omni-queue: the queue is not making progress` (`scripts/merge-queue/watchdog.mjs`, every 30 minutes): when a base with work (a candidate in flight, a pause, a stored land-status withdrawal, or a labeled PR, drafts included) has saved no state for more than 90 minutes; when a managed base that labeled PRs target has no state file at all and the newest update of those PRs is more than 90 minutes old ("**Labelled pull requests, no state file**": no tick ever completed or recorded a failure for it, as when the App token cannot be minted); when the queue's config does not load or does not validate ("**The queue's config cannot be loaded**", with its one-line reason; such a run judges nothing else, never closes the issue, and mentions the approvers only when the raw JSON has an `approvers` array of valid logins); when an episode's comment has not been posted 30 minutes after the episode opened, on a base that is not an orphan (no work and no save for 90 minutes); or when a state file cannot be read: it is not JSON, it fails `validateState`, or its document is valid but not where its base belongs. That last case has two reasons: "the document is for base B, which the queue does not manage" (its own file, or a name the store refuses), and "the document is for base B, which is stored in state/<sanitized-base>.json" (another file; an unmanaged base gets this one too when its document is not in its own file). The base name and the file name are each clipped to 60 characters inside the reason, so the reason stays readable. Both lines add what to do: if a managed base is stored in this file, its ticks fail until the file is fixed or deleted; otherwise the file is stray and can be deleted. An unmanaged base's own file written by an older version (before ticks refused a base the queue does not manage) is reported this way too, until someone deletes it with an ordinary commit on `omni-queue-state` (with the `omni-queue refs protection` ruleset applied, disable it first, and enable it again after). The approvers are mentioned when the issue is created. While it stays open its body is kept up to date in place (absolute times, no new mention; a hidden hash line decides whether it changed); it is closed with a comment when nothing fires, and reopened with a comment and no mention if something fires again within 24 hours of the closing. A file or a listing the watchdog cannot fetch (the state files, the labeled PRs) is not a signal: a GitHub incident of a few minutes opens no issue and pings nobody. It makes the run partial: a partial run may still open or reopen the issue for what it did establish, but it never closes the issue, never posts the closing comment and never rewrites an open issue's body; then it fails (red), one error line per failed read. When the listing of the state files itself or the issue search fails, the run writes nothing and prints one error line (the message, no stack trace). A read that keeps failing shows as a red scheduled `omni-queue watchdog` run. Three numbers bound a watchdog run, all counted from its start. No state-file fetch starts after 150 seconds (`WATCHDOG_READ_BUDGET_SECONDS`): the run is partial and its error line reads "read budget exhausted after N of M state files". No write sequence (create, reopen, update, close) starts after 210 seconds (`WATCHDOG_WRITE_CUTOFF_SECONDS`): the run is partial and its error line reads "write cut-off of 210 s passed". At 240 seconds (`WATCHDOG_DEADLINE_SECONDS`) the script stops waiting for the run and exits 1 with "deadline of 240 s reached: the run was stopped" and what it was doing. The budget only limits when fetching starts; one request is bounded by the watchdog's own client limits (`WATCHDOG_MAX_RETRIES`, `WATCHDOG_REQUEST_TIMEOUT_SECONDS`, `WATCHDOG_MAX_WAIT_SECONDS`: at most 3 attempts of 15 seconds and 2 waits of 15 seconds, 75 seconds; a `Retry-After` longer than 15 seconds, or a rate-limit reset further away than 15 seconds, is not waited for: the read fails at once). The deadline leaves the job's 5-minute limit about a minute for checkout and Node setup; only when those take longer is the run killed before it prints its line. Once the deadline has fired the run starts no write, and a reopen or a close stops between its comment and its issue update: the next run finds the issue again by its title and marker. The run itself is still pending then; the workflow's script exits the process at once. What the dashboard alert covers, by its rules (see [Health](#health)): a pause of more than 120 minutes, an `error` or `tree-divergence` pause at once, a candidate in flight too long, eligible PRs with nothing started, three failed ticks in a row, a land-status withdrawal GitHub has refused for more than an hour, and three landings in a row without a verdict. What the watchdog adds: a base whose ticks stopped saving, a base with labeled PRs and no state file, an undelivered alert, an unreadable state file and an invalid config. One comment per episode, and a new episode for each new kind of cause that begins while one is open (see [Health](#health)): a pause for an error during a run of failed ticks is told on its own. What still tells nobody (each shows on the dashboard or in the history only): - a labeled PR that waits on `pr-checks-not-green`, `approval-missing`, `label-not-by-approver` or any other eligibility reason: it is not eligible, so the waiting rule does not count it; - a check run on a candidate that is no real job of its push runs: one `error` event, nothing more; - a `would-land` event that says `live mode would pause: …` or `… could not run (…)` in shadow mode; - a `base-red` pause younger than 120 minutes, and a release freeze that holds a green batch; - the watchdog's own workflow failing before its script runs (a broken workflow file, a lost runner): only its red scheduled runs show it; - a person closing a dashboard issue: nothing is told until the base's state stops moving, then the watchdog reports it after 90 minutes; - a cause of a kind the open episode already carries, or one that began before that episode opened (it is in the episode's comment only when it held when the episode opened); - a base repair the lane stopped composing after its infrastructure drops: one comment on its PR (not in shadow mode) and the dashboard line; the `base-red` pause itself is a stall after 120 minutes. ### The queue stalled A comment `🚨 The omni-queue of <base> has stalled since <time>` on the dashboard issue (or the same reasons in the watchdog issue) lists why. Each reason line points at its cause: - `paused … since …, for more than 120 min`: read the pause banner and its entry below (for a manual pause: resume it when the change it was for is done); - `batch … in flight since …, for more than <n> min`: open the candidate's checks from the dashboard's In flight section. A run that never ends or never starts is an Actions problem (see "Infra failure or timeout"); the queue itself takes the `checks-timeout` path at `checksTimeoutMinutes`; - `eligible PRs waiting with nothing in flight since …`: ticks complete but compose nothing; read the latest `omni-queue` runs (the decision lines say why) and the `error` events; - `<n> ticks in a row failed, the first at …`: read the `error` events (`npm run queue -- history --base <base>`) and the failed `omni-queue` runs; - `paused (reason <reason>) since …: a pause for this reason does not lift by itself` (`error` or `tree-divergence`): read the pause detail and its entry in Incidents; - `stored land-status withdrawals not written for more than 60 min (<n> in landWithdrawals, <m> in landWithdrawalsOverflow): the oldest, <sha12> of batch <batchId>, refused since …`: see [A withdrawal GitHub refused, or one refused for a day](#a-withdrawal-github-refused-or-one-refused-for-a-day); - `<n> landings in a row ended without a verdict, the first at …, none landed since: the landing keeps failing`: read the `error` events of the failed ticks (the error each landing threw) and the base's history for what keeps moving it. The episode ends by itself at the first completed tick that finds none of these (an episode that failed ticks opened, after two completed ticks in a row); nothing needs to be closed by hand. The watchdog issue closes itself once none of its signals fires. ### Dashboard stopped updating What you see: the Health section's line `Heartbeat: ticks completing as of <hour>` no longer moves. An idle queue rewrites only the dashboard's heartbeat line, once per hour, and only for a base that ticks visit, so first tell idle from dead: while ticks complete for a base, `updatedAt` in `state/<sanitized-base>.json` on `omni-queue-state` moves at least once per hour. A tick that fails saves too (its `error` event), so a moving `updatedAt` with `error` events and `failedTicks` in the state is a failing queue, not a dead one: the `queue-stalled` alert fires after three failed ticks in a row, and the watchdog reports an episode whose comment could not be posted. If `updatedAt` is older, check, in order: the latest `omni-queue` runs in the Actions tab; the OMNI_QUEUE_ENABLED variable; the secrets of the `omni-queue` environment (a rotated key or an uninstalled App fails at the token step) and its deployment branch, which must still be the default branch (a run refused by the environment never starts a step); a tick failing on an invalid state document (fix it with an ordinary commit on `omni-queue-state` while paused; with the queue-refs ruleset applied, disable it first); an invalid `config/merge-queue/config.json` or a failing base discovery (red runs with `setup failed` or `base discovery failed`, see [Invalid configuration on the default branch](#invalid-configuration-on-the-default-branch) and [A tick fails before any base](#a-tick-fails-before-any-base-base-discovery-failed)); a queue run that is pending forever (only one tick runs at a time, by design); a closed dashboard issue, on a base whose only work is not a labeled PR (see [State](#state)). ### Owner voice unavailable `error` event `owner voice unavailable, written with the App's token instead: <cause>` (with `voice: "owner"`). Nothing was lost: every write of that tick was made by the App. By cause: - `OMNI_QUEUE_LAND_TOKEN is not set`: put the token in the environment `omni-queue`; - `GitHub refused the owner's token (401)` or `… reading its login (401)`: the token expired or was revoked: rotate it; - `GitHub refused the owner's token (403)`: a permission is missing, most often Issues: Read and write (see [Installing the GitHub App](#installing-the-github-app), step 8); - `the owner's token does not name a user account`: the secret holds some other token. The event is not repeated while the cause stays the same; the decisions of every tick that falls back say which write did. ### Merge commits composed unsigned `error` event `<batchId>: <n> merge commit(s) composed unsigned: <cause>` (with `landing.signing: "ssh"`). The batch was composed, tested and (live) lands as usual, without the signature. `no signing key file in the job …`: the secret OMNI_QUEUE_SIGNING_KEY is missing from the environment or the step that writes it warned that it could not. `git could not sign a merge commit (exit <code>)`: the secret is not an unencrypted SSH private key (a passphrase, a public key, a truncated paste); store the private key file's full contents again. To stop signing, set `landing.signing` back to `none`. ### Dequeued PR What you see, in live mode: a comment on the PR that starts "❌ omni-queue isolated this PR as the cause of a red candidate", "⚠️ omni-queue: this PR no longer merges cleanly into", "This PR conflicts with", "The head of this PR (<sha12>) has no omni-queue approval" or "ℹ️ omni-queue: the head of this PR". The PR lost the label and got a comment with the reason (culprit of a red batch, conflict with the base, head moved after approval, head already part of the base). Fix it and label it again; a PR already in the base needs nothing more. In shadow mode the PR keeps its label and gets no comment: look for the `culprit-found` or `would-dequeue` event on the dashboard. ### Landing paused with reason `error` What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>" and the detail `landing needs OMNI_QUEUE_LAND_TOKEN (landing.actor is "owner")`, or a detail that ends with `(check OMNI_QUEUE_LAND_TOKEN: landing.actor is "owner")`. The pause detail names `OMNI_QUEUE_LAND_TOKEN` when the token is missing or refused (see [Who lands](#who-lands-landingactor)). Fix the token in the `omni-queue` environment, then `npm run queue -- resume <base>`. The two cases differ in what is left on the commits: - **Token refused**: the status was written and then turned into `failure`, so nothing can merge the commits of that batch by hand in the meantime. - **Token missing**: nothing was blessed, so the commits have no land status at all. ### Landing paused: the candidate does not match the stored batch What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>" and a detail that starts `the stored in-flight batch <batchId> does not match its candidate <sha12>:` and ends `(state tampering or corruption: not landed, not retried)`. It means the candidate is not exactly the composition of the PRs the state names (no PR, a PR the candidate does not merge, a commit that is not a queue merge commit, a merge commit whose tree is not the merge of its two parents, a merge commit whose `Omni-Queue-Base` is not the stored base or that carries more than one, or another candidate tree with `squash-api`; see [Before the land status is written](#before-the-land-status-is-written)). Nothing was blessed or landed, and in shadow mode nothing was recorded as would-land. Find out how the state document or the candidate ref changed before you resume: the queue does not retry it. When the detail names a tree (`merge commit <sha12> of #<n>: tree <sha12>, recomposing gives <sha12>`) and neither ref was touched, the cause can be the runner: the tick recomposes the merge with the git of its own runner, and a git version that merges differently from the one that composed the candidate gives another tree for a legitimate batch. Recompose that merge locally with the parents of the named commit (`git merge-tree --write-tree <first parent> <second parent>`) and compare; if the trees agree and nothing was tampered with, resume. Shadow mode runs the same check, so repeated tree mismatches there are the signal to look at before `mode: "live"`. ### Landing paused: queue refs are not protected What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>" with this detail. The detail `queue refs are not protected (<ref>: <rule>, …): not blessed, not landed; apply apply-ruleset.mjs --kind queue-refs, then resume` means GitHub did not enforce `creation`, `update` or `deletion` on `omni-queue-state` or on the candidate ref when the tick read it. Nothing was blessed. The usual cause is the `omni-queue refs protection` ruleset left disabled after a manual edit of the state, or never applied. Enable it, or apply it again (`node scripts/merge-queue/apply-ruleset.mjs --kind queue-refs --repo <owner/repo> --app-id <app-id>`, with `OMNI_QUEUE_ALLOW_PRODUCTION_RULESET=1` on the production repository; see [Ruleset](#ruleset)). If the refs were unprotected for a while, read the state document again and check the candidate branches before `npm run queue -- resume <base>`: the pause dropped the batch, and after the resume its PRs are composed again. In shadow mode the same finding only adds `live mode would pause: queue refs unprotected (…)` to the `would-land` detail. ### Landing paused: the landing was refused What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>" with this detail. The detail `landing <batchId> failed (<reason>): <detail>` means the landing ended with a verdict that is not a success, a moved base or a tree divergence: `rejected` (the push was refused by a ruleset, a protected-branch hook or another server-side rule, or the base was missing at the landing's own read), `not-descendant` (a local check before any push: the stored base is not an ancestor of the candidate) or, with `squash-api`, `merge-failed` (GitHub refused one PR's merge; the PRs merged before it are on the base and named on the `error` event; a rate limit on the first merge call is not a refusal: it is retried, see [Who lands](#who-lands-landingactor); one after a PR of the batch merged pauses here, without the token hint). The status written for the landing was withdrawn. Read the detail: for `rejected`, check the rules GitHub enforces on the base (the landing-path check of `apply-ruleset.mjs --kind release` lists the rules of other rulesets that block the landing actor, see [Ruleset](#ruleset)); for `merge-failed`, look at the PR GitHub refused. Fix the cause, then `npm run queue -- resume <base>`: the pause dropped the batch, and after the resume its PRs are composed again on the tip. The reason `auth-failed` has the same format and is the authentication case of [Who lands](#who-lands-landingactor). ### Landing paused after three attempts What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>" with this detail. The detail `landing of <batchId> ended without a verdict 3 times since its candidate was composed or the queue was last paused or resumed by hand (last error: <detail>); not blessed again` means three ticks blessed the batch since then (not necessarily in a row: a pending re-run or a release-freeze hold in between keeps the count) and none of them reached a verdict: the landing threw an error that is neither an authentication refusal nor a known refusal, or the tick died after the blessing. The status of the batch's commits was withdrawn. Read the last `error` events of `npm run queue -- history --base <base>` (each cut at 200 characters there; the whole detail is in `history[]` of `state/<sanitized-base>.json`) and the failed `omni-queue` runs. A GitHub rate limit that outlasts three ticks ends here too: in both landing modes a rate limit is retried, not treated as a refused token. Once the cause is gone, `npm run queue -- resume <base>`: the pause dropped the batch, and after the resume its PRs are composed again. ### A withdrawal GitHub refused, or one refused for a day What you see: an `error` event whose detail reads `<batchId>: could not withdraw <landing.statusContext> (<why>) on <sha12> (<error>)`; an hour later, a stalled alert whose reason starts `stored land-status withdrawals not written for more than 60 min`; a day later, an `error` event that reads `<batchId>: the withdrawal of <landing.statusContext> on <sha> (<list>) has been refused for more than 24 h, since <time>; the queue keeps retrying it`. The dashboard and `npm run queue -- status` show the counts of the stored withdrawals. What it means: GitHub refused to write the App's `failure` land status on a commit whose blessing had to be withdrawn, so that commit may still carry the App's `success` and can be merged by hand past the release ruleset. The refusal is stored and retried (see [Who lands](#who-lands-landingactor)). The last detail means the `success` has stood for a day (`WITHDRAWAL_ALERT_MINUTES`, counted from the entry's `since`). What to do: find out why GitHub refuses the App's status writes, as in step 1 of [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full). The ticks keep visiting the base while an entry is stored (through its open dashboard issue: do not close it) and retry the entry on every run; wait until it is gone from `state/<sanitized-base>.json`. Nothing else needs a person. ### Paused: landWithdrawals is full What you see: the dashboard banner "⏸️ Queue paused — reason `error` since <time>", the line `Stored land-status withdrawals (retried on every tick): <n> in landWithdrawals, <m> in landWithdrawalsOverflow.` and, while the overflow holds entries, the banner line "A resume is refused while `landWithdrawalsOverflow` holds entries (<m> now): wait until the ticks write them, then `npm run queue -- resume <base>`.". A resume from the CLI then fails with `<base>: resume refused: landWithdrawalsOverflow holds <m> entries (landWithdrawals <n>); the pause stays. …`. A pause detail that starts with `landWithdrawals is full (<n> of 20; landWithdrawalsOverflow holds <m> of 20; counts at the time of the pause): GitHub refused the App's <landing.statusContext> failure again` (the `error` event of the same tick starts with `landWithdrawals is full (<n> of 20; landWithdrawalsOverflow holds <m> of 20)`) means GitHub refused to write the App's `failure` land status on a commit that had to become a new entry of the overflow, because 20 refused withdrawals were already stored: GitHub is refusing the App's status writes, so the queue stopped blessing. Every refused withdrawal is kept, in `landWithdrawals` or in `landWithdrawalsOverflow`, and both lists are retried on every tick of the paused base. The counts are those at the time of the pause (the detail says so). A base that was already paused for a reason that neither lifts by itself nor blesses (`manual`, `error`, `infra`, `tree-divergence`; a manual pause before a mode change, for example) keeps its own pause: the same condition is then an `error` event that starts with `landWithdrawals is full`, plus, for a commit kept nowhere, its name appended to that pause's detail. A later pause (an operator's `queue pause`, for one) keeps every `Kept nowhere (both lists full)` name of the pause it replaces. A `base-red` pause is replaced by this one (its detail says so), since the base-repair lane is blessed under it and it lifts by itself. The new detail names that pause's issue, in the clause `; the base was also paused as base-red (issue #<n>): <its detail>`. A tick that loads a `base-red` pause together with entries in `landWithdrawalsOverflow` (a hand-edited state) replaces it the same way, at its start. When a tick that completes replaces it, one comment on its base-red issue says the base will not resume by itself (best effort: a comment GitHub refuses is only a line in the run's log); when the failure path of a tick that threw replaces it, no comment is posted. The dashboard and `npm run queue -- status` count the entries of each list while either is not empty. Check, in order: 1. Why GitHub refuses the App's status writes: the run's log names the error of each refused write, and so does an `error` event (`<batchId>: could not withdraw …`, or the detail of the failed tick's own `error` event when the tick threw). A GitHub incident is the usual cause. A permission the App no longer holds, or an App that is no longer installed, does not get this far: GitHub mints no token for the tick, which fails at that step and stores nothing. 2. Once that is fixed, wait until both lists are gone from `state/<sanitized-base>.json` on `omni-queue-state` (the next ticks write the `failure` statuses). Nothing else needs a person. 3. Then `npm run queue -- resume <base>`. It is refused while `landWithdrawalsOverflow` holds entries (the CLI says so at once; a tick that still finds entries records an `error` event that starts with `resume refused` and leaves the pause as it was; see [CLI](#cli)). The resume lifts whatever pause is there: read `paused.reason` and `paused.detail` first, and resume only when this is the pause to lift (an operator's own pause, kept as it was, needs its own reason to be over). The resume also clears the `Kept nowhere (both lists full)` words of the detail; its `resumed` event then names those commits (as many as fit in 500 characters, then how many more), but handle them first (the last resort below). The batch in flight, if any, is then followed again from where it was: its checks are read and, green, it is blessed and landed as usual. #### The last resort: commits kept nowhere When both lists were full too, a refused withdrawal is kept nowhere. Its commit is then named in full, as `<sha> (<batchId>)` after the words `Kept nowhere (both lists full)`, in `paused.detail` of `state/<sanitized-base>.json`, whatever the pause, and in the `sha` and detail of that `error` event (cut at 500 characters: it names the commits that fit and how many more `paused.detail` holds). Read `paused.detail` in the state file itself: the dashboard (300 characters) and `npm run queue -- status` (200) cut long details. That commit's App status may stay `success` and nothing retries it; a person has to put it back in a list, once a list has room (after step 2): 1. The base is already paused (this pause); keep it paused. 2. Disable the `omni-queue refs protection` ruleset (Settings → Rules → Rulesets), so an ordinary commit can change `omni-queue-state`. While it is disabled, any other live base whose tick tries to bless pauses with `queue refs are not protected (…)` (see [Before the land status is written](#before-the-land-status-is-written)); turning the kill switch off first (see [Kill switch](#kill-switch)) avoids that, and you turn it on again after step 4. 3. In `state/<sanitized-base>.json`, append to `landWithdrawals` (or to `landWithdrawalsOverflow`; at most 20 entries in each, and a SHA in one list only) one entry per named commit: `{"sha": "<40-hex sha>", "batchId": "<batchId>", "candidateSha": "<40-hex sha>", "why": "left the landing stage", "since": "<ISO 8601 time, e.g. 2026-11-16T12:00:00.000Z>", "attempts": 1}`, where `candidateSha` is the commit's own SHA when you do not know the batch's candidate. Commit that file alone; an invalid document makes every tick fail (see [State](#state)). 4. Enable the ruleset again. 5. `npm run queue -- resume <base>` when the next tick has written the `failure` (the entry is gone), after the checks of step 3 above. ### Invalid configuration on the default branch What you see: red `omni-queue` runs whose step "Run one queue tick" prints `omni-queue: setup failed: invalid omni-queue config <path>:` and one line per error; red `Approval` jobs that print `omni-queue approval failed: invalid omni-queue config …`; red `omni-queue watchdog` runs that print `omni-queue watchdog: the queue's config cannot be loaded: invalid omni-queue config …`, and the watchdog issue `omni-queue: the queue is not making progress` with the section "**The queue's config cannot be loaded**" and the same reason on one line. A file that is not JSON prints the JSON parser's message after the same prefixes instead. What it means: `config/merge-queue/config.json` on the default branch fails `validateConfig`. Every tick stops before it loads any state: no `error` event, no `failedTicks`, no stalled alert, no dashboard change. The approval job writes no approval status. The watchdog opens (or keeps) its issue with the reason, mentioning the approvers only when the raw JSON still has an `approvers` array of valid logins; it judges nothing else in that run, never closes the issue, and exits 1. What to do: fix the file through a pull request into the default branch (the errors name each key). The queue cannot land that pull request and a `bless` cannot run either (both load the same file), so while a release ruleset of the queue is on the default branch, a person with administration access has to disable that ruleset for the merge, and enable it again after. ### A tick fails before any base: base discovery failed What you see: a red `omni-queue` run whose step "Run one queue tick" prints `omni-queue: base discovery failed: <message>`. What it means: a tick without a base could not list the open pull requests or the dashboard issues (`discoverBases`), so it visited no base and recorded nothing. The next scheduled tick tries again (the schedule asks for one every five minutes; GitHub often starts scheduled runs later). When it keeps failing, no state is saved: after 90 minutes the watchdog reports each base with work (see [Who is told, and when](#who-is-told-and-when)). Read the message (an API outage, a revoked App permission), and check the App's installation. ### A command or a dispatch did not apply What you see, from `npm run queue -- pause|resume|bless`: - `warning: run <id> of omni-queue.yml was cancelled before applying the <action> (a newer tick replaced it); dispatching again`: nothing to do, the CLI dispatches again; - `error: run <id> of omni-queue.yml ended <conclusion> without applying the <action> (<url>); check the run (is OMNI_QUEUE_ENABLED true?), then retry`: a `skipped` run means the kill switch is off; a failed bless run prints `bless refused: <why>` in its log (see [Land status and manual bless](#land-status-and-manual-bless)); - `error: <action> of <base> not confirmed within 1200s; …`: the run may still be pending behind a running tick; check `npm run queue -- status --base <base>` and the `omni-queue` runs before retrying; - `<base> is not paused: nothing to resume`, and `the pause this resume targeted is gone, but <base> was paused again (<reason>, since <time>) and stays paused`: read the new pause before you resume again; - `<base>: resume refused: …`: see [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full). ### Messages of a refused dispatch or a failed step - `omni-queue: "<base>" is not a base the queue manages (config.bases: <pattern>): nothing loaded or written` (a dispatch whose `base` does not match `bases`, or a name the store refuses), and the CLI's `<base> is not a queue-managed base (config.bases <pattern>)`: check the base name. Nothing was written. - A raw dispatch from the Actions tab with inputs the tick refuses, printed as `omni-queue: <message>` with nothing loaded: `--action <pause|resume|bless> requires --base`, `--action bless requires --sha`, `--sha must be a full 40-hex commit SHA (lower case)`, `--action bless requires --reason`, `--sha is only valid with --action bless`. Dispatch again with the inputs the message names (the CLI checks the same ones before dispatching). - A red run whose step "Resolve the bot identity" says `unexpected App slug` (the token step gave an App slug that is not lowercase letters, digits and dashes) or `could not resolve the user id of <slug>[bot]` (`GET /users/<slug>[bot]` failed): check the App token step and the App's installation; no tick ran. - `state of <base> is invalid: <fields>` from the CLI: the state document fails `validateState` (see [State](#state)); its ticks fail too. - `omni-queue <base>: the failed tick's record was not applied: <message>` in the log of a failed run: `main()` recorded the tick's `error` event without what the tick left for the state, so the withdrawals GitHub refused during that tick are not stored. Check the land status of the commits that tick blessed (its log names them) and withdraw by hand where needed (the last resort of [Paused: landWithdrawals is full](#paused-landwithdrawals-is-full)). - `state of <base> changed during the tick` as a failed tick's error: one run redid its tick three times, and each attempt lost the compare-and-swap of the state save (the log shows `omni-queue <base>: state changed during the tick, redoing it (<n>/3)` before); `main()` records the error. Something else writes `omni-queue-state` (a second writer, an edit by hand while the queue is enabled): find it. ### Labels with no effect If labeled PRs stay `approval-missing` and no `omni-queue/approval` status appears on their heads, the `approval` job is not running: look in the Actions tab for `pull_request_target` runs of the workflow with the status `Startup failure` and no jobs. Their annotation names the `pull_request_target` protection; during GitHub's brownout of 2026-11-16 it began "Workflows are being blocked due to a scheduled brownout of the default `pull_request_target` protection" (see [Actions event policy](#actions-event-policy-pull_request_target-in-public-repositories)). An `Approval` job that runs and fails prints `omni-queue approval failed: <message>`. ## Cut-over and rollback > **2026-11-25, `release/v3.8.55`.** With the owner's approval at each step, the cut-over applied > "omni-queue release protection: release/v3.8.55" (28108528, step 6) at 20:59Z, deleted "Require > PR on default branch" (21899981, step 7) at 21:00Z, and merged `mode: "live"` (#20902, step 9) at > 21:17Z, with `voice: "owner"` and `signing: "ssh"` from #21205. The first live landing was > #21033 at 22:51Z, with a Verified merge commit. The new dashboard is #21239. The owner evaluated step 10 > and kept his local guard because it also covers release branches without a door. The cut-over is a separate owner decision, taken after the sandbox rehearsal and a few days of shadow mode on the real repository. In order: 1. Stop Mergify from acting on release PRs (remove its queue rules in a PR that also updates `tests/unit/mergify-queue-config.test.ts`) and drain or remove the remaining `queue` labels. 2. Make sure the Actions policy that allows `.github/workflows/omni-queue.yml` exists on the production repository (see [Actions event policy](#actions-event-policy-pull_request_target-in-public-repositories)); it is needed already for shadow mode. 3. Confirm that the environment `omni-queue` exists with the default branch as its only deployment branch, by exact name, and no required reviewers. It was created before the queue was enabled (see [Before OMNI_QUEUE_ENABLED is set](#before-omni_queue_enabled-is-set)); if it was not, stop and do that first. 4. Confirm that OMNI_QUEUE_APP_CLIENT_ID, OMNI_QUEUE_APP_PRIVATE_KEY and `OMNI_QUEUE_LAND_TOKEN` are secrets of that environment (the land token: fine-grained, this repository only, Contents, Pull requests and Workflows in read and write, valid for 90 days, with its replacement date written down), that no repository-level secret of the same names is left, and that no `OMNI_QUEUE_APP_ID` secret is left: the workflow no longer reads it. 5. Confirm that the ruleset of the queue's own refs (`omni-queue refs protection`) is active. It was applied before the queue was enabled (see [Before OMNI_QUEUE_ENABLED is set](#before-omni_queue_enabled-is-set)); if it was not, stop and apply it first. 6. Apply the door to every active release branch: `OMNI_QUEUE_ALLOW_PRODUCTION_RULESET=1 node scripts/merge-queue/apply-ruleset.mjs --base <branch> --repo cheaper-inference/OmniRoute --app-id <app-id>`. While "Require PR on default branch" still exists, the script exits `1` on the base that is the default branch (the rule matches `~DEFAULT_BRANCH`) and names it as a rule that would reject the landing push. From this step on nothing reaches a release branch without the land status, Mergify included. 7. Remove the old ruleset "Require PR on default branch" (21899981): the status door replaces it. Rerun the apply of step 6 until it exits `0` on every branch. 8. Decide the label: keep `omni-queue` or set `label` to `queue` (in the config **and** in the job filters of `omni-queue.yml`, see [Eligibility](#eligibility)). A change goes in a pull request into the default branch, and from step 6 on nothing reaches it without the land status while the queue is still in shadow mode: bless the head of that pull request (`npm run queue -- bless <default branch> --sha <head> --reason "<text>"`), then merge it. 9. Only then put `mode: "live"` into `config/merge-queue/config.json` on the default branch. Before that, confirm the preconditions of live mode: - the App's private key exists in this repository's `omni-queue` environment only: no rehearsal repository, repository-level secret or file holds a key of this App (see [Installing the GitHub App](#installing-the-github-app), step 7); - the `omni-queue refs protection` ruleset is active (step 5): without it a live tick blesses nothing and pauses (see [Before the land status is written](#before-the-land-status-is-written)); - recent shadow `would-land` events carry neither suffix: no `live mode would pause: queue refs unprotected (…)` and no `<composition check|queue refs check> could not run (…): live mode would fail the tick`; and no shadow batch was paused for a composition mismatch; - for this and any later mode change: each base paused, no batch at stage `landing` and empty `landWithdrawals` and `landWithdrawalsOverflow` (see [Before a mode change or a stop](#before-a-mode-change-or-a-stop)). The queue cannot land that pull request (it is still in shadow mode): bless its head, then merge it, as in step 8. 10. Retire any local guard that blocks manual merges into release branches while a gate is red: the ruleset refuses a manual merge without the land status from step 6 on, so such a guard is redundant. 11. Update the merge skills and `AGENTS.md` (agent-instruction surfaces: each change needs the owner's explicit approval). These pull requests touch protected paths: once step 9 is on the default branch they land through the queue, with the queue label and `protected-approved`. One merged before that cannot be landed by the queue (still in shadow mode): bless its head, then merge it, as in step 8. Rollback: first pause each base and check that no batch is at stage `landing` and that `landWithdrawals` and `landWithdrawalsOverflow` are empty (see [Before a mode change or a stop](#before-a-mode-change-or-a-stop)). If the code goes back too, read [Rolling the code back](#rolling-the-code-back) now: one of its steps happens before the variable goes `false`. Then set OMNI_QUEUE_ENABLED to `false`. That stops new ticks only: cancel the in-progress and pending `omni-queue` runs in the Actions tab (or wait for them to end), and check with `npm run queue -- history` and each base tip that nothing landed after the cut before declaring the rollback done (see [Kill switch](#kill-switch)). Then: - delete the `omni-queue release protection: <base>` rulesets in Settings → Rules → Rulesets (while they exist, nothing reaches those branches without the land status) and restore "Require PR on default branch" if it was removed. When the code goes back too, do this when [Rolling the code back](#rolling-the-code-back) says: its step 3, or its step 6 when step 1 blessed the rollback's head; - re-enable the Mergify queue rules; - delete the `omni-queue refs protection` ruleset if the state branch or the candidate branches have to be changed by hand. Leftover `omni-queue/**` candidate branches can be deleted once nothing is in flight; the `omni-queue-state` branch can stay as an audit trail; - to roll the code back (the workflows, `scripts/merge-queue` and `config/merge-queue/config.json` on the default branch), follow [Rolling the code back](#rolling-the-code-back) below. ### Rolling the code back Code and configuration go back together. The `validateConfig` of the code before the re-runs, the PR gates, the adaptive batch and the lanes refuses the keys `flakyReruns`, `prChecksRequired`, `lanes`, `batch.adaptive` and `batch.startSize` as unknown: with the newer `config/merge-queue/config.json` every tick would fail at setup. The watchdog workflow goes too: the older scripts have no `scripts/merge-queue/watchdog.mjs`, so every run of `.github/workflows/omni-queue-watchdog.yml` would fail; close its open issue by hand. The state needs work only where the older code refuses it or would lose a blessing. Its `validateState` refuses a state document whose history holds an event type it does not know (`EVENT_TYPES` in `scripts/merge-queue/contracts.mjs`): its ticks, and `npm run queue -- status`, fail on that base until the events are gone. It loads a document with fields it does not know and carries them along without acting on them. In this order; each step works in the state the step before it leaves: 1. While the queue still runs (OMNI_QUEUE_ENABLED `true`): pause each base and wait until no batch is at stage `landing` and both withdrawal lists are empty (the first paragraph of Rollback above; the paused bases' ticks retry the lists). If the `omni-queue release protection` rulesets are to stay on the branches while the rollback pull request merges, bless that pull request's head now (`npm run queue -- bless <default branch> --sha <head> --reason "<text>"`) and push nothing to it afterwards: once the variable is `false`, a `bless` dispatch is skipped like any run of the workflow, and no tick can give the rollback its land status any more. 2. Set OMNI_QUEUE_ENABLED to `false` and cancel the `omni-queue` runs (Rollback, above). 3. Delete the `omni-queue release protection: <base>` rulesets (the first bullet of Rollback), unless step 1 blessed the rollback's head. Disable or delete the `omni-queue refs protection` ruleset, so an ordinary commit can change `omni-queue-state`. 4. Edit each `state/<sanitized-base>.json` on `omni-queue-state` with an ordinary commit: the column "Before rolling back" of the table below. 5. Merge the pull request that puts back the older workflows, `scripts/merge-queue` and `config/merge-queue/config.json`, and deletes `.github/workflows/omni-queue-watchdog.yml`. Without the release rulesets it merges like any pull request; with them, only through the blessing of step 1. 6. Right after that merge, when step 3 left the release rulesets in place (step 1 blessed the rollback's head): with OMNI_QUEUE_ENABLED `false` nothing can write the land status any more (the rulesets have no bypass actor), so those release branches accept no merge and no push at all. Either delete the `omni-queue release protection: <base>` rulesets now (Settings → Rules → Rulesets) and restore "Require PR on default branch" if it was removed, or set OMNI_QUEUE_ENABLED back to `true`: the rolled-back config is in `shadow` mode, where no batch is blessed, so each change that has to reach a release branch then needs its head blessed by an approver (`npm run queue -- bless <base> --sha <head> --reason "<text>"`) before it is merged. Do one of the two before anything else has to reach a release branch. Rolling forward again goes the same way: the release rulesets absent (re-apply them afterwards, [Cut-over and rollback](#cut-over-and-rollback), step 6) or the head blessed while a queue runs, and the state edited first, by the column "Before rolling forward again". What the re-runs, the adaptive batch, the lanes, the health checks and the final fix wave added to the state, and what the code before them does with each: | Added | The code before it | Before rolling back | Before rolling forward again | | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `flaky-rerun` events | refuses the document | remove them | nothing | | `queue-stalled` events | refuses the document | remove them | nothing | | `landWithdrawalsOverflow` | carries it along, never retries its entries: a blessing stored there stays until the roll-forward | nothing more than step 1, which waits until it is empty (the paused base's ticks retry it); if entries are left once the variable is `false`, nothing retries them: move them into `landWithdrawals` (when that list has room) in the commit of step 4 | nothing | | `inFlight.landAttempts` at the stage `testing` (kept by a failed tick) | ignores it, and replaces it at the batch's next landing | nothing | nothing | | `failedTicks`, `failedSince` | ignores them and never deletes them | nothing | remove them: otherwise the first failed tick counts the old ones (the older code saves hourly too, so the 90-minute gap that restarts the count does not apply) | | `stalled` (`since`, `reasons`, `openedAt`, `notified`) | ignores it | nothing | remove it when it has no `notified: true`: the first new tick would post its old alert (a paused base is stalled after 120 minutes), and the watchdog would report it at once | | `batchWindow` | ignores it; its batches take up to `batch.maxSize` | nothing | nothing | | `inFlight.rerun` | ignores it | nothing | nothing | | `inFlight.lane` (and `inFlight.pendingRed.lane`) | processes a lane batch as an ordinary batch; under a `base-red` pause it leaves it as is | nothing | nothing | | `inFlight.freezeHold` | carries it along unchanged | nothing | nothing: the first tick that does not hold the batch closes it | | `repairTried` | ignores it, never prunes it, never composes a repair alone | nothing | nothing: the first tick prunes it | | `landingsWithoutVerdict` | ignores it, carries it along and never deletes it | nothing | remove it: the first new tick would count on from the old run (a stall at 3) | | `stalled.quietTicks`, `stalled.kinds` | ignores them | nothing | nothing (the row of `stalled` applies) | | `repairInfraDrops` | ignores it: a repair dropped for infrastructure pauses the base (`infra`) as any batch | nothing | nothing: the first tick prunes the entries of closed PRs and changed heads | | stored withdrawals as work | does not visit a base whose only work is a stored withdrawal, nor does its watchdog judge it | nothing more than step 1, which empties both lists | nothing | `pr-checks-not-green` is never stored, so it needs nothing. Older versions, for a rollback further back: - to a version from before the land status: `manual-bless`, `land-blessed` and `hang-suspected` are event types that code does not know either; remove them the same way; - to a version from before the live-mode locks (the state fields `landWithdrawals` and `inFlight.landAttempts`): no cleaning is needed, that code loads the document and carries both fields along without acting on them. Its ticks do not retry a stored withdrawal, and a blessing by hand does not drop one. So **before rolling forward again**, read `landWithdrawals` in each `state/<sanitized-base>.json`. An entry whose SHA was blessed while the older code ran (a `manual-bless` event for that SHA after the entry's `since`) would have its `success` turned into `failure` by the first new tick. Remove such entries with an ordinary commit (OMNI_QUEUE_ENABLED `false`, the queue-refs ruleset disabled, then enabled again), or, after the first new tick, check the newest `omni-queue/land` status of each blessed SHA and bless it again where it reads `failure`. A batch stored at the landing stage also keeps its `inFlight.landAttempts` across both moves, so after the roll-forward it can reach the attempts limit with fewer than three new attempts.