Skip to content

Check runs

Check runs let an external CI system report per-job results back to a change, asynchronously. Stratum tells your runner about each evaluated revision and returns immediately; the runner reports running, then passed or failed, whenever it is ready — minutes later if need be. A project can require named checks before a change may merge.

Use check runs when your CI takes longer than a request can wait, or when you want one result per job. The webhook evaluator is the simpler choice when a single verdict fits in one HTTP response.

webhook evaluatorCheck runs
Result arrivesIn the response, within timeoutMs (at most 120 s)Later, through a signed callback (default deadline 30 minutes, at most 6 hours)
GranularityOne score for the whole callOne status per named check
Affects the evaluation verdictYes, it is scoredNo — it gates the merge through merge.requiredChecks
Gate settingmerge.requiredEvaluators: ["webhook"]merge.requiredChecks: [name, ...]

Check runs are declared in .stratum/policy.yaml, on the project’s default branch:

evaluators:
- type: checks
url: "https://ci.example.com/stratum/checks"
secretRef: WEBHOOK_CI_SIGNING_KEY # required: names a project secret
checks: [lint, test, build] # every check this runner reports
timeoutMs: 10000 # optional: how long the dispatch request may take
deadlineMs: 1800000 # optional: how long a check may stay unfinished
merge:
requiredChecks: [lint, test] # these must have passed to merge
FieldRequiredMeaning
urlyesWhere the dispatch request is POSTed. Must be a public http(s) address; redirects are not followed.
secretRefyesName of the project secret that signs the dispatch and verifies the runner’s reports. Same rules as the webhook evaluator: it must start with WEBHOOK_. A literal secret is refused.
checksyesThe check names this endpoint reports: 1–64 characters of ASCII letters (a–z, A–Z), digits, ., _, - or /, starting with a letter or a digit (-lint, .test and café are refused). A bad name, here or in merge.requiredChecks, makes the whole policy file malformed, which blocks every merge until it is fixed: an entry that cannot be used is a gate its author meant to have, so it is never quietly dropped. At most 32 names per policy file.
timeoutMsnoTimeout for the dispatch request. Default 10 000, clamped to 1 000–120 000.
deadlineMsnoHow long a check may stay queued or running. Default 1 800 000 (30 minutes), clamped to 60 000–21 600 000 (6 hours).

Add the signing key in Project → Settings → Deploy secrets (or with PUT /api/projects/{namespace}/{slug}/secrets/{name}), under the name you put in secretRef. Rotating it takes effect on the next dispatch and the next report, with no policy change.

Rules the policy file must follow, or the whole file is rejected and merges are blocked until it is fixed:

  • A check name belongs to exactly one checks entry. Two entries may not declare the same name.
  • Every name in merge.requiredChecks must be declared somewhere: by a checks entry, or as a step in .stratum/ci.yaml. A required check nothing dispatches could never pass.
  • merge.requiredChecks must be a list of valid names. A string or a mistyped entry is an error, not “require nothing”.

You may declare several checks entries, each with its own url, key and names — for example a fast linter service and a slow test farm.

A checks entry is not scored. It adds no row to a change’s evaluator evidence and does not change whether the change is accepted or needs_changes. Do not list checks in merge.requiredEvaluators; use merge.requiredChecks.

The set of checks is declared in the policy, not created by the runner. When a revision is evaluated, Stratum creates one check run per declared name and hands their ids to the runner. A report addresses an existing check run by id and can change only its status, summary and details link.

This is what makes a required check trustworthy. A runner cannot:

  • create a check, or report under a name it was not dispatched for;
  • move a result from one revision of a change to another;
  • report for another project, even with a valid key of its own — the key is resolved from the project the check run belongs to.

The policy is read from the project’s default branch, never from the change. A change that edits .stratum/policy.yaml to drop a required check is still held to the checks the base requires (and, because it edits protected config, needs a human approval as well).

A second source of names is first-party CI. Each step in the default branch’s .stratum/ci.yaml is a check run of the same kind, named after the step and created by Stratum in the same way. Three things differ:

  • A step is required without being listed in merge.requiredChecks. A step marked optional: true is reported and shown, and does not gate the merge, unless merge.requiredChecks names it: the policy wins, and the step is required.
  • A name belongs to one source. A step may not share a name with a check a checks entry declares; that makes the configuration invalid.
  • Its reports are signed with the instance’s executor secret, not with a project secret. Stratum decides which key to verify a report against from the check run’s own record, set when the run was created, so a project’s runner key cannot report a CI step and the executor’s key cannot report a project’s check.
queued ──▶ running ──▶ passed
│ │ ├──▶ failed
│ │ └──▶ errored
└───────────┴──▶ errored (deadline passed, dispatch failed, or superseded)
StatusMeaning
queuedCreated and dispatched; the runner has not reported yet.
runningThe runner reported that work has started. It may report running again to update the summary.
passedTerminal. The only status that satisfies a required check.
failedTerminal. The job ran and did not pass.
erroredTerminal. The job could not produce a result: the runner said so, the dispatch could not be delivered, the deadline passed, or a newer run replaced this one.

passed, failed and errored are final. A report that would move a check out of a terminal state is rejected.

Checks are dispatched each time a revision is evaluated: when a change is opened, and each time it is re-evaluated. Each dispatch creates new check runs with new ids, and ends any still-pending runs from before.

The dispatch request (Stratum → your runner)

Section titled “The dispatch request (Stratum → your runner)”

POST <url> with Content-Type: application/json:

{
"event": "checks.requested",
"changeId": "chg_8f2b…",
"title": "Retry uploads that time out",
"description": "Uploads to the archive time out under load…",
"project": "@acme/api",
"baseSha": "9c1e…",
"headSha": "4a7d…",
"headTreeSha": "e21b…",
"diff": "diff --git a/src/app.ts b/src/app.ts\n…",
"checkRunIds": { "lint": "chk_51c0…", "test": "chk_a93e…" },
"callbackUrl": "https://app.usestratum.dev/api/checks",
"deadline": "2026-11-09T12:30:00.000Z"
}
FieldMeaning
eventAlways checks.requested. Also sent as the X-Stratum-Event header.
changeIdThe change the checks belong to.
titleThe change’s title as its author wrote it, or null if it has none.
descriptionThe change’s description (Markdown source), or null if it has none. A check that reviews the change can hold it to what its author says it does.
projectThe project, as @namespace/slug.
baseShaThe commit diff was computed against: where the workspace forked from the project. It is the project’s tip only while the workspace is up to date.
headShaThe evaluated revision. Echo it back in every report.
headTreeShaThe git tree id of headSha: what checking out baseSha and applying diff must produce. See Verifying what you built.
diffUnified diff of baseSha..headSha.
checkRunIdsCheck name → check run id, for exactly the checks this request asks for. A re-run of one check carries only that one.
callbackUrlReport to <callbackUrl>/<checkRunId>.
deadlineISO 8601 instant after which an unfinished check is errored.

Headers:

  • X-Stratum-Signature: sha256=<hex> — HMAC-SHA256 of the raw request body under your signing key. Verify it before trusting the payload, with a constant-time comparison.
  • X-Stratum-Event: checks.requested

Respond with any 2xx as soon as you have accepted the work. The response body is ignored; the checks stay queued until you report. Do not run the jobs before responding. A non-2xx status, a redirect, a timeout or a connection failure marks the dispatched checks errored with the reason, and re-evaluating the change (or re-running the check) dispatches again.

To apply the change, check out baseSha and apply diff, exactly as for the webhook evaluator — see Wiring your CI to the contract and Running a Webhook Evaluator Executor Safely. The diff is untrusted code; everything in that guide applies to a check runner.

A runner does not receive the change’s head commit; it rebuilds it from baseSha and diff. headTreeSha lets it prove the rebuild is the revision Stratum evaluated before it runs anything:

Terminal window
git checkout --detach "$BASE_SHA"
git apply --index change.diff
test "$(git write-tree)" = "$HEAD_TREE_SHA" || exit 1 # not the evaluated tree

The diff is written to be applied: it carries missing final newlines, empty files, executable bits and symlinks. What it cannot carry is a file that is not UTF-8 text. A change that adds or modifies a binary file does not reproduce its tree, and a runner that checks — as the first-party executor does — must fail such a run rather than test something else.

POST <callbackUrl>/<checkRunId> with a JSON body:

{
"checkRunId": "chk_51c0…",
"headSha": "4a7d…",
"status": "passed",
"sequence": 3,
"summary": "214 tests passed in 3m 12s",
"detailsUrl": "https://ci.example.com/runs/8841"
}
FieldRequiredMeaning
checkRunIdyesMust equal the id in the URL. It is inside the signed body so a captured report cannot be replayed against a different check.
headShayesMust equal the dispatched headSha.
statusyesrunning, passed, failed or errored.
sequenceyesA positive integer that increases with every report for this check run — a counter, or milliseconds since the epoch. Stratum applies a report only if its sequence is higher than the last one applied.
summarynoPlain text shown on the change page. Truncated to 4 000 characters. Omit it to keep the previous one.
detailsUrlnoAn http(s) link to the job, at most 2 048 characters, with no embedded credentials. Omit it to keep the previous one.

Unknown fields are ignored. There is no field that sets a check’s name, change or revision.

Sign the request the same way Stratum signs the dispatch:

  • X-Stratum-Signature: sha256=<hex HMAC-SHA256 of the raw body under the signing key>

Send no Authorization header and no cookie. The signature is the only authentication; a Stratum API token grants nothing on this endpoint.

StatuscodeMeaningWhat the runner should do
200—{ "applied": true, "check": {…} } — the report was recorded.Continue.
200—{ "applied": false, "check": {…} } — a duplicate or out-of-order report (sequence not higher than the last applied). Nothing changed.Treat as success. This is what makes a retry safe.
400INVALID_REPORTThe body is signed but not a valid report.Fix the request; retrying it unchanged will not help.
401INVALID_SIGNATUREMissing or wrong signature, or no such check run. The two are deliberately indistinguishable.Check the key and the id.
409STALE_REVISIONheadSha is not the check’s revision, or the change has moved on to a newer revision.Stop work on this run.
409CHECK_SUPERSEDEDA newer run of this check (a re-run or a re-evaluation) replaced this one.Stop work on this run.
409CHECK_TERMINALThe check already finished.Stop; the result is final.
409CHECK_DEADLINE_EXCEEDEDThe deadline passed before a terminal report arrived. The check is errored.Stop; ask for a re-run.
413PAYLOAD_TOO_LARGEThe body is over 64 KB.Send a shorter summary and link to the full log.
429—Rate limited.Retry after the Retry-After header.

Every 409 carries the current check so the runner can see why.

  • Retry on a network failure, 429 or 5xx, with the same body. If the first attempt was applied, the retry gets 200 with applied: false.
  • Reports may arrive out of order. sequence decides: a late, lower-numbered report is acknowledged and ignored.
  • Report state transitions, not log lines. The callback shares the per-address rate limit for unauthenticated requests (60 per minute by default). That is two reports for each of 30 checks in a minute; a policy may declare 32, so a runner that reports them all at once can be answered 429. Retry, as above, and a lost report is never the result.

Each check run has a deadline, deadlineMs after it was dispatched. A check that has not reached a terminal state by then becomes errored with the summary “The runner did not report a result before the deadline.”

A background sweep applies this every five minutes, but nothing waits for the sweep: the merge gate treats an overdue check as blocking the moment its deadline passes, and a report that arrives after the deadline is refused.

A runner that never reports cannot make a change mergeable. Silence is never read as a pass.

Required names come from two places: the names in merge.requiredChecks, and every step in .stratum/ci.yaml that is not marked optional (a step needs no listing). Everything below applies to both alike.

A CI step has one more condition. Its run must have been dispatched under the base branch’s current .stratum/ci.yaml. If that file has changed since, the earlier result does not count, even a passed one, and the merge is blocked until the change is re-evaluated: see First-party CI.

merge.requiredChecks is enforced with the other merge protections, on both POST /api/changes/:id/merge and the batch merge. For each required name Stratum reads the newest run of that check for the change’s evaluated revision, and blocks unless it is passed:

The required check is…Merge
passedallowed (subject to the other rules)
missing — never dispatched for this revisionblocked
queued or runningblocked
failedblocked
erroredblocked

The blocked response is 403 PROTECTION_BLOCKED with one reason per check, for example Required check 'test' is still running.

Things that follow from “evaluated revision”:

  • New commits invalidate old results. After you push to the workspace and re-evaluate, the change is on a new revision with a fresh set of queued checks. A pass recorded for the previous revision does not count.
  • Re-evaluating the same revision also starts over. The new runs replace the old ones.
  • A check a checks entry declares but merge.requiredChecks does not name is shown on the change and never blocks. An optional CI step is nearly the same: its result never blocks, but it must still have run under the base’s current .stratum/ci.yaml, so a missing or out-of-date one blocks until the change is re-evaluated.

merge.allowForce behaves as it does for every other protection: a force merge skips requiredChecks only where the policy has explicitly enabled force, and never for a change that edits the policy file.

A manual conflict resolution cannot satisfy a required check — there is no evaluated revision for a runner to report against — so it is refused when requiredChecks is set. Commit the resolution to the workspace and re-evaluate the change instead.

Re-run a check when a job was flaky or the runner never reported. A re-run creates a new run (attempt 2, 3, …) of the same check on the same revision and dispatches only that check. The previous run stops counting, and if it was still pending it is ended.

  • On the change page: the Re-run button beside the check.
  • API: POST /api/changes/:id/checks/:checkId/rerun
  • MCP: stratum_rerun_check

A re-run needs write access to the project and a user credential: like re-evaluating a change, it is refused to agent tokens. It is also refused when:

codeWhy
EVALUATION_PENDINGThe change is still being evaluated; its checks are dispatched when that finishes.
STALE_REVISIONThe workspace has new commits, or the change has moved to another revision. Re-evaluate the change — that dispatches checks for the new revision.
CHECK_SUPERSEDEDA newer run of this check already exists. Re-run that one.
CHECK_NOT_DECLAREDThe policy on the default branch no longer declares this check.
CHECK_DISPATCH_FAILED (502)The new run was created but the runner could not be reached; it is errored.

A re-run does not pick up new commits and cannot be used to carry a result to code that was never evaluated.

Re-running a first-party CI step re-runs the whole job: its steps share one checkout, so every step gets a new run.

  • Change page — a Checks section lists the newest run of each check for the evaluated revision, with status, summary and details link.
  • API — GET /api/changes/:id/checks returns the same set; ?all=true returns every revision and attempt. See the API reference.
  • MCP — stratum_list_checks.
  • GitHub — once a change is promoted, each check also appears on the pull request as a stratum/check/<name> commit status: pending while queued or running, then success, failure or error, linked to the run’s detailsUrl. It is updated as the runner reports, and posted when the change is promoted for checks that finished before. Only the newest attempt on the pull request’s own head commit is posted: after a re-evaluation the statuses wait until the change is promoted again. Like stratum/evaluation, posting is best-effort, so a status GitHub refused stays stale until the next report.

An agent waiting to merge should poll stratum_list_checks (or the API) until every required check is terminal.

import { createHmac, timingSafeEqual } from "node:crypto";
import express from "express";
const KEY = process.env.STRATUM_SIGNING_KEY;
const sign = (body) => `sha256=${createHmac("sha256", KEY).update(body).digest("hex")}`;
const app = express();
app.post("/stratum/checks", express.raw({ type: "application/json" }), (req, res) => {
const expected = Buffer.from(sign(req.body));
const presented = Buffer.from(req.get("X-Stratum-Signature") ?? "");
if (presented.length !== expected.length || !timingSafeEqual(presented, expected)) {
return res.sendStatus(401);
}
const job = JSON.parse(req.body);
res.sendStatus(202); // acknowledge first, work afterwards
for (const [name, checkRunId] of Object.entries(job.checkRunIds)) {
void runCheck(job, name, checkRunId);
}
});
app.listen(process.env.PORT ?? 8080);
// One counter per check run. `sequence` must go up with every report for a
// run; a clock can repeat or step backwards, and a report whose sequence is
// not above the last one applied is acknowledged and ignored.
const sequences = new Map();
async function report(job, checkRunId, fields) {
const sequence = (sequences.get(checkRunId) ?? 0) + 1;
sequences.set(checkRunId, sequence);
// Built and signed ONCE. Every retry sends these same bytes, so a report
// that was applied the first time is recognised and not applied twice.
const body = JSON.stringify({ checkRunId, headSha: job.headSha, sequence, ...fields });
const request = {
method: "POST",
headers: { "Content-Type": "application/json", "X-Stratum-Signature": sign(body) },
body,
};
for (let attempt = 0; ; attempt++) {
const res = await fetch(`${job.callbackUrl}/${checkRunId}`, request).catch(() => null);
// Lost in transit, rate limited, or Stratum is briefly unwell: try again.
// Anything else is an answer. 409 means this run no longer counts (new
// revision, re-run, finished, past its deadline): stop working on it.
const retry = res === null || res.status === 429 || res.status >= 500;
if (!retry) return res.status;
if (attempt >= 8) return 0; // gave up; the check's deadline will mark it errored
await new Promise((resolve) => setTimeout(resolve, Math.min(60_000, 1000 * 2 ** attempt)));
}
}
async function runCheck(job, name, checkRunId) {
if ((await report(job, checkRunId, { status: "running" })) === 409) return;
const result = await runJobInIsolation(job, name); // see the executor safety guide
await report(job, checkRunId, {
status: result.ok ? "passed" : "failed",
summary: result.summary,
detailsUrl: result.url,
});
}

The counter here lives in memory, which is enough for one process. A runner that can restart mid-job has to keep each run’s last sequence somewhere that survives, or its first report after a restart is ignored as stale.

runJobInIsolation is where your CI lives. It runs code from a diff an agent wrote: read Running a Webhook Evaluator Executor Safely before you write it.

  • APP_URL must be set on an instance that evaluates on the evaluation queue (the default deployment). It is the public origin put in callbackUrl; a queue consumer has no request to take one from. Without it the checks are errored with a summary saying so. An instance that evaluates inline falls back to the origin of the triggering request.
  • DEPLOY_SECRET_KEY must be set, as for any project secret. Without it the signing key cannot be decrypted, dispatches fail closed, and reports are rejected.
  • The deadline sweep runs on the existing five-minute cron. No new binding or queue is needed.
  • Check runs report a status, a summary and a link. There are no log uploads, annotations or artifacts for a runner of your own; a first-party CI step has a log, served by Stratum.
  • Stratum does not cancel work on the runner. A run that has been replaced learns of it from the 409 on its next report.
  • There is no event or outbound webhook when a check finishes; poll the API or the MCP tool.
  • A dispatch that fails is not retried automatically. Re-run the check or re-evaluate the change.
  • The CLI has no check-run commands yet.