Skip to content

We ran out of CI minutes on a Thursday. Two weeks later our CI took 4 minutes instead of 15.

Agents push a lot of code. On November 5 that volume drained our GitHub Actions budget at 7:27 pm UTC. Over the next two weeks we moved to self-hosted runners, put the test database in RAM, ran CI on the laptop before every push, and deleted the checks that only ever re-checked.

Paarth Jamdagneya
ci for ai agentsgithub actions minutesself-hosted runnersagentic coding cipre-push hookspytest xdistci cycle timeengineering productivity

The short version

At about 7:27 pm UTC on Thursday, November 5, 2026, our GitHub Actions minutes hit zero. We had burned roughly 3,000 billable minutes in five days, about 1,950 of them in one repo. Our agents were writing code faster than our CI had been built to check it.

Two weeks later:

  • The backend CI run dropped from about 15 minutes to about 4.5. Teams went from about 6 to under 2, and Hire's backend from about 6 to about 2.
  • The median PR across our repos merged in 6.5 to 8 minutes. In late October it was 35 to 58.
  • The pre-push hook runs CI's own checks on what changed, about 35 seconds on the backend, so a red build shows up on the laptop before anything gets pushed.

The tests themselves barely changed. We deleted the waiting around them.

How an agent empties the tank

Once we looked, the cause wasn't mysterious. A person opens a PR in the morning and maybe another after lunch. An agent opens a PR, pushes a fix, pushes a test, then pushes a fix for the review comment on the fix. We merged 954 PRs in November, more than double August. Every one of those pushes ran CI, and our CI was full of small costs that nobody notices when humans are the ones pushing.

Some of them weren't small. A single test, test_demo_seed, built a full demo dataset and took 572 seconds of a 1,034-second pytest step. It ran on every PR, including the ones that never went near demo data.

Then there was our merge workflow, which woke up on every check, review and comment event. Greptile edits its summary comment about two seconds after its check completes, so each review kicked off two billed runs that could never merge anything. We were paying CI to watch itself.

First, delete the runs that do nothing

The cheapest wins were deletions.

  • Trigger on PRs, and filter by path. The demo-seed test now runs only when demo code changes.
  • Cancel the superseded run. When an agent pushes again, nobody cares how the old head would have done. Kill it.
  • Retire the homemade merge bot. We'd built an Actions workflow that gated merges on Greptile's score. GitHub's native auto-merge plus branch protection does the same job without waking up for every comment.
  • Stop re-running the suite on main. Main only changes through squash merges of PRs that already passed. Running everything again tells you nothing new.

We also nearly did the thing everyone suggests first, which is skipping CI on draft PRs. Before touching it, we checked how much drafts were actually costing. Twenty-three minutes. Total. So measure where the minutes go before you change anything, because the obvious fix is often aimed at the wrong place.

Then, bring the runners home

Every job in our seven private repos got the same one-line change:

runs-on: ${{ vars.CI_RUNNER || 'ubuntu-latest' }}

That points CI at self-hosted runners on a desktop under WSL. Flip one variable and we're back on GitHub's runners.

Cheaper minutes were the smaller part of the payoff. A hosted runner wakes up with amnesia, so every job downloads a dependency cache, installs its tooling, and uploads the cache again on the way out. On a machine that remembers everything from the last run, all of that is ceremony. We cut it. No more pnpm cache round-trips, and pnpm now comes from corepack in under a second instead of 10 to 35.

Put the database in RAM

Our Python repo spun up a fresh Postgres service container for every job. That cost 50 to 96 seconds before the first test even ran. We replaced it with one shared Postgres instance on a RAM disk, and each run gets its own database inside it.

Once the database stopped being per-job, the tests could run in parallel. pytest across 4 workers went from 246 seconds to 81. We pushed to 8 workers and got timing flakes, so we went back to 4. A suite that's quicker but randomly red costs you more than the seconds it saved.

Another backend was even more lopsided. Its suite took 165 seconds of wall time and only 43 seconds of CPU, which means the machine spent most of the run waiting. With one worker per core it finishes in 37 seconds. We ran 8 workers against 12 in paired runs, and 12 won every time.

If you take one diagnostic from this post, take that one. Put wall time next to CPU time. A big gap means you're paying for idle.

Run CI before the push

For agents, this is the change that mattered most.

A red CI run costs more than its minutes. The agent pushes, waits, sees red, reloads its context, fixes, pushes again, then waits for CI and code review to come round a second time. That's a full cycle, often five minutes or more, for a type error the compiler could have flagged in seconds.

So our pre-push hook now runs CI's own checks, scoped to what the branch changed: lint on the changed files, typecheck and build, and unit tests for the packages that changed plus anything that depends on them. On the backend it takes about 35 seconds. What finally pushed us to build it was a single day on which three PRs went red in CI for errors a local build would have caught.

The commit message says why: a red CI should show up "locally in under a minute instead of a CI + Greptile round later."

One repo went a step further with a small test planner. It reads the diff and picks which test files to run, about 34 of 52 on average. Browser checks run only when the change could plausibly affect them. Of the previous 59 PRs, 28 hadn't needed them at all.

Where it got worse, and what bit us

One repo's CI got slower, from about 4.5 minutes to about 7.5. We'd added a lot of tests, including an end-to-end walk through a map UI. We'll take that trade happily. The goal was never the smallest number on the dashboard. It was to spend CI time only on checks that can actually fail.

The shortcuts also bit back a couple of times. The first version of the pre-push hook ignored deleted files, and when you pushed a branch you weren't currently on, it tested the wrong tree. Our code reviewer caught that before it merged. Later, a test-planner PR committed over a stale tree quietly reverted two other PRs, and review caught that too. When you tighten the loop, keep a reviewer inside it, because the fast path is exactly where these mistakes slip through.

What to do if agents are outrunning your CI

  1. Find your single slowest test. Ours was eating more than half the pytest step.
  2. Cancel superseded runs, and stop re-running main after squash merges.
  3. Self-host, then delete the setup steps that self-hosting makes pointless.
  4. Compare wall time with CPU time. A big gap means waiting, and parallel workers will win it back.
  5. Move CI's checks into pre-push, scoped to the diff. An agent should hear about a type error in seconds, not one review round later.
  6. Measure before you cut. The draft-PR fix everyone reaches for would have saved us 23 minutes.

CI used to be a gate a person walked through a few times a day. With agents it's a loop a machine runs hundreds of times a week, and every second of setup you leave in it gets paid again on every push.

Frequently asked questions

  • Why do AI coding agents put so much pressure on CI?
    They open far more pull requests and push to each one more often. We merged 954 PRs across our repos in November 2026, against 425 in August. Every push triggers CI. A pipeline designed around a few human PRs a day, with slow setup steps and duplicated runs, falls over long before the tests themselves get slow.
  • What was the single biggest CI speedup?
    Removing waiting, not adding compute. One backend test suite took 165 seconds of wall time and only 43 seconds of CPU. Running it across parallel workers, one per core, cut it to 37 seconds. In another repo, replacing per-job Postgres containers with one shared RAM-backed database, then running on four workers, took pytest from 246 seconds to 81.
  • Should CI run again on main after a squash merge?
    Not if main only changes through squash merges of PRs that already passed CI against an up-to-date base. Running the full suite again on main repeats a result you already have. We stopped doing it.
Attribute · optimize · operate

See where your tokens go,
not just what they cost.

Your team's AI-coding spend went from zero to a real line item in eighteen months — unattributed, unbudgeted, invisible behind one vendor invoice. Promptster Teams is the TokenOps platform: it attributes spend per developer, separates recoverable waste from real leverage, and puts the whole loop on a budget.