Case Studies

How AI Coding Broke Linear's CI — and What They Did About It

When AI agents ship dozens of PRs overnight, traditional CI runner pools collapse. Linear rewrote its scheduling model and shared the engineering details publicly.

Font size

Original: linear.app/now/ci-bottleneck-reworked
Discussion: HN thread, 73 points, 61 comments


The Problem Wasn't Slow CI — It Was Too Many PRs

Linear's engineering team recently published a blog post about how AI coding agents overwhelmed their CI system. The post hit the Hacker News front page last week (73 points, 61 comments), and the comment section turned into a wall of "same here" stories.

The contradiction? It wasn't that individual test runs were slow — the PR count exploded.

A developer used to submit 3–5 PRs per day. With agents like Claude Code or Cursor, producing 30–50 PRs overnight is routine. Each PR triggers CI, and the runner pool fills up instantly. Queues back up by 40+ minutes, so developers open their laptops in the morning only to find their PRs still waiting for CI — review doesn't start until noon.

The traditional CI model assumes:

  • One runner per PR
  • Runner releases when done, next one queues up
  • Tests are slow? Optimize tests. Not enough runners? Add machines.

AI coding blows up all those assumptions. Adding machines can't keep pace with PR growth, and no matter how fast tests run, they can't withstand a 10x surge in demand.

Linear's data: at peak, each developer triggers 4–6 CI runs per hour — 8x higher than before AI agents became widespread.

They Rewrote the Scheduler, Not the Tests

Linear's solution is interesting — they didn't chase "faster tests" or "more hardware." They rewrote the scheduling logic.

Three core ideas:

  1. Bundle compatible jobs. Lint + typecheck + unit test on the same PR can share a workspace. No need for three runners doing three jobs. Linear switched to job bundling — a single runner runs a group of compatible tasks sequentially.
  2. Reuse workspaces. Previously, every CI run re-cloned the repo and reinstalled dependencies. Linear introduced a workspace cache pool: runs hitting the same commit hash mount an existing directory. That 90 seconds of pnpm install / node_modules setup disappears.
  3. Dynamic allocation by priority and impact. PRs touching core files (monorepo root, shared libs) get high priority; doc/typo PRs queue at the back. Linear uses GitHub's CODEOWNERS + path matching to compute an "impact weight."

Together, these three changes cut runner pool capacity requirements by 60%.

They published simplified pseudocode for part of the scheduler (not production code):

// Linear CI scheduler — simplified version
interface CIRun {
  prId: string
  commitSha: string
  changedPaths: string[]
  jobs: Job[]
  priority: number // computed from impact weight
}

function scheduleRun(runs: CIRun[], runners: Runner[]) {
  // 1. Sort by priority
  const sorted = runs.sort((a, b) => b.priority - a.priority)

  // 2. Check workspace cache hits
  for (const run of sorted) {
    const cached = workspaceCache.find(r => r.sha === run.commitSha)
    if (cached) {
      run.workspace = cached.path // reuse, skip clone + install
    }
  }

  // 3. Job bundling: group compatible jobs
  const bundles = bundleCompatibleJobs(sorted)

  // 4. Assign runners; degrade non-critical jobs under contention
  assignToRunners(bundles, runners, {
    onContention: degradeNonCritical,
  })
}

The point isn't how elegant this code is. It's what it reveals: in the AI era, CI optimization shifts from "fast individual runs" to "dense batch execution."

Deep Integration with Git Workflow

Linear builds issue tracking and Git workflow tools, so they tightly coupled their CI rework with branching strategy.

Key design decisions:

  • Detecting AI agent commit signatures. AI batch commits have recognizable patterns — 5–10 consecutive feat: prefixes, clustered timestamps — distinct from human commits. Linear uses this signal to predict "a PR flood is coming in the next 30 minutes" and pre-warms the runner pool.
  • Merge queue integration. Their merge queue doesn't wait until a PR actually merges into main to trigger CI — it starts pre-running tests the moment the PR enters the queue. By the time merge happens, results are already in. No more final wait.
  • Branch stacking optimization. Developers no longer use one branch per feature. They stack 5–6 PRs that merge sequentially. Linear's scheduler recognizes stack relationships and reuses the previous PR's workspace cache for the next.

Linear didn't fully open-source this part, but the blog includes a fairly clear flow diagram.

Linear Isn't Alone

Out of 61 HN comments, I counted at least 30 "fellow victims." A few representative scenarios:

User devops_at_scale: We scaled from 50 self-hosted runners to 200 and it still wasn't enough. Turns out the problem wasn't capacity — runners were fighting over the same monorepo lock. Switching to workspace reuse fixed it instantly.

User agent_pm: We have 8 devs at our company. After adopting Claude Code, PR volume went from 12/day to 150/day. CI monthly cost went up 4x. My CEO wants to know why IT spending is out of control.

User platform_eng_lead: We found that per-PR CI time didn't actually change (still averaging 8 minutes), but the number of PRs running simultaneously jumped from 20 to 200. Bottleneck is scheduling, not tests.

That third one validates Linear's core thesis: the problem isn't slow CI — it's a concurrency model mismatch.

Other comments mentioned:

  • GitHub Actions concurrency limits (20 concurrent for free accounts) got blown out, pushing teams to self-hosted runners
  • Some teams use build matrices (same code on multiple runners) as a "PR importance filter," running low-priority PRs against test subsets
  • Others just assign AI agents their own dedicated runner pools to avoid resource contention

Lessons for Other Engineering Teams

Linear's experience offers a few transferable lessons:

1. Don't wait until CI is on fire. AI coding adoption is happening faster than most teams forecast. Your current runner pool sizing assumes human-paced PR volume — that assumption breaks the moment agents go live.

2. Schedule optimization beats hardware. Adding runners is the easiest fix, but costs scale linearly and ROI is poor. Rewriting scheduling logic (job bundling + workspace reuse + prioritization) is a one-time investment with long-term payoff.

3. Design CI and Git workflow together. Wire merge queue, branch stacking, and AI commit detection into CI scheduling rather than running them as separate concerns. Linear has a natural advantage here since they already build issue tracking.

4. Track PR inflow rate. Beyond standard CI duration and success rate, add a "PRs per hour per developer" metric. When that curve starts climbing exponentially, a CI crisis isn't far behind.

Editor's Take

The most interesting part of this story is its contrarian angle: everyone is obsessing over AI coding agent quality (does it write correctly, can it review, does it hallucinate less) while almost nobody is talking about how generation speed is crushing engineering infrastructure.

Linear's case suggests that in 2026, the AI adoption bottleneck might not be at the model layer — it'll be at the "sewage layer" of CI/CD, review queues, and merge queues. These systems usually fly under the radar, but the moment AI coding scales up, they're the first to break.

How is this different from past infrastructure-overload moments? The cloud-native era saw similar collapses — microservices exhausting database connection pools, service meshes blowing up sidecar resource usage. But those were gradual, predictable scaling curves. AI coding produces a step-function PR surge: a team adopts Claude Code on Monday, and PR volume quintuples by Friday. No gradual ramp.

One uncertainty: Linear's solution works at their scale (mid-size engineering team + custom CI orchestration), but portability is limited for small companies stuck on GitHub Actions or CircleCI defaults. Their fix might still be the blunt approach: "tell AI to submit fewer PRs" or "give AI its own runner pool."

Another prediction: within the next 12 months, a wave of "AI-native CI" tools will appear, purpose-built for workspace reuse, job bundling, and AI commit detection. It's an underrated market.

Source: https://linear.app/now/ci-bottleneck-reworked