# Pre-queue Lane checks

Decision record for checking the composed head in the hosted landing queue by
default, with optional full Lane checks before the queue on any configured runner. Behaviour lives in
[landing batches](operations/landing-batches.md#pre-queue-lane-checks); the model
is [`models/landing-queue`](../models/landing-queue/README.md).

Landing documentation calls the accepted destination Channel `main`; a receipt's target Channel refers to that same destination, including when the project names it differently.

## Resolve an exact predecessor conflict early

Early resolution is on unless `acceptance.earlyResolve` is `"off"`. Owners can
turn it off with `nforge x ROOT set-policy '{"acceptance":{"earlyResolve":"off"}}'`.
An absent override enables it. Stored `"automatic"` and `"on"` remain readable as on. This changes scheduling advice, not the strict/fast
promise, review policy, runner or acceptance strength.

When a signed trial merge proves a conflict with an unaccepted predecessor,
`wouldConflict.predecessor` names its exact State and reserved acceptance receipt.
Advice and composition share one fixed-tail rule: if the retained checking chain
extends beyond that predecessor, advice selects its last exact prefix. An internal conflict between cohort members waits
for the surviving members to install their check, then names that survivor
State and its reserved receipt. The outer predecessor may be disjoint and is
used only for conflicts the worker proved against that outer base. Rejected
and still-composing members never supply the resolution target.
An exact saved-peer notice also offers the pinned sync immediately when that
peer already has a fixed checking prefix. It validates the peer head and uses
the same fixed-tail rule, with no extra Convex call or background work.
With early resolution selected, `land`, `wait` and `observe` return a `sync`
continuation carrying those pins instead of another wait. Run it from the Lane
checkout, edit the returned conflict, `resolve`, then `land --save`. The existing
sync worker creates the draft; the existing predicted-head pipeline checks the
resolved change while the predecessor checks. The resolved landing composes on
the current fixed train tail; its early pins remain exact acceptance preconditions.
An unfixed tail parks on its predecessor settlement/re-pin event, retaining its recovery alarm. A third overlapping group either stays
in that checked prefix or yields another compose conflict before a check starts.
Advice is best effort: unavailable optional metadata leaves the ordinary cohort
wait in place and never discards the survivors' installed check. All optional
reads precede parking; the predecessor is marked first, and failures during
writes roll the transaction back.

A pinned sync that merges cleanly proves the target did not expose the advised
conflict. It returns the unchanged Lane selection, preserves its head and live
submission, and records no early pin or timing watch. An ordinary clean merge
keeps its no-action path and allocates no conflict work.

A conflicting own-Lane sync against main supersedes every live finish from that
head, including source preparation, through the cancellation path. Resolution
acceptance retires any remaining origin finish as a backstop. A peer's sync does
not supersede the Lane actor's work. Joining an existing landing probes its
driver in every live phase; a queued ownerless submission is superseded before
the new request is admitted, and a lost Ready finish is re-driven in place. Replays retain their original operation identity.

A composing cohort keeps recovery within the existing five-minute train hold.
Dropping its train replays the leader once, then splits a repeated loss through
normal recovery. Retry and split entries arm the existing alarm at that bound;
queue progress defers supervision only behind a live predecessor. If the early
alarm fires after composing ended, it re-arms at the ordinary fifteen-minute
progress bound. Optional
`drive` metadata names the cohort's last step, and `observation.stall.owner`
records the observed finish wake, compose and cohort step in observations, queue
status and repaired receipts. Its retained progress token distinguishes a past
recovery from a current stall. Every immutable attempt fork takes its parent and
ordinal from the current attempt; a reserved finish retains its source identity
and refreshes those fields at installation.

Advice names the exact conflict, predecessor and pinned `sync` action. With early
resolution off it offers the same sync as an optional action, or waiting for the
predecessor to settle. No sampling window or rate decision is maintained.

A Lane records its original author State and exact predecessor pins. If that
predecessor fails, is withdrawn, enters review or changes head **or receipt**,
Forge retires the dependent check and restores the Lane's original author State.
All intervening saved resolution States remain retained. Its board note names
the prior resolution State and recovery: open the restored Lane, sync main and
resolve again. This deliberately discards the speculative resolution from the
active head, including edits made during that resolution; those edits stay in
its retained State. No rejected predecessor content can be accepted through the
old check. Exact head, receipt, authority, generation, cancellation and main CAS
checks still apply. Ordinary stacked Lanes retain their existing behavior.

The selector adds no calls, reads or writes on a disjoint landing, and idle adds
zero calls. An exact conflict reads only the bounded active prefix and the one
existing queue row. Samples live on that queue row; dependency metadata reuses
stack-dependents rows, and source bytes remain in R2. Recovery processes one
indexed dependent page per event-owned continuation; it never polls. Replaying
unchanged conflict advice performs no writes or repeated train/history walk.

The fake-clock conflict trio runs the production queue, merge, resolve and check
controllers with synthetic source. A 180-second check quantum, a tail predecessor
with 360 seconds remaining and a 75-second resolution produce late-task time to
main of 615 seconds with deferred recovery and 360 seconds with early recovery;
two resolutions become one and both paths use three checks. The central
`earlyResolveLateTaskToMainMs` budget fails against the accepted-main advice
implementation. These are relative synthetic timings, not a live benchmark or
billed-usage result. Existing byte, query, memory and latency guards remain.

The protocol feature is `early-resolution-v1`. Deploy reader expansion before
enabling writers for older strict record readers; release/deployment and live
qualification are separate from this implementation.

## Context

With 12 builders in parallel, each change's first full check ran inside the serial
queue: builders skip the near-full suite locally, and a check-only pass counts only
while main is unchanged, which never holds at that rate. The queue became the place
where broken changes were first found. In one wave, 44 of 51 check runs failed or
were cancelled, isolating one culprit took about 75 minutes, and a passing check
takes about 22 minutes. Merge-queue tools avoid this by running each change's CI
before it enters the queue, so the queue mostly sees green.

The owner kept two constraints: **bring your own CI** (any runner configured
through `configure-check` / `configure-runner`: GitHub Actions, other hosted CI,
self-hosted machines, the local runner; nothing GitHub-specific in the core path)
and **proved reuse** as the S2 contract for acceptance across a main move.

## Decision

Absent or `false`, `acceptance.admissionCheck` checks the composed head in the
queue. This removes isolated checks that would need another check after overlapping
work lands, and avoids first-check reuse audits when an exact queue check already
covers main. Queue checks still isolate red members through the existing cohort
failure and bisection path. Required check coverage and publication fences remain.

`acceptance.admissionCheck: "full"` explicitly enables the pre-queue Lane check.
Existing explicit settings keep their meaning; projects with no setting use the
queue path. `true` retains the older scoped admission. A finish with no configured
check skips admission. The following Lane-check mechanics apply when full admission
is enabled; the measured comparison below explains the default.

1. **Lane check.** When a batchable owner-agent finish is submitted (`land`,
   `land --save`), Forge enqueues the project's configured check, with its
   configured gate, for that change alone on the main it composed on. Every
   arrival's check runs at once, in parallel, on the project's own runner through
   the ordinary `enqueueHostedCheck` path, so every runner provider is eligible.
   WIP saves never start a check; `land --save --check-only` keeps its existing
   reuse.
   A strict-mode arrival with known, disjoint paths that have an unplaceable
   global-risk interaction with a pending full admission uses the existing
   predicted-head pipeline instead of spending a solo run that cannot carry the
   combination. It checks the exact union on the predecessor's reserved head and
   receipt while that predecessor is still checking. The same actor, authority,
   policy, priority and check pins must agree, and a pipeline slot must be free.
   Independent arrivals, overlapping paths, placeable manifests, fast mode and
   unknown evidence retain their ordinary Lane checks. Publication still waits
   for the exact predecessor to land; failure, a review hold or changed pins
   retire the dependent generation and restore its original selection. A failed
   speculative combination cannot reject that fresh selection.

2. **Admission rules.** The submission is not in the queue while its Lane check
   runs: it is not runnable, not batchable and holds no queue order.
   - A failing test ends it with `CHECK_FAILED` and its failing files. A change
     known to be red never enters the queue.
   - A run that ends without a failing test (runner unavailable, cancelled,
     timeout) starts a new Lane check, at most twice; then the change enters
     unadmitted. Unknown is not red.
   - A pass enters the queue. Queue order is the time a change entered the queue,
     not its submission time: an older submission still checking, or one that
     re-entered after a refused proof, never holds back a change that entered
     before it. When its turn comes, the queue step that binds the passed Lane
     run as the change's check also judges it. That one state write carries both,
     with no new run and no second queue step.
   - With cross-head reuse enabled, a passed one-member group can overtake
     independent work outside its exact predecessor chain. An earlier,
     independent pass can also clear a spent order hold when the holder
     starts a new generation. Re-pinning wakes those parked followers during
     composition, before the replacement check binds. The order decision
     uses the submitted Candidate's main-relative paths, including any
     predecessor changes carried by that Candidate.
   - **Reservation after a supersession** (Issue 10d253c6). Because a checking
     submission holds no order, small changes to the same files can land while a
     large change checks, and its passed check then fails `COMPOSITION_CONFLICT`
     when it composes onto the moved main. The next submission of the same Intent
     after one such supersession (a passed check, then the conflict) reserves the
     files it changes for 30 minutes: a passed landing that changes any of them
     waits for it (order wait `reason:"reservation"`) instead of taking main
     first, and the holder never waits for an older entry its reservation holds
     back, nor for one whose chain of parked waits leads back to such a waiter
     (incident 43b51a5e: three landings waited for each other until the time
     bound): it goes ahead of that entry when the two are disjoint, and otherwise
     its reservation ends, since it could only deadlock. The reservation ends when
     its landing lands or fails, at that point, or at its time, whichever is
     first; nothing extends it. Urgent owner landings, members of the
     holder's own group and an earlier holder never wait; unknown paths count as
     overlapping. `status`, the finish wait and the land summary show
     `reservation {until, live, superseded}`. Cost: the count and the end are
     stored on the new submission's own row (no extra write); a claim reads one
     indexed window of live reservations and, only while one is live, the paths;
     a holder's claim follows the wait chain (handed links included) of the one
     entry it would wait on, for at most 8 indexed reads. Only a solo holder that
     may overtake goes ahead of such an entry; a combined group or a pipelined
     successor ends its reservation instead.
     The landing-queue model checks it (`reserve`, `reserve-fixed`: within two
     attempts, no deadlock, every reservation ends).
   When main accepts while a Lane check is still running, the existing first
   post-acceptance transaction examines at most eight checking entries in that
   Channel. A shared Candidate path or a global-risk path changed by the new
   landing retires the stale run through its existing CI adapter. Unrelated
   checks finish normally. Predicted-head checks that already include that
   acceptance retain their run. This decision uses path metadata only; it does
   not change the proof needed to accept a check after main moved.

   Cancellation and the replacement composition's durable wake commit together.
   A clean merge starts the exact replacement check without another agent turn;
   a real conflict ends the landing with its ordinary recovery continuation in
   status and the open wait. Source failures retain ordinary failure/retry
   recovery. The operation and sequence stay the same, and late results from the
   retired run cannot accept. Back-to-back main moves refresh an unfinished
   replacement before spending CI on obsolete source. There is no added
   observer job, polling or idle work; an empty checking window reads zero DB bytes.

3. **The queue re-verifies only the combination.** An admitted change first tries
   its own Lane run, once:
   - on unchanged main, that run is the exact acceptance evidence and the change
     lands with no second run;
   - on a moved main, it **lands on that first check** when all of these hold
     (rule `clean-disjoint-v1`, Issue 7fe54c7c): the run passed the project's
     whole check (or, for a docs-only change, its docs selection) on its base;
     the change recomposes onto current main byte-exactly with no text conflict;
     the paths main gained since that base are disjoint from the change's paths;
     no path on either side is a [global-risk file](#global-risk-files); and no
     changed path is a symlink or submodule on any side (links the change and main
     leave alone, anywhere in the tree, do not count). The
     rule reads only Forge data (manifests, the run's selection, receipts), so it
     works with any CI and any check command. The coalesced [main audit](workflows.md#hosted-acceptance-gate)
     is armed at once and covers the new head with one full run.
     Rule `clean-disjoint-v2` also lands a change whose only overlap with main is a
     clean text merge of Markdown that no test or script reads: the runner pins
     those files in its selection (`testedDocs`, any Markdown whose file name a code,
     JSON, HTML or YAML file mentions); a missing list means every Markdown is tested.
     Paths whose blob and mode (or deletion) are identical in the checked, current
     main and recomposed trees are recorded as `identicalPaths`: both checks already
     saw that change, so it contributes no overlap. The complete changed-path
     lists still decide global risk, declared check inputs, package placement and
     shared sequence/fixture folders: identical configuration does not prove the
     new combination passes under it. Differing entries keep the usual rules.
     If the entire recomposed file tree equals the checked tree, the existing
     `exact-tree-v1` proof carries the full pass, including for ancestry-only main
     moves outside the pipeline path. All current policy, check and audit gates remain.
     A docs-only landing after a full green run advances that run's coverage frontier,
     while retaining the exact source head its full run checked. Consecutive docs-only
     landings therefore preserve a usable full audit baseline. They cannot cover an
     intervening unaudited code landing, clear red main or erase audit debt.
   - Otherwise (any doubt: overlap, global-risk file, text conflict, a scoped
     first run, red main or audit debt, unreadable evidence) the proof is refused,
     the change re-enters the queue as a new entry and joins a cohort for one
     combined check.
   The receipt's `firstCheck` says which path it took: `{"landedOn":"admission-run","mainMoved":…}`
   , `{"landedOn":"scoped-intersection","reason":…,"selection":…,"tests":…}` for a
   [scoped recheck](workflows.md#hosted-acceptance-gate) (the tests that can see both
   changes, own tests and smoke)
   or `{"landedOn":"recheck","reason":…}` with the recheck reason (`path-overlap`,
   `tested-doc`, `global-risk`, `unsupported-mode`, `text-conflict`, `checked-not-full`, `main-red`, `audit-debt`,
   `cohort`, `reuse-policy`, …); `metrics` counts every code and flags the limitations
   ([fallback reasons](operations.md#fallback-reasons)).
   Cohorts of admitted changes use the admitted failure prior, so they are larger.
   A refused change waits for peers still deciding their own Lane run (bounded by
   the train hold, holding no queue order, with one armed wake), so the refused
   changes of one wave share one cohort check (Issue 10b0a94b).
   **Passed-change grouping** is the default here (Issue 10b0a94b):
   only changes whose own Lane check passed form a cohort; a change that entered
   unadmitted (its Lane check ended without a result three times) checks alone,
   since grouping such changes made 69% red groups of 4. A refused change waits
   only when no check slot is free, and a peer still deciding its own Lane run
   fills the free slot, so with no peer deciding and a free runner nothing waits;
   in a wave it is the hold above, at most five minutes. The cohort size is the
   automatic size (below) or `acceptance.batchMaxSize`.
   A main-race recheck (single or cohort) that starts with no free check slot runs
   the full check instead of the [scoped recheck](workflows.md#hosted-acceptance-gate),
   so its pass can carry across the coming disjoint main moves; with a free slot it
   stays scoped. Neither rule adds a Convex call; the slot read is one indexed read
   when a recheck starts.
   A Lane run that a moved main has made stale is refused before its turn when
   every older change holding order is itself refused or stale and nothing else
   can move main first, so the wave recomposes in one pass instead of one change
   after another. It is the same one refusal and recomposition, earlier: no new
   check and no added Convex calls (Issue 7fe54c7c).
   A Lane run the queue binds after main has already moved, with no older change
   holding order, no urgent change ready, no other landing reservation and no
   approved check ahead, starts that recomposition in the write that binds it. It
   is never shown ready only for publication to refuse it. The attempt ledger is
   unchanged (`check-binding`, then `main-race`), and so is the carry or recheck
   that follows. It costs one landing-state write and one finish round trip less
   (Issue 5b4b5918).

### Global-risk files

One list, in `src/first-check-risk.ts` (rule `first-check-risk-v7`; a proof pins the
rule it was decided under, so older receipts keep their v1 to v6 decisions). The
same list decides which older landing a newer one may overtake. A change or a main
delta touching any of these always rechecks, except a placed manifest (below). When a
shape is in doubt it is on the list: a wrong match costs one recheck, a miss lands a
change on a check that never ran the new harness.

- package manifests and lockfiles (npm, pnpm, Yarn, Bun, Cargo, Go, Python,
  Ruby, Composer, Maven, Gradle) and `.npmrc`/`.yarnrc`;
- TypeScript, build, lint, format and test-runner configuration (`tsconfig*.json`,
  `*.config.{js,ts,…}`, Oxlint/Oxfmt/ESLint/Prettier/Babel/SWC configs,
  `.editorconfig`, `.nvmrc`, `.node-version`, `.tool-versions`, `Makefile`,
  `Dockerfile`);
- CI configuration on any provider (`.github/`, GitLab, CircleCI, Buildkite,
  Forgejo, Woodpecker, Jenkins, Azure Pipelines, Bitbucket Pipelines). From v7 a
  `.github/` file is CI configuration only when the check can run it: Forge's Actions
  entry workflow `.github/workflows/forge-check.yml` and local actions
  (`.github/actions/**`), or every `.github/` file when a check entry is a GitHub
  workflow (a CI-status project's own workflow may call any other). Other workflows
  (nightly, release, deploy), templates and settings are ordinary files (incident
  `43b51a5e`);
- every repository file the project's check command or its Actions setup command
  (`actions.setup`) names: its executable, its arguments and any path inside a shell
  string such as `bash -c "./ci/run.sh"` (the check contract's own entry points;
  `checkRunEntryPaths`). Forge's own standard check
  (`node scripts/forge-check.mjs`, `isStandardForgeCheck` in `src/standard-check.ts`)
  also declares its extra inputs there: its check scripts, check contract and
  shared test runtime (`scripts/verify`, `check-contract`, `check-path-scopes`,
  `test-*`, `tests/check-runtime.mjs`, …). Other repositories' files of the same
  names are ordinary files, except `scripts/check-contract.mjs`, which the Actions
  executor reads from every Candidate;
- from v2, build inputs of other ecosystems at any depth: Rust (`build.rs`,
  `.cargo/config(.toml)`, `rust-toolchain`), Python (`conftest.py`, `pytest.ini`,
  `tox.ini`, `noxfile.py`, `mypy.ini`, `.python-version`), .NET (`*.csproj`,
  `*.fsproj`, `*.vbproj`, `*.sln(x)`, `Directory.Build.props/targets`,
  `Directory.Packages.props`, `packages.lock.json`, `global.json`, `nuget.config`),
  Gradle (`gradle/libs.versions.toml`, `*.versions.toml`, `gradle-wrapper.properties`,
  `buildSrc/**`), Bazel (`BUILD(.bazel)`, `WORKSPACE`, `MODULE.bazel`, `.bazelrc`,
  `*.bzl`), CMake (`CMakeLists.txt`, `CMakePresets.json`, `*.cmake`) and `go.work.sum`;
- database schema (`convex/schema.ts`, `schema.prisma`, and from v2 `schema.rb`,
  `schema.sql`, `structure.sql`);
- from v2, a **sequence folder** both sides changed: when the change and main each
  changed a file under the same `migrations`/`migration` folder, `db/migrate` or
  `alembic/versions` (Django, Rails, Flyway, Prisma, Alembic), the change rechecks even
  though the paths are disjoint (`0005_a.py` and `0005_b.py` would leave two leaf
  migrations on main). Reads paths only; folders in different places do not interact;
- from v5, a **shared test folder** both sides changed, by the same rule: `fixtures`,
  `__fixtures__`, `__snapshots__`, `snapshots`, `testdata`/`test-data`, `golden`/`goldens`,
  golden-file and `cassettes` folders at any depth (the outermost one is the key). Tests
  often list or glob such a folder, and a snapshot runner fails on an obsolete or
  unexpected snapshot, so two disjoint files in one folder can still break a test that
  neither side ran with the other's file. A fixture changed on one side only stays
  reusable;
- from v6, Apple, Android and Dart build inputs v1 to v5 do not name: Xcode project and
  workspace contents (`*.xcodeproj/**`, `*.xcworkspace/**`, shared schemes), `*.xcconfig`,
  `*.xctestplan`, Gradle script plugins (`*.gradle`, `*.gradle.kts` at any depth),
  `proguard-rules.pro`, `dart_test.yaml` and `build_runner`'s `build.yaml` (Issue 870791c3);
- from v4 (`src/first-check-risk-v4.ts`), test-harness, runner and build files of every
  ecosystem by shape, at any depth: runner setup files (`vitest.setup.ts`,
  `jest.preset.js`, `vitest.workspace.ts`, `setupTests.ts`, `global-setup.ts`,
  `karma.conf.js`), harness-named files and `support/` or `setup/` folders inside a
  test folder (`spec/spec_helper.rb`, `spec/rails_helper.rb`, `spec/support/**`,
  `test/test_helper.exs`, `tests/bootstrap.php`, `test/setup.ts`), Jest `__mocks__/`,
  dot-rc files (`.mocharc.yml`, `.nycrc`, `.coveragerc`), `.rspec`, `phpunit.xml(.dist)`,
  `.env*`, compose files, and the build and dependency files of Ruby, Elixir, Swift,
  Dart, Scala, Deno, Bun, Nix, Haskell, OCaml, Zig, C/C++ (Meson, `*.mk`, Conan, vcpkg)
  and JS workspace tools (`turbo.json`, `nx.json`, `project.json`); a test file itself
  (`*.test.*`, `*_spec.*`) is not harness;
- every path matching the check definition's declared `globalRiskPaths` (below);
- any other root-level file that is not `.md` or a prose `.txt` (`README`, `LICENSE`,
  `NOTICE`, `CHANGELOG`, `llms.txt`, …; before v4 every root `.txt`).

A project declares what Forge cannot recognise by shape (a custom harness folder, a
fixture corpus every test reads) as `globalRiskPaths` on its check definition:
repository-relative globs (`**`, `*`, `?`, `{a,b}`; at most 64), part of the definition
digest. They are risk for first-check reuse and for overtaking only; unlike the command's
entry files they need no owner approval.

```sh
nforge x ROOT configure-check '{"command":{"name":"verify","executable":"bash","args":["ci/check.sh"],"environmentLabel":"","globalRiskPaths":["test/harness/**","fixtures/shared/**"]}}'
```

From v3 (Issue 5cfcca4b), a package manifest or lockfile inside a package is
**placed**: the checked run pins its manifest package graph in the selection
(`packagePlacement`, rule `package-placement-v2`: each package's ecosystem, folder
and dependencies, the packages with references the graph cannot place, and whether
forge.json declares the cross-ecosystem edges, at most 128 KiB; `src/package-placement.ts`).
Its reach is that package plus every package that depends on it, widened like the
package graph's selection (unresolved packages, other ecosystems). The change lands on its first check
when the other side's paths all lie outside that reach (a path outside every package
counts only when it is Markdown or under `docs/`); the proof records `placedRisk`
(each placed path and its reach). Root and workspace files (`pnpm-workspace.yaml`,
`.npmrc`, `.yarnrc`, `go.work`, `settings.gradle`, `gradle.properties`), every other
risk file, a missing pin, and placed manifests on both sides keep the recheck. Works
for every ecosystem the [package graph](workflows.md#check-command-scope) reads (npm, Cargo, Go, Gradle, …).

The placement reader also accepts `package-placement-v3` pins. An Actions runner
writes v3 when `acceptance.standaloneNestedPackages` is enabled and it certifies a
JavaScript folder. The setting defaults off. A v3 pin appends placement-only rows
for the outermost certified nonmembers, including eligible dot folders. The
ordinary package graph and test selection use the same inputs in both modes.
If the added rows exceed the pin size limit, the runner keeps the v2 pin
whenever ordinary placement fits.
To certify a nested package, the runner needs complete evidence of all five facts.

1. The toolchain keeps the package outside the enclosing build. Go has its own
   `go.mod`. Cargo names the folder in a workspace's `exclude` or has no enclosing
   workspace. JavaScript has no matching enclosing workspace pattern and has its
   own lockfile or no dependencies. Other ecosystems have no standalone rule.
2. No other package depends on or claims the folder. The package has no unresolved
   references, and cross-ecosystem widening cannot make the change reach other packages.
3. The JavaScript writer scans captured JS/TS code and alias configuration outside
   the package, including dot folders. It refuses relative specifiers pointing
   into the package even when the target is missing, absolute specifiers, aliases
   that can point into the package, computed imports with matching literal
   prefixes, and direct mentions of the folder in code. Unreadable inputs,
   syntax errors and exceeded analysis bounds keep the existing placement.
4. No check entry, CI file, declared `globalRiskPaths` entry or enclosing package
   script names the folder or a parent below the root. A shell command entering
   the folder or a script glob naming a parent keeps the recheck. A workspace glob
   that includes the folder keeps the ordinary workspace-member placement.
5. The package has a command for its own tests if it contains any.

For strict reuse the Candidate-side proof reads the Candidate check's pin. For a
main-side manifest or lockfile, standalone evidence comes from the already-read
audit pin only when the audit checked current main exactly. Missing, unreadable
or incomplete evidence keeps the existing placement decision. A standalone
manifest or lockfile reaches only its own package, and the receipt records the
evidence as `standalone: go-module`, `cargo-exclude` or `js-non-member`. Root and
workspace files, CI and check entries, manifests on both sides and a shared sequence
folder still keep the recheck. The rule uses the same six pinned objects and leaves
test selection unchanged. Go and Cargo evidence kinds are available in the reader.

A dynamic read that walks the repository or a new import on the other side can
still couple two path-disjoint changes. Each side passed its own full check.
The main audit checks the combination and can revert a proven culprit. A reader
added via a manifest, workspace file or CI entry already keeps the recheck.

The Lane check never re-runs because main moved. Re-running it would race main
again (model finding 5, moving-main starvation) and add a full run per move; the
combined check verifies the same interaction once per cohort.

## Landing modes

`acceptance.landingMode` chooses what a moved main costs. Absent is `strict`. The rule is
`src/landing-mode.ts`, one derive shared by the server, the CLI and the web.

| Mode | What it promises | When a moved main needs the second check |
| --- | --- | --- |
| `strict` (default) | A change lands on a check of exactly its content, or on its own check when it is proved disjoint from what main gained. With `hostedCrossHeadReuse:false` only the exact check lands. | Every refusal of the first-check rule above. |
| `fast` | A change lands on its own check; main is verified after the landing and recovers fast: the audit finds a break, Forge reverts the one proven culprit or opens a fix. Fast mode does not promise that main is always green. | `path-overlap`, `order-sensitive`, a text conflict, a scoped first run, a changed link, unreadable evidence, and any time fast mode is not in effect. |

Fast mode relaxes two refusal classes and nothing else: `tested-doc` (a clean text merge of a
Markdown file that a test reads) and `global-risk` that is not order-sensitive (manifests,
lockfiles, build and test-runner setup, other root files). The receipt's proof is
`fast-first-check-v1`; it names the classes it relaxed (`relaxed`) and the risk paths.

**Order-sensitive risk always gets the second check**, in both modes, and is recorded as
`order-sensitive`: database schema files; a migration, fixture or snapshot folder both sides
changed; the check's own entry files, check contract and declared `globalRiskPaths`; CI
configuration; lint, format and type-rule configuration (`tsconfig*.json`, ESLint, Oxlint,
Prettier, Biome, Ruff, RuboCop, Clippy and similar). To keep any other path on the second
check, declare it in the check's `globalRiskPaths`.

**Fast follows the owner's policy, with a circuit breaker.** No earning count or drill is
required. Fast carries a landing while all of these hold:

1. the policy is `fast`;
2. a green main audit is on record (an accepted exact full check also establishes this baseline);
3. main is not red and the audit is fresh: no audit newer than the last green ended without a
   verdict, at most 10 landings are unaudited and their oldest is at most 60 minutes old;
4. fewer than 3 real red audits occurred in the last 50 audited landings, and fewer than 3 of
   the last 50 audits ended without a clean verdict (flaky or stalled).

Freshness and the breaker are checked when the proof is decided and again in the publication
transaction. A proof based on main's own exact full check has no audit lag to bound. Otherwise
it gets the second check; a passed full second check audits main too. A single recovered red
pauses fast only until main is green and audited again. A new project can use fast after its
first green main audit. Repeated trouble pauses fast and advises the owner and next agent to
switch to strict; it resumes automatically when the window clears, if policy remains fast.
Forge never edits that policy automatically.

The existing main audit row retains at most 50 compact verdicts, updated only in transactions
that already write the row. Each compact slot pairs a red count at an audited landing position with a recent audit
verdict. The two horizons advance independently: a coalesced green audit advances the red
horizon by its covered landings, while unclear verdicts count once per audit, including its
retry. At most 50 landing positions and 50 audit verdicts fit in those 50 slots. A flake replaces the failed verdict with one unclear
verdict. A missing window starts empty; no history recount or backfill runs. Retired earning
fields have no readers and are removed by the next verdict write; their schema validator
only tolerates existing rows during deployment. Older CLIs' recount requests return an inert
compatibility reply: nothing is scheduled and the window stays unchanged.

**Coverage changes and newly covered tests.** A landing that changes which tests run (the
check script or contract, CI configuration, or the standard browser-selection files) never
earns main green from its own full check; its audit runs promptly. On a project whose checks
run with no gate (machine runners, credentialed Actions), which keeps no audit bookkeeping, it is
only marked, so its own run carries no other landing; the next landing's full run does. Before it
lands, its check is
main's full check plus a trial of its own definition
([definition trial](operations/github-actions-checks.md#definition-trial)). When a red audit's failing
tests had no pass on the last green main (skipped or not run), recovery names the landing that
changed coverage, reverts nothing and keeps main red until a fix lands: fix forward. In a
mixed red, recovery bisects the failing tests that passed on the last green main and reports
the rest as newly covered; a reverse that cannot pass while they fail is named, not widened.
Until that coverage landing's prompt audit passes, its own run is no reuse baseline. A
docs-only audit never clears red. While main is red, `queue` replies carry `mainRed`: the
failing tests (first 20), the reason, the fix Intent, the named culprit or coverage
landing (`newlyCoveredBy`), the `branch` recovery runs (`classifying`, `reverting`,
`reverse-held` when the prepared reverse waits for a person, or `fix-forward`, which a revert
decision replaces), and `next`, which names that branch and says a
landing failing only on these tests waits when either park switch is on, or to land it again
once main passes. Recovery writes one coverage event the first time a red names its coverage
landing, so `status {"main":…}` and the Main broke view still name it after main recovers.
Landing replies mark `culprit` only on the receipt the culprit event names, `made-tests-run`
on the receipt a coverage event names; other receipts in the red range show `in-red-range`.

A **Fix needed** notice clears itself once main passes a full check (a full audit or a
full-gated landing) at or after the landing its failure was recorded on: the fix-forward is on
main. A **Reverted from main** notice stays until its Intent lands again. The cleared Intent
completes again unless one of its Lanes is still open. With no Fix needed notice open, a green
costs nothing more; otherwise it schedules one hop that reads at most 20 Fix needed notices. A
notice recorded after that green (its bisect still ran) waits for the next full green.

With `FORGE_QUEUE_PARK_ON_MAIN_RED=1` (Item 687d1eda fix D, off by default), a landing whose
admission check fails only on tests main's red audit fails too, none of them explained by its own
paths or its own contract tests, is not failed: it waits under the main-red hold (`MAIN_RED`) and
joins the queue again when main passes, where its ordinary check runs. It parks only under Forge's
standard check, when the run finished with exactly one failed test job and a separate static job (so a
static, cancelled, interrupted or incomplete run, or a project's own check command, never parks), and
neither failing list is clipped. A parked landing holds no stall alarm, cohort place or reservation;
withdrawing or superseding it ends it for good. Release counts as progress: a released landing's stall
alarm runs 15 minutes from release, however long main was red. With the switch on, the change that
turns main green only schedules the release (one indexed read when nothing is held), and scheduled
pages of 25 release held landings, publication holds included, with one row patch, one observation
and one stall alarm each (about 6 document reads, 5 writes and 6 KB written per landing). If a release page is lost (a failed task), the redrive sweep or a same-Lane re-submit releases
again once main is green (one audit-row read, only for a held entry). A failed
admission costs one audit-row read, plus one Candidate read when its files match main's; parking
writes less than failing. Idle and passing landings cost nothing more. Each hold leaves a record:
the park (or publication hold) stamps `heldAt` and the release `releasedAt` on the same row write,
and the receipt, its `landings` row and the Lane's `lane-history` landing carry them as
`mainRedHolds` (at most four), so a hold and its re-landing can be read after main recovers.

With `FORGE_QUEUE_KEEP_THE_RUN=1` (Item fa2c1383, off by default), a main move no longer throws away
every running check it touches. The post-acceptance sweep (at most eight running entries) asks the
keep rule (`src/stale-check-keep.ts`) per solo run. A kept run never lands on its own pass: the pass
either carries through the ordinary cross-head proof or becomes the basis of a scoped recheck on current
main, so nothing changes what may land. A run is kept to carry wherever the proof could use it, and kept
for a scoped recheck only when that costs less than a full replacement on the project's own measured
check costs (from the first test shard's start, never runner wait; recorded scoped rechecks that ran in
full count in the scoped share). A run sharing a path with the mover keeps only until a precompose probe
of its Candidate on current main answers: a conflict ends the landing with `COMPOSITION_CONFLICT` and
releases the run, and a later mover retargets a probe still running (or detaches it when the rule then
cancels). A kept pre-queue admission run takes queue order in the write that would have retired it
(`admission.kept`), so followers compose behind it while the pipeline has a slot; with the pipeline full a
follower checks on its own in strict, as today; fast stacks it behind the kept row in its train, as it
stacks behind today's retired entry, and the kept run's settle wakes it, including when the kept run
parks on main's red tests (it gives up its place). When the platform ends a kept run without a test
result, the entry clears the kept marker. An ordinary finish already in progress continues on its
existing attempt. Otherwise, the queue retires the check, recomposes on current main, and passes the
provider-delay reason to the replacement check. Coverage movers, red main or audit debt, cohorts, recoveries,
reverts and partial runs retire as today, and today's unrelated keep reads nothing more. Each landing
row records its check kind (full, scoped or batch) when the check starts. With the switch off the sweep
is unchanged.

With `FORGE_QUEUE_PARK_EXACT_ON_MAIN_RED=1` (Item 687d1eda, off by default), queue checks park the
same way under the same run rule. A cohort's shared run that fails only on main's red tests, with no
member named by its diagnosis (paths, contract tests or an earlier combined failure on other tests
than main's red ones), no semantic conflict, no unknown member paths and no predecessor below it,
ends the cohort without counting as a cohort failure: every pending member parks with a fresh
deferred attempt for its own Candidate instead of splitting into solo re-checks on red main. One
entry's own exact check that fails only on main's red tests, explained by none of its own paths or
contract tests, parks too, but only when that check came from a deferred attempt (its cohort
original when it came from a cohort in any phase, such as a fallback line member or a split's lone
single, or the deferred parent of a solo cohort check, past that check's platform retries). A check its submission was
never deferred (no owner provenance, a revert, a recovery gate, a stacked or own-run request) fails as
before, so parking never grants a deferral. A fallback member leaves the line, which moves on to its
next member at once; it stays out of that line once released. Parked entries leave the speculative
train, so nothing stacks on them. On green they compose onto the repaired main and check again;
nothing lands unchecked. A failed queue check costs one audit-row read (a lone entry also its batch
row or parent attempt and its Candidate) and, when it parks, one queue read and patch; each parked
entry writes one attempt and one landing row instead of the solo re-checks it would have started. With both switches on, a landing that already
failed on main's red is told to land again now when a fresh land would be deferred again (its request
could be and its attempt chain was, past platform retries; failed runs only, at most three
attempt reads): its check fails only on main's
tests, so it waits and lands once main passes. Any other landing is told to land again once main
passes.

With `FORGE_QUEUE_HOLD_ON_CI_DOWN=1` (incident e62d834b line 5, off by default), the queue holds
landings while CI is failing for every check. Once three landing checks in a row end on one
infrastructure cause (the CI never started the run, or stopped it, with no failing test) and no
verdict came between, an entry whose own exact check, or whose cohort's shared check, ends that
way parks under the `ci-down` hold with a fresh deferred attempt, instead of spending its
platform retries and failing for good. While the hold is on, an infrastructure end on any cause
(a runner that dies mid-run, or none at all) extends it with the same probe. A submission whose
check was never deferred (an explicit check, a revert, or one with no finish or an `after`) cannot
park: it spends its platform retries and fails as before, and its ends still count toward the
streak. The queue reply's `ciDown` field and each held entry give one reason (the cause, since
when, the streak) and `wait` prints `HELD: CI IS DOWN`. One probe wake releases one held entry
after 2, 4, 8, 15 and then every 30 minutes; the first verdict (a pass or a failing test) of a
landing check ends the hold and releases the rest in pages. A cohort parked for red main does not
end it; the held entries then wait for the next verdict or probe. An entry that arrives while the
hold is on still gets its first check, which works as one more probe; if CI cannot run it, the
entry parks at once with no retries. An admission check that CI could not run counts toward the
streak; the entry joins the queue unadmitted as before. The streak is a field on the queue row,
written only on an infrastructure end or its clear, so a healthy queue reads and writes nothing
more. Turning the switch off stops new holds; a verdict still releases what it held.

The same switch holds a check whose environment fails it the same way every time (Item 0d14c456).
An environment end is a failed check with no failing test file whose job summary carries Forge's own
attribution of the fault: a check input Forge wrote that the Candidate user could not use, or
`CANDIDATE_ISOLATION_UNAVAILABLE`. A shell's own `Permission denied` or `command not found` is not
enough, because a Lane can cause it (a script that lost its execute bit exits 126 too). After three
such ends with the same check pins (check, runner configuration and environment) and the same failing
line, normalized for temp names and numbers, an entry with that check parks before dispatch, so a
fourth identical run never starts. Its admission check is skipped, and a direct check on those pins is
refused with `RUNNER_UNAVAILABLE`. `wait` prints `HELD: CHECK ENVIRONMENT IS FAILING` with the failing
line and the resume step: fix the runner or environment, then change the check or runner configuration
(`configure-check`, `configure-runner`). The change ends the hold and puts held entries back in the
queue. A pass, a failing test, an infrastructure end or another failing line also ends it. One probe
lets one held entry check again after 30 minutes, 2 hours and then every 6 hours; the permit belongs to
that entry, so a change that arrives meanwhile still parks. A failed build or other failure without
that evidence never counts. On a failed check the hold reads the run's sealed output streams once (at
most 64 rows); a passing check reads and writes nothing more. Known gaps: a cohort already composing
when the hold trips runs its one check, and its end parks every member; Candidate output that prints
Forge's own line could trip the hold, which costs that project a config change, not a wrong landing.

**Optional red-audit drill.** To exercise detection and recovery, the owner can start a drill.
It is advice, never an eligibility condition. From an agent sign-in, the existing owner
approval still applies:

```sh
nforge x ROOT configure-runner '{"mainAudit":{"drill":"start"}}'
```

The drill claims the first red main audit within 2 hours of its start and cannot start while
main is red. Normal recovery still applies. A deliberate drill recovered within 2 hours of its
red is recorded as a drill rather than a real red; a late drill counts as real. A flake-cleared
red counts as unclear. Events retain start, red, recovery and end times and the outcome
(`recovered`, `late` or `flake`); `check-settings` `mainAudit.drill` shows a drill in progress.

**Flake policy.** A failed audit re-runs its failing files once on the same head. A pass there
vouches for the audit, records a `flake` and clears main red; its verdict counts as one unclear
audit. The retry count stays fixed at one.

**Advice.** `check-settings` (`mainAudit.landing`), web project settings and the next land
receipt show the policy mode, effective mode, reason when paused and one next step. The
receipt retains the observation from check selection, without another status call. Live
trouble resumes automatically after a green, fresh audit. The circuit breaker advises switching
to strict after 3 real reds or 3 unclear audits in the stated windows. To choose fast:

```sh
nforge x ROOT set-policy '{"acceptance":{"landingMode":"fast"}}'
```

Switching the mode never invalidates a queued landing: it is read when a proof is decided. From an
agent sign-in, switching fast on is held for the owner person, like any edit that changes what may
land; switching back to strict applies at once.

A file main changed that already holds the queued Candidate's bytes is not `SYNC_REQUIRED`
advice: an early resolution carries its predecessor's own files, and the recompose takes
either side. The would-conflict pass compares main's blob with the Candidate's stored file
listing in the action it already runs; a Candidate without a readable listing keeps path
advice. In the client, a `land --save` that rejoins its own marked entry syncs main into the
Lane once and lands the new head. A sync conflict returns that sync's resolve guidance, and a
sync still running returns its own resume command (exit 3). If the sync completes without moving
the Lane, or the landing rejoins the same entry, it stops (exit 2) with the reason instead of
offering `land --save` again.

**Exactly-once finish wakes** (Item 9a04d916). A lost action on a cancelled check's
recompose, once or twice, no longer waits for the 15-minute stall alarm. The finish step that
submits the recompose, the one that consumes its result, and the 120-second compose watchdog run
in a scheduled mutation, which Convex runs exactly once, rather than an action, which runs at most
once. IO stays in the action. The step's retained retry for that IO (30 seconds; a proof's lease
wait) is scheduled as that mutation too, using the same scheduler row, which resume cancels. So a
lost IO action, even twice, is retried by a mutation within 30 seconds, and a lost source action
is resumed by the watchdog mutation. After three mutation retries in a row the retry is an action
again, so IO lost every time still ends typed through the stall supervisor; a lease wait spends
none. The watchdog counts as the first of those three, so IO a watchdog step hands out gets two
mutation retries. Task arguments never hold plan bytes or URLs: a solo plan carries its pin and compose
identity, and the action re-reads the bytes in one indexed query. IO that cannot travel that way
(an acceptance page, a cohort plan) gets one immediate action that runs the step again, with the
mutation retry kept behind it. Every other finish wake that starts a new wake generation has no
IO in flight, so it is that mutation too. That covers the first step into acceptance, each next
acceptance page, a cohort's first compose step, an order-wait wake or expiry, a claim retry and a
new-run follower. A mutation that fails outright (it throws) is not retried by Convex; the head's
stall alarm, armed in the same transaction as the wake, stays its backstop. Recovery re-drives
(the stall alarm's repair, an operator redrive and the dependency redrive) stay actions. A solo
stall keeps its owner diagnosis only while it is current.

## Three test tiers

Each tier answers a different question. None depends on a particular CI provider.

1. **Local (builder machine): a quick first answer.** Preflight runs the tests
   closest to the change first (the changed tests, then direct and nearer
   transitive consumers), with a measured time estimate instead of a fixed cut.
   Issue c14f4065 replaced the former fixed 25-file cap for nearby consumers with
   this: tiers in order (changed tests, explicit coverage and smoke; tests that
   failed for these paths before; direct tests, which run a changed module
   themselves, through a test fixture or through one module that imports it;
   hub consumers, recent landing failures within two modules, name-watch and
   two-module consumers), with only the last four trimmed by a local time budget
   (180 s by default, `budgetSeconds` overrides). The budget is also a wall-time
   cap: the run starts no file once it is spent and names those files in
   `stopped`, with `stoppedRerun` to run just them. Every local test phase,
   `trim:false`, finish and retry runs included, also stops at a 600 s ceiling
   (`PREFLIGHT_RUN_CEILING_SECONDS`, Item 8dbd2683; declared guards too): runs
   past it held half of all preflight slot time on 2026-11-19 and caught nothing.
   What it stops goes to the landing check, and the receipt's `ceiling` names it;
   a `budgetSeconds` above 600 raises it for that one run, named as an override.
   The plan, the receipt and
   the builder output name the rule, the trimmed tier and files, the one command
   that runs them (`trim:false`), the estimate and the number of tests left for this
   pre-queue tier. The local tier **may leave out** any hub, name-watch or farther
   consumer of the change, plus the near-full set that preflight already hands to
   the runner. It never decides acceptance. A docs-only change parses no import
   graph: the local tier runs only the tests that read a changed document, beside
   the static checks. Tiers 2 and 3 select the same readers (one shared selector,
   `scripts/docs-readers.mjs`) beside the documents checks, and nothing more: a document
   no test reads still runs no test file, and the docs scope keeps its rules (no full
   re-check, the main-audit skip: a docs-only pass that also passes its readers still
   inherits a green parent).
   A repo-wide guard (a rules or lint-style test that lists a folder and checks every
   file in it) is explicit coverage of each file in that folder, in every tier and for
   code and documents alike: `scripts/test-tree-scanners.mjs` finds tests whose
   `readdir`, `opendir` or `glob` argument is built from the repository base
   (`import.meta` or `process.cwd()`) and takes the folder names that flow into it.
   `scripts/test-tree-readers.mjs` adds the two shapes that base misses: a listing
   or walk of a plain relative path (tests run from the repository root, so
   `readdirSync('src')` lists the repository's `src/`), and a recursive reader, a
   function that reads the file its parameter names and calls itself on paths found
   there (an import walk), which covers every code file below its start but no
   Markdown document. Only values whose every piece is known count: a temporary
   folder, a helper's return value or an unbound name drops that alternative, and a
   test that changes its working directory is skipped. A comment-only edit keeps
   these guards in preflight, since they read comments too.
   Literal Vite `import.meta.glob` loaders narrow to their matched files only for
   supported relative patterns (`*`, recursive `**/` and trailing `**`) and literal
   `base`, `eager` and `import` options. A relative base starts at the importer.
   Absolute bases depend on the unmodeled Vite root and stay broad, as do
   unknown patterns or options. These forms keep
   conservative loader coverage; an unsupported form never proves an empty match.
   No import edge reaches such a test, so before this a new literal in a scanned
   file could fail only the landing check.
   Preflight reuses raw import and symbol facts by parser version, path and verified
   source hash. The local cache lives alongside the project's Forge checkout.
   Each invocation resolves imports and loaders against its current source inventory,
   package manifest and lockfile. Repeated computed module paths reuse their matches
   within the current import graph. Guard and Markdown reader discovery filter the
   inventory by path before opening candidate source files. The local cache also reuses
   guard scopes for unchanged tests when analysis is independent of package file lists
   and shared TypeScript bindings. Missing pins or unreadable cache entries use the source
   parser. The Actions planner shares raw facts within its trusted process.
2. **Pre-queue Lane check (project runner, any CI): the complete consumer set,
   off the builder's machine.** It runs the project's configured check on the
   project's runner. Forge's `verify` selects either the full suite or every
   transitive test importer of the change plus fixed smoke coverage, all static
   checks included. That is the same selector with no closeness cut, so it contains
   every test the local tier left out. **Guarantee:** with
   the pre-queue check explicitly enabled, every test left out locally runs on the Lane's own
   Candidate before it can enter the queue, unless one of these is true:
   - the Lane check ended without a verdict after two restarts (unknown): the left-out
     tests then run first in the change's queue check;
   - the project configured a check whose selection is narrower than the consumer
     set (a custom command that declares `selection.scope` and scopes itself, or a
     contract gate that declares fewer tests): the pre-queue tier then covers only
     what that check selects. A custom command without that declaration runs in full;
   - a disjoint global-risk interaction uses the pending full admission's exact
     predicted head in the pipeline: the left-out tests run in the combined full
     check before publication, rather than in a separate solo admission;
   - the project uses queue-only checks (absent or `admissionCheck: false`) or
     scoped admission (`true`): there is no
     pre-queue tier, and left-out tests run first in the queue check.
3. **Landing (queue check of the combination): the authority.** It checks the
   exact combined head, or accepts by exact or proved reuse of tier 2, and the
   post-accept main audit runs the full suite on the new head. Tiers 1 and 2 never
   accept anything by themselves.

## Why not the alternatives

- **Check on every save:** most saves are checkpoints, not candidates; it multiplies
  runner minutes by the save count.
- **Scoped admission only (`admissionCheck: true`):** GitHub Actions only, and an
  affected-set selection misses failures outside the selector's view.
- **Re-check the Lane on each closure-touching main move:** see above; the cohort
  check is the cheaper and bounded re-check.
- **Proved reuse for whole cohorts:** a batch publishes several same-head receipts,
  which the existing recovery proof does not cover. Members try reuse one at a
  time instead, before cohorts form.

## Consequences

- With full admission enabled, every submitted change costs one full check on the
  project's runner, in parallel, before the queue. A single Lane on unchanged main pays nothing extra: its Lane
  run is the landing check (one run, as without the Lane check). Queue checks run only for changes that are not independent of
  what landed meanwhile, or for unadmitted changes.
- Proved reuse works with any configured check command on any runner: the rule
  reads paths, manifests and the run's selection, never the command's own test
  selection. Every command receives the same changed-paths file
  ([check command scope](workflows.md#check-command-scope)); a scoped run of a command
  that declares `selection.scope` is scoped evidence, so it rechecks (`checked-not-full`)
  instead of landing on its first check, exactly like Forge's own scoped runs. It needs owner-agent automatic acceptance. A Markdown overlap lands
  on its first check only when the runner pinned a tested-docs list. Forge's own
  selector writes one; any other command writes it from its check's opt-in
  [`docsPaths`](#docs-only-paths) and otherwise rechecks such an overlap.
- Changes that land on their first check publish one by one, each proved against
  the main it lands on. A wave of k such changes makes up to k(k+1)/2 proof
  analyses (one action each, reading six small objects) and gives up the shared
  cohort publication, so it uses more Convex calls per landing than one cohort
  recheck (5-change fixture wave: 51 to 65) while it saves a full check per change.
- No polling: a Lane check wakes its submission only when its run reaches a
  terminal state, as admission did before. Idle costs nothing.

## Docs-only paths

A check definition may declare `docsPaths`, repository-relative globs of files that
no test or build reads (`**/*.md`, `docs/**`, `LICENSE`; same glob syntax as
`acceptance.protectedPaths`; at most 32). It works like GitHub's `paths-ignore` and
is **off by default**: a check without it always runs its whole command, and every
Markdown overlap rechecks. Declare it with `configure-check`:

```sh
nforge x ROOT configure-check '{"command":{"name":"verify","executable":"bash","args":["ci/check.sh"],"environmentLabel":"","docsPaths":["**/*.md","docs/**"]}}'
```

- **Docs-only change.** When every path a Candidate changes against its base matches
  `docsPaths`, the Actions runner runs no command and no install; the plan has the
  static job alone and the receipt records `skipped: tests not-affected`, as for
  Forge's own docs-only changes. Any other changed path runs the whole command.
  Audit runs, failed-file probes and composed Intent contract tests always run it.
- **Docs-only overlap.** A Markdown file matching `docsPaths` is pinned as untested,
  so a text-clean overlap of it after an overtake lands on its first check; every
  Markdown file outside the globs counts as read and rechecks. Overlaps of
  non-Markdown files always recheck. The Mac and self-hosted runners run the full
  command either way but pin the same list.
- **Forge's own check** (`node scripts/forge-check.mjs`) ignores the setting: its
  selector already knows which tests read which document, which is strictly
  better than a path list.
- The globs are part of the definition digest. Declare only paths nothing reads: a
  glob such as `**` skips every check, and a change to the check's own entry file
  under a declared path would run nothing.

## When to turn it off

Leave admission absent or set `acceptance.admissionCheck: false` when one full
check per change costs more than the queue saves:

- the runner bills per minute and changes rarely fail their first check;
- the check is very long and the queue rarely holds more than one change, so
  there is nothing to run in parallel with;
- the runner has fewer free slots than changes arrive at once, so Lane checks
  would wait for each other anyway.

A solo user does not need to turn it off: a single Lane on unchanged main
lands on its Lane run with no second run.

## Measured effect

On the synthetic 12-Lane wave with 3 red changes, no queue check contained a red
change (before: 8 of 19) and no queue run was thrown away (before: 0.67 per
landing). With the cohort hold, the 8 changes that missed proved reuse share two
cohort checks instead of 7 groups: runner minutes per landing fell from 46 to 34,
landings per hour rose from 6.1 (8.2 without the hold) to 12.3 and Convex calls
per landing from 121 (99) to 77. A single Lane uses one run (22 runner minutes) with or without the Lane check.
Details are in [landing batches](operations/landing-batches.md#pre-queue-lane-checks).
These incident fixtures establish the benefit for a red-heavy wave. They do not
establish that full admission is cheaper for a mostly green project. The replay
comparison below measures that distinction; a live default-change qualification
remains separate.

## Provider outage recovery

The lead's decision for Issue 238b3573 applies to every CI adapter: once every required
shard has reported a verified signed pass, the provider confirms that evidence. If
its run or job statuses lag, a complete provider job list showing **every job's
steps completed without failure** is sufficient to pass at the +30 minute read.
A job report alone never supplies that provider confirmation. A missing or
incomplete page, unknown step conclusion, absent steps on a nonterminal job, or
missing signed shard evidence never passes by this rule. The check retains the
provider's lag in `failureReason` as `provider-delayed` evidence, even when passed.
The ordinary provider-success path is unchanged.

Reads are fixed offsets from the last shard: jobs at +10 s and +30 s, the run at
+5 min, jobs/steps at +30 min (replacing the former run read), then the run at
+1 h, +2 h and +4 h. A provider failure at any read fails the check. Otherwise it
shows `provider-delayed`, with the time since the last shard and next fixed read;
after the series, the existing 12-hour execution watchdog remains the backstop.
There is no polling loop or periodic job.

An accepted dispatch that has neither an authenticated execution acknowledgement
nor any shard result gets one provider lookup at +5 minutes, by its returned run
id or dispatch run-name. A missing run, `startup_failure` or cancellation settles
as `runner-unavailable` with a provider-outage reason and uses the existing bounded
platform retry (two retries, three checks total). A still-pending run is adopted;
an unreadable provider response remains uncertain and never licenses a duplicate
dispatch. Healthy startup cancels this deadline within its existing session/event
write; healthy completion cancels the verdict fallback within its existing write.
Replayed deadlines and the stall alarm cannot issue a second startup lookup.

The shared contract is `src/ci-provider-recovery.ts`; the GitHub and GitLab-shaped
adapter contract tests cover the same startup and lagged-step decisions. An adapter
normalizes its own authenticated provider records, supplies complete-page coverage,
and proves signed passes for the entire plan before applying the delayed-pass rule.
GitLab Candidate publication remains unsupported; these tests are contract parity,
not a claim of a live GitLab deployment.

Budget per check: healthy execution adds zero Convex calls, application DB reads or
writes and provider reads; a startup deadline is scheduled and cancelled in existing
transactions. A stuck startup adds one provider lookup and two short mutations.
A delayed verdict uses at most seven provider reads in total, three beyond the
previous four. Provider authentication/token calls are additional to these record
reads, as before. At most 100 jobs and their steps are inspected in memory; larger
or incomplete pages stay delayed rather than being treated as complete. No source
or log bytes move, no new storage table is added, and idle costs zero calls.
Live deployment, replay and billed-usage deltas remain separate qualification.

## Replay comparison and default choice

The production queue, composition, completion and audit controllers were replayed
under a fake clock on three ten-change arrival timelines. Source bodies are
synthetic clean line edits; fixtures retain only relative timings and synthetic
path-equivalence. Full admission is A, queue-only is B, and C skips a solo full
admission when its paths overlap an earlier checking, queued or composing entry.
The C experiment retains full admission for other arrivals; it is not a product
setting or an additional runtime branch.

| Arrival width | A checks / rounded CI min | B checks / rounded CI min | C checks / rounded CI min | B minus A mean submit-to-land (s) | B minus A all-landed wall (s) |
| --- | ---: | ---: | ---: | ---: | ---: |
| 10 | 17 / 46 | 10 / 29 | 18 / 51 | -26.974 | -49.858 |
| 5 | 16 / 46 | 10 / 30 | 16 / 46 | -1.674 | -0.500 |
| 3 | 16 / 46 | 10 / 31 | 16 / 46 | -11.120 | -0.500 |

B executes no separate audit in these clean waves: each accepted queued check
covers its exact composed head. A executes four, five and four audits respectively;
the width-three wave also retains one later cadence wake. C does not consistently
save checks and adds overlap-selection work. The default therefore uses B, while
explicit full admission remains available for projects where red isolation pays.
No audit scheduling or publication-proof rule changes with this default.

### Red-change sensitivity

At 10% red, each of the ten arrivals is made red once. At 30%, ten rotations of
three spaced red arrivals give each arrival equal weight. Green survivors must
land, every red must end with its own check failure, and no red source may accept.
A red change fails after a full measured service interval; fixes and agent editing
are not simulated. Values below are means across rotations, with each CI job
rounded separately before averaging.

| Width / red submissions | A CI min | B CI min | A mean submit-to-land, green (s) | B mean submit-to-land, green (s) | A mean culprit isolation (s) | B mean culprit isolation (s) |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| 10 / 10% | 44.5 | 35.5 | 178.552 | 211.723 | 181.682 | 293.550 |
| 10 / 30% | 39.1 | 62.2 | 169.770 | 393.395 | 165.286 | 424.904 |
| 5 / 10% | 45.0 | 32.2 | 151.604 | 174.072 | 151.424 | 253.450 |
| 5 / 30% | 41.8 | 43.3 | 151.121 | 268.886 | 151.424 | 287.150 |
| 3 / 10% | 44.8 | 33.8 | 172.333 | 178.388 | 173.319 | 273.350 |
| 3 / 30% | 40.9 | 42.1 | 168.803 | 222.011 | 163.375 | 280.200 |

For three red changes, isolation is the per-rotation median, then averaged across
rotations; it is not the time to isolate the final culprit. Full admission catches
most reds before queue entry, but a stale admission may be cancelled before its
red verdict and the replacement then isolates it in the queue. Existing stale-run
cancellation is preserved.

To replay this matrix, build core and run the sensitivity test once for each
`FORGE_ADMISSION_REPLAY_WIDTH` of 3, 5 and 10. Each process compares both policies for
one clean wave and all ten rotations at each red rate. The test reports mean billed
CI minutes and green-survivor latency, and verifies the cheaper mode and the
outcome of every submitted change. These synthetic runs use the checked-in
timelines and do not qualify a change against the live regression ladder.

Linear interpolation between the measured 10% and 30% points puts the CI-cost
crossovers near 15.6%, 27.9% and 28.0% respectively. These are sensitivity estimates
for these timelines, not universal thresholds: survivor-latency crossovers are
different, and runner capacity, duration, overlap and queue depth change the cost.
The historical dogfood prior in `src/hosted-landing-admission.ts` is about 30% first
checks failing. Self-metrics now report the measured value
(`totals.firstChecks`, [operations](operations.md#first-submission-check-red-rate)): red first checks over
decided first checks per window, with flaky, cohort-failed, cancelled, runner-unavailable,
pending and unresolved checks counted apart. Zero test failures in the three observed cells explain
why their expensive red-isolation path supplies no measured benefit.

Prefer a recommendation derived from the project's compatible measured checks,
red submissions and queue depth, comparing expected CI minutes and survivor
latency under both designs. Do not automatically change an explicit project
setting or install one of these interpolated constants as policy. Existing cohort
sizing already adapts from retained outcome history; this draft adds no history
query, counter, poller or automatic policy change.

### Limits and I/O

This is a replay of successful-submission arrival/service shapes, not the complete
agent experiment. Withdrawn/conflicted revisions, provider setup and post-conflict
agent edits are not reconstructed. Keeping an additive observed-minus-A calibration offset unchanged
and adding only B-minus-A replay deltas projects 36, 42 and 38 CI minutes from
observed totals 53, 58 and 53. The offsets are not attributed individual jobs. Those estimates do not establish the exit benchmark
bar or eliminate its real cancelled-job costs. The observed rounded job ledgers
are retained separately in the synthetic fixture.

The default selector itself adds zero calls, reads or writes; it bypasses the
existing admission path. Whole-wave transaction counts fall 628 to 506, 571 to 493
and 542 to 499; writes fall 4508 to 3585, 3983 to 3458 and 3739 to 3476. Reads fall
13384 to 11694 and 11384 to 10765, but rise **10521 to 10717** at width three.
Thus this draft has not met a whole-workload no-read-regression bar. Byte totals,
live billed usage, source placement, provider capacity and exact earlier-revision
replay remain qualification work; no live cost improvement is claimed. Landing
work settles without idle calls; a deferred cadence audit retains its existing
one-shot wake.

Build-failing `admissionQueueOnly*` budgets retain the measured clean-wave ceilings.
Full-admission incident tests explicitly select `"full"`, keeping their existing
assertions, retries, stale cancellation, overtaking and exact-proof requirements.
