Every CI pipeline I’ve ever tuned had a person on the other end of it. Someone pushed a few times a day, went for coffee while the build ran and came back to read the failure. The runner pool, the timeouts and the order of the jobs all assumed that rhythm without anyone writing it down.
Coding agents don’t keep that rhythm. One opens a pull request, pushes a fix, pushes a fix to the fix and opens three more PRs before lunch. Every push starts the same workflow you sized for a team of humans.
So the pipeline turns into the slow part of the loop. Then somebody asks you to make it faster.
In a regulated shop, that request is where the danger starts.
Look at the queue first #
Before you touch a single test, pull the step timings from your recent runs. Use the median and ignore the worst run. Then split the time three ways: waiting for a runner, setting up and running. The fix almost never lives where you guessed.
With agents in the mix I’d bet on the queue. A runner pool sized for human traffic starts stacking jobs long before any one job gets slow. You can shave a minute off the test suite and still watch PRs sit for ten. If your self-hosted runners live on Kubernetes, letting Actions Runner Controller scale the pool will buy you more than any edit to the workflow file.
That one’s a capacity problem. The rest of the usual speed advice comes with a catch when every pipeline run is also audit evidence.
The cache is a build input #
Key the dependency cache on a hash of the lockfile. Install dependencies before you copy source into the image so Docker can reuse the layer. If a commit SHA is in your cache key with no restore-keys fallback, almost every run saves a fresh cache and almost none restores one. None of that is controversial.
A cache is also an input to your build. Anything that can write to it can change what you ship. So I want two answers before I tune it: who has write access, and does every package still come through the approved artifact repository? I’ll take a slower restore from a proxy repo I control over a fast one I can’t explain to an auditor.
Bigger runners come with a bigger review #
The default hosted runner is small and it won’t win any races. Third-party runner services sell faster hardware, and switching to one is mostly a change to runs-on, once their GitHub App is installed.
Getting that vendor approved is a project. Your source code and build secrets would run on someone else’s hardware. That means a third-party risk review and a long conversation about where your data lives. In a regulated shop the config change is never the expensive part.
For most enterprises the realistic path is larger runners from the platform you already pay for, or self-hosted runners on bigger nodes in your own cloud account. Same outcome. Fewer meetings.
Shard until setup wins #
Parallel jobs are the cheapest speedup most pipelines have left. Lint, type checks, unit tests and the build rarely need to wait on each other (plenty of needs: lines exist only because someone copied them from another workflow years ago). Jest and Playwright both take a --shard flag. pytest-xdist spreads tests across the cores inside one job.
Each shard pays the setup cost again, though. Past a certain point you’re buying runner minutes to save wall-clock seconds, and agents running all day turn those minutes into a real bill. Shard until setup is the biggest bar on the chart. Then go fix setup.
Skip work, never controls #
This is the part I care about most.
Path filters and affected-only test runs are good ideas. So is cancelling superseded runs. A concurrency group keyed on the branch (${{ github.workflow }}-${{ github.ref }}) with cancel-in-progress: true kills the older run when a newer commit lands on that branch, and agents push often enough to make that worth doing on day one.
GitOps takes some of the risk out of cancelling. When Flux pulls changes into the cluster, CI’s job can stop at building and publishing an artifact. Set it up that way and a cancelled run leaves no half-finished deploy to clean up, because CI never started one.
There are two traps. The first is mechanical: a required status check whose workflow never starts, because a path filter skipped it, leaves the PR stuck at pending. Put the condition on the job with if: instead. GitHub reports a skipped job as a success, so the check clears.
That cuts both ways: a control job that depends on a failed job with needs: is skipped, and GitHub counts a skipped check as passing. Keep control jobs free of skippable dependencies.
The second trap is the one that bites regulated shops. Some checks are never optional. Security scanning, policy checks and anything that produces audit evidence have to run on every change that can reach production. If a path filter can switch off your vulnerability scan, an agent’s change will slip through that gap sooner or later. The agent wants green checks. It has no opinion on how it gets them.
flowchart TB
A[Agent pushes a commit] --> B{Path filter}
B -->|code| C[Lint, tests, build]
B -->|docs only| D[Skipped]
A --> E["Security scan<br/>Policy checks<br/>Audit evidence"]
C --> F[Required checks]
D --> F
E --> F
Path filters get a vote on the speed lane. Nothing gets a vote on the control lane.
I know because I did it to myself. In July I found two months of green CI in my own framework on conformance checks that had never passed once, across 13 adapters. One line of YAML, continue-on-error: true, told every failing job to report success. Nobody had to be clever. The pipeline handed out the green for free.
That’s the failure I’d design against first: any setting that lets a check look passed without passing. Audit for it the way you’d audit for a hardcoded secret.
The slowest step isn’t in the YAML #
Make CI fast enough and the line just moves to someone’s inbox. A PR goes green in six minutes and then waits two days for a reviewer. I wrote about that ceiling in September and I still think it’s the harder problem.
My team treats manual review cadences as an anti-pattern. If a person checks something the same way every time, it should be a pipeline step. Formatting, dependency versions and coverage belong to the pipeline. Reviewers should spend their attention on design and intent.
Make the agents do their homework too. Most coding agents read an instruction file in the repo. Tell them to run lint and the unit tests before they push. A failure caught on the agent’s side never costs you a runner minute.
Where I’d start #
Measure. Fix the one thing the numbers point at, then measure again before you touch anything else.
Then write down the checks no speed fix is allowed to touch, and put that list somewhere the pipeline can enforce it. The agents won’t slow down for your pipeline. It has to keep up with them without dropping a control you’d have to defend in an audit.
An agent will take any green you hand it. Make sure the only green left is the kind you’d sign.
Todd Linnertz has spent his career in enterprise engineering, most recently on platform engineering and AI infrastructure. He’s the creator of AIEOS, an open-source AI governance system for software delivery teams. Find him at devopsdiary.blog and github.com/wtlinnertz.