# GitHub Actions checks

Checks run on the project's configured runner. For GitHub Actions, the owner picks a runner
repository once with `configure-runner`. Convex then dispatches each check through the Forge
GitHub App ([Convex dispatch with the GitHub App](#convex-dispatch-with-the-github-app)):

```sh
nforge agent ROOT configure-runner '{"provider":"github-actions","repository":"OWNER/NAME","runsOn":"ubuntu-latest"}'
```

Forge's own project uses free `ubuntu-latest` runners; it stopped using Blacksmith on
2026-10-25. Other CI can run the same check plan: `githubActionsWorkflow()` exports the workflow
for bring-your-own CI, and the [BYOCI parity test](../forge-only-rules.md#byoci-parity) keeps
the landing fast paths working there.

`runsOn` defaults to `ubuntu-latest`. Omitted `shards` uses the same duration-balanced
provider-neutral check plan; a positive shard count explicitly partitions all selected test files.
Every standard check runs one independent static job. Docs-only candidates run
only documentation checks in that job, with no test shards. Code candidates use
the same scoped selection as local checks; explicit full scope and
post-accept main audits retain full verification. Test matrices use fail-fast
disabled. Both call `node scripts/forge-check.mjs`; the Actions plan
selects static verification or `scripts/test-files.mjs` with the pinned selection and
worker environment. Node is 24.22.1. Each job installs with `npm ci --ignore-scripts`.
Retained pre-upgrade Node 24.19.0 executions remain observable and cancellable,
with their original runtime identity. They cannot dispatch new work or retry shards;
an unstarted old-runtime plan needs a new check on the fixed runtime.
Other configured commands run once in the static job and receive the changed-paths file; a
check that declares `selection.shards` also runs its own test shards, and `selection.scope` lets
it scope ([check command scope](../workflows.md#check-command-scope)). A scoped run gets the package
graph's affected packages (`FORGE_CHECK_PACKAGES`) and, when they have tests, a runner for their
per-ecosystem commands (`FORGE_CHECK_PACKAGES_RUN`, one line in the repository's CI script); an
Intent without a contract gets a scoped first check when the graph selects a minority of packages. Candidate sources must
include the Actions-aware standard check script to use Forge's test selection.

**Checks that do not apply skip, never wait.** A project has one configured landing
check and no per-check path filters, so no required check can sit pending because a
change is outside its paths. The planner decides what applies from the changed-path
list it already holds: test shards a change does not reach are not dispatched, and the
landing waits only for the jobs that apply. A docs-only change under the standard check
runs the test files that read a changed document (`scripts/docs-readers.mjs`, the selector local
preflight uses) in ordinary test shards, still under the docs scope: the documents checks run, no
full re-check, and the main-audit skip holds. When no test applies (a docs-only change that no
test reads) the plan has the static job alone, and the run, its acceptance
receipt (`check.skipped`) and the `landings` row (`checkSkipped`) record
`{"part":"tests","status":"not-affected","reason":…}` with the planner's reason. A change
that reaches tests selects them and waits for every shard; its receipt has no `skipped`.
Bring-your-own commands, and machine runners, which plan the whole configured check, never
skip: Forge runs the command on every change. A command whose check declares
`selection.scope` reads the changed paths and may scope itself under a reduced-evidence gate.

A standard check never passes without running a test for a change that touches code. Every
planner (local, owner, hosted gate planning) applies `scripts/selection-guard.mjs`: a non-docs selection
with zero tests runs the fixed smoke set instead (every test file when the source has no smoke file),
and a docs scope that covers a non-Markdown path becomes a full selection. Both record
`Zero-selection guard:` in the selection reason. A source with no test file at all fails with
`ZERO_SELECTION`. The runners refuse the same state at execution: an Actions plan with no test shard for
code, an empty shard, or a pinned selection that names no test file fails with `ZERO_SELECTION`.
Only docs scope (when no test reads the changed documents) and explicit partial evidence (which never lands) run without test files; arbitrary
commands have no selection.

### What Actions evidence attests

Source descriptor windows negotiate server-verified recipe leaf closures. The
same current-access call signs those leaves without reading their metadata rows.
The job's disk reader verifies each unique leaf and streams it into a separately
hash-verified logical object. Signed replies continue through the existing bounded
prefix protocol; older servers and recipes retain their tree traversal. State-bound
catalog reads can also build that projection for imported recipes within the current
request: recipe and tree metadata are hash/size verified in shared frontiers, then
leaf descriptors are resolved in sorted pages. One State proof covers the window;
current access and the exact selected State are rechecked after preparation.
Preparation is opt-in through the `preparation` request flag under the existing
`source.closures` capability. A prepared reply can carry exact verified recipe
descendants even when the recipe exceeds the 100-leaf inline closure bound.
The connection reuses these descriptors for ordinary tree traversal, including
packed ranges. Older clients omit the flag; older servers ignore it and retain
ordinary readers. Nothing is persisted. The existing 4 MiB reply bound applies;
preparation exceeding 8 MiB of metadata keeps the ordinary recipe reader. Raw file
descriptors still read their object rows or catalog pages from Convex.

Catalog fallback keeps three 400-object download pages progressing across signed
metadata prefixes, with up to 16 raw reads per page. A short large-file prefix
starts downloading while the next prefix is described; it does not drain all
workers between metadata calls. Complete signed pack runs are prepared before
pages split, preserving one ranged GET per run. Object aliases share verified
bytes, and a failed metadata or download request drains active writers before
cache cleanup. Recipes without an inline closure also prefetch consecutive raw leaves into the
verified disk cache: at most 16 leaves or 4 MiB per logical object, then ordered
reconstruction verifies the whole-file hash. Concurrent files share in-flight
leaf reads. The serial source-worker default, source State and publication rules
are unchanged. `tests/state-source-preparation.test.mjs` guards two HTTP rounds
and seven internal mutations for a cold check preparation window with 1, 3 or 24
large imported recipes, 24/24/6 MiB packed files and recipes beyond the inline
closure bound, plus exact reconstruction, corruption and current access.
Larger descriptor inventories continue through the existing bounded page protocol.

A hosted check job runs the Candidate's own code (its tests and scripts) on the same runner as
Forge's supervisor. So Forge takes the verdict, the outputs later steps read and every cache entry
only from places that code cannot write (Issue 432164bf). For every CI adapter:

- **A pass needs the provider's own success.** Supervisor results say which tests ran, failed or
  flaked, and a failing result fails the check at once. When every shard has reported passing, the run
  waits for the CI provider's own record that the run succeeded: on GitHub, the signed
  `workflow_run` completed event Forge already receives (no extra call), which usually arrives a few
  seconds after the last result. GitHub never redelivers a lost event, so the pass also schedules one
  read of GitHub's job list for the run 10 s after the last shard result (again at 30 s if a job is
  still running); the event cancels it when it arrives first. Every job except the optional
  source-pack job (`Refresh optional Forge source pack`, continue-on-error, so the run's conclusion
  never depends on it but still waits for it) must have completed as success or skipped. If both
  jobs reads find a job still running, one read of the run follows 5 minutes after the last result,
  then the job list at 30 minutes. At that read, all verified signed shards passing
  plus a complete provider list with every job's steps completed without failure
  settles the check as passed even if GitHub's status lags; the check records
  `provider-delayed` evidence. Otherwise fixed reads at +1 h, +2 h and +4 h follow,
  then the existing 12-hour watchdog. A failure seen at any read fails the check;
  cancelled and unavailable results retain their ordinary platform handling.
  [Provider outage recovery](../pre-queue-checks.md#provider-outage-recovery) records
  the lead's decision, finite read budget and the CI-neutral adapter contract.
  The ordinary lost event still costs about 10 s and one action and one mutation,
  and a pass never waits for the optional pack job. The
  plan call still says when it starts the pack job (capability `checks.packVerdict`; an older server
  never sees the field).
  A new adapter supplies the same record from a channel the job cannot write: a signed provider event
  or a provider API read with the adapter's own credential.
- **Outputs come from the planning step only.** It reads the Candidate as data and runs none of its
  code; the check runs in a separate later step with no `id`, nothing after it in its job, and no
  secret or workflow token in its environment. Plan and run never share a step.
- **Caches are saved before the check step, never after it.** Forge's own control caches come from
  the pinned control checkout; a declared dependency cache is seeded by a download that runs no
  repository code ([Toolchains and dependency cache](#toolchains-and-dependency-cache)). Only the
  default branch (and, on the App/OIDC path, a main audit) saves.
- **Candidate code runs as its own user on Linux.** Where the runner user has passwordless `sudo`
  (GitHub-hosted Ubuntu), each Candidate child runs as the system user `forge-check` in a private
  mount namespace (`src/candidate-user.ts`, `scripts/candidate-sandbox.mjs`): the runner's home is
  replaced by an empty folder, and only the check's working folders, its declared cache folders and
  the toolchains under the home come back (the toolchains read-only, from their install roots, so a
  toolchain nested in another one is bound once). Folders a declared toolchain writes into its own
  install while it runs come as private copies: `ruby` gets its gem folder (`lib/ruby/gems`) and
  `bin`, so `bundle install` and `gem install` work unchanged; `flutter` gets its SDK's `bin/cache`
  and `packages/flutter_tools` (the tool's first `pub get` writes its `.dart_tool` there); `elixir` gets the runner's `~/.mix` (Hex and rebar3 from `setup-beam`). The sandbox copies each
  folder once per job into `/var/lib/forge-check/state` and mounts the copy, owned by `forge-check`,
  at the original path in the Candidate's view only; the install itself is never made writable or
  changed. Only installs in the runner's tool cache, job temp folder or home count, never a system
  folder. A toolchain that is a git checkout (the Flutter SDK) is marked `safe.directory` in the
  Candidate's own home, so git reads it although the runner owns it. A Candidate command that fails
  on a path it cannot write or see gets a line naming the path (relative to `$HOME`,
  `$RUNNER_TEMP` or `$RUNNER_TOOL_CACHE`) and the user. It has no groups, no
  capabilities and cannot gain privileges, so it cannot read the runner's credentials, the
  supervisor's environment or the step-command files, and cannot use `sudo`. Creating the user takes
  about 20 ms, each launch about 0.2 s. Elsewhere (macOS, Windows, a self-hosted runner without
  passwordless `sudo` or the util-linux tools, a failed launch self-test, or
  `FORGE_CANDIDATE_USER=off`) the check **fails setup** before any source or project code runs, with
  `CANDIDATE_ISOLATION_UNAVAILABLE` and the reason. The project owner can allow such a runner with
  `configure-runner '{"provider":"github-actions","isolation":"shared"}'` (owner-only; shown in the
  `configure-runner` output and as `actions.isolation` in `check-settings`; kept while the repository
  stays the same, `"isolation":"user"` withdraws it). Its checks then run project code as the runner
  user and the job log says why: `Candidate user: project code runs as the runner user (…; the
  owner's runner configuration allows shared mode)`. Each shard result says which mode it ran in;
  the run keeps `actions.isolation` (`shared` if any shard was) and the landing receipt shows it as
  `check.isolation`. The supervisor also removes the job's runner tokens from its own environment
  before it starts project code, as defence in depth. The optional `actions.setup` program is the
  owner's own configuration and still runs as the runner user.
- **Slow caches and registries fail fast.** Every cache restore in a check workflow treats a download
  stalled for 1 minute as a miss (`SEGMENT_DOWNLOAD_TIMEOUT_MINS`), so the job installs normally, and
  every `npm ci` has a 5-minute timeout, so a stalled registry fails the job and Forge retries the
  check instead of holding a landing batch (friction d99fcf3a).

`scripts/check-candidate-steps.mjs` enforces the workflow rules for every workflow in the repository
and every generated one (`tests/action-pins.test.mjs`).

What a pass therefore attests: the pinned plan ran on the provider, every planned shard reported its
tests from the supervisor, and the provider confirmed success (or, at +30 minutes, confirmed every job step completed without failure while its run status lagged). On a runner the owner
allowed to run without a Candidate user (`isolation:"shared"` above; the receipt's
`check.isolation` is `shared`), project code shares the runner user's access during its own step, so
treat such a pass as no stronger than the check's own tests.

### Check contract

A hosted check runs the control plane's executor (the pinned main checkout's
`scripts/hosted-actions-execute.mjs` and `github-actions-check.mjs`) against the
Candidate's own check scripts (`scripts/verify.mjs`, `scripts/test-files.mjs`, package
scripts). A Candidate that changes both could therefore be misread by the older executor, and
fail late with a confusing test failure (frictions 80de9cc8 and a801adba). Forge does not run the
Candidate's executor in the trusted position: the control plane keeps deciding the plan pin,
environment, secrets, receipts and which tests count, so a Candidate cannot weaken its own check.
Instead the two sides share a small versioned contract in `scripts/check-contract.mjs`, which
is plain Node and CI-neutral:

- The executor **provides** `CHECK_CONTRACT_PROVIDED` through `FORGE_CHECK_CONTRACT` for every
  child it starts. Any other CI adapter sets the same variable (an Actions plan without it means an
  executor older than the contract, which provides 0).
- The Candidate's scripts **require** `CHECK_CONTRACT_REQUIRED`. The executor reads that line of the
  Candidate's file as data (never executing it) before `npm ci`, build or tests, and `verify.mjs`
  checks the same on start. A Candidate that requires more than the executor provides fails within
  seconds with `CHECK_CONTRACT_MISMATCH` and the next step, with no test run.
- A direct local run has no executor and is accepted.
- `tests/check-contract.test.mjs` fails the build when the executor's commands or environment change
  without raising `CHECK_CONTRACT_PROVIDED` and the recorded surface digest, and when a tree
  requires more than it provides.

Changing what the executor gives check scripts takes two Lanes: Lane A changes the executor and
raises `PROVIDED` (check scripts must not use it yet, so its own check passes under the older
executor); once Lane A is on main, Lane B changes the scripts that use it and raises `REQUIRED`.
The contract only grows: to remove something, first stop requiring it, then remove it. Contract 2
(2026-11-06) added the [shard pool](#shard-pool) parts: the executor may run a shard as its kept front
and then single pool units (tests only), each a plain `scripts/test-files.mjs FILES...` call, so check
scripts need nothing new. Contract 3 (2026-11-08) passes the supervisor's private
`FORGE_JUNIT_DIR` through to the check ([JUnit reports](#junit-xml-reports-from-any-check)).
Contract 4 stopped giving configured (non-Forge) commands Forge's suite settings (worker counts,
Git timeout, Node heap cap); Forge's own check scripts see no change. Planrecipe fields written by the planner and read by the executor belong to the same surface. Runtime
pins (Node) are provided by the control workflow: raise the pin through the executor Lane first.

For this repository, code verification runs document validation and the installed
package smoke in the shared `scripts/verify.mjs` entry point. Hosted landing checks
and the public mirror therefore exercise the same
static and package contracts. Docs-only checks retain their documentation path.
Package smoke runs once in the static job, after its other verification completes,
because it rebuilds `dist` before installing the archive in a disposable directory.
A packaging failure fails the exact-Candidate check before acceptance; the mirror
has no separate package step that could diverge from that gate.

The owner plans remote test selection with its installed selector, reading the
pinned Candidate as data. It does not execute the Candidate's selector to plan a
run. The merge-queue benchmark instead runs the selector shipped in its checked
tree. Comparing their selections therefore requires the same selector version,
as well as the same changed paths and source bytes. Updating repository selector
code alone does not update an already installed owner runtime. Retained
`changes.json`, `selection.json` and the digest-bound plan distinguish comparison
paths from conservative selection; lockfile graph fallbacks name
`package-lock.json` in the recorded reason.

Landing checks dispatch through a detached check controller, so owner driver
work cannot starve GitHub polling. Read-only API failures retry within the existing
observation window. Progress includes the HTTP status when available; retained
`apiFailures` distinguish transport failures without an HTTP response from HTTP
errors, without retaining raw stderr or response headers.

New plans use the owner's `.forge/work/test-timings.json` history for both explicit
and automatic shard counts. Complete per-file runner reports update a local EWMA
(30% newest observation) when a passed or failed check receipt is reconciled;
cancelled and interrupted checks do not train it. The store prunes files absent
from the checked snapshot and retains at most 4,096 files and 1 MiB. A bounded run
ledger and a durable per-check marker make completion reconciliation idempotent.
No timing data is written to Convex or fetched over the network.

The shared partitioner assigns longest files first, modelling the runner's two
concurrent whole-file workers. Unknown files use historical p75; missing or corrupt
history preserves sorted round-robin. Ties use portable path order and shard index.
For receipt compatibility, membership remains in the digest-bound `modal-plan.json` and generated Actions
recipe; an existing run always reuses that plan after timing history changes.
`scripts/public-verify.mjs` and the landing benchmark use the same partitioner.
They read the local history path above, or an explicitly supplied
`FORGE_TEST_TIMINGS_HISTORY` file, and cover every selected test with either strategy.

The owner exports the immutable State and adds a generated
workflow and recipe to that export only. The exported commit is pushed only to
`refs/heads/forge-check/<runId>`, using a compare-and-swap creation. A changed or
colliding ref is never overwritten. Before pushing, Forge saves an ambiguous intent;
only a successful reply or observation of the exact commit establishes publication.
A transport error (HTTP 5xx, RPC/EOF, timeout or lost reply) retains that intent for
bounded discovery. If the exact commit becomes visible, Forge adopts it without
another push. After at least sixty seconds and five empty Git observations, Forge
can push the **identical commit to the same run-owned ref** again, using the same
expected-absent lease. Empty listings do not prove non-execution; the lease makes
the repeated ref creation safe even if the original push arrives later. A different
commit is never overwritten, including a race after the final observation.

Push attempts are capped at five across restarts, including definitively rejected
transient attempts. Each ambiguous attempt retains its discovery start time and
observation count; resuming a controller continues that window rather than
restarting it. Historical journals use retained branch-observation time and count
an unrecorded original attempt toward the bound. Exhaustion ends with terminal
infrastructure error `GITHUB_ACTIONS_PUSH_EXHAUSTED`, without a source verdict or
another pending discovery loop. Source and diagnostics remain available for a new
check after the underlying access or transport problem is resolved.

Explicit Git receive-pack rejections retain a `ref-rejected` class. Authentication,
permission and missing-repository rejections retain `access-rejected`. Workflow
OAuth scope, protected-ref/repository rules and invalid ref names have specific
classes and actionable `GITHUB_ACTIONS_PUSH_REJECTED` errors. They end discovery
immediately. Classification uses the original stderr before diagnostic truncation;
only redacted, bounded Git diagnostics are retained in attempts and progress.
Known-rejected transient creations use exponential backoff and jitter (up to
45 seconds in total), checking the exact ref before every retry. Cleanup and the
GitHub mirror retain their existing retry helper and exact lease/ancestry checks.
The source State, Candidate, definition, runtime,
selection and shard membership stay digest-bound. The journal also retains the
target repository and runner label so policy changes cannot redirect adoption.
Git-backed checks and declared environment/credential inputs keep existing local
routing. The source export rules for local credential configuration apply.
No owner token is sent in the plan or check environment; checkout does not retain
its credential, and raw gh/git error output is never logged. Failed Actions API calls retain only
the HTTP status and GitHub’s structured `message` and `documentation_url` fields
in the journal and progress log, with account identifiers and credentials redacted.
This includes transient reads and optional log/timing failures.

Before dispatch, the controller waits for GitHub's branch API to report the pushed
commit (up to sixty seconds of backoff). It records dispatch intent before sending
it and finds the execution by runId and commit. Dispatch HTTP 404/422 responses
are definitive rejections: the journal records the status, clears dispatch intent,
and retries up to five attempts with seventy-five seconds of total backoff.
Exhaustion records a failed check with `GITHUB_ACTIONS_DISPATCH_REJECTED` and its
HTTP status, rather than an interrupted check.

Ambiguous dispatch responses, including HTTP 400, transport failure, HTTP 5xx and
unknown status, preserve the original POST outcome. HTTP 400 uses a two-minute
lookup window (thirteen reads, ten seconds apart); other unknown or acknowledged
responses use twelve reads over at most five and a half minutes. The journal
retains the start and observation count across controller restarts. An exact
matching execution is adopted; duplicate matches remain an evidence error.
Exhaustion records terminal infrastructure outcome
`GITHUB_ACTIONS_DISCOVERY_EXHAUSTED`, without a source verdict. Legacy exhausted
journals get one final lookup. The run is no longer automatically reopened.
Empty listings never license another ambiguous or accepted POST: GitHub has no
idempotency key. If only the push reply was lost, observing its exact commit
permits the original `workflow_dispatch` once; a definitively rejected dispatch
can still retry as described above. The ref and original identities remain
available to inspect a late execution before starting a new check.

This is an evidence policy, not an exactly-once provider guarantee: Forge cannot
prove that an ambiguous POST or push did not execute. Only a retained definitive
rejection permits another dispatch. Push creation can also be repeated after its
bounded discovery window because its identical SHA and create-only lease preserve
the same ref effect.
Dispatch attempts retain sanitized response fields and `not-found`/`unprocessable`
rejection classes; branch evidence retains the observed commit or absence and
whether it came from Git or REST. Push attempts retain their timestamp, outcome, definitive
rejection class and redacted diagnostic without raw transport text. The journal retains discovery windows
and original attempts after adoption; they are not rewritten as successful replies.

When dispatch discovery remains unresolved or push observation is interrupted
before its persisted window completes, the legacy check-run status is `interrupted` with
structured error code `GITHUB_ACTIONS_PENDING_INFRA`. Finish and submission receipts
report `pending-infra`, `terminal:false`, `complete:false`, and retain the original
source/attempt identity. This is incomplete infrastructure evidence, not a source
failure. The landing batch stays resumable without splitting or blaming a Lane.
The owner driver or a replay of the same operation continues discovery. Retrying
the original `run-check` or interrupted `finish` reopens only unresolved provider
operations, including lost push replies, preserving source, run ID and landing-batch
pins. The previous interrupted receipt is retained beside `result.json` with an
`interrupted-<id>` suffix. Explicit cancellation does not authorize a replacement.
Unknown rerun outcomes are never repeated; shard replacement remains governed by
the existing adapter.
Read-only API calls back off up to sixty seconds between attempts; job polling
uses ten seconds. A GitHub rate-limit rejection never interrupts a check: the
controller waits until the reported `x-ratelimit-reset` (at least a minute, at most
an hour per wait), says so in progress, and continues. Because GitHub performed
nothing, a rate-limited dispatch, rerun or cancel is sent again after the wait; any
other rerun or cancel failure is still never repeated. Cancellation is observed after a
wait ends. A run reported completed while its job list still shows unfinished or
missing jobs is polled again for up to five minutes. If a job status remains stuck,
the controller fetches and retains its log. Complete `__FORGE_TESTS__` markers for
every selected file, or a complete Node test summary with consistent counts and
no failures or cancellations, can corroborate a successful run conclusion. Only
that combination recovers the stuck job as passing. The journal records the log
evidence source, counts and run conclusion; progress and the result receipt explain
that GitHub's job status was stuck and which evidence was used. Observed job
statuses and timestamps remain unchanged. Missing jobs, unavailable/truncated logs
and incomplete evidence remain interrupted, even when the run is green. Failure
evidence in the log or a failed run conclusion stays failed. Each shard status
transition appears in numbered progress.
Compact job evidence, including failure excerpts and machine test reports, uses `shards/<index>.evidence` and
`shards/static.log` layout, with attempt suffixes for retries. GitHub exposes job
logs after completion; this backend does not claim live stdout streaming.

Failed test jobs stay failed. Confirmed unfinished jobs (runner loss, timeout or
startup failure) can retry once individually; successful siblings are retained.
The rerun intent and original job ID are durable before the replacement request.
A lost rerun reply or a replacement missing from a later job-list window stays
`pending-infra`; the submission driver reopens the same run operation and adopts
the replacement job without another rerun. Original and replacement compact test reports and
cost observations remain separate. The run-owned ref stays retained while that
replacement is unresolved. Recovery uses the original source, definition, shard
selection, repository and runner label even if current runner settings change;
new settings apply to new operations.
Unrecoverable incomplete runs are interrupted. A live controller requests provider
cancellation and observes the retained execution. If the local controller is dead,
the cancel command or worker recovery promptly writes a terminal `cancelled`
receipt and releases the submission. It retains provider identities and explicitly
reports that provider cancellation is unconfirmed; it does not claim the remote
execution stopped or delete its ref. An unresolved dispatch can also complete
local cancellation without waiting through discovery.
When a newer Candidate supersedes the checked Candidate in the same Intent and
Lane-input family, the controller cancels only the retained older execution.
Each new run retains the latest family Candidate when requested, so a fresh explicit
check of an older Candidate remains possible. Historical runs without that cursor
require a replacement timestamp strictly after their request to prove supersession.
The run keeps status `cancelled` with `cancellation.reason: "superseded"` and the
replacement Candidate ID; its receipt, execution ID and logs remain available.
Cancellation provenance optionally records the first request's timestamp, actor,
reason and details. Command cancellation accepts optional actor/tool attribution
and a reason. Observed controller signals retain their signal name; an external
sender is unknown. Historical records without these fields remain readable.
Queue a new run operation to check a cancelled Candidate again.

A failed job whose log has the runner's `exit code 137`, a SIGKILL/out-of-memory
error annotation or a kernel `Killed process` line gets a likely-OOM diagnosis
(exit 137); test names in passing logs do not count. This is not a
provider-confirmed memory measurement. The timing API remains in `backend.billableMinutes` for compatibility, but can
report zero for Blacksmith. `backend.cost` estimates each retained job attempt
from its start/end timestamps, rounds up to whole minutes separately and applies
the pinned per-label rate. Unknown timestamps or unpriced custom labels retain
unknown quantities, not zero. Blacksmith Ubuntu x64 defaults to vCPU/2 ×
$0.004/job-minute, before its shared free allowance. Override any label through
`checks.ratesUsdPerMinute`; see [cost basis and summaries](../operations.md#runner-selection). Selected output files are currently marked unavailable;
remote process resource metrics are unavailable.

The result and compact test evidence are recorded before deleting a terminal run’s ref,
including failed and cancelled executions. Unresolved dispatches and reruns keep
their refs. Source, results, failure summaries and provider log links remain retained; full logs stay with GitHub Actions. Cleanup never deletes
a ref that no longer names this run’s commit; it uses the same exact Git lease
as ref creation. A cleanup error preserves the result and reports reconciliation
in progress. To restore a removed temporary branch, push the journal’s retained
`commit` from the retained plan’s `source` repository to `refs/heads/forge-check/<runId>`
using an empty-ref lease. No local fallback is inferred from an ambiguous outcome.

After an observed result, a best-effort sweep visits up to twenty local run records
and reconciles at most five eligible refs. Its disposable cursor rotates through
retained history on subsequent checks. Only locally terminal operations with a
matching retained plan, journal and result qualify. An execution must also still
match the run ID, commit and run-name and be terminal on GitHub. Definitively
rejected dispatches with no ambiguous recovery can be cleaned without an execution.
Live or reopened local operations, unknown dispatch outcomes, unavailable evidence,
other repositories and changed remote refs are preserved. The sweep uses retained
local ownership records rather than assuming every `forge-check/*` branch is ours.

Offline tests inject fake gh/API and Git transports; they never contact GitHub:

```sh
node --import ./tests/check-runtime.mjs --test tests/github-actions-backend.test.mjs
```

The lead can run one opt-in tiny synthetic smoke against a throwaway repository
with the dispatch workflow already registered (substitute `OWNER/THROWAWAY`):

```sh
FORGE_GITHUB_ACTIONS_SMOKE_REPO=OWNER/THROWAWAY FORGE_GITHUB_ACTIONS_SMOKE_RUNS_ON=blacksmith-2vcpu-ubuntu-2404 node --test --test-name-pattern='one real tiny Actions smoke' tests/github-actions-backend.test.mjs
```

`FORGE_GITHUB_ACTIONS_SMOKE_RUNS_ON` selects the smoke policy runner label and defaults to `ubuntu-latest`. Register the generated workflow with the same label on the target default branch first.

Run it without `tests/check-runtime.mjs`: that runtime isolates configuration
directories, so `gh` would see no login. On 2026-10-18 this smoke passed against a
private repository in about 29 s end to end (one static job).

This sends only synthetic source, creates a run-owned ref, dispatches one tiny job
and removes the ref after recording success. It does not land Forge source.

### Definition trial

A hosted check always runs main's check definition: the pinned control checkout's workflow,
planner and executor. So a Lane that changes that definition is judged by main's version,
never its own, and its own version never ran before it lands (Item 687d1eda: a landing that made
landing checks run browser tests landed on main's selection, and the tests it enabled were already
red). Forge handles this the way a pull request that edits a workflow runs its own copy, without
letting the edit judge itself:

- **The rule.** A Lane that changes the check definition is checked by main's full definition, plus
  one trial of its own definition beside it. The trial runs in addition to main's check, never
  instead of it.
- **What counts as the definition.** For Forge's standard check (`node scripts/forge-check.mjs`):
  its entry and inputs (`STANDARD_CHECK_INPUTS`), its selection inputs
  (`STANDARD_SELECTION_INPUTS`, both in `src/standard-check.ts`), the check contract and Forge's
  Actions workflow and local actions (`.github/workflows/forge-check.yml`, `.github/actions/`). The
  same coverage paths name a culprit landing (`coverageChangePaths` in `src/first-check-risk.ts`).
  Every module `scripts/test-impact.mjs` imports, directly or through each other (selection-guard,
  core-queue-paths, script-impact, docs-readers, the import graph), also counts for the trial: they
  decide which tests run. The planner reads that list from the Candidate's own imports as text, and
  only when the Lane changed a script, so no second list is kept by hand.
  Other `.github/` files, a main audit and a failed-file probe get no trial.
- **Main's side.** The planner, reading paths only, widens such a Lane to main's full selection
  (with every browser test) and pins `selection.trial` (the definition paths) in the plan
  (`src/check-definition-trial.ts`). It never narrows: a gate that already chose full keeps its
  selection. A Lane whose own selector claims nothing runs, or that deletes a check, is still judged by
  main's full selection.
- **The trial.** After its own command passes, the browser job (else the static job) runs the
  Candidate's `scripts/forge-check.mjs` once more with `FORGE_CHECK_TRIAL=1`, as the same Candidate
  user. That entry loads this tree's own executor, computes this tree's own full selection, and runs,
  with its own executor, every test it selects that main's plan did not run (none, usually; a new
  kind of check test, or browser tests main left out). The trial's output goes to the job log only:
  its test reports and JUnit files are never check evidence. Its failure fails the job; its pass
  decides nothing.
- **Browser tests.** Main's full selection has a browser job whenever main's rules see a browser
  test, and the trial runs there, so browser tests the Lane's own rules add run before it lands.
  When main's plan has no browser job (main's rules see none), the trial runs in the static job,
  which has no browser: it names the browser tests its rules found and does not run them, rather
  than failing on the missing browser. Main's check runs them once this definition is main's; the
  main audit names this change as the culprit only through the paths noted at the end of this section. The Lane's own rules decide
  what counts as a browser test here, like everything else in the trial.
- **It is not dropped by accident.** The supervisor reads `export const CHECK_DEFINITION_TRIAL = 1;`
  from the Candidate's entry as data before any Candidate code runs. An entry without it fails the
  trial job. This catches a definition change that loses the trial; it is not a guard against a
  hostile Lane, which could keep the line and make its trial run nothing. That is harmless: the
  trial only adds work, main's full check still judges the Lane, and `scripts/forge-check.mjs` is a
  protected path that needs a person's approval to land.
- **Cost.** A Lane that changes no definition path pins nothing new and runs no trial: the same
  recipe, Convex calls and runner minutes as before. A definition Lane pays main's full check (most
  already ran full) plus a few seconds of trial selection, more only when the trial finds tests to
  run. No Convex call is added.

What the trial does not cover: the Candidate's own workflow YAML and its TypeScript planner and
supervisor do not run until they are on main's control checkout (running them before landing would
need a pushed Candidate ref with the runner repository's secrets). Their unit tests run in main's
full check, and the main audit after landing names the definition landing as the culprit if a newly
run test fails ([culprit attribution](../pre-queue-checks.md)). Tests that main's plan already
ran are not rerun under the Candidate's executor. When there is nothing extra to run, the Candidate's executor is only
loaded. Main's culprit naming still uses only the check's entry paths and
`STANDARD_SELECTION_INPUTS`, not the modules `scripts/test-impact.mjs` imports.

### JUnit XML reports from any check

Forge's own check prints `__FORGE_TESTS__` markers. Any other check command can instead
write JUnit XML, which vitest, jest-junit, pytest, Go (gotestsum or go-junit-report),
Maven Surefire and Gradle all produce. The fixed runner (Actions jobs and the Mac runner)
gives every check a fresh private directory outside the checkout in `FORGE_JUNIT_DIR`;
write one or more `*.xml` files there, for example:

```json
{"name":"verify","executable":"sh","args":["-c","pnpm vitest run --reporter=default --reporter=junit --outputFile.junit=\"$FORGE_JUNIT_DIR/vitest.xml\""]}
```

(`pytest --junitxml="$FORGE_JUNIT_DIR/pytest.xml"`, or point jest-junit's
`JEST_JUNIT_OUTPUT_DIR` at it.) After the command exits the runner reads those files as
data, never running repository code, into the same per-file records as the markers:
failed files with their first error, durations for timing history, and
flakes the tool reported as a failed attempt that passed on rerun (`flakyFailure`,
`rerunFailure`). The exit code still decides pass or fail. The test file is the case's or
suite's `file` attribute, else a path-like classname or suite name, else a dotted pytest
module (`tests.test_api.TestUser` → `tests/test_api.py`), else the classname. Paths inside the
checkout become relative; other absolute paths keep only their name. Markers win for a file
both report. Limits: 32 report files, 8 MiB each and 16 MiB together, 5000 test files; one
unclosed token over 1 MiB, a DOCTYPE, mismatched elements, a link or an empty report makes
that file ignored with a one-line log note, so the run keeps its previous evidence (exit code
and log). Reading is a stream with no extra Convex call; a green run's records ride in the
existing result call. The directory is removed after the job.

A report (JUnit or marker) whose file is not a storable test path — a source file such as
`lib/widget.py`, a path outside the checkout, or a report with no name at all (`junit`) — is
not retained, so it can never make the shard's whole result invalid. The log names up to three
such files; if one of them failed, the shard fails even when the command exited 0. If Forge
still refuses a shard result as invalid (for example while the runner and server are on
different versions), the job resends it once with only its exit status and log, failing
closed with that cause in the failure summary. It is never reported as `runner-unavailable`,
so the check is not re-run three times on the same failure.

An Intent contract union that rides on the check is covered by the same reports: a union
test file that a complete JUnit report (or `__FORGE_TESTS__` line) names was run by the
configured command and is not run again, so a Gradle, Maven or cargo start-up is not paid
twice; a failed report fails the union. Reporters that name no file are read by what they do
name: a Go package (gotestsum, go-junit-report) covers every `_test.go` file in that package
(found through the nearest `go.mod`), a JVM class (Surefire, Gradle: `com.acme.LedgerTest`) covers
the file that declares it (nested classes count), and a cargo-nextest binary (`crate::binary`)
covers the crate's `tests/binary.rs`. An entry that cannot be attributed with certainty covers
nothing, so the file runs again. Only the files no report names run afterwards with the project's
test runner, or, when the project declares none and its package graph is readable, with the owning
package's own command (`go test ./pkg`, `./gradlew :mod:test`, `cargo test -p crate`); with neither,
the check fails with `SEMANTIC_TESTS_UNAVAILABLE` and the reason rather than guess. The union wrapper carries the report parser itself, so an exported
Actions script needs no Forge install, and it reads the same bounded `FORGE_JUNIT_DIR`.
A stack frame in a failure excerpt also names a changed JVM source by its qualified class
(`at com.acme.billing.Invoice.total(...)` explains a changed
`src/main/java/com/acme/billing/Invoice.java`; Kotlin, Scala and Groovy likewise), whole
names only (`Invoice` does not match `InvoiceFormatter`).

Failing files then name likely members of a failed batch by file name in any folder: a test
`x.test.ts`, `x.spec.js`, `test_x.py`, `x_test.go`, `XTest.java` or `x_spec.rb` (or a dotted
test class) explains a member that changed a source `x.*` anywhere, and a Go package report
explains a changed source in that package's directory. Generic or short names (`index`,
`main`, under five characters) name no one. A named member checks alone instead of the whole
batch splitting in halves ([landing batches](landing-batches.md)).

## Convex dispatch with the GitHub App

An App runner configured without a `credential` uses the Convex dispatch path.
`installationId` is optional: each operation resolves the selected repository's
App installation and mints a short-lived token with WebCrypto RS256. Existing
credential-reference runners retain the export/controller path; the
`FORGE_HOSTED_ACTIONS_CONTROLLER_*` seam is unselected for App runners.

`projectHostedActionsConfigure:configure` accepts `projectId` and a JSON `request`
containing `operationId`, `authorityEpoch`, `expected` (current configuration digest
or null), `repository`, and optional `runsOn`. It reuses the owner-only idempotent
configuration mutation and derives the runtime and environment fingerprint;
`runsOn` defaults to `ubuntu-latest`.
It accepts no installation ID or credential secret. Before writing, it derives the
repository's App installation (one read-only GitHub call, no token minted) and
refuses with `GITHUB_APP_PERMISSIONS` when the accepted installation permissions
lack Actions write or Contents read, for example while a permission request is
still pending approval. It then reads the repository's visibility with a metadata-only token (Actions write is
never minted to connect) and refuses with `RUNNER_REPOSITORY_PUBLIC` when the project is
private and the repository is not: a private project needs a private runner repository
or its owner's `publicLogs:true` (below), which dispatch and the runner's OIDC session recheck on every check
([security](../security.md#hosted-check-authorization)). The CLI routes
`nforge agent ROOT configure-runner '{"provider":"github-actions","repository":"OWNER/NAME"}'`
to this action; the Mac provider continues through its existing configuration
path. `check-settings` reports the selected runner under `actions` (`app-direct`
or `legacy-credential`, repository, workflow and ref). Add `"runsOn":"blacksmith-4vcpu-ubuntu-2404"`
or `"runsOn":["self-hosted","linux","x64"]` to select your runner; omission selects
`ubuntu-latest`. Labels are nonblank strings of at most 256 characters with no
control characters, or an array of 1–100 such labels (all must match one runner).
The setting is stored in the existing runner configuration and included in its
configuration and environment fingerprints; changing it invalidates old evidence.
Invalid labels fail configuration before any GitHub request or settings write.

Actions logs, test names, paths and printed output are as visible as the runner
repository. The project owner records acceptance of that with `"publicLogs":true`
(owner only: the same owner-only configuration transaction; a member's or a
coordination-only agent credential is refused). It is stored in the runner
configuration (so it changes the configuration digest, like any runner change), carries
over to later `configure-runner` calls while the repository stays the same, and
`"publicLogs":false` or a different repository withdraws it. While it is set,
`check-settings.actions.logs`, the `land`/`check` receipt (`checkLogs`, also printed
as the last land summary line), the run summary and the web landing view say plainly
that check logs are public. It costs no extra call: the notice comes from the runner
setting row the check selection already reads.
`check-settings.actions.runner` displays `runner: LABEL`; custom labels include
`(not GitHub-hosted: billed by your runner provider)`. This is based on standard
GitHub label names, not a live billing lookup: custom GitHub larger-runner labels
also get the provider notice. No runner is blocked based on this notice.

Hosted dispatch passes `runs_on` as a JSON string or array. Both hosted jobs use
`fromJSON(inputs.runs_on || '"ubuntu-latest"')` in `runs-on`. GitHub supports
[dispatch inputs in runs-on expressions](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idruns-on).
The BYOCI jobs and generated single-label workflows retain their behavior.
OIDC accepts GitHub's `github-hosted` and `self-hosted` runner environments with
the same signature, repository, workflow, execution and SHA checks.

App JWT signing and installation-token minting live in one module,
`convex/githubAppToken.ts` (`installationToken(ctx, repo, permissions?)`), shared
with the hosted GitHub mirror. Check dispatch and cancellation request only
Actions write and Contents read.

Backend configuration needs `GITHUB_APP_ID`, `GITHUB_APP_PRIVATE_KEY` (PKCS#1 or
PKCS#8 PEM), `GITHUB_WEBHOOK_SECRET`, `FORGE_HOSTED_CHECK_KEY_ID`, and its matching
`FORGE_HOSTED_CHECK_KEY_<ID>`. The existing object-store configuration is also
required. `CONVEX_SITE_URL` is Convex's system-provided site URL and the exact OIDC
audience. No callback key, App key, storage key, or source URL is sent in workflow
inputs or stored as a GitHub Actions secret. The existing App needs repository
Actions read/write, Contents read/write (the check token requests only read),
Metadata read, and the Workflow run event. Its webhook remains `/github/webhook`.

The checked-in workflow branches on `deployment`. Empty deployment preserves the
BYOCI `plan` input and export jobs. Convex dispatches on `main` with
`runId`, `projectId`, `deployment`, and JSON-encoded `runs_on`; the run name is `forge-check/<runId>`.
The `forge-check` timeout uses the explicit `timeout_minutes` input first, then the repository variable `FORGE_CHECK_TIMEOUT_MINUTES`, then defaults of 90 minutes for shards and 120 for planning. An explicit input or repository variable bounds the planning job's whole budget too; it does not add a separate 30-minute allowance. Forge's repository currently sets the variable to 30 minutes; the per-test-file hang guard remains ten minutes by default ([verification](../development.md)).
The fixed workflow checkout verifies and materializes the pinned Candidate using
hash/size-checked storage downloads, including recipe-backed content. With the
negotiated `source.batch` capability, one metadata read resolves up to 3,200
object descriptors in digest order; older servers keep 400-descriptor reads.
The resolver reads locations in 100-object groups and returns a verified prefix
when transaction index or byte headroom is low. Large files retain 400-object
lookahead once their descriptors cover 8 MiB, so later five-minute grants are
signed as downloads advance. The runner continues with the unresolved hashes; an empty or changed descriptor reply fails verification.
Metadata batches share authorization and catalog reads without hydrating test
reports. Three 400-object download pages still overlap verified streaming reads
and disk copies; symlinks are created only after all pages succeed.
With `source.runs`, the same resolver groups only back-to-back requested members
of each stored pack into one signed range. The runner keeps the complete signed
window together, uses the checkout run reader to stream each range into private
files, checks every member's hash and size, and then materializes the tree.
A gap never becomes part of a grant. Partial or expired runs use fresh individual
grants; a run URL is never reused for a member's narrower range. Old runners
receive their existing per-object reply. This reader rollout changes no stored
format or State writer; catalog reads and the all-raw path remain.

The subsequent State-bound reader protocol (`source.state`) accepts a compact
exact-key URL representation and whole-State physical-run plans, verifies every
manifest chunk before using its member rows, and keeps complete runs together
across descriptor windows. The capability is advertised after the reader landing. The signer
checks live run authority before and after R2 I/O and refuses digests outside the
selected State; recipe metadata must be a proved descendant of a selected file.
Raw or fragmented bindings retain the named one-time window. That check publishes
the existing source pack and a following fresh job uses it. No retained manifest
contains expiring URLs. A real-handler synthetic 29k job with a historical pack
covering 28,700 files and 300 raw additions uses two source requests and three
resolver mutations, with 14,404 serialized DB bytes and 83,268 grant reply bytes
including signed pack metadata. These are fixture serialization counts, not billed
usage. The default-off writer setting remains disabled.
Failures drain in-flight pages before returning without publishing a plan.
Each completed page logs files, downloaded bytes and elapsed time. Source bytes
go directly from object storage to the runner. The Candidate is transferred once as an artifact, preserving modes and
symlinks. The plan and run pins remain outside the Candidate directory. Planning
reads source as data with the installed selector and shared eight-way partitioner;
existing default full selection remains full. Docs scope uses only the static job.
Other commands run once (or once per declared shard), and the composed Intent contract union
runs in their static job.

The runner first sends the oldest session shape. The reply adds `capabilities`
alongside the existing run fields, so old runners retain their response shape.
Missing capabilities mean no extensions: results omit `testFiles` and planning
uses round-robin without requesting timing history. The shared list in
`src/hosted-actions-capabilities.ts` currently advertises `results.testFiles`,
`session.timingHistory` and `sourcePack`. A runner requests history only after that advertisement,
using one additional session request (two Convex function invocations per check).
Negotiated capabilities travel with the runner's plan artifact for its shards
and the optional pack refresh job.
The server still derives retained summaries from `contractReports`; the optional
`testFiles` field is a compatibility summary, not independent evidence. The runner
reads the session's `sourcePack` field and sends pack prepare/commit commands only
when the server advertised `sourcePack`. Without it, planning uses W2 full download
and skips pack refresh. Backend and runner updates can be deployed in any order.
Older runners that still try to resolve a historical pack State outside their
run fall back to the full download.

Command and result metadata strip unknown fields. The identity envelope, known
field types, logs, object pins and recipes remain strict. Refusals include a fixed
`reason` (`validation`, `authorization`, `storage`, `cancelled` or `limit`); the
runner includes only these codes in its error, never arbitrary response text.
`limit` means the request broke a Convex value limit (for example an object of more
than 1024 fields); it fails the same way on every retry, so Forge answers 403 and
the runner stops at once with `CONVEX_VALUE_LIMIT`. Internal functions on this path
return runs as JSON text, because a run holds one report per test file.

The negotiated planning session includes the project's advisory timing history. Eight-way LPT partitioning models the two test workers on each
runner; unknown files use the historical p75, or the existing sorted round-robin
split when history is missing or invalid. Complete per-file reports already carried
by shard results train that history once when a check passes or fails. Hosted Mac
completions use the same store and algorithm. Cancelled and interrupted checks do
not train it. The indexed `projectHostedTestTimings` document uses the same JSON
format and EWMA as the local `.forge/work/test-timings.json`, with `timingHistoryLimits`
(4,096 files, 128 runs, 1 MiB) and space reserved for the containing Convex document.
Local history is not uploaded. On a missing hosted
history document, the session bootstraps from at most the latest passed and latest
failed hosted run's retained reports through their status indexes. With no usable
reports, planning uses round-robin. Partial hosted selections
retain earlier samples for unselected paths, bounded by those limits.

`/checks/actions` accepts only GitHub-signed OIDC tokens for this exact site audience,
repository, `forge-check.yml@refs/heads/main`, `workflow_dispatch`, first attempt,
and a GitHub-hosted or self-hosted runner. The execution ID must already be bound by the dispatch
response or an HMAC-verified Workflow run event; an arbitrary first JWT cannot
claim a Forge run. Every transaction rechecks original actor authority, source
authority epoch, fence, and execution. Results and compact log receipts are atomic
and idempotent. The supervisor passes no OIDC or provider credentials into project
commands. Full logs stay in Actions; Forge retains a redacted tail of at most
64 KiB per job through checksum-bound R2 PUT and verified commit.

A dispatch reservation is committed before GitHub IO. Unknown replies retain that
reservation and are never dispatched again. GitHub has no dispatch idempotency
key: a process failure between reservation and the HTTP call can therefore leave
zero executions, while a lost HTTP reply can leave one. Neither case silently
creates a second execution. The Workflow run event binds the original execution
when its dispatch reply was lost. Without complete job evidence, workflows settle
as `runner-unavailable` unless an authenticated failed shard/report proves failure
(a shard result Forge refuses as invalid is resent as a failed shard, see
[JUnit reports](#junit-xml-reports-from-any-check));
cancellation stays cancelled. Standalone landings share the batch budget: two
retries, three runs total, with exact Candidate/check pins and parent-linked
attempts. Exhaustion is infrastructure `CHECK_NOT_PASSED`; genuine failures remain
`CHECK_FAILED`. Standalone cancellation is not retried. One
12-hour watchdog bounds a missing completion event and is cancelled on terminal
results. Accepted dispatches without an authenticated execution acknowledgement or
shard result also have a +5 minute, one-lookup startup deadline: a missing run,
`startup_failure` or cancellation goes through the same bounded platform retry
with a provider-outage reason. The same lookup can settle an already-bound first execution
that failed before Forge took its plan, including when its completion webhook was lost.
Healthy startup cancels that deadline in its existing write. There are no project scans, active-run pollers, or idle scheduled functions.

When a CI adapter reports a failed run and Forge's expected job plan is missing, the result is check
infrastructure (runner setup, OIDC or Forge's job API), not runner capacity and not the code: it
settles `runner-unavailable` (so the same platform retry and budget apply) with the reason `Check
infrastructure: the runner ended (failure) before Forge recorded its plan` (Item 0d8a85a3, the
2026-11-20 05:27-06:37Z job-API outage). Every platform retry's run carries `provider-delayed:
waiting for check infrastructure since HH:MMZ; retrying after <reason>` (a provider outage keeps its
own words; a later retry keeps the first start), so its landing reads `pending-infra`, "Waiting for
check infrastructure since HH:MMZ", on land, status, the Lane page and the Lanes page instead of
Checking. The wait ends when Forge takes the retry's plan, not on GitHub's `requested` or
`in_progress` event (in the outage the jobs ran; the job API did not); an adapter without a plan
step ends it once the run runs. A CI-down hold's landing reads the hold's own start. Healthy checks
read nothing new: the label comes from the run reason status already reads for a waiting check.

For legacy 400-descriptor servers, success uses
`17 + 2 * ceil(sourceObjects / 400) + 6 * jobs` Convex calls,
including HTTP/nested calls, enqueue, dispatch, webhook and Candidate/base manifest.
With inline logs the job term is `4 * jobs`. For 3,000 objects: nine jobs cost
87 calls, two cost 45, docs-only 39; twelve inline-log jobs cost 81, equal to eight
without inline logs. The 6,000-object full fixture budgets 101 calls.

Each descriptor batch costs two Convex calls regardless of download concurrency.
A 6,000-file full fetch uses three source reads (one manifest read and two file
batches), down from sixteen; transaction headroom can split sparse or large
metadata batches further. Recipe metadata and leaves add their own bounded reads. Grants expire after five minutes. GitHub/R2
requests are separate. Each job has one pre-spawn query with no nested call or
polling. Timing history adds one indexed planning read and one terminal read/write;
capability bootstrap adds two calls/check and initially at most two indexed run
reads. Plan retries may leave unused small metadata objects; retention is unchanged.

Job IO retries timeout/network errors, 429 and 5xx three times total with 1/2 s
backoff. Deadlines include body transfer: default 60 s/attempt, 180 s total;
OIDC 20 s/attempt (63 s maximum); advisory capacity pages 5 s/attempt, 18 s total;
pack PUT 120 s/attempt, 360 s total; pack GET 600 s total. Raw reads resume verified
Content-Range offsets and still require the full size/hash before publication.

Replays retain serialized bodies and run/fence pins: session/source are reads,
plan uses digest CAS, results dedupe by run/index/digest, and output/pack PUTs use
checksum-bound create-only keys. Unknown replies never repeat project execution.
Site storage/key-lookup/service faults return 503; permanent refusals stay 403.
A source request's object-storage reads share a 24 s budget under the runner's 30 s
reply timeout: each read gets at most the time left (20 s at most), and slow storage
answers 503 `reason: storage` inside the timeout rather than a second slow read (a
catalog fallback) running past it, so the runner's retry starts at once.
Exhaustion throws sanitized `RUNNER_UNAVAILABLE`; the webhook classifies failure
when a job cannot send a callback. Result and output delivery (Issue 72d50375)
outlives a write outage: the same body is resent with 1, 2, 4 … 60 s backoff for
up to 35 minutes, longer than the 30-minute approved dev storage pause. Forge
answers a refused write (`LEGACY_STORAGE_WRITES_PAUSED`, `HOSTED_CONFLICT`) with
503 and, during a pause, `Retry-After` set to the pause end, which the runner
waits for once. A 20-minute outage costs about 25 attempts without `Retry-After`
and two with it. Success adds zero Convex calls, DB reads/writes
or idle activity.

### Forge source packs

Hosted planning uses Forge source directly, without any GitHub mirror, Git checkout
of Candidate source, or GitHub source cache. The archive codec and verification
work with any runner provider; this workflow uses its existing Actions OIDC session
for authorized metadata and signed URLs. The control-tool checkout and Candidate
artifact transfer remain workflow bootstrap, independent of Forge source storage.

The existing planning session optionally returns `sourcePack`: the newest project's
`stateRef`, `objectKey`, `sha256`, `size`, `fileCount`, `createdAt` and a five-minute
signed GET. It reuses the negotiated timing-history session; no additional
pack session or polling is needed. Planning resolves and verifies the pinned
Candidate and base manifests, plus any scoped recheck States. The pack's State
reference identifies the archive. It grants no access to the historical State.
One pack GET seeds a freshly emptied, job-private blob cache. Planning keeps only verified,
hash-named members referenced by a held manifest and computes the Candidate's
missing content from the set of members it wrote. Pack paths and modes supply
neither the cache keys nor the tree layout. Only missing content uses W2's paged,
three-worker downloader. A fresh tree applies deletions, mode changes and path-type
changes, creates symlinks last, and hashes every final file/link against the Candidate
with Forge's SHA-256 digest. Pack framing or verification errors, missing delta
bytes, and final tree failures discard all extracted bytes and run the full W2
transfer. The plan log and pack-refresh artifact record the fallback reason.
The execution plan pin stays stable across retries. Older
servers without `sourcePack` use that same full path.

The deterministic format is gzip (level 1), containing a four-byte big-endian JSON
inventory length, the version/State/path/mode/blob/size inventory, then exact file
bytes in sorted path order. It avoids tar's platform-specific metadata, extensions,
and link/path extraction rules; only verified hash-named cache files are written.
It is bounded to 300 MiB compressed, 1 GiB file bytes, 32 MiB per file, 100,000 files
and a 16 MiB inventory. Larger source remains checkable through W2; only caching
is skipped. Packing and hashing stream disk files; extraction uses its bounded write window
plus the inventory. There is no persistent runner-local cache.

When there is no usable pack, or the delta exceeds 300 paths or 10% of Candidate
content bytes, the optional `hosted-pack` job runs alongside the check shards after
matrix and Candidate artifact publication. It uses that artifact to seed its cache,
fetches any missing accepted-base blobs, verifies them, and packs the pinned accepted
base. Planning counts the Candidate paths and bytes the pack did not serve
for this refresh decision. The plan carries the negotiated State-source requirement in the existing
artifact. A fresh pack job uses it to bind its missing-file requests to the pinned
base, with current authorization and no separate State discovery request.
Refresh failures leave the check outcome alone. The pack job logs a fixed
`source pack: refresh skipped (CODE)` line, such as `base-source-unavailable`,
`archive-bounds`, `reservation-unavailable`, `upload` or `commit`. The line carries
no error message, URL or source identifiers. The job sends `sourcePack`
prepare/commit commands only after advertisement.
Servers without that capability receive no pack commands, and their checks use
the existing source/plan/result shapes.

`projectSourcePacks` holds one small indexed document per project, including newest
metadata and a second slot for a previous pack or reserved upload. Reservations
precede PUTs; conflicting refreshes skip, including after interrupted uploads.
Reservations reuse the State row's authenticated generation when recorded.
A check on a base with a lower known generation than the current pack skips
before cleanup or upload. Legacy rows without generations keep the same
two-slot behavior until a refresh records a generation, with no backfill.
A create-only, checksum/length-bound PUT grants one computed project/State/digest
key. Commit checks R2 HEAD size/checksum and repeats current session authorization.
The previous or abandoned slot is deleted before its next replacement, after its
15-minute signed PUT plus two-minute transfer grace has expired. Failed deletion
retains the slot and skips refresh; later refresh retries it. At most two pack
objects are tracked, with no idle calls, sweeps, timers or schedulers. Latest pack
metadata is never removed by that cleanup. Pack readers verify member hashes, and
the Actions plan gets its tree inventory from the pinned Candidate manifest.

For 6,000 unique raw files with 20 changed blobs and a pack of the base, planning
uses two source requests (one manifest window and one delta window), versus W2's
sixteen. Including HTTP actions and nested mutations, session/source/plan totals
are eleven versus thirty-nine function invocations; source itself is four versus
thirty-two. R2 reads are 23 GETs (pack, two manifests, twenty blobs), versus 6,002.
A different pack State adds its descriptor and manifest reads on the default
path. The anchored path skips those reads. Recipe-backed content adds its actual
bounded descriptor and storage windows. The negotiated timing-history session adds one indexed
pack-document read; unchanged-pack planning writes no pack metadata.

A refresh adds two HTTP requests / five function invocations, one PUT (Class A)
and one HEAD (Class B), plus missing-base descriptor pages and blob GETs. Replacing
an old slot adds one nested mutation and one DELETE (free); the DELETE must succeed
before another object is reserved. The saved base routing choice adds no
requests to planning or to the existing State-bound descriptor windows.
Fallback adds the attempted pack/manifest reads
to ordinary full-download costs; a final verification failure can also repeat the
already downloaded delta. Check result/log operations remain unchanged.

The 100–300 MB GET + unpack + full verification + twenty-blob delta is expected to
take roughly 5–25 seconds at 25–100 MB/s with local SSD storage and two vCPUs,
excluding runner/tool bootstrap and Candidate artifact transfer. This is an
estimate, not a hosted measurement. Two packs add about 200–600 MB per project,
with a hard compressed maximum of 600 MiB. At R2 Standard's $0.015/GB-month this is
about $0.003–$0.0094/month amortized, before free allowance and account-level billing
rounding; requests also have free allowances. See [R2 pricing](https://developers.cloudflare.com/r2/pricing/).
There is no new paid provider or mirror dependency.

After object fetch or pack extraction, independent regular files are copied and
chmodded with at most sixteen local workers. Copies retain independent writable
inodes; cache files are never hardlinked into Candidate source. Directory creation
shares one in-flight promise per parent directory. Links are created after regular
files, retaining one target buffer at a time. Final verification still lstats every
path, checks its file/link type and executable mode, streams every regular-file
hash and hashes every link target. It uses the same sixteen-worker window,
including setup verification. Inventory stats share one promise per blob and run
within that window. On failure, scheduling stops and every active worker drains
before cleanup, pack fallback or failure publication.

The additional regular-file verification buffers are at most two 64 KiB chunks
per worker (2 MiB for sixteen); copies use filesystem copy operations. Directory
and stat caches retain metadata only, proportional to the existing inventory.
The sixteen-file / 64 MiB qualification budget is internal scheduling, not a
project content limit. Source logs report manifest fetch/parse, pack fetch,
unpack, object fetch, copy/chmod, final verification and inventory-stat wall times
as `source: phases` in milliseconds. Retried local phases accumulate. Local
filesystem work and trusted build caching add zero Convex calls, document reads,
writes or idle activity at any project size; descriptor windows remain unchanged.

Without a usable pack, planning reads objects with 16 concurrent GETs per descriptor
window (the paged descriptor calls are unchanged) and logs a line naming the repair
action. Pack download and unpack also log progress. Planning is bounded to 30
minutes and execution to 90; the combined `hosted-plan` job allows 120 minutes.
Distributed `hosted-check` shards stop after 90 and `hosted-pack` after 20,
instead of GitHub's 6 h default.

### Source packs outside checks

Signed-in clients read the same pack. `projectSourcePackClient:latest` (project
reader, one mutation, writes nothing) returns the latest pack with a signed GET.
A Lane open, sync or clone that misses 500 or more objects downloads that pack once,
writes every object whose bytes match its own digest, and fetches only what the
pack lacks through the paged object path. Older servers, a missing pack or any pack
failure fall back to that object path. The checkout is still verified file by file.

`nforge x ROOT source-pack {}` is the operator repair and backfill. It reads current
hosted main, fetches its objects through the pack, machine-store and object paths,
builds the deterministic pack locally and publishes it with
`projectSourcePackClient:publish` (owner or contributor; prepare signs one PUT for
the current main head only, commit verifies R2 HEAD and promotes it into the same
`projectSourcePacks` slots). It returns `status: current` when the latest pack
already matches main. Run it after a seed, cutover or import of a large repository;
later checks then refresh the pack through `hosted-pack`. Calls: one `latest`
mutation, two actions (four nested mutations), one PUT and one HEAD.

Clients also keep one machine-wide object store,
`${XDG_CACHE_HOME:-~/.cache}/forge/objects` (`FORGE_OBJECT_CACHE` moves it, `off`
disables it; test processes leave it off unless set). Files are content-addressed,
owner-only and written with temp-and-rename, so concurrent processes need no lock.
Each checkout root clones (APFS/Btrfs) verified objects from it into its private
cache, so a second Lane of the same project reads no bytes from R2 and makes no
object signing call. Nothing evicts it yet; a collector can delete any file at any
time, because readers verify each digest and refetch on a miss.

Deploy additive schema/backend support first, then publish the runner modules,
script and workflow together. The first successful full check seeds a base pack;
subsequent checks can use it. An old runner ignores the optional response; a new
runner on an old backend completes via W2 and skips pack publication. Qualification
of real R2 throughput, signed checksum headers and Actions job scheduling remains
an operator task.

Deploy this backend and publish this workflow on GitHub `main` before configuring
the App runner. Keep the Mac interim selected until one hosted Candidate completes
with exact shard evidence and its failure/cancellation paths have been qualified.
Then change the runner configuration with its expected digest; already-enqueued
Mac runs keep their original configuration and execution owner. Acceptance policy
and outbound GitHub mirroring are independent prerequisites and are not changed
by configuring this runner.

### Warm hosted Actions jobs and optional setup

The App/OIDC workflow uses free `ubuntu-latest` runners by default. Its
`hosted-plan` job restores `control/node_modules` and the npm download cache using
SHA-pinned `actions/cache`. The key comes from `node scripts/control-deps-key.mjs`
(plain Node, so any CI computes the same key): platform, architecture, the exact Node
version and a hash of the pinned control lockfile, with no Candidate input and no
prefix restores. A miss runs `npm ci --ignore-scripts`. Test and source-pack jobs
restore read-only.

Cache policy for every CI adapter, not only GitHub Actions:

- **Only main writes.** The planning job saves the cache before any Candidate code runs, from the
  pinned control checkout, and only when the run's ref is the repository's default branch
  (`github.ref` equals `refs/heads/<default_branch>`). The workflow is always dispatched on
  that branch, so every Lane check restores a main-seeded entry. Lanes read; a Lane's checkout never
  writes or chooses an entry, and nothing saves through a post-job action after project code has run.
- **Candidate installs are not cached.** A Candidate's own `npm ci --ignore-scripts` reads the
  main-seeded npm download cache and verifies each package against the Candidate lockfile's integrity
  hashes, so a changed lockfile downloads only its new packages. Caching a Candidate's `node_modules`
  would let one Lane plant files for another, so no job does.
- Candidate source, plans and check results are never cache entries. Lockfile changes create
  independent keys; cache loss changes preparation time only.
- A new adapter implements the same three rules with its own cache primitive: key from
  `control-deps-key.mjs`, seed from the default branch before Candidate execution, restore read-only.
  A stalled restore is a miss and an install has a timeout ([What Actions evidence attests](#what-actions-evidence-attests)).

Measure the policy with `node scripts/actions-cache-report.mjs OWNER/REPO [runs]` (uses the owner's
`gh` login, one list call plus one read per run): jobs, misses (a job whose `npm ci` step ran),
hit rate, median restore time and check wall-time median and p90. Each job's `install` phase is in
its `Check phases` line below. The active entry is about 150 MiB, inside the free Actions cache
allowance; it costs no money and no Convex call.

Every Actions job ends with one log line, `Check phases on N CPUs (CPU model), M GiB: install 3.4s (cpu 52%);
build 5.8s (cpu 90%); tests 359.1s (cpu 58%)`, giving each phase's wall time, the machine's CPU busy share and
its CPU model (`scripts/check-phases.mjs`, run by `scripts/github-actions-check.mjs`; any CI that runs those
scripts logs it). The planning job logs one `Shard plan:` line with the planned test seconds of every shard
(`describeShardPlan` in `scripts/test-shards.mjs`), to compare with each shard's `tests` phase. Standard GitHub-hosted runners for this public repository are 4 CPUs and 16 GiB. On
2026-11-05 shards ran two test workers at 58-69% CPU busy, so a third worker would saturate the box.
Use these lines, not estimates, before changing the worker count (`FORGE_TEST_WORKERS` in
`scripts/github-actions-check.mjs`) or the shard count. Those worker settings and the 3 GiB Node heap
cap (`NODE_OPTIONS`) apply to Forge's own standard check only; any other configured command runs
with the clean allowlisted environment, as on plain GitHub Actions.

Reading a run's log later: `gh run view RUN_ID --log` returns empty output (exit 0) for runs older than about an
hour, because GitHub expires that view. The job log is still readable through the jobs API:
`gh api repos/OWNER/REPO/actions/jobs/JOB_ID/logs` (get `JOB_ID` from `gh run view RUN_ID --json jobs`). Do not
print the redirect URL it follows. A job still in progress returns 404; that is not a lost log.

### Input closure experiment

Two manual `forge-check.yml` runs can collect test-file input traces from the same
accepted Git mirror commit. Use the legacy dispatch jobs with empty `deployment`,
a contiguous zero-based `plan` matrix, and run IDs of the form
`closure-trace-<label>-<base64url X25519 public key>`. Both runs should use the
same matrix and an immutable ref for the accepted commit. The checkout SHA is
recorded in every job. Compare traces only when their checkout SHAs agree. The standard static
commands and all test files, including browser files, still run. Ordinary runs
keep their existing recipe and process settings.

The test supervisor collects repository-relative filesystem observations and
executed V8 function spans from the test and the Node children it can trace. Type
checks report their compiler file lists. Native children and other coverage gaps
remain explicit in the experimental data. No check or landing decision reads
these traces. Trace records are compressed and encrypted before uploading them
as job log lines. Keep the matching private key and decoded records in private
scratch storage.

### Where a check's wall time goes (measured 2026-11-06)

`node scripts/actions-cache-report.mjs NanthAI/nanthai-forge 40` also prints a `breakdown` of the successful
runs, from the jobs API only (Actions run logs are deleted within about an hour, so a before/after pair
can be taken any time after a run ends). 34 successful full checks, 11 test shards, p50 / p90:

| Part | p50 | p90 |
|---|---|---|
| Whole check, created to updated | 508 s | 535 s |
| Queue before the first job | 4 s | 4 s |
| `hosted-plan` job | 30 s | 38 s |
| Slowest test shard job (sets the wall time) | 470 s | 497 s |
| Mean test shard job / fastest | 400 s / 293 s | |
| Slowest over mean shard | 1.18 | 1.24 |
| Shard job time outside the run step (setup-node, checkout, cache, artifact) | 17 s | 18 s |
| `forge-hosted-static` job (parallel, off the critical path) | 232 s | 246 s |
| Runner minutes per check | 77 | 83 |

Shard balance is already at its floor. Planned shard times are equal to the second (LPT on recorded
times: planned slowest over mean 1.000), yet the realized slowest over mean is 1.16. The cause is runner
speed, not planning: the same test file with the same neighbours ran 98 s on one runner and 183 s on
another in the same hour, and a shard's total time over the sum of its files' median times had a
coefficient of variation of 0.13 (143 shard runs, from 0.62 to 1.18, two clusters near 0.7 and 1.05).
Drawing 11 shard speeds from that distribution for a perfect plan gives slowest over mean 1.157 (p50),
1.224 (p90); the 13 deployed runs measured 1.156 and 1.165. A better duration estimator or a refining
pass over LPT cannot lower that. Only moving work between running jobs can: the [shard pool](#shard-pool)
does that with a claim that is atomic without a Convex call. The CPU model in the phase line is there to
confirm or refute a hardware cause.

Fixed cost is about 12% of the wall time: queue 4 s, plan job 30 s (source fetch 8 s inside it, checkout
2 s, setup-node 4 s, cache restore 3 s, artifact upload 2-3 s), then per shard about 17 s of job steps, 3-5 s
of `npm ci` and 5-8 s of build. Each is a few seconds and is dominated by GitHub step overhead. Changing
`forge-check.yml` is risky for what it saves: the workflow comes from GitHub `main`, so a broken workflow
fails the check of its own fix.

### Fixed cost per check job

Every hosted job also logs where its fixed part goes, as durations only: the planning step prints
`plan: phases {"sessionMs":…,"sourceMs":…,"selectMs":…,"planCallMs":…}` and the run prints
`run: phases {"preflightMs":…,"setupMs":…,"commandMs":…,"reportMs":…}`. `setupMs` covers source
verification and the command's inputs; `reportMs` the log upload and result call. Read them with the
step durations from the jobs API to split a job into runner setup, control checkout, Node, control
cache, plan and upload. The planning step reads the candidate, base and checked-base State manifests
concurrently, and the server stores a plan's selection and recipe objects concurrently: the same
requests, less waiting.

A workflow can opt in to three more cuts. None changes anything for a workflow that does not use them,
so installed workflows keep working without a reinstall:

- **Capacity step.** `node control/scripts/hosted-actions-job.mjs capacity` reads the runner queue with
  the GitHub token and writes `forge-actions-capacity.json` to the runner temp folder. A planning step
  that finds that file reads it instead of calling GitHub, so it needs no token.
- **Plan and run stay separate.** An earlier opt-in ran the check inside the planning step to save
  about 1 s per check; it is removed, because the planning step's outputs must come from a step that
  ran no Candidate code ([What Actions evidence attests](#what-actions-evidence-attests)). The plan
  output `npm_cache` is `true` only for Forge's own suite, which installs from its npm download cache.
- **Small control runtime.** With a restored control build (`dist/`), the supervisor and executor load
  only the packages that `node scripts/control-runtime-deps.mjs paths control` lists (about 32 MB
  unpacked, not the full install of about 150 MiB compressed). Its `key` command gives a cache key
  from the control lockfile, under the same main-writes, Lanes-read policy as the full install.
  `tests/control-runtime-deps.test.mjs` fails when the supervisor imports a package that is not listed.

### Shard pool

Work stealing between the test shards of one check (Issue 0ea17a29), so a fast runner finishes a slow
runner's tail. The static LPT groups stay the plan of record; the pool only decides who runs the tail.

- **Plan.** With recorded timings and at least two test shards, the planner (`scripts/shard-pool.mjs`)
  keeps the front of each LPT-ordered group (the longest files) and offers the tail, about the last 20%
  of the shard's planned time (its shortest files), as numbered units of at least 20 planned seconds,
  at most 128 per check. Shards under 60 planned seconds offer nothing. The cut indices are the recipe's
  optional `pool` field, inside the recipe pin, so every shard verifies them like the groups.
- **Claims.** One create-only object per unit at `v1/pool/PROJECT/RUN/EXECUTION/UNIT` in the
  deployment's R2 bucket. The existing plan call returns, for a pooled recipe, one presigned PUT
  (`If-None-Match: *`, fixed public body, signed sha256, 2 hours) and one presigned HEAD per unit. They
  are signed in the HTTP action (CPU only): no extra Convex function call, read or write. They travel in
  the plan bundle (`forge-actions-run.json`) to the fixed supervisor, never in a project script's
  environment and never in a log.
- **Protocol** (`src/hosted-actions-pool.ts`, per shard). Run the kept front (install, build, tests).
  Then claim the shard's own units front to back with a PUT each: 200 runs the unit (one executor
  process with `FORGE_ACTIONS_POOL_PART=UNIT`, tests only, files taken from the pinned plan), 412 means
  another shard has it. Then steal: HEAD every unit not yet seen taken, take the last free unit of the
  home with the most free units, and keep taking that home's units from the back while claims succeed.
  Homes claim from the front and thieves from the back, so they meet in the middle.
- **Run on doubt.** A shard skips a unit only after a clean 412 on its single PUT (or a HEAD that showed
  the object before it tried). Any other outcome (timeout, 5xx, expired URL, missing targets, an
  error after which the write may have landed) ends stealing and runs every own unit the shard has not
  seen taken. A misbehaving store can make a unit run twice, never zero times, and an unavailable
  store means today's static plan: the pool never fails a check.
- **Counting.** The result merges reports by file, so a file run twice counts once, and a pass never
  replaces a failure. Each home's result lists the files it yielded to another claimer; the server keeps
  the ones no shard has reported yet (`poolPending`, normally empty) and turns any left at completion
  into failed reports `POOL_UNIT_UNREPORTED`. Anyone who can read the plan bundle (project code on the
  runner, or a reader of a public repository's artifacts) can create claim objects, so a forged claim
  can fail a check but never pass it with fewer tests; claims never add or choose files.
- **Crash.** A shard posts one result at its end with every file it ran. A shard that dies loses its
  kept files too, so reclaiming its units cannot complete that check: the existing bound applies (job
  failure or the 90-minute job and 10-minute file timeouts), and a retry is a new run with a new claim
  namespace.
- **Log.** Each pooled shard prints `Shard pool: N units, ...; ran X own and Y claimed from other
  shards; yielded Z; D run without a confirmed claim; P claim writes, H claim reads, R lost races`
  and its phase lines show `pool` for unit time. The plan job prints `Shard pool: on|off`.
- **Any CI.** Plain HTTPS PUT and HEAD, the plan bundle and N workers running the Forge supervisor. An
  adapter that hands the bundle to its shard workers gets stealing; one that does not, or an old
  server (no `checks.pool` capability), keeps the static groups.
- **Budgets.** Convex calls per check unchanged. R2 per 11-shard check: about one PUT per unit plus a
  few lost races (Class A, ~35-50) and about 400-600 HEADs (Class B, 382-566 measured on dogfood),
  ~35 objects of 18 bytes.
  Runner minutes stay flat (the same work, plus about one second of process start per unit).
- **Cleanup.** Forge deletes its own claims; no bucket lifecycle rule is needed. When a check's final
  result is recorded (any shard ran the pool, `poolClaimed`), the same HTTP action lists and deletes
  that run's `v1/pool/PROJECT/RUN/` objects, and sweeps one page (100 keys) of the project's other
  claims older than the 2-hour URL expiry, starting after its own random run id, so claims of
  cancelled or crashed checks go with later checks. That is 2-3 R2 lists plus one DELETE per claim,
  no Convex call, beside the output manifest work, best effort and capped at 10 seconds: cleanup never
  fails or holds a result. Expired claims are harmless meanwhile (18 bytes each, never read).
- **Measurement.** Decided on 34 interleaved A/B pairs of dogfood checks (static groups vs pool):
  wall p50 -44.5 s (95% interval -54 to -28), slowest shard -47 s (-54 to -33.5), runner minutes
  +1.3 (-0.3 to +2.4) per check ([perf claims](../agents/perf-claims.md)). The pool is the one path;
  the A/B switch is deleted.

When the pinned recipe has exactly one execution job (no test groups plus the
static execution), that execution runs in `hosted-plan` after planning. This includes
opaque configured commands and standard docs-only checks. It uses the same persisted
recipe, pre-spawn authorization, source/setup verification and exact result callback;
planning alone is never passing evidence. No matrix execution job is dispatched.
Candidate/control artifacts are uploaded only when distributed shards or the existing
optional source-pack refresh need them. Refresh artifacts are published before the
single execution can change its workspace. Multi-job plans retain their existing
matrix, artifact handoff and shard evidence.

Planning restores trusted control `dist` from an exact cache key containing OS,
architecture, Node 24.22.1 and a content hash of the control lockfile and every file
`build:core` reads (`node scripts/control-build-key.mjs`, plain Node, so any CI can
compute the same key; it never uses the commit sha, so commits that leave the build
inputs alone share one cached build). There are no prefix restores. A miss runs the current
`npm run build:core` in the pinned control checkout, then explicitly saves only
`control/dist` before the planning supervisor or any Candidate code executes.
Candidate-produced files, builds, plans and results never populate this cache;
the key never uses a Candidate head. Cache loss retains the cold build path.
The control commit selects trusted supervisor code; it does not certify Candidate
code or replace any exact-Candidate checks.

Planning includes that control `dist` in the run artifact when needed.
Shards and the optional source-pack job unpack that build beside the exact
`github.sha` control checkout. Candidate installs/builds still use Candidate code
and its lockfile; the shared control build is not evidence for Candidate tests.
There is no additional serial build job. Dependency and exact-control-build
archives are separate; monitor Actions cache storage across old lockfile and
control-build keys when comparing the roughly 1 GiB cache budget. This workflow does not introduce a cache deletion policy.

Hosted test shard counts use the existing per-file timing history and two-worker
LPT estimates. When capacity is idle the planner picks the smallest count predicted to
fit 150 seconds of tests per shard, or the slowest single test file when that is longer:
no shard can finish before its slowest file, so more shards past that point only spend
runner minutes. The count is also capped by Convex calls per check: jobs times calls per
job stays within 48 (eight jobs at six calls, the cost before results carried their log).
A server advertising `results.inlineLog` takes the bounded log inside the result call,
so a job makes four calls (preflight query, result action, output and result
mutations) and a check may use twelve jobs; older servers keep six calls and eight jobs.
A result whose request would crowd the 512 KiB metadata window keeps the separate
output upload. The runner setting `concurrencyBudget` includes the static job and
defaults to twelve (eleven test jobs); test jobs never exceed twenty.
Planning is serial; an optional pack job is additional.
Configure it through the existing owner command, for example:

```sh
nforge agent ROOT configure-runner '{"provider":"github-actions","repository":"OWNER/REPO","concurrencyBudget":12}'
```

On standard GitHub-hosted runners, planning samples this workflow's queued and
running checks once: two Actions read requests, at most twenty records and 1 MiB
per response, with a five-second deadline and no pagination or polling. The job cap
is `FORGE_ACTIONS_JOB_CAP`, set by the pipeline that knows its plan (this repository's
workflow sets 60 for the Team plan); unset or invalid keeps the Free-plan twenty. A
stale low cap makes concurrent checks shrink their shard counts: on 2026-11-05 checks
planned with 3 to 7 shards took 14 to 31 minutes, against about 9.5 minutes with 10 or 11.
Repo demand is a lower bound on organization
demand; unrelated workflows/repos can also occupy those slots. The automatic
workflow token receives Actions read permission only in planning and never enters
Candidate code. Unavailable or malformed samples retain timing-only planning;
self-hosted runners do not use this Free-hosted capacity sample.

With competing checks, the planner compares all counts up to the idle target.
It models throughput as occupied test slots divided by predicted runner time:
slots are `min(20, activeChecks * testShards)`; runner time includes the sum of
two-worker shard estimates plus one minute per test job and the three possible
non-test jobs (plan, static, pack). The minute is a conservative preparation
estimate, above the observed 23-second p75 before test execution, not measured
test evidence. Ties prefer fewer jobs. This favors fuller shards under a deep
queue instead of spending more job-minutes chasing an isolated wall target.
For example, a fifteen-check queue selects two test shards for the recorded full
workload instead of eight; a small scoped workload still needs one. The selected
groups remain digest-pinned. This is a planning estimate, not an org reservation
or a new admission rule; GitHub enforces its actual concurrency limit.

Without timing history the planner falls back to at most eight round-robin shards within that budget;
unknown test files use historical p75. Every selected file remains in the plan.
A long individual file or a saturated budget can exceed the target; the planner
never drops tests or turns a failed test green to meet a duration. Contract tests,
changed tests and composed-Intent unions retain the existing gate selection.
This planning/cache work adds zero Convex function calls or idle activity.

A hosted check definition may declare an optional Actions preparation command:

```json
{"name":"verify","executable":"node","args":["scripts/forge-check.mjs"],"environmentLabel":"Node 24","actions":{"setup":{"executable":"/opt/forge/warm-cache","args":[]}}}
```

A definition may also declare `docsPaths` (globs; see
[docs-only paths](../pre-queue-checks.md#docs-only-paths)). A change whose every path
matches them runs no command on the Actions runner, and the server refuses a
docs-scoped plan for a command whose check declares none.

A definition may declare `globalRiskPaths` (globs; see
[global-risk files](../pre-queue-checks.md#global-risk-files)): files that can change
every result but that Forge cannot recognise by shape. A change on either side of a
composition that touches one never lands on an earlier check.

### Submodules in checks

The Actions planner and the self-hosted runner replace each submodule pointer in
the check workspace with its pinned commit's tree, recursively (up to 8 levels and
256 submodules), like `actions/checkout` with `submodules: recursive`. They fetch
only credential-free HTTPS URLs from `.gitmodules`; a `git@github.com:` URL is
fetched as its public HTTPS form. A relative URL (`../lib.git`) resolves against the
project's GitHub repository (the Actions repository of the check configuration), as Git
resolves it against the superproject's remote; a runner with no such repository (a
connected machine) still refuses it.
Each commit is fetched once per run (shallow, cached by URL and commit), and shards
receive the trees in the Candidate artifact. Git runs with no inherited
configuration, hooks, credential helper, filters, LFS smudge or prompts, and no
repository code runs. The tree carries no `.git` metadata. Source verification
checks the pointer bytes; the fetched tree is external content, as on GitHub.
LFS files inside a fetched submodule stay pointers. LFS files of the project
itself are ordinary source bytes in the Candidate ([Git LFS files](github-project-import.md#git-lfs-files)).

**Private submodules.** A GitHub URL that cannot be read anonymously is fetched with a
short-lived, read-only (`contents: read`) installation token limited to exactly that
repository, but only when the project owner allowed that repository and the GitHub App
installation that serves the project's own repository also includes it. Like GitHub,
where a workflow's token cannot read another private repository until an owner grants
it, nothing is allowed by default. The project owner allows a repository with

```sh
nforge agent ROOT configure-runner '{"provider":"github-actions","submodules":{"OWNER/NAME":true}}'
```

What the owner grants: every change that reaches a check, from any member or agent who
can land one, can read that repository's contents, and the check's own commands can
print them into the check logs. `submodules` merges into the current list (`false`
removes a repository; the list is shown in `check-settings.actions.submodules`). It is
stored in the runner configuration (owner only: the same configuration transaction as
`publicLogs`, so a member or agent credential is refused, and it changes the
configuration digest), and carries over while the runner repository stays the same; a
different repository starts empty.

When the run's check logs are public (`publicLogs:true`, or a run repository whose
GitHub-signed OIDC `repository_visibility` claim is not `private`), anything a check
prints from a private submodule is public. There a
repository is read only when the owner also allowed it for public logs with
`{"OWNER/NAME":"public-logs"}`; otherwise it refuses with `public-logs`.

The Actions job asks once per repository (`submoduleAccess` over the OIDC session;
capability `checks.submoduleAccess`, so an older server simply refuses as before). The
same session call reads the owner's current runner setting (one row; a withdrawal
applies to running checks, and runs of a replaced runner repository get nothing). The
server refuses a repository not on the list (`not-allowed`) or not allowed for public
logs (`public-logs`) before any GitHub call, then verifies the project's binding, looks
up the repository's installation, mints the token and returns it with
`Cache-Control: no-store`. Public submodules never ask. The token is never stored
or logged (the job also masks it), reaches Git only through the fetch's environment
scoped to that repository's URL (not argv, not config files), and is not written to
the workspace. A repository outside the installation is not given a token
(`outside-installation`); a failed lookup refuses with `access-unavailable`. Each
refusal names the repository and, for `not-allowed` and `public-logs`, the owner's
exact command. Cost per private repository: one Convex request (the session mutation,
which includes the one settings read) and two or three GitHub API calls (installation
lookup, mint; the project lookup and binding proof are added once per call). A request
naming only refused repositories makes no GitHub call.

A gitlink with no URL in `.gitmodules` has nothing to fetch: it becomes an empty
directory, as in GitHub's default checkout, and the check output carries one
`submodules: N without a URL in .gitmodules left as empty directories` line.
Any other URL (SSH to another host, `http:`, `file:`, credentials), a
relative URL without a project repository, an unreachable commit, a private repository
the owner has not allowed, a repository outside the installation or a runner without
`git` refuses with
`SUBMODULE_NOT_MATERIALIZED`, naming path, commit, URL and reason. The check fails
with that line before any project code runs: on the self-hosted runner before the
command; on Actions the plan pins the refusal (`selection.planError`), so every job
fails at once with the code and the check settles failed, not runner-unavailable.
Connected-machine runners (provider mac or self-hosted) have no project GitHub
repository and no installation, so they never fetch private repositories and refuse
relative URLs; the refusal says so (`relative-url-without-origin`, or `fetch-failed`
for a GitHub URL that is not readable anonymously) and names the way out: an absolute
public URL, a GitHub Actions runner, or `"submodules": false`. A check that does not
need submodule content sets `"submodules": false` in its definition (part of its digest)
to keep the pointer files.

`actions.setup` belongs to the App/OIDC Actions supervisor, including when that
workflow uses a self-hosted runner. Other runner providers do not use this
Actions-specific option. The definition digest includes the command. It runs once
per check job, before the selected check, with the same credential-free child
environment, in an external cache directory. `FORGE_SOURCE_CACHE_DIR` names that
directory (the runner-provided value, or a run-local temporary directory). Setup
can warm npm downloads, a sticky disk or an already installed cache integration;
it does not install or select a vendor. The check command receives the directory
as well. Relative cache paths are resolved once by the supervisor so setup and
tests use the same directory. Setup output is not test evidence and its exit status is advisory: a
missing executable or failed cache warm continues through the cold path.

The plan step verifies the Candidate tree before publishing the same-run
Actions artifact. Run jobs verify tree bytes only when the check declares
`actions.setup`. In those jobs the supervisor verifies the artifact State hash
against the exact run head, checks Candidate paths, hashes and modes before and
after setup, and rechecks the execution plan. Added, removed or modified source
fails the check before tests start. A run job without setup relies on the plan
step's verification and the same-run artifact. Cache preparation must keep its
files outside Candidate source. This is
source verification under ordinary OS rights, not a sandbox against a malicious
process with access to supervisor files or other account resources.

To qualify performance after installing the workflow, run the same full Candidate
and definition twice through normal Forge finish/check operations: first with a
new lockfile cache key, then with the same key. Record each Actions run URL,
Candidate/control heads, gate, selected file count, matrix, cache hit/miss, job
start/end times, dependency preparation, artifact transfer and test duration.
Compare cold and warm critical-path wall time and total runner minutes with run
40852593458 (722 seconds wall, plan 86 seconds, slowest shard 628 seconds).
Use the same timing history and workload for a causal comparison; contract gates,
batch unions and concurrent organisation jobs can change both counts and queue
latency. Keep the shared-build path only if its measured net critical path drops.
Repeat with a scoped Candidate to assess the five-minute target. These checks use
existing free GitHub-hosted Actions; no paid runner, idle service or vendor is
needed.

### Toolchains and dependency cache

A check definition can declare the toolchains its command needs and a dependency
cache, as plain GitHub Actions projects do with `setup-*` actions and `actions/cache`.
They are sibling fields of `actions` (whose `setup` stays required), so released CLIs keep
reading every check:

```json
{"name":"verify","executable":"go","args":["test","./..."],"environmentLabel":"Go","actionsToolchains":[{"tool":"go","versionFile":"go.mod"}],"actionsCache":{"presets":["go"]}}
```

- **`actionsToolchains`**: at most one entry per tool, from a fixed list. Each entry has
  either `version` or `versionFile` (a repository-relative path read from the Candidate).

  | `tool` | Step | `versionFile` examples |
  | --- | --- | --- |
  | `go` | `actions/setup-go` v7.0.0, its own cache off | `go.mod`, `go.work`, `.go-version` |
  | `python` | `actions/setup-python` v7.1.0 | `.python-version`, `pyproject.toml` |
  | `java` | `actions/setup-java` v6.1.0; `distribution` defaults to `temurin` | `.java-version`, `.tool-versions` |
  | `dotnet` | `actions/setup-dotnet` v6.0.0 | `global.json` |
  | `rust` | `rustup toolchain install` (rustup 1.28 or later, preinstalled on GitHub images) | `rust-toolchain.toml`, `rust-toolchain` |
  | `zig` | `mlugg/setup-zig` v2.2.1, its own cache off | none: `version` only |
  | `cmake` | `lukka/get-cmake` v4.4.2 (CMake and Ninja), its own cache off | none: `version` only |
  | `dart` | `dart-lang/setup-dart` v1.8.1; `version` only (`3.5.4`, `stable`, `beta`, `dev`) | — |
  | `flutter` | `subosito/flutter-action` v2.23.0; `version` is a release (`3.24.5`) or a channel (`stable`, `beta`, `master`, `main`) | `pubspec.yaml` (its `environment.flutter`) |
  | `elixir` | `erlef/setup-beam` v1.24.1; a `version` (Elixir) also takes `otpVersion`; a file is read strictly | `.tool-versions`, `mise.toml` |
  | `ruby` | `ruby/setup-ruby` v1.335.0, read from the file's folder; never `bundler-cache` (it runs `bundle install`) | `.ruby-version`, `.tool-versions`, `mise.toml` |
  | `php` | `shivammathur/setup-php` 2.40.0 with an empty `github-token`, so no token lands in Composer's `auth.json` | `.php-version` |

  Swift needs no entry: the runner image's Swift (Xcode on macOS, swift.org on Ubuntu) runs.

  Every tool above runs in an exported workflow and in the fixed App/OIDC `forge-check.yml`. A
  tool the fixed workflow has no steps for would fail planning with `ACTIONS_TOOL_UNSUPPORTED`,
  naming the tools, instead of running without them.

- **`actionsCache`**: `presets` from `go`, `cargo`, `pip`, `uv`, `poetry`, `maven`, `gradle`, `nuget`,
  `npm`, `pnpm`, `yarn`, `zig`, `vcpkg`, `conan`, `hex`, `bundler`, `composer`, `swiftpm` and `pub`. One entry holds the presets' download caches under the runner's home
  directory, never build output or Candidate source. Its key is the presets, the runner OS and
  architecture and a hash of the lockfiles: each preset's defaults (for example `**/go.sum`,
  `**/Cargo.lock`), or the `lockfiles` globs the declaration lists instead. Entries use the free
  GitHub Actions cache (10 GB per repository); no paid runner or service is involved.

Every action is pinned to a full commit SHA. Values accept only plain versions, paths and
globs, so a declaration can never place an expression or a quote in the workflow. The
declaration is part of the definition digest and is pinned in the run plan and the recipe;
a plan that lacks it, or names another one, is refused. The runner sends it only to a
server that advertises the `checks.toolchains` capability, and refuses a declared check
otherwise. Declaring adds no Convex call.

**Who saves.** As for Forge's own dependencies, only main writes, and never from the check.
A run whose ref is the default branch, and on the App/OIDC path only a main audit (a check of
accepted main), seeds the entry when its restore missed, before the check step runs: Forge copies
only each lockfile and its manifest into an empty temporary folder (no repository configuration
comes along) and runs a download-only command there, then saves. On Linux the seed runs as the
Candidate user too. A seed that fails skips that lockfile and never fails the check.

| Preset | Seed |
| --- | --- |
| `go` | `go mod download` beside `go.sum` and `go.mod` |
| `cargo` | `cargo fetch --locked` beside `Cargo.lock` and `Cargo.toml`. Cargo fetches without compiling or running build scripts. Manifests that need source files to infer their targets or require uncopied local crates may skip. |
| `npm` | `npm ci --ignore-scripts --no-audit --no-fund` beside `package-lock.json` and `package.json` |
| `pnpm` | `pnpm fetch --ignore-scripts --ignore-pnpmfile` beside `pnpm-lock.yaml` |
| `pip` | `pip download --only-binary=:all:` of each `requirements*.txt` (wheels only, so no build code runs) |
| `uv` | `uv sync --no-config --no-python-downloads --frozen --no-install-local --no-build` beside `uv.lock` and `pyproject.toml`. uv warms its cache with wheels in a disposable environment, omitting local packages including the project and editable paths. A dependency that needs a source build skips the seed. |
| `poetry` | Restore only. `poetry install --no-root` can still build locked Git or source archive dependencies. Poetry's wheel-only chooser applies to repository packages, while direct origins use a separate install path. |
| `maven` | Restore only. `dependency:go-offline` loads the project model, and `pom.xml` can declare Maven build extensions that load on that path. |
| `gradle` | Restore only. Gradle evaluates Groovy or Kotlin build and settings scripts to configure dependency resolution. `gradle.lockfile` pins versions for those configurations. |
| `nuget` | Restore only. `dotnet restore --locked-mode` still runs the MSBuild restore target. A project file can import or define tasks on that path, and `packages.lock.json` alone is not a restore project. |
| `yarn` | Restore only. Yarn Classic can install and pack a Git dependency with a `prepare` script. That fetch path starts a nested install without the outer `--ignore-scripts` flag. |
| `zig` | `zig build --fetch` beside `build.zig.zon` and `build.zig` (fetches and hash-checks; never compiles `build.zig`) |
| `composer` | `composer install --no-scripts --no-plugins --no-autoloader --ignore-platform-reqs` beside `composer.lock` and `composer.json` |

The uv seed needs `uv` on PATH with support for `--no-install-local` and an installed Python
compatible with the lockfile.

The `vcpkg`, `conan`, `hex`, `bundler`, `swiftpm` and `pub` presets are also restore-only.
On cache misses, checks download any dependencies the seed did not populate. Lane code never writes
an entry that another Lane restores.

**Where the steps live.**

- BYOCI export (`githubActionsWorkflow()`): the declared steps are inlined after
  `setup-node` in each job, and the generated workflow is committed with the run's
  ref. Per-run refs restore only entries the default branch saved.
- App/OIDC dispatch: one fixed `forge-check.yml` serves every project of its runner
  repository, so it cannot inline one project's values. The planning step pins the
  declaration and writes the `toolchains` and `deps_cache` outputs. Steps generated by
  `hostedWorkflowBlocks()` (`src/actions-toolchains-hosted.ts`) run only for declared tools,
  after the Candidate is in place and before the check step. If the installed workflow lacks those steps, planning a
  declared check fails with `ACTIONS_WORKFLOW_OUTDATED` instead of running without its
  toolchains. The `zig`, `cmake`, `dart`, `flutter`, `elixir`, `ruby` and `php` tools have their own blocks
  (`hostedLateToolBlocks()`), required only by a declaration that names them, so a runner repository
  that predates them keeps working for every other declaration.

Xcode and iOS simulators need a macOS runner: the project owner sets the runner's `runsOn` to a
macOS label (`macos-15`); Forge never picks one by itself, and every other project keeps
`ubuntu-latest`. Public repositories run macOS jobs free; private ones pay GitHub's macOS rate.

A connected repository reinstalls `forge-check.yml` only when one of its checks declares
toolchains or cache. Undeclared checks generate byte-identical workflows and need no
reinstall.

#### Toolchain variables

On Actions a configured command (any command other than Forge's standard check) also
receives these locations, when the runner image or a setup step sets them: `JAVA_HOME`,
`JAVA_HOME_<version>_X64|ARM64`, `GOROOT`, `GOROOT_<version>_X64|ARM64`, `GOPATH`,
`GOMODCACHE`, `GOCACHE`, `pythonLocation`, `Python_ROOT_DIR`, `Python2_ROOT_DIR`,
`Python3_ROOT_DIR`, `PKG_CONFIG_PATH`, `LD_LIBRARY_PATH`, `DOTNET_ROOT`, `NUGET_PACKAGES`,
`CARGO_HOME`, `RUSTUP_HOME`, `ANDROID_HOME`, `ANDROID_SDK_ROOT`, `ANDROID_NDK`,
`ANDROID_NDK_HOME`, `ANDROID_NDK_ROOT`, `ANDROID_NDK_LATEST_HOME`, `GRADLE_HOME`,
`GRADLE_USER_HOME`, `MAVEN_HOME`, `M2_HOME`, `CONDA`, `VCPKG_INSTALLATION_ROOT`, `PUB_CACHE` and
`setup-beam`'s `INSTALL_DIR_FOR_<TOOL>` (`toolchainEnvAllow` in `scripts/child-env.mjs`). The same applies to `actions.setup`. No
name containing `TOKEN`, `SECRET`, `PASSWORD`, `CREDENTIAL`, `AUTH` or `KEY` passes,
whatever pattern it matches. Forge's standard check keeps its exact environment.

#### Runner variables

On GitHub Actions a configured command also sees GitHub's documented, non-secret default
variables, so a test that reads them behaves as in the same job on plain Actions:
`GITHUB_ACTIONS`, `GITHUB_ACTOR`, `GITHUB_ACTOR_ID`, `GITHUB_API_URL`, `GITHUB_EVENT_NAME`,
`GITHUB_GRAPHQL_URL`, `GITHUB_JOB`, `GITHUB_REPOSITORY`, `GITHUB_REPOSITORY_ID`,
`GITHUB_REPOSITORY_OWNER`, `GITHUB_REPOSITORY_OWNER_ID`, `GITHUB_RETENTION_DAYS`,
`GITHUB_RUN_ATTEMPT`, `GITHUB_RUN_ID`, `GITHUB_RUN_NUMBER`, `GITHUB_SERVER_URL`,
`GITHUB_TRIGGERING_ACTOR`, `GITHUB_WORKFLOW`, `RUNNER_ARCH`, `RUNNER_DEBUG`,
`RUNNER_ENVIRONMENT`, `RUNNER_NAME` and `RUNNER_OS` (`runnerEnvNames` in
`scripts/child-env.mjs`, one list per adapter). `GITHUB_WORKSPACE` names the Candidate checkout.
Never passed: tokens and `ACTIONS_*`; the workflow command files (`GITHUB_ENV`,
`GITHUB_OUTPUT`, `GITHUB_PATH`, `GITHUB_STATE`, `GITHUB_STEP_SUMMARY`), through which a step
could change Forge's later steps; `GITHUB_EVENT_PATH`; `GITHUB_SHA`, `GITHUB_REF*` and the
workflow ref, which describe Forge's dispatch rather than the Candidate; and the runner's own
folders (`RUNNER_TEMP`, `RUNNER_TOOL_CACHE`). GitLab CI runs the project's own CI file
([CI status checks](ci-status-checks.md)) with its own variables, so it needs no list. Forge's
standard check keeps its exact environment.

### Hosted cancellation

Cancelling a hosted landing releases its check in the same transaction. Abandoning
a Lane uses this same cancellation path for its live submissions. A queued,
checking or ready submission that still pins the check keeps it live, including
another member of a batch. Replacing an attempt releases its old check as well.
Once the last live submission leaves, the check is terminal `cancelled`; signed
results cannot revive it. Runner sessions, control, heartbeats and results refuse
cancelled checks with `CHECK_CANCELLED`, and the Actions HTTP endpoint returns
403 with the non-secret reason `cancelled`. Old runners already stop on that 403.
The new Actions runner checks live permission before spawning tests and prints
`Forge check cancelled.` with exit zero for cancellation.

The existing OIDC planning session supplies a run-specific signed preflight ticket
in the `X-Forge-Actions-Preflight` response header, leaving the oldest session JSON
shape unchanged. The fixed supervisor retains it beside the plan, outside the
project command environment. A shard calls the read-only
`projectHostedActionsPreflight:check` query once before spawn. This is one Convex
function invocation with no HTTP action, nested function, refresh or polling. It
verifies the ticket, current actor/authority epoch and exact execution/fence, then
returns only active/cancelled. The ticket uses a separate signature domain and
grants no source access, result publication, provider IO or signing authority. Its
lifetime inherits the original run; it introduces no additional expiry or user step.

The `session.preflight` capability gates this query and all its request fields.
A new runner on an old server uses the original saved-plan path and existing
result refusal points, sending no unsupported query or new session fields. An old
runner on a new server ignores the header and retains its existing 403 stop behavior.
Deploy the backend before publishing the new runner modules and supervisor script.

Direct App-backed Actions cancellation schedules one provider cancel action. It
uses the existing project/repository binding and an installation token requesting
`actions: write` and `contents: read`. The action consumes its reservation before
IO, sends the cancel endpoint once, and tolerates 409 when the workflow has already
completed. An unknown network outcome is not resent. Dispatch acknowledgements or
requested/in-progress webhooks arriving after cancellation can bind the retained
run ID and schedule the same cancellation without reviving the check. Completed
webhooks for a cancelled check leave its state and scheduling unchanged.

An explicit check-run cancellation stops the selected run even when live landing
requests reference it. Cancelling an individual landing stops its check only after
the last live consumer leaves.

The Actions mid-shard stop bound is **GitHub cancellation latency**: the provider's
run-cancel mechanism stops running jobs, normally in seconds; no fixed latency is
asserted by the local fakes. Actions has no new heartbeat or file-boundary polling.
The existing 60-second request deadline bounds a stalled pre-spawn/result request;
it prevents spawn on an unknown preflight outcome. It is not an active Actions
lease and does not kill an already-running child after 60 seconds. Mac and Forge
G9 self-hosted workers keep their existing 20-second heartbeat/subscription stop,
with their last acknowledged 60-second lease as fallback for a hung heartbeat.
Actions jobs on self-hosted labels use GitHub cancellation, like other Actions jobs.

Direct cancellation uses its mutation plus one scheduled action and one claim
mutation (three invocations), independent of shard count, plus one workflow-cancel
POST and existing App token acquisition. Before dispatch there is no provider call.
The planning header adds zero calls; preflight adds one call per shard because the
restored shard had no session/lease call before spawn to fold it into. Results keep
their existing call path. For a plan with eight test shards plus static, the routine check delta
is **+9 calls**, or **+12 including the complete cancellation operation**; relative
to an old explicit cancel operation, the marginal cancel plumbing is +2. Adaptive plans use the actual number of test jobs plus static; pack refresh adds
no preflight query. Existing repository-binding and App-token lookups remain
additional. No new timers, crons, polling or idle function calls were added. Legacy credential-adapter observation/cleanup
retains its prior call and retry behavior.

Installed App permissions and real-provider stop latency require operator
qualification; the local tests use synthetic installations only.

### Batched result inbox

Supervisors advertising `results.batch` ask for it during the existing plan call.
The plan returns private create-only R2 result slots scoped to the project, run,
dispatch fence and provider execution. They remain in the supervisor bundle;
Candidate processes receive neither that bundle nor the upload capabilities. The
run bundle is written and restored with owner-only file permissions before
Candidate execution.
With negotiated `results.packed`, each shard writes one immutable combined result/log
object. After uploading, a required shard HEADs the other required slots once, stopping
at the first missing slot. A shard that sees them all attempts a create-only election
marker, then the winner sends one completion notification. The marker identifies its
shard so a lost PUT reply can reconcile without a second shard notifying. Optional
pack/proof jobs have no slots and never delay this notification. The signed
provider-completed webhook recovers a lost elected supervisor; packed discovery uses
no LIST. Older `results.batch` supervisors retain their
LIST/election protocol. This adds no workflow step, timer or per-shard Convex call.

Forge streams each slot within the existing 512 KiB metadata window (plus the
base64 encoding of its at-most-64-KiB log for packed objects) and commits
results in pages below 768 KiB. Each page folds all its shards in memory and
writes the run head once, preserving per-shard identities, retry budgets, pool
settlement, failure excerpts and immutable result digests. An ordinary 10–12-shard
run fits one page; unusually large report sets use one mutation per metadata page.
The CI reply contains only run identity, status and counts. Older supervisors keep
the original result protocol.

For these batched runs, terminal per-file reports live in bounded records in the
existing Actions results table. Run heads keep counts and failure/flaky summaries.
Readers that need per-file evidence hydrate the report pages; provider verdicts,
webhook updates and metrics read the slim head. Timing aggregation is scheduled
once after provider completion, rather than loading reports into the webhook.
Logs remain in R2. Packed output chunks retain the original log hash/size and seal,
plus the physical envelope hash/size and dispatch fence. Authorized downloads verify
the physical envelope, extract the log and verify its original pin. Output cleanup
reads and deletes that same physical key; backup/restore preserves its R2 reference.
Packed backing objects survive collection and terminal replay. Only legacy inboxes
are scratch removed after ingestion. No retention setting or output expiry changes.

Only the provider's independent conclusion makes a passing verdict reusable.
Reuse is indexed by exact source digest, check definition, runner configuration,
runtime, environment, authority epoch, actor, gate and contract. An identical
recheck references the original verdict without another CI dispatch, run or result
write. A different Candidate records a small provenance alias; operation-id receipts
still reconcile retries. Supervisor results alone never enter this reuse index.

### CI byte guard and serving estimate

`ci-batch-fixture` in `src/speed-budgets.json` guards the result path separately
from the small synthetic check in the six-landing `landing-fixture`. It runs eleven
interleaved legacy/batch pairs with the same 886 test files, two recovered flakes,
twelve shards and one check run per fixture landing. Provider conclusion, final
output and the existing deferred timing aggregation are included. Collection runs before
provider completion, so optional pack/proof work does not block required results.
The before path remains executable for older supervisors. KB means 1,000 bytes.

The packed fixture counts six executions: batch prepare, batch result, final output
apply, provider-completed webhook, deferred timing aggregation and one collector
invocation. The provider HTTP envelope is excluded consistently. This is the same
call count as the older batched inbox. A representative packed run reads 91.8 KB and
writes 197.0 KB, including timing aggregation; its result reply is 113 B. The existing
plan response carries about 20.0 KB including private upload/HEAD/election capabilities,
with no additional planning call. The older per-result route and eleven interleaved
comparisons remain in the guard; these are synthetic fixture observations, not bills.

The packed fixture uses 14 Class A requests (twelve combined objects, one election
marker and one final manifest) and 90 Class B requests, compared with 38/25 for the
older batched inbox. Sequential upload order executes 77 discovery HEADs, twelve
collector GETs and one final-verification HEAD; another completion order can execute
up to 132 discovery HEADs. Discovery skips the uploader's own slot and stops at the
first missing required object. It removes twelve LISTs and twelve duplicate log-copy
PUTs, including their verification HEADs and legacy scratch deletes. The marker stays
in its run/fence/execution namespace so concurrent losers and lost replies can reconcile.
For new runs pinned by default-off `FORGE_CHECK_REPORTS_R2=1`, the collector
adds one immutable folded-report PUT: 15 Class A and 91 Class B requests in the
twelve-shard fixture. Six Convex executions remain six; duration arguments replace
the deferred report-row timing read. The fixture reads 44.2 KB and writes 167.8 KB
versus 93.5 KB and 197.8 KB for its legacy pair. These are fixture bytes, not bills.
Legacy runs retain the original protocol and 14 requests.
The absolute nominal Class A ceiling is 15, independent of the ledger's percentage
tolerance. Race fixtures count attempted conditional writes and marker reads too;
retries and losing election PUTs are additional executed requests, never inferred
from signatures or hidden as zero.
The original per-result route remains executable for older supervisors. These are
synthetic operation counts; live billed usage and byte placement still need a
post-deploy observation. The cost ledger also combines the actual 4,096-file
source/main-race fixture, two twelve-shard check collections and exhaust maintenance
under a separate 80-Class-A fixture ceiling (31 A / 193 B observed with the legacy writer; 33 A including two new report objects). Lane/check
setup, client uploads/materialization, reuse, mirror, external backup/sweep and
unobserved retries remain coverage gaps. The earlier live bucket window is reported separately in [cost to serve](cost-to-serve.md#s7-request-ledger-and-smoke-coverage).

Live verification still needs the lead's log-only meter on the deployed version.
The reported baseline was 23.7 MB / 231 result calls, 14.8 MB / 215 webhook calls
and 14.8 MB Actions HTTP egress over about nine landings. Those totals include
more than one twelve-shard run per landing and multiple webhook phases; they
cannot be compared directly with this one-run fixture. The earlier 75cb5074
fixture's projected 62% read reduction versus the observed 25% also mixed a
smaller report/timing payload with live run shapes and event counts. Payload
shape, retained timing history, provider-verdict work and rechecks are known
coverage differences; their individual contributions to that gap remain
unmeasured. No live capture, export, import or load test is run by this guard.

`configure-runner` receipts include the public-log consequence when `publicLogs:true` is selected or retained for that repository, including a held settings proposal. It uses the existing `checkLogs` notice; no extra confirmation is added.

## Conditional browser fixtures

Standard Forge checks classify browser fixtures in `scripts/browser-test-policy.mjs`.
Any `tests/<name>-browser.test.mjs` is a browser fixture by name, in the Candidate's own
inventory too, so a new browser test needs no registry edit; the policy lists only older
fixtures without that suffix. Name new browser tests `*-browser.test.mjs`.
For scoped checks, changes under `web/`, browser tests and fixtures, package
manifests, the browser policy, or shared source in the web import closure select
the browser fixtures. Scoped non-web changes omit browser execution and cache restores. The static
contracts in `docs-site.test.mjs` remain applicable independently of its browser
subtest. A missing changed-path comparison selects browser coverage conservatively.
A full selection runs every browser test, including main audits with no changed
paths. A scoped solo recheck considers both the Lane’s changes and the main delta
since its checked base. A cohort recheck also considers the Candidate delta from
each member’s checked head. Web-affecting paths on either side, including changes
to shared type contracts the web imports, select the browser fixtures. An unavailable recheck basis falls back to full coverage.

A test file whose every test skipped is recorded as skipped (`attempts: []`), never
as a pass or a timing, and is never culprit-probe pass evidence. When browser
coverage was selected, a skipped browser test fails its shard and is named as a
failing file with its cause: a missing pinned browser cache (setup), or the test
skipping itself while the browser was present. A machine runner always runs the full
selection, so Forge's standard check fails the run there too. The contract gate never
counts a skipped contract test as evidence: publication refuses the landing and names
the test. Before the browser shard runs any Candidate code, the fixed supervisor
checks the pinned cache; if it is still missing, that is a setup fault, and it
installs the pinned Chromium once (the one retry) before the tests run, at the
same pinned Playwright version the plan read.

If the selected browser tests have no exact Playwright version in a valid
Candidate `package-lock.json`, the hosted plan pins a refusal that names the
lockfile. The planned jobs report that failure
without restoring a browser cache, installing Chromium or running Candidate code.

Browser fixtures stay together on one existing test job, which also carries ordinary
tests to balance the critical path, without increasing the job or Convex-call budget. That job keeps its browser files out of the work-stealing pool.
The hosted and public workflows restore a Chromium cache keyed by the exact
locked Playwright version, OS and architecture. A cache miss installs the pinned
browser; an explicit cache save runs before Candidate execution, never as a
post-job upload. Hosted saves require the Candidate version to match the control
checkout’s pinned Playwright version. Other versions install without saving a cache.
The Linux Candidate user reads the restored cache through a read-only mount.
Failed installation fails the job, and the fixed executor checks for the executable
inside the Candidate namespace before any selected browser fixture can skip.

Executor contract 5 passes the browser cache path and the pinned browser-selection
flag through the private check environment. It is an additive executor contract;
the fixed executor already enforces CI failure for a missing selected browser.
Individual fixtures adopt the shared CI-failure/local-skip rule after that executor
is accepted. The helper reads the pinned `FORGE_BROWSER_TESTS` flag; excluded
coverage never probes a browser. A self-hosted check can declare `FORGE_UI_BROWSER`
as an environment input and point it to an installed Chromium. The fixed probe and
the Chromium fixtures use that executable even with an empty Playwright cache.
Executor contract 6 stops the hosted executor (`scripts/hosted-actions-execute.mjs`) from
collecting V8 coverage: hosted results keep none, and it made test files 0.93 to 2.83 times
slower (median about 1.9). Native runners still collect it ([development](../development.md#scope-aware-standard-check)).
Browser fixture tests use synthetic data and start no hosted service. Cache bytes
are runner files, not CLI dependencies or Convex records. Timing qualification and
cache-size evidence are recorded on planning Item `1dd4e095`; restoring a browser
cache and running its tests add no work to a non-web landing check.
