Repository navigation
Description
This issue is the running log for CI duration work. An agent that is asked to "rebalance CI", "repack the shards" or "speed up CI" starts here. Read the budget, measure the current state with the commands below, fix the worst job, and append a dated log entry as a comment. Keep the issue open.
Budget
From maintainer decision M 2026-11-17, "Pack CI jobs to about 9 min" (P12: never over 10), and R43 / M-4:
- Every job in the PR workflow (
.github/workflows/pr.yml) finishes in about 9 minutes, and never in more than 10. - The whole workflow should finish in 15 minutes, ideally 10 (R43, M-4).
- A job's time is measured from
startedAttocompletedAt. Queue time comes from runner concurrency, and repacking cannot fix it. Still, watch it: more jobs can make the queue longer.
Layout
- The slow suites are split into partitions by
packages/oracles/scripts/pr-shards.mjs. Eachpr.ymlmatrix job runsnode scripts/pr-shards.mjs pattern <partition> "$SHARD"to get its-tpattern. - The end-to-end gap oracle has four partitions: fixed seed, random seed, determinism and Windows fixed seed. Their shards are generated into
scripts/ci-packed-shards.mjsbyscripts/pack-shards-from-ci.mjs, from the CI test times inscripts/ci-durations.json. Do not edit the generated file by hand. scripts/e2e-shards.mjslists the end-to-end tests. Itscheckkeeps that list equal tovitest list.node scripts/pr-shards.mjs checkfails in three cases:- a test is in no shard, or in two;
- a
pr.ymlmatrix leaves out a shard of its partition; - a job name's
/<n>does not match the length of its matrix.
- The other partitions (framework self-oracle, the static gap oracle and its Windows twin) still use hand-written patterns.
How to measure
Job durations for one run (replace the run id):
gh run view <run-id> --repo TanStack/oracles --json createdAt,jobs --jq '.createdAt as $c | .jobs[] | select(.completedAt!=null and .conclusion!="skipped") | "\(.name)\tqueued \((((.startedAt|fromdate)-($c|fromdate))/60)|floor)m\trun \((((.completedAt|fromdate)-(.startedAt|fromdate))/60)|floor)m"' | sort -t$'\t' -k3 -rn | head -20Recent runs (pr.yml runs on pull requests and on pushes to main):
gh run list --repo TanStack/oracles --workflow pr.yml --branch main --limit 10 --json databaseId,headSha,createdAt,conclusionPer-test times for the end-to-end partitions, and a repack. Run these from packages/oracles. The jobs run Vitest with --reporter=verbose, so their logs give each test's time:
node scripts/pack-shards-from-ci.mjs fetch <runId> <runId> ... # rewrites scripts/ci-durations.json
node scripts/pack-shards-from-ci.mjs pack # rewrites scripts/ci-packed-shards.mjspack prints the following for each partition:
- the shard count;
- the setup charge;
- the calibration factor and the job that set it;
- each job's predicted time;
- each test that is past the target by itself;
- each test that CI has not measured yet.
Then do these steps:
- Change each partition's
pr.ymlmatrix and job name to the printed count. - Raise the floor in
pack-shards-from-ci.mjs'spartitionsto the same count. - Run prettier on the changed files.
- Run
node scripts/pr-shards.mjs checkandnode scripts/e2e-shards.mjs check.
How the prediction works (#323):
- Each test is charged its longest measured time, a passing time if any run passed it.
- Each job is charged its longest measured setup.
- The tests' time is multiplied by the partition's calibration factor, which is the worst error of the same rule on a held-out run. Each run is predicted from the other runs, and the factor is the largest ratio of a passing job's Vitest time to its tests' charges.
fetchneeds two runs or more. Use runs of the same code: a run from an older base, with other tests or no verbose output, gives a wrong factor.
Ways to fix a slow job, in order of preference:
- Repack from fresh measurements:
fetchthe newest main runs, thenpack. A new test is charged the partition's mean until CI measures it. A new test that repeats a measured test's work can borrow that test's time throughweighsAs. - Cut a single test's cost (P12: "cost paid by cutting cost, sharding second"; M-28). More shards cannot shorten a test that is already past the target by itself.
- Add shards. The packer does this when a job of two tests or more is predicted past 9 minutes.
Do not lower or remove an oracle run budget without saying so in the PR.
Current state, 2026-12-03
On main at fee6439 (#99, run 46930652313), five end-to-end jobs ran over 10 minutes:
| Job | Time |
|---|---|
| random seed 4/7 | 15m10s |
| fixed seed 6/6 | 11m01s |
| Windows 11/11 | 10m34s |
| fixed seed 4/6 | 10m26s |
| fixed seed 3/6 | 10m17s |
The old packer did not allow for variation between runs, and its data left 64 tests unmeasured, so they were charged the mean. A random-seed test's slowest run is typically twice its fastest.
#323 calibrates the prediction and repacks.
| Partition | Jobs before | Jobs after | Factor |
|---|---|---|---|
| fixed seed | 6 | 9 | ×1.05 |
| random seed | 7 | 13 | ×1.38 |
| determinism | 14 | 20 | ×1.22 |
| Windows fixed seed | 11 | 11 | ×1.09 |
That is 53 end-to-end jobs, up from 38. A typical job runs at 0.65–0.80 of its prediction, which is about 6–7 minutes. One job sets the random-seed factor: main's 15m10s random 4/7.
On #323's runs before the merge of main, which had 51 end-to-end jobs, every end-to-end job ran under 10 minutes:
| Run | Slowest job | Slowest job, any kind |
|---|---|---|
| 46959838128 | Windows fixed seed 3/11, 8m41s | |
| 46979272177 | Windows fixed seed 3/11, 8m09s | 8m09s |
The budget for the whole workflow is not met. Runner queueing decides that time, not job length.
| Run | Jobs | Median queue | Created to last update |
|---|---|---|---|
| 46959838128 | 19.6 min | 67 min | |
| 46979272177 | 84 | 47 min | 92 min |
Other PRs were running at the same time.
Backlog
- Measure the five tests from fix(oracle-gaps): a mid-run edit lands, and the driver sees that it landed (#165) #326, which CI has not measured yet. They are charged the partition's mean, and that charge is part of why random seed has 13 jobs and determinism has 20. After a main run that includes them, run
fetchon the newest main runs of the same code, thenpack. - oracle-gaps: three determinism units are each predicted near or past 10 min alone in CI #324: cut the cost of three determinism constructed histories. Each one is predicted at 612–624 s by itself and has a job of its own; their jobs measured 352–459 s.
- Pack the framework self-oracle (9 jobs) and the static gap oracle partitions from CI measurements. M 2026-11-17 names them too, and ci: pack the end-to-end jobs from a calibrated prediction, under 10 minutes #323 packs only the end-to-end partitions.
- Whole-workflow time (R43, M-4): runs have about 84 jobs, and the median queue was 20–47 minutes. Find out the org's runner concurrency, and whether fewer, larger jobs or larger runners would shorten the run.
- Revisit the random-seed factor (×1.38) when more main runs are measured. One job sets it. If more runs show that job was an outlier, a quantile could remove jobs. The alternative was option (b) in ci: pack the end-to-end jobs from a calibrated prediction, under 10 minutes #323's body: at least 43 jobs, with jobs over 10 minutes again on unlucky seeds.
- Setup time: usually 15–30 s on Linux, with outliers of 86–90 s, and 41–75 s on Windows. The packer charges the longest measured setup to every job.
- Add a CI step that prints each job's duration against the budget, so that a PR which slows a job shows it in its own run.
- The Windows end-to-end jobs are still not blocking (Windows e2e: 'two batches each read a capture row' flakes (torn-row witness not reached) #211, Windows fixed seed: "a copy waiting on a pipe it opened" breaks bounded retention (errorsSet) once, not reproduced #311). L9 (D57) depends on them.
Log
Append one entry per repack as a comment. Give the date, the PR, what moved, the factors, the job counts before and after, and the measured times.
- 2026-11-17. M decision "Pack CI jobs to about 9 min" (P12: never over 10).
- fix(oracle-gaps): no wall-clock cut decides an outcome #99 (fee6439). End-to-end partitions at 6/7/14/11 jobs. On main's run 46930652313, five jobs ran over 10 minutes, the slowest being random seed 4/7 at 15m10s.
- 2026-12-03, ci: pack the end-to-end jobs from a calibrated prediction, under 10 minutes #323. The packer is calibrated by its worst held-out error. When one test is past the target by itself, it gets a shard of its own; before, the pack never ended.
pr-shards.mjs checknow also checks thepr.ymlmatrices. The counts are 9/13/20/11 after the merge of main (9/12/19/11 before it). Before the merge, every end-to-end job ran under 10 minutes on two runs. The results on the merged head will be added in a comment.
Activity
KyleAMathews commentedon Dec 3, 2026
Log: 2026-12-03, #323 merged (8e3b88c)
What moved.
Measured on the merged head (run 47127688160, a9ae67e).
Not met. The whole workflow time (R43, M-4): the median queue was 57 minutes, with other PRs running at the same time.