We Stopped Running Every Test on Every PR. Waits Dropped 10×.

Running only the test suites a PR can affect cut our CI runner time by 54% and the median wait for a green check from 18 hours to under 2. Here is the data, and what it cost.

ByteFalls Engineering · 2026-11-19

We changed one rule in our CI: a pull request now runs only the test suites its changes can affect. Runner time fell 54% while PR test runs rose 49%, and the median wait for a green check went from 18 hours to under 2.

The setup

Our main repository is a shell-heavy monorepo with a large integration test suite: about 7,500 tests in 150 files, split into three parallel shards of roughly 35 minutes each. It runs on a small pool of self-hosted Mac runners, so we don't pay per minute. We pay in time instead.

Most of our pull requests are opened by automated coding agents, not people. That means volume: 50 to 80 PR test runs a day into the integration branch, many of them small, touching one script or one doc.

Every one of those runs asked for all three shards. The pool could not keep up. In the week before the change, the median suite job waited 9.2 hours for a runner, and the median passing run took 18 hours to go green. Worse, 685 suite jobs sat in the queue so long that they were cancelled without ever running.

What we changed

We added a cheap first job, select suites, to every PR into the integration branch. It takes about 20 seconds. It reads the PR's changed paths, maps each one to the test files that exercise it, and hands that list to the shard jobs.

  • A PR whose changes no suite depends on (a docs-only change, say) selects nothing, and the suite jobs are skipped.
  • A PR touching one script runs only that script's tests, usually in a single shard.
  • A PR touching shared libraries or the test harness itself still fans out to all three shards.

The full suite didn't go away. It still runs on every push to the integration branch, on release PRs, and on the production branch. That run is the backstop for anything the selection misses.

The mapping reuses the same path-to-test logic our pre-commit hook already used locally, so CI and developer machines agree on what "impacted" means.

The numbers

We compared the 7 days before the switch with the first 3.7 days after it. The figures cover the integration test workflow on PRs only.

| Measure | Before (7 days) | After (3.7 days) | Change | | --- | --- | --- | --- | | PR runs per day | 55 | 82 | +49% | | Runner-minutes per day | 3,804 | 1,738 | −54% | | Runner-minutes per run (mean) | 68.6 | 21.3 | −69% | | Runner-minutes per run (median) | 68.5 | 2.3 | −97% | | Queue wait per suite job (median) | 9.2 h | 54 min | about 10× faster | | Queue wait per suite job (90th percentile) | 19.6 h | 4.8 h | 4× faster | | PR opened to green (median) | 17.9 h | 1.7 h | about 10× faster | | PR opened to green (90th percentile) | 40 h | 7.7 h | 5× faster | | Suite jobs cancelled before any runner took them | 685 | 25 | −96% | | Runs that finished green | 33% | 84% | +51 points | | Runs that needed a rerun | 57 | 1 | −98% |

How the 304 PR runs after the switch split by suite jobs needed:

| Suite jobs selected | PR runs | Share | | --- | --- | --- | | None (skipped) | 83 | 27% | | 1 | 177 | 58% | | 2 | 15 | 5% | | 3 (full fan-out) | 29 | 10% |

Before the switch, 386 of 388 PR runs started all three.

The real win was the queue

A 54% cut in runner time is nice. A 10× cut in waiting is what people actually feel.

On a fixed runner pool, demand above capacity doesn't slow things down a little. It builds a queue that grows all day. Before the change, each run asked for about 105 minutes of shard time (3 × 35). At 55 runs a day that is far more than a handful of runners can serve, so jobs waited hours. Our CI keeps only the newest waiting run per branch, so when an agent pushed again, the older waiting run was dropped. That made the waste invisible: those jobs used no runner, but they still cost the PR its place in line.

After the change, the median run needs 2.3 runner-minutes. Most requests are now tiny, so the pool spends its time draining instead of falling behind. The same runners, with no new hardware, now handle 49% more PR runs.

The second-order effects were just as large:

  • Fewer reruns. Reruns fell from 57 to 1, though the after window is short, so read that one loosely.
  • More green runs. 84% of PR runs now finish green, up from 33%. Before, only 16 of 388 runs actually failed; 248 were cancelled before they finished.
  • Faster agents. Our coding agents wait on CI before they merge. Cutting that wait from 18 hours to under 2 turns a day-long merge cycle into an afternoon one.

What it cost

Test selection trades certainty for speed, and we paid for it. Since the switch, 10 of the 37 completed full-suite runs on the integration branch have failed. That's 27%. In the week before, it was 2 of 8.

We haven't yet sorted those into flaky tests and real breakages the PR checks missed. But we know some misses exist. An audit of our path map found 13 cases where a change did not select a suite that depends on it. The usual cause is a test that reaches a file indirectly: through another script that sources it, a shared test helper, or a loop over a whole directory. A simple "this path maps to that test" table misses all three.

The full-suite backstop catches these right after the merge, not at release time. But a red integration branch blocks everyone's merges until someone fixes it. That is the bill for faster PRs, and the fix we're working on is a stricter mapping: any suite that reads a changed path gets selected, even indirectly. It will likely give back some of the savings.

How we measured

All numbers come from the CI provider's API: every workflow run and job for 22 days, with job created, started and completed times.

  • Runner-minutes count only jobs that a runner actually picked up. A job cancelled while still queued has a long recorded duration but used no runner, so we counted those separately.
  • Queue wait is job start minus job creation, for jobs that ran.
  • Open to green is the time from a run's creation to its last job finishing, for runs that ended green.

Three reasons not to over-trust this:

  • The "after" window is only 3.7 days.
  • The first day after the switch saw a burst as the old backlog cleared, which flatters the throughput figure.
  • Runner availability changes week to week. One runner host was offline for part of the "before" week, which likely inflated those waits.

If you're thinking of doing this

Impacted-test selection pays off most when your runners are a fixed pool, your PRs are numerous and small, and your suite is slow. That combination turns full runs into a queue problem, and selection fixes the queue.

  • Keep a full-suite backstop on the branch PRs merge into. Selection will miss things; the question is only how fast you find out.
  • Measure the queue, not just the compute. Our compute fell by half. Our waits fell by 10×, and that is what people noticed.
  • Count jobs that never ran. On a starved pool, cancelled-while-queued jobs hide the real cost of over-testing.
  • Expect to tune the mapping. Indirect dependencies (scripts that source other scripts, shared test helpers, tests that loop over a whole directory) are where selection breaks. Audit them early.
  • Watch the backstop's failure rate. If it climbs, your selection is too loose. Ours has been 27% red since the switch, which is where we're looking next.

All posts · ByteFalls home