Skip to content

CI speed: where merge time goes and a tiered test plan #1390

Backlog

Description

@scuttletoby

Research only: nothing was changed. Window: Fork tests runs created 2026-11-26 00:00Z to 2026-11-29 about 17:30Z (1,103 runs, 3.7 days), the 214 pull requests merged since 11-26 (the first merged on 11-27), and the 52 merge trains, which started 11-27 20:40Z. All data comes from GitHub (runs, check runs and their annotations, label events, commits); see "Method" at the end.

Recommendation

A tiered plan is safe for the fork's own tooling tests, and that is where the minutes go. The merge wait comes from the conveyor's queue and from the runner cap, not from slow tests.

Do these three, in this order:

  1. Run only the affected tooling tests on pull requests; keep the full suite on trains, conveyor reruns and main. Use the kit's own fork-ci/actions/test-select with a declared input map, not a folder rule. Saves about 2,100 job-minutes a day (13% of all Fork tests minutes) and about 2.7 jobs per PR run (of 20). Risk: 2 of 37 real tooling catches on PRs would have moved to the train, each costing about one red train (about 9 min, plus a rebuild).
  2. Skip the Fork tests run on main when a green full-suite run already tested the same tree, and add one scheduled full run on main. 42 of 45 green trains landed exactly the tree they tested, and main tested it again. Saves about 830 job-minutes a day (5%). It adds no code risk: same tree, same suite. It also drops 3 of the 10 red main runs, all flakes.
  3. Quarantine flaky tests automatically, but fix them first. 9 of the 10 red main runs were flaky tests and 1 was infrastructure. None was a regression. Each flaky test got a fix PR hours later. Quarantine keeps a test running but stops it blocking for a short time limit. It never applies to a test the pull request changes or added recently. Saves about 8 PR reruns a day (about 450 job-minutes), plus the red-CI waits, which are the largest PR wait in the G21 Faster merges: batched merge queue and shared build caches #862 study.

The conveyor's log-only skip check (#862 fix 5) is low leverage as written. Over 78 single-PR reruns it would have skipped 11 (14%), all of which were green on rerun. Shared ledger files stop most other skips.

1. Label to merge

191 merged PRs had fork:merge-ready. Each one is timed from its last label to its merge:

PRs median mean p90 total
Label to merge, all 191 24 min 38 min 83 min 121 h
merged in a train 117 42 min 49 min 102 min 95 h
merged alone (serial) 74 11 min 22 min 44 min 27 h

Where those 121 hours went:

Part Hours Share
Waiting for the conveyor to start on the PR 81 h 67%
...while the conveyor's lane was busy with other PRs' CI 46 h 38%
...while the lane was idle (no conveyor CI run in flight) 36 h 30%
CI of the train or rerun 32 h 26%
Merge step after green 7 h 6%
  • Retries are on top of this. 24 PRs were labelled more than once: unlabelled after a red rerun, a conflict or fork:merge-blocked, then labelled again. First label to last label added 75 h (median 75 min each). 21 PRs got fork:merge-blocked once or more.
  • The PR's own CI was rarely the wait. At labelling time, 42 of 188 PRs still had a run in flight, 2 min on average.
  • Train PRs wait longer because trains form when the queue is long. Train CI took 8.2 min median, 22 min p90. A serial rerun took 6.8 min median, 13 min p90.
  • The conveyor lane was busy 40% of the time (19 of 47 h), in bursts. In those bursts PRs queue behind each other: that is the 46 h.
  • The 36 h of idle-lane wait (median 3 min, mean 11 min per PR) is conveyor-side: polling, gates, or waiting on other workflows. GitHub data cannot split it further. That needs the conveyor's own log, which is not readable from where this study ran.

2. Fork tests: wall time, jobs, queue

Run kind finished runs wall median wall p90 job-min jobs per run
pull_request 708 7.5 min 20.4 min 43,131 (72%) 20.1
push to main 130 (+85 cancelled) 7.0 min 14.2 min 11,021 (18%) 25.8
train (dispatch) 50 7.9 min 21.0 min 3,854 (6%) 24.5
head and other dispatch runs 32 8.7 to 8.9 min 17 to 24 min 2,310 (4%) 22 to 24

That is 60,300 job-minutes in total, about 16,200 a day.

  • No job is slow. Medians: Test (packages) 4.9 min, Workflow lint and upstream drift 4.2, Test Web 4.2, Test Server 3.8, Fork kit tests 3.4, Secret scan tests 3.3, Build and Typecheck 2.6. The slowest job ever took 8.3 min.

  • The critical path (the last job to finish in a green run) on PRs: Test Server 167 times, Workflow lint 144, Fork kit tests 115, Test 55, Test Web 33. On trains and main it is Test Server and Test.

  • Runner queue, not test time, makes the p90. Job queue wait (time from when a job may start to when it starts):

    Run kind median p90 p99
    PR 0.6 min 7.8 min 21 min
    train 0.1 min 7.4 min 24 min

    The p90 wall time (20 min) is about 3 times the longest job.

  • The runner cap is the ceiling. Concurrent Fork tests jobs plateau at 36 to 40 for 28% of the whole window and almost never go above 40. Other workflows share the same cap. One PR run is about 20 jobs, so two pushes landing together fill it.

  • Where the minutes go, by job group:

    Job group Share of all minutes Share of PR minutes
    Fork tooling jobs (kit tests ×3, kit tests as root, action and fleet walls tests, workflow lint, secret scan tests) 38% 41%
    Test Server 27% 27%
    Test Web 13% 11%
    Test (packages) 10% 9%
    Lint, typecheck, gates and the rest 12% 12%

    The change detector already skips app jobs when no app path changed: 310 of 802 PR runs had no Test Server job. The tooling jobs have no gate at all, so every PR runs them whatever it changes.

3. Red runs on trains and main

Trains: 6 red of 52 (12%). 5 were real problems in a member PR and 1 was infrastructure. None was a flake.

Train Members Failure Verdict
11-28 23:39 #1185 #1241 #1251 #1253 SlotObserver.test.ts #1241's own new test was racy. Real (see #862).
11-29 10:41 #1244 #1267 #1296 #1301 "Finish installing browser secret helper build libraries" timed out Infrastructure
11-29 11:01, 11:41, 12:03 three trains, each with #1283 fork-kit/gardener/tests/checks.test.py Real clash. #1283 and #1267 both changed gardener. #1283's own rerun after merging main was red too. It was fixed by a new commit at 12:50 and merged at 14:07.
11-29 16:34 #1357 #1358 #1360 #1364 calmSidebarList.browser.test.tsx A test that #1364 changes (#1364 is still open). Likely real.

This is the first clash measured here. The #862 study had none in 166 trials.

What the red trains cost: about 1,000 member-minutes from the red train to each member's merge. Members were batched again without the culprit, mostly in the next trains. 2 PRs (#1185 and #1357) fell back to serial, adding 18 and 25 min.

Main: 10 red of 130 finished push runs (7.7%). 9 were flaky tests, 1 was infrastructure, 0 were regressions.

Flaky tests by file. This counts failures with a flake signal: red then green with no change by the PR, red on a tree that passed elsewhere, or fixed by a commit that did not touch the test.

Test file flake signals failures with a real fix
.github/scripts/fork-owned-reads.test.py 5 2
fork-ci/actions/pr-queue/review_judge.test.py 4 6
.github/scripts/fork-release-downloads.test.py 3 0
fork-kit/cleaner/tests/clones.test.py 3 0
fork-kit/cleaner/tests/pack.test.py 3 0
ComposerPromptEditorTiptap.input.browser.test.tsx 3 (2 on main) 1

26 files had at least one flake signal, 48 failures in all. Per file, the flake rate is low: under 1% of the runs of its job (for example 3 in 548 Test Web runs). Added up across files, about 7% of full-suite runs hit at least one flake. review_judge.test.py shows why quarantine must be per test and time-limited: the same file also caught 6 real bugs.

4. The skip check (log only)

.github/scripts/fork-merge-skip.cjs and .github/fork-merge-skip.json hold the settings: mode: log, max_merges_old: 2, max_files: 100. The conveyor runs the check before each single-PR merge. It has only been on main since 11-29 10:02Z (#1264), and its log lines stay on the conveyor's host. So this study replayed the shipped script itself, read-only, over all 78 single-PR conveyor reruns since 11-27. A rerun here is the update-branch merge commit and its run. Head = that commit's first parent, tip = its second parent. Tested main = main's tip when the head's last green run started, a close stand-in for the new tested main notice.

Row Verdict Cases
1 merge: the green run already tested main's tip (k = 0) 10
4 skip: k at most 2, no file changed on both sides 1
3 rerun: a CI, dependency or config file changed on either side 47
2 rerun: no green run on that head 20

5. Which test groups caught real bugs on pull requests

A red episode is counted once per PR, job group and head. "Fixed by own code" means the PR got new commits of its own (by patch id, so rebases count correctly) before that job turned green. It is an upper bound for real catches. The column after it is the subset where the fix did not touch the failing test's folder, which may be a flake.

Job group fixed by own code ...fix elsewhere, maybe flaky green after main update only flaky (passed on rerun) infrastructure unresolved or unmerged
Gate: fork-checks (no database schema changes) 32 0 13 0 0 12
Lint 31 4 1 0 0 8
Build and Typecheck 22 0 0 0 2 5
Test Server 21 1 4 0 0 2
Workflow lint and .github/scripts tests 20 6 11 1 0 10
Test Web 11 3 0 0 0 4
Fork action and fleet walls tests 9 4 0 0 2 3
Fork kit tests 8 5 2 0 6 4
Test (packages) 1 1 0 0 2 0
  • Every group caught real bugs on PRs. No group is flake only.
  • Lint, typecheck and the gates are deterministic and cheap: keep them on every PR.
  • The catches sit in the PR's own area. Where the failing test file is known, 48 fixes touched the test's own folder, 7 its package and 24 elsewhere. That locality is what makes selection safe.

Options with numbers

Option Saves per day Bug risk it adds Effect on merge time
A. Affected-only tooling tests on PRs: test-select with a declared input map; always_all for shared readers (fork-kit/common/, .github/workflows/, .github/actions/, the queue config); an unknown path runs every test; full suite on trains, conveyor reruns, main and release runs about 2,100 job-min (13% of all, 18% of PR minutes). The PR kit, action and as-root jobs used 11,900 job-min; a folder rule keeps 23% of their test seconds, and 53% of PR runs select none, so 5 jobs can be skipped outright A folder rule would have missed 2 of 37 real tooling catches: #1165's pc-agents tests read .github/scripts/fork-fleet-walls/, and #1162's review_judge.test.py reads .github/fork-pr-queue.json. A declared or traced input map catches both. Anything missed fails the train instead: about one red train, about 9 min, plus a rebuild Less runner-cap pressure, so train and rerun p90 drop (today 22 and 13 min). It does not touch the 81 h conveyor wait.
B. No main rerun of a tree a green full-suite run tested, plus one scheduled full run on main about 830 job-min (5%); 42 runs over the window None for code: same tree, same suite. Loses drift detection (runner image, outside services) between scheduled runs Fewer false red mains: 3 of 10 in the window
C. Auto-detected quarantine, fix first. Flaky when red then green on the same tree, or red on a tree a train passed. File or attach an issue, keep running the test, stop it blocking for up to 48 h. Never applies to a test the PR touches or that is under 7 days old about 8 PR reruns (about 450 job-min) and the red-CI wait each one starts. Red-CI waits were 25% of PR-hours in the #862 study Could hide a real intermittent bug. #1241's racy new test was the PR's own bug; the exclusions cover that case. Per test, not per file (review_judge.test.py caught 6 real bugs) Fewer relabel cycles (75 h in the window), fewer false stops
D. Fewer jobs per run: fold the sub-2-minute jobs (Release Smoke, Rust, Fork checks ran, Secret scan, kit tests as root) into neighbours; give the kit shards a test-count floor under 5% of minutes; about 4 to 5 jobs per run None Less queueing at the 40-job cap
E. Skip check with ledgers exempt (#862 fix 5) about 50 min of conveyor CI (14 skips over 2 days instead of 11) Low: no would-skip rerun was red Small: only single merges, 14 to 19% of them

Together, A + B + C save about 3,400 job-minutes a day (21%). They cut the time the runner cap is full and make red mains rare enough to act on.

For merge time itself, the next lever is not CI.

  • The 81 h conveyor wait: 46 h is queueing behind its own single lane in bursts, and 36 h is idle-lane gaps that only the conveyor log can explain.
  • The 75 h of relabel cycles.
  • Larger trains when the queue is long would cut the 46 h, at a higher cost per red train. 5 of the 6 red trains were real, so trains are earning their keep.

Notes and limits

  • "Real" means a red job that turned green only after the PR's own new code. A flaky test fixed at the same time counts as real here, so the real counts are upper bounds.
  • Flake counts are lower bounds: many red PR runs were never rerun on the same commit.
  • The conveyor's own log (round timing, the skip check's log lines since 11-29 10:02Z) was not available. The skip replay used the shipped script with an estimated tested main. Rerun and train membership come from the train branches' commits and the conveyor's update-branch merge commits.
  • Not run here: no test, build or server. Only read-only git and node .github/scripts/fork-merge-skip.cjs. API use was about 1,600 REST and 900 GraphQL points: bulk run lists, check runs in batches of 25 suites, annotations for failed jobs only, and one log read per dispatch run to learn what it tested.

Method

  • Runs: actions/workflows/fork-tests.yml/runs, one query per day.
  • Jobs: GraphQL check suites with their check runs, all attempts for rerun suites, and annotations of failed check runs, which give the failing test file and test name.
  • What each dispatch run tested: the Changes job's "Testing (from )" line, which identified 52 train runs.
  • PRs: GraphQL search for merged:>=2026-11-26, with label events, commits and files.
  • Concurrency: the overlap of all Fork tests job intervals.
  • Old PR heads were fetched read-only so patch ids and trees could be compared.

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 29, 2026

    @scuttletoby
    OwnerAuthor

    Follow-up: the conveyor's own log (research only, nothing changed)

    Window: 11-27 16:48Z to 11-29 17:36Z (48.8 h, 359 conveyor runs, 216 PRs merged by the conveyor). From the last fork:merge-ready label to the merge: 141 h.

    Part Hours
    Waiting before the conveyor starts on the PR 89.8
    ...behind another train's CI 38.3
    ...behind another PR's serial path (update branch + full CI) 24.8
    ...conveyor running, nothing in flight (gates, builds, merges) 12.3
    ...between runs (3-min timer) 5.8
    ...timer stopped by hand (2 stops, 91 + 25 min) 8.6
    The PR's own train CI or serial rerun 43.1
    Merge steps, between tries 8.4

    Relabel cycles on top: 32 cycles, 104 h. Conflicts with main are 17 of them and 75 h (median 108 min until relabelled). Red serial reruns: 7 cycles, 18 h.

    What stands out:

    • The serial path holds the lane longer than all trains together: 117 runs, 15.8 h, against 9.7 h of train CI over 52 trains. A PR that arrives during a serial run waits the whole 7-14 min.
    • Conflicts come from a few shared list files. Of the 18 PRs blocked for conflicts, 9 touched the fork docs index, 7 fork-seams.json, 6 forkLayers.ts and 5 fork-ci-tests.txt. 55 "does not merge cleanly" drops hit 23 PRs, up to 7 times each. 14 of the drops were conflicts with main itself, and the serial path then failed within about 20 s. The other 41 conflicted only with an earlier PR in the same train, and merged in a later train.
    • The new gate judge (log only, since 11-29 10:29Z) slows every train. The time from one train to the next went from a median of 26 s to 197 s. Each merge inside a train went from 6 s to 54 s. It judges one PR at a time, twice. A queue model says this almost doubles the queue time at today's load (46 h → 79 h per 216 PRs). The real median label-to-merge went from 18-24 min to 39 min, though a streak of red trains also hit that window.
    • A red train retries only its first PR alone. That PR was innocent 3 of 5 times. On 11-29 from 10:50 to 12:16, 4 red trains in a row with 2 culprits used about 70 min of lane time while 5-8 PRs waited.
    • The 3-train limit per run caused 12 exits and 63 min of idle lane. The train-size cap of 4 hardly matters: it held back waiting PRs for 6.3 PR-hours, and a cap of 8 gains 0.2 h in the model.

    Proposals, ranked by hours saved and merge-path risk:

    1. Remove conflicts at the source (no merge-path risk). Split the 4 shared list files into one file per entry, or generate them. When a PR conflicts with main itself (git merge-tree against main alone), mark it blocked at once and start a rebase writer, instead of trying the serial path. Estimate: 40-60 h saved per 2 days.
    2. Make the gate cheap (low risk). Judge all candidates in parallel, while the train's CI runs. Judge all train PRs at once right after green, and keep the "main is exactly the expected commit" check before each merge. The verdicts stay the same. About 30 h per 216 PRs at today's load.
    3. Small timer fixes (near zero risk). Loop instead of exiting after 3 trains. Poll every 30-60 s while PRs are waiting. Pause with the hold file, not by stopping the timer. About 14-20 h per 2 days.
    4. Later (higher risk): 2 trains in flight, with the next train built on the running one, and on a red train test halves in parallel instead of the first PR alone. The model saves 12 of 46 h (p90 wait 20 → 12 min). This changes the merge path and uses more runners when a train is red.
  2. scuttletoby commented on Nov 30, 2026

    @scuttletoby
    OwnerAuthor

    Working on tier 3 (quarantine), part 1, log only: a quarantine ledger (one file per entry under .github/fork-quarantine/: test file, test name, issue, at most 48 h) and the fork script test runner's verdict on each failed test (all its failed tests covered by a live entry, the PR changes neither the test nor the entry, the test file is 7 days old or more). Log only: it prints and records what it would excuse and never changes a pass or a fail; making it block (the fork-ci-result record check is in fork-tests.yml, so a workflow push) and finding flakes automatically are later parts. One fork PR.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions