AI-driven code generation has made continuous integration a bottleneck at Linear, forcing the company to rework its entire CI pipeline to keep pace with the volume of changes agents now produce. The engineering team cut pull request wait time from over 6 minutes to just over 5 minutes while halving runner time per test, despite the test suite nearly quadrupling in size since the start of 2026.
The problem emerged as agents accelerated code shipping but validation infrastructure did not scale with it. Every PR still passes through CI, so as development velocity increased, the pipeline became a constraint on both developer and agent feedback loops, driving up infrastructure costs. Linear's response was systematic: they optimized for two metrics — how long a PR waits on CI and how much runner time each test consumes — across four categories of work.
Infrastructure changes alone yielded immediate gains. Moving workloads from GitHub Actions to third-party runners with faster CPUs and better cache infrastructure made jobs run 34% faster on average, with some workloads like TypeScript compilation dropping 52%. Separately, switching to tsgo, a native TypeScript compiler, cut the weekly median of the tsc check by 73%, moving the bottleneck off typechecking entirely. Linting was another early target: Linear rewrote custom lint rules to use static analysis over the abstract syntax tree instead of building the full type graph, reducing API lint time by 68% and full-repository lint time by 55%.
The team then optimized jobs on the critical path. Change-detection jobs that decide what runs next were checking out the full working tree even when they needed only a subset. Capping fetch depth took the slowest of these gates from 94 seconds to 20 seconds, and removing checkout entirely from jobs that never needed a working tree reduced time from 27 seconds to 7 seconds. The median duration of the change-detection job fell from 26 to 8 seconds. After switching runner infrastructure, checkout times had grown and sometimes hung due to network instability between third-party runners and GitHub. Linear replaced the standard checkout action with a composite action that retried with backoff and set connection timeouts to abort after about 30 seconds instead of hanging indefinitely.
Setup overhead consumed disproportionate resources. Linear's API test shards each spent 7 to 8 seconds installing the same Postgres client on every run; moving it into a CI base image eliminated that cost. The API test workflow was installing the entire pnpm workspace even though it only needed the API package and its dependencies; restricting the install cut pnpm install from 44-73 seconds to 16-18 seconds. Testing showed that caching node_modules was slower than rebuilding: a cache hit took about 28 seconds to restore versus roughly 7.5 seconds for a filtered install. Together, these changes reduced per-shard setup time by roughly 44%, from 110-140 seconds to 67-73 seconds. Seven independent checks that each started a runner, checked out the repository, and installed dependencies before doing only seconds of useful work were consolidated into two jobs running seven tasks concurrently inside them, saving roughly 87,000 runner-minutes per month, equivalent to 11.8% of total CI usage.
The largest single optimization came from test execution. Vitest, Linear's TypeScript test runner, distributes work by file rather than by test duration, meaning a few large test files could dominate a shard and hold up the entire suite. Linear split those files into smaller, more focused ones and moved from four to eight shards, making the critical job roughly 19% faster and 19% cheaper. More significantly, they introduced an opt-in vitest project with isolate: false, allowing safe files to share a module registry within each worker instead of rebuilding the entity, GraphQL, and decorator graph in each shard. This single change was worth roughly 17% in monthly savings, dropping the slowest shard from 300-379 seconds to about 195 seconds and total API-shard runner time from about 32.8 to 22 minutes per run. The optimization carried correctness risk: Linear made eligibility explicit with an opt-in comment on every file, added necessary teardown for shared state, and updated their agent skills so generated tests follow the same constraints by default.
Without these changes, Linear's test suite would take roughly 11 minutes today, close to double what developers wait now. The company is adding roughly 2,000 tests a week, so keeping CI fast as the codebase grows will require continued effort. The lesson for architects: when AI agents change the shape of your build workload, the bottleneck moves from code generation to validation, and the fix requires rethinking infrastructure, job dependencies, and setup overhead as a system rather than optimizing individual components in isolation.