808. Every gate accounts for its time
(Promoted from the proposal pile on 2026-10-06 (UTC); number provisional until the merge queue lands it.)
(Ruled 2026-10-06 (UTC), calef on PR #1778, four forks. §254 (a gate prints what each item cost, and a job near its budget warns rather than fails) records them. Fork 2 went against this block's recommendation: per-suite budgets are refused, and a soft warning with a tracking issue replaces them. The text below is rewritten to the rulings.)
Raised 2026-10-06 (UTC) by lane gate-time-proposal, a writing-only lane. calef asked for a
proposal measuring where the riscv64 suite's time goes, then: "Is there a more general milestone
here? Don't we want all of the gates to account for how they spend their time?" The maintainer
agreed. This is the general milestone. Its first slice, and the riscv64 answer, is
milestone 807 (the kernel suite reports what each test cost), which this block depends on. Title
and slug are drafts.
Why
Milestone 721 (each merge-group CI job has a 20-minute budget) gave every ci.yml job one number,
its wall time, and a gate on it. That gate works. On 2026-10-06 it fired on cpu-matrix at 20.1 to
21.0 minutes and ejected pull requests from the queue, which is what PR #1775 answered by splitting
the job in two.
A wall-time gate can say that a job is slow. It cannot say why. To answer that, PR #1775 sampled 31 runs over seventeen days and read per-step times from the Actions API. Per-model and per-test times had to be read from log timestamps. Its finding was that no step regressed and the suite grew, across many milestones, at about 0.1 minutes per model per day. The gate fired about two weeks into a drift that every run in the window showed.
So the rule this milestone builds: a gate that spends time says where, in a form a script can read, without anyone scraping a log.
What the tree already accounts for
Some gates do this already, each its own way:
| gate | what it records | where |
|---|---|---|
every ci.yml job |
its own wall time, against 20 minutes | helpers/job-budget.py, .github/ci-job-budgets (milestone 721) |
swish-check |
seconds per line, per leg, against a baseline | xtask/src/swish_check.rs, milestone 722 (swish-check fails a leg that costs five times the others per line) |
| re-falsify | seconds per harness, used to balance shards | notes/project-metrics/falsification-times.tsv |
fuzz |
60 s per target, fixed by design | script/fuzz |
| the kernel suite | seconds per test, printed only at 5 s and over | kernel/src/testing.rs |
cpu-matrix |
one log per model, as an artifact | ci.yml |
Nothing reads CI time over weeks. script/metrics charts the merge queue's ejections, from milestone 724 (the merge queue reports its
ejection share and its time to merge), but not the wall time of the jobs that cause them. verify.yml is outside milestone 721's
budget because nobody measured its job medians, which is that milestone's first BUGS entry.
What "accounts for its time" means
Three levels. Each gate provides the ones that apply to it.
- Per step, for every job. GitHub's jobs API already returns each step's start and end, so this
needs no change to any job. A daily collector reads it for green merge-group runs and appends a
committed record. It follows
helpers/merge_queue_share.py, which writesmerge-queue-daily.csvthe same way for milestone 724. - Per phase, inside a step that does several things.
script/ci-build testruns fifteen phases in one step: the host pass,std-src, three architectures, three x86_64 variants and the boot tour.xtasktimes each phase on the host and writes it to a machine-readable file per job (name provisional), uploaded as an artifact. - Per item, for a gate made of many items: tests per architecture, Kani harnesses, fuzz targets,
cpu-matrixmodels,swish-checklines. The item's own framework reports the time, never a log scrape. For the kernel suite that is milestone 807, in §254'stime <ms> <test path>format. Forswish-checkand re-falsify it already exists and only moves into the shared file.
What the first read of per-step data already found
Run 37505448674 on 2026-10-06: 85 of script/bootstrap's 92 seconds in the test job were
cargo install building script/lint's tools. Six jobs that never lint did it, about 8.5
runner-minutes per merge-group run. It was cheap and reversible, so it did not wait for this milestone:
NIFE_SKIP_LINT_TOOLS (#1778) removed it.
What catches the next drift before the wall-time gate fires
The drift PR #1775 found was spread across about a hundred tests, which a per-test ceiling would not
have seen. This block recommended a per-suite budget; calef refused it (§254, Fork 2), because a
second hard limit fails whichever pull request tips an aggregate over, as cpu-matrix's budget did
to #1755 and #1766. Milestone 721's job budget stays the only hard limit. In its place, a warning
that fails nothing:
- A job past about 85% of its budget in
.github/ci-job-budgets(17 of 20 minutes) warns and stays green. Its step summary shows its time against the budget and its slowest items. - A routine running as
nife-smelter[bot]opens one labeled tracking issue per job when it first crosses the line, updates it, and closes it when the job is back under. A label needs an object, and a commit onmainhas none, which is why the signal is an issue. - calef ruled on 2026-10-06 (UTC) that the issue must reach a session (§254). It is a
needs-maintainercause, read with one command that lists pull requests and issues together, and a bullet under the weekly job-time chart while it is open.
At the measured growth of about 0.1 minutes per model per day, the longer cpu-matrix shard would
have opened its issue about three weeks before the hard limit. A script/lint check holds the rule
itself: a ci.yml job that checks out the tree uploads the breakdown file or has an exemption line
with its reason.
Where it lands
- A CI artifact per job, every run: the per-phase and per-item file.
- The job's step summary, every run: the slowest items and the phase table (§254, Fork 3). It costs nothing unless someone opens it. No pull request comment.
- A daily CSV under
notes/project-metrics/(name provisional), appended by a scheduled workflow on milestone 724'shelpers/merge_queue_share.pypattern: per-job, per-step and per-test times on main (§254, Fork 4). - A weekly chart from
script/metrics: each merge-group job's time against its milestone 721 budget. It is the chart milestone 721 said was missing. - The 85% warning and the tracking issue above. Neither fails a job.
The runner-minutes measurement pass calef approved on 2026-10-05 is a one-off report on concurrency, and it stays owed. The daily record makes it repeatable by script.
Parity
The per-step record and the warning are host-side, so they are architecture-neutral. The per-test
record is the kernel's shared test framework and lands on aarch64, riscv64 and x86_64 at once
(milestone 807). The step summary and the chart show suites per architecture, because the three
emulators cost differently: riscv64 system tests took 129 s against aarch64's 98 s in the run
above. A suite that runs on fewer than three architectures says why in its exemption line, which is
§19 (architectural parity is a tenet) applied to cost. Milestone 722 already compares cost across architectures for swish-check.
Exit criteria a stranger can check
notes/project-metrics/holds a daily CSV of per-job, per-step and per-test times for green runs on main ofci.ymlandverify.yml, appended by a scheduled workflow on the pattern ofhelpers/merge_queue_share.py.script/metricscharts each job's weekly time against its milestone 721 budget.- Every
ci.ymljob that checks out the tree uploads the breakdown file or carries an exemption line with a reason, andscript/lintfails a job that does neither. - The kernel suite on all three architectures,
cpu-matrix,swish-check, re-falsify andfuzzwrite per-item times into that file from their own frameworks. - A job's run on main past about 85% of its budget emits a warning, stays green, and lists its slowest suites and tests in the step summary. A host test proves the warning fires above the line, stays silent below it, and never changes the exit status.
- The routine opens a labeled tracking issue for a job that crosses the line, updates the same issue on a later crossing rather than opening a second, and closes it when the job is back under. A host test drives all three transitions against a recorded API fixture.
- An open budget issue appears in the session's
needs-maintainerlisting with causebudget, and leaves it when the issue closes.helpers/needs-maintainer-selftest.shproves both from fixtures, andbriefs/session-start.mdandbriefs/survey-the-queue.mdgive the one combined query. - While a budget issue is open, the weekly job-time chart carries a bullet naming the job, its
percentage of budget and the issue number, written through
week-notes.csv, and the bullet ages out with its week. verify.ymljoins milestone 721's budget, using the medians the record now has, which closes that milestone's first BUGS entry.- Milestone 663 (bound the host pass) takes its deadline from the host pass's measured time in the record, as its block asks.
Cost
- Runner-minutes: the daily collector is one short job a day on the x86_64 pool, which is not the constrained one. Writing and uploading the file costs seconds per job. The step summary costs nothing. The bootstrap fix found on the first read returns about 8.5 arm64 runner-minutes per merge-group run.
- Claude tokens: zero per pull request, by design. Nothing is posted as a comment (§254, Fork 3). The cost lands only when a tracking issue opens, which a session reads once and acts on.
Ranking
This is not one of the nine fatal risks, and it is not on the customer path, which is vacant. It serves principle 2: queue throughput is the method, and the bottleneck since 2026-08-04 has been how fast one merge queue lands. A wall-time gate that fires late ejects pull requests, which is where lanes and tokens are lost. So it ranks below work that moves a fatal-risk verdict and above work that does neither. The bootstrap fix and the calendar fix are each under an hour of lane work and should go now on cost alone. The first slice should go when a lane frees. The rest can wait for it.
The forks, ruled by §254
All four were ruled on 2026-10-06 (UTC), in the order this block asked. §254 has calef's words and the refused options.
- The kernel record's format: the printed
time <ms> <test path>block, grammar in a shared crate. Milestone 807 builds it. - What gates drift: a soft warning at about 85% of the milestone 721 budget, raised as a labeled tracking issue per job. The per-suite budget this block recommended was refused.
- Where the per-run breakdown shows: step summary plus artifact, no pull request comment.
- The daily record and chart: a CSV under
notes/project-metrics/on milestone 724's pattern, charted weekly byscript/metrics.
Reuse
Taken: GitHub's jobs API for per-step times, actions/upload-artifact for the file, and the step
summary for display. Followed: helpers/verify_times.py and helpers/merge_queue_share.py for the
daily record, and helpers/job-budget.py itself for the budget, the line and the job parser, which
helpers/ci_job_times.py imports rather than copies. The issue routine calls gh issue directly;
helpers/watcher_watch.py (milestone 723 (a stopped merge watcher is reported within three of its own intervals)) was read and is shaped around watchers. Written: the collector, the warning and the issue routine, a few hundred lines of Python
against this tree's own record formats. JUnit XML was
considered as the file's format and not taken, because no consumer here reads it.
What was considered and lost
- Splitting more jobs into shards each time a budget fires. It shortens the pole and spends the scarce resource, arm64 runner concurrency. PR #1775's own table prices five shards at 87% more runner-minutes.
- Raising budgets. It moves the day the gate fails.
- A per-suite, per-architecture budget ratchet, which this block recommended. calef refused it (§254, Fork 2): a second hard limit ejects whichever pull request tips the sum.
- cargo-nextest for host tests, which reports per-test time and JUnit XML. It is a dependency, which
§46 (thin primitives or whole subsystems) makes a decision, and the host pass is 89 of 900
seconds. libtest's own JSON output with per-test times, behind
-Z unstable-optionson nightly, is the in-tree route if the host pass ever matters. That flag is recalled, not re-read.
What was built
Every name below is provisional.
- The warning line.
helpers/job-budget.py checkwarns at 85% of a job's budget, inci.ymlandverify.yml, and writes the job's minutes to the step summary. - The record file. One
time-record.tsvper job, in milestone 807's format, uploaded astime-record-<job>ortime-record-<job>-<matrix value>. The kernel suite ownstarget/time-record.tsv; every other writer appends only toNIFE_TIME_RECORD, which CI sets.helpers/time_record.pywrites for gates that are not Rust. - Per item, from each framework. The kernel suite and
cpu-matrixwritetestandphaserows (milestone 807). The host pass writes onephaserow, leghost.swish-checkwrites alinerow per typed line,script/fuzzatargetrow per target, build included, andscript/falsificationsafalsificationrow per replayed record. - Upload or exemption.
.github/time-record-exemptionsgives eachci.ymlcheckout job that uploads nothing its reason, andhelpers/time_record.py lintholds it. - The daily record.
helpers/ci_job_times.py update, daily inmetrics.yml, writes per-job and per-step medians of every merge-group run tonotes/project-metrics/ci-job-times.csv, and from each green run's records everyphaserow and every item with a daily median of 1 s or more (ITEM_FLOOR_MS).script/metricsdrawsci-jobs.svgagainst the 20-minute ceiling. - The tracking issue.
helpers/ci_job_times.py syncopens, rewrites and closes onenear-budgetissue per job asnife-smelter[bot], and adds a week-notes row while it is open. One run at or past the line opens it; three under close it (§254's Open section).needs-maintainerlists it with causebudget. verify.ymlunder the budget.falsify-shardhas a 25-minute line in.github/ci-job-budgets: a shard planned at 17 minutes must outlive one record at its own 15-minute limit to report it.
Exit criteria
| criterion | state | |
|---|---|---|
| 1 | the daily CSV per job, step and test, and the weekly chart | met. Per-item rows start with the first daily pass after merge, when artifacts first carry their job key. Over 2026-10-18's 88 green runs they are 454 rows, 73 kB a day. ci_job_times.py --selftest holds the floor and the mapping |
| 2 | upload or exemption, held by script/lint |
met. time_record.py --selftest; deleting fmt's exemption line fails the lint naming fmt |
| 3 | per-item times from the kernel suite, cpu-matrix, swish-check, re-falsify and fuzz |
met. Run 39292789618 uploaded every record with rows: lines on three architectures, ten fuzz targets, the host pass. Re-falsify wrote rows in a local sweep; its first CI shard runs on a diff that reaches a record |
| 4 | the 85% warning, its summary, its host test | met |
| 5 | the issue's three transitions, tested against a recorded fixture | met |
| 6 | budget in the needs-maintainer listing, the selftest, the briefs |
met |
| 7 | a week-notes bullet while an issue is open | met, through sync |
| 8 | verify.yml joins the budget |
met. To 2026-10-19 (UTC), prove shards ran 12 to 14 minutes, maximum 21.1 once in about 600 merge-group runs; re-falsify shards 8.5 to 10.8, maximum 18.3 |
| 9 | milestone 663's deadline from the host pass's measured time | not yet. Rows (test-shard, host / host crates, phase, suite) start 2026-10-19 20:40 (UTC). The week 2026-10-20 to 26 is recorded by the 2026-10-27 daily pass; the deadline is then milestone 663's work |
BUGS
- The warning reads one run, and
syncdamps the issue (one run opens, three close). A job hovering at the line keeps one issue open rather than flapping, and may hold it open longer than its median deserves. syncruns once a day, so an issue opens up to a day after the crossing run.helpers/nanny.py, which wakes a running session, still reads pull requests only. A budget issue reaches a session at its nextneeds-maintainerread, not mid-session.- A merge-group run's runner varies, and every number here is wall time on a shared hosted machine. The record takes medians over runs for that reason.
- Item rows under 1 s a day are dropped, so one fast test's slow growth is visible only in its
image's
suitephase. script/lintis a few hundred checks in one job and times none of them.ci.ymlandverify.ymlboth name a jobgate, so the two share one budget key and one tracking issue. Both run in seconds.- The fuzz job builds no
xtask, so it uploads its record without a step summary.
Follow-on
- Outstanding. Exit criterion 9, through milestone 663's lane from 2026-10-27 (UTC).
Index row
Milestone 721 gave every CI job a wall-time budget that says a job is slow but not why. This makes every gate report where its time goes, per step, per phase and per item, in a step summary and an artifact, with a daily record and a weekly chart against the budgets. A job on main past about 85% of its budget warns and opens a labeled tracking issue rather than failing (§254), so the next drift is named weeks before it ejects a pull request.