1. Back to blog

DevOps

AI Coding Agents: Check the Path to a Working Preview

11 min readBy Eugen Yamamoto, Founder of CQUELLE

AI Coding Agents: Check the Path to a Working Preview

Before a team adds more AI coding agents, it should measure one thing: how long a pushed change needs until its preview is deployed and passes a smoke test. We learned this in autumn 2026, when the lead of a client whose team we had helped to set up development with agents told us that the build pipeline was now the bottleneck. On that platform the number of merged pull requests went from 27 in June to 323 in October, and the cluster that builds and hosts the previews was not prepared for it.

The cluster in question is one of our internal build and development clusters, the one carrying a set of per-branch environments. No production system runs on it. It is the setup from our 2024 post on hosted feature branches: every branch gets its own environment in a Kubernetes namespace, with its own URL.

What follows is what we would check today before the first agent starts, in five steps, with our own figures from before, during and after the changes. Limiting the builds made the cluster stable. It did not make a single run faster, and the figures for that are here as well.

What AI coding agents changed in our delivery

Agents write code faster than people. That part is known. What we underestimated is everything a change has to pass before an engineer can trust it, since the engineer did not type it.

On that client platform a story now goes this way:

  1. A story is written as a brief for an agent. Once it is marked ready, an agent may start it without asking.
  2. The agent implements it, builds, runs the tests and the type check. Then up to six specialist review agents check the change in parallel: acceptance criteria, the API contract, framework rules, impact of database migrations.
  3. The push starts the pipeline: build, database migrations, restore of a data dump, rollout to the branch's environment.
  4. A smoke test runs against the environment's URL, and the agent itself exercises the feature there.
  5. Browser end-to-end tests run on the pull request, about 18 minutes.
  6. A different model than the one which wrote the code reviews it, mutation testing included. Nineteen such reviews were run and all nineteen found something.
  7. The pull request merges only when the backend and the front-end build are green.
  8. After the merge the main branch deploys to an environment with production-shaped data, and a performance suite times the requests behind the heavy pages against a budget per scenario.

The diagram shows the same route; the amber marks are the points where a person decides.

The route of one story from ready to a working preview, a merged pull request and a performance run, with three points where people decide
The route of one story from ready to a working preview, a merged pull request and a performance run, with three points where people decide

People decide at named points. New database entities need approval and destructive migrations go to an engineer. Production deploys wait for the go of the client's lead. Mornings are for triage and decisions, the rest of the day and the night the agents run, and the engineering team oversees the result, as we described it in AI in software development.

Now the numbers. The upper panel shows merged pull requests per month, the lower one the pipelines that did not exist in August.

Merged pull requests on one client platform rose from 27 in June 2026 to 323 in October and 204 in November; end-to-end pipeline runs went from 0 in August to 705 in October, performance runs from 0 to 641
Merged pull requests on one client platform rose from 27 in June 2026 to 323 in October and 204 in November; end-to-end pipeline runs went from 0 in August to 705 in October, performance runs from 0 to 641

The backend pipeline of this platform ran 88 times in August and 2,092 times in October. On a second client platform all pipelines together went from 214 runs in June to 2,231 in November.

So one merged change is a build, a test suite, an environment which keeps running, a smoke test, a browser run, and after the merge a deploy plus a performance run of about 14 minutes. With 27 merged changes a month nobody notices this load. With 323 it is the main consumer of the cluster. And none of these checks can be dropped to save capacity, they are the reason why engineers can oversee work they did not write.

Step 1: measure the path from push to a working preview

The number to know is the time from a push until the smoke test on the deployed environment has passed. A green build is not enough, the agent and the reviewer both wait for a URL that works.

We measured it afterwards for one backend pipeline, from GitHub's own timestamps, on a sample of about a hundred successful pushes per period:

  • Before any limit (26 October to 8 November): median 13.2 minutes, nine of ten pushes within 16.7 minutes, none over 30 minutes.
  • With four build slots (13 to 30 November): median 17.9 minutes, nine of ten within 56.9 minutes, one push in four over 30 minutes. The longest took 139 minutes.

Notice that before the limit this number looked healthy while the cluster under it was restarting, and afterwards it shows the price. So it has to be read together with the state of the machine. Agree a target first, for example a preview within 20 minutes for nine of ten pushes, and watch the slow end and not only the median.

Step 2: limit everything that shares the machine

Our node has 24 cores and 125 GB of memory. It carried 21 namespaces with development and demo environments, the self-hosted runners and one shared BuildKit image builder. The setup was sized for people pushing a few times a day, and two limits were missing.

The first: the environments had no resource limits. An environment keeps its memory after the build has finished, whether somebody looks at it or not.

The second is less obvious. Actions Runner Controller manages pools of self-hosted GitHub Actions runners, called runner scale sets, and its maxRunners setting counts per set. We had four sets with 8 runners each, so 32 runner pods could start together, and nothing limited them as a whole.

Four runner sets of 8 could start up to 32 runner pods with no common limit; with the queue the same sets share four slots and a fifth pod stays pending
Four runner sets of 8 could start up to 32 runner pods with no common limit; with the queue the same sets share four slots and a fifth pod stays pending

On 9 November, in the morning, the control plane of the cluster lost leader election and restarted during a burst of builds. It was the 23rd restart since 28 October and the fourth on that day. Memory in use was 102 GB and swap was exhausted.

You can check your own setup for the same gap in ten minutes:

bash
# what the runner sets may start together (column MAXIMUM RUNNERS)
kubectl get autoscalingrunnersets -A
# what the node has already promised to pods
kubectl describe node | sed -n '/Allocated resources/,$p'
# on the node: share of time tasks waited for a CPU
cat /proc/pressure/cpu

If the maxima add up to more than the node can run at once, you have what we had. The pressure value only tells something during a real burst of builds.

What we changed, in this order:

  • Default caps for the environments. A LimitRange in every environment namespace gives a container without declared resources a limit of 2 CPUs and 2 Gi. It applies to pods created afterwards.
  • One queue for all runner sets. The node advertises a countable resource, we call it example.com/ci-slot, and every runner pod requests one. The [Kubernetes scheduler](/kubernetes-architecture-explained) starts a runner pod only while a slot is free; the others stay pending and their jobs wait at GitHub.
  • Memory that is counted. The memory request of a runner pod equals its limit, so the scheduler reserves the 8 Gi a build may use.
yaml
# runner pod template (Actions Runner Controller, gha-runner-scale-set 0.14.2)
containers:
  - name: runner
    resources:
      requests: { cpu: 500m, memory: 4Gi, example.com/ci-slot: 1 }
      limits:   { cpu: "3",  memory: 4Gi, example.com/ci-slot: 1 }
initContainers:
  - name: dind            # Docker-in-Docker sidecar
    restartPolicy: Always
    resources:
      requests: { cpu: 100m, memory: 4Gi }
      limits:   { cpu: "4",  memory: 4Gi }

Two things went wrong on the way, and both are worth knowing.

The default caps also landed on the build sidecar of the runners, which had no resources of its own. With 2 CPUs the front-end unit tests of one project took 128 seconds instead of 20 and ran into their timeout. A default cap reaches every container that declares nothing, so write the resources out for the ones that do real work.

And we sized the queue by memory first, because memory was what had run out: six slots of 8 Gi fitted. On 12 November, with six slots, the load average was 36 on 24 cores and tasks were waiting for a CPU 53 % of the time. A test that normally takes 0.2 seconds crossed its 5-second limit twice and held a release of another project. CPU was the real limit, the count went to four, and the shared builder went from 10 to 6 cores.

This mechanism counts per node, so it is a shared limit only on a single-node cluster like ours. On our node the advertised resource is also reset when the kubelet restarts, and a small script puts it back every 15 seconds. With several nodes we would look at a dedicated runner node or a queueing controller, which we have not tested.

Step 3: check that the backlog drains

A limit turns overload into waiting, and waiting is fine only if it ends. So the next thing to watch is how many runs are unfinished at the same time and how long a pile-up takes to clear.

Across five pipelines of three projects:

  • Before: at most 27 runs unfinished at once. More than ten were unfinished for about 6 minutes a day, and the longest such stretch took one hour.
  • With four slots: at most 35 unfinished at once, more than ten for about one hour a day. The longest stretch took four hours to clear.

The backlog drained every day. But four hours is a long time for an agent, and for the person waiting for its preview. If such a stretch does not end before the next burst arrives, the limit is too low for the work or the work per run is too large.

The three charts show the same period from three sides. The first one is the arriving work: 175 runs a day before, 232 in the four days with six slots, 205 with four slots.

Workflow runs started per day across five pipelines: 175 a day with no shared limit, 232 with six slots, 205 with four slots
Workflow runs started per day across five pipelines: 175 a day with no shared limit, 232 with six slots, 205 with four slots

The second is the cost. Look at the upper line, the slowest tenth of the runs per day.

Backend run duration from start to end: phase medians of 14.0, 15.2 and 20.2 minutes; the daily 90th percentile peaked at 103.4 minutes with four slots
Backend run duration from start to end: phase medians of 14.0, 15.2 and 20.2 minutes; the daily 90th percentile peaked at 103.4 minutes with four slots

The third is what we got for it.

Control-plane restarts: 23 between 28 October and 9 November, one on 14 November, none since up to 3 December; failed runs 3.6 %, 2.6 % and 2.9 % per phase
Control-plane restarts: 23 between 28 October and 9 November, one on 14 November, none since up to 3 December; failed runs 3.6 %, 2.6 % and 2.9 % per phase

The control plane restarted once more on 14 November and not since, checked on 3 December. The share of failed runs went from 3.6 % to 2.9 %, and in the busiest hours from 4.6 % to 3.0 %. In those busiest hours a backend run takes 32.1 minutes at the median where it took 15.3. Waiting is one part of that. The caps slow the work itself as well: the image build on the shared builder went from 3.0 to 6.5 minutes after its limit dropped from 10 to 6 cores.

These figures cover all changes together, and the amount of work was not the same in both periods. We cannot say which part of the effect belongs to the queue alone.

Step 4: stop work nobody needs any more

An agent pushes again while the previous run of the same branch is still building. That older run is waste, and with four slots waste is expensive. In GitHub Actions it takes three lines per workflow:

yaml
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref_name != 'main' }}

It cancels a superseded run on the same branch and never a running one on main. It works inside one repository, so it does not replace the shared limit from step 2. Deploy and cleanup jobs should not be cancelled halfway, they need their own rule.

On the client platform this is in place for pull requests. Across the five pipelines 119 runs were cancelled in the busiest hours after the change, against 52 before. On some pipelines we have not rolled it out yet.

Step 5: then less work per run, or more capacity

Only now the question of speed is worth asking, because now the numbers show where the time goes.

If runs mostly wait, capacity is missing: more cores for builds, or a separate node only for runners, so a burst can not reach the environments at all. If runs mostly execute, the work per run is too large. Path filters stop a front-end change from running the backend pipeline, one of our own pipelines already skips changes that touch only documentation. Caches on the shared builder are the next candidate.

We have done the first four steps and not this one. So we can not tell yet which of the options buys the most, we will measure it the same way as above.

What this covers and what it leaves open

All of this describes a shared development cluster with per-branch previews on one node. It says nothing about how many agents a team should run, about production capacity or about how many features got delivered; merged pull requests and pipeline runs are activity, they are not delivery. What it gives is an order: measure the path to a preview, limit what shares the machine, check the backlog, cancel what is superseded, and only then spend on speed.

If your team is about to add agents and builds and previews share a cluster, bring the runner limits and a week of pipeline timings to a fit check, and we look how and if we can help.

Frequently Asked Questions

  • What breaks first when AI coding agents push many branches?

    In our case the shared development cluster broke before the code review did. Builds and per-branch environments competed for one node: four runner sets could start 32 runner pods together and the environments had no resource limits. During bursts of builds tests timed out and the control plane restarted 23 times in twelve days.

  • How can CI runners be limited across runner sets in Actions Runner Controller?

    Actions Runner Controller applies maxRunners per scale set. On our single node, an advertised extended resource, example.com/ci-slot, supplies a shared limit because every runner pod requests one unit. Additional pods remain pending when slots are occupied. We reduced the count from six to four after CPU pressure caused test timeouts.

  • Does a build queue make pipelines faster?

    No speed improvement appeared in our comparison. Busy-hour median run durations rose from 15.3 to 32.1 minutes on one pipeline and from 12.0 to 25.0 on another. The shared-builder image job rose from 3.0 to 6.5 minutes. Waiting and execution both increased; the comparison includes resource caps alongside the queue.

  • What should be measured before adding more AI coding agents?

    Measure the time from a push until the smoke test on the deployed preview has passed, at the median and for the slowest tenth. On one of our pipelines it was 13.2 minutes at the median before a build limit and 17.9 after, with one push in four over 30 minutes. Then watch how long a backlog takes to clear.