
AI Agents at Scale: Diagnose Git and CI Before Adding Workers
Measure checkout, queueing and integration failures before adding coding agents.
Before adding more coding agents, measure where a change spends its time: acquiring repository data, materializing files, preparing dependencies, waiting for checks, running them, and being revalidated for integration. Faster code generation helps only while downstream capacity can absorb it. A busy agent dashboard is not a delivery metric.
The coding-agent execution guide explains the prompt-to-test loop. This article follows the work outside that loop: how workers obtain their repositories, share limited validation capacity, and carry evidence from a tested commit to an integration decision.
The accompanying experiment runs real Git operations and Node checks on a synthetic repository. It uses scripted workers, no LLM, and an intentionally controlled CI service time. Its purpose is to make those costs visible and reproduce an integration failure, not to benchmark agent intelligence or reproduce Anthropic’s infrastructure.
What Scion makes worth investigating
On October 13, 2026, Anthropic described its internal source-control system, Scion; the post was expanded on October 15. Its design serves an unusual population of online agents and CI jobs, with repository queries handled by services and files materialized selectively. The useful question for a smaller team is which operations its workers repeat unnecessarily. Anthropic’s engineering account.
Scion is a bespoke internal system. The account does not provide an independently reproduced comparison for ordinary repositories, and explicitly limits its suitability to exceptionally large workloads. Its approach to post-merge validation also reflects its own infrastructure and risk decisions. Treat it as a case study in locating bottlenecks, not a migration prescription.
Our narrower, testable question is: what happens to a fixed batch of changes when repository preparation can run in parallel but validation has only two slots?
Give each stage its own clock
Start with one change identifier and record transitions rather than asking an agent to estimate where time went.
| Stage | What to record | What a long duration might mean |
|---|---|---|
| Repository acquisition | Fetch/clone start and finish, requested revision, transport bytes if instrumented | Repeated transfer, server contention, unavailable objects |
| Materialization | Checkout duration and files/bytes actually written | Too much working tree, slow filesystem, contention between workers |
| Dependency preparation | Install/build duration, lockfile and cache identity | Repeated installation, incompatible cache, native compilation |
| Validation queue | Requested slot and granted slot timestamps | Submission rate exceeds available validation capacity |
| Validation execution | Start/end, command, environment and tested SHA | Expensive tests, resource contention, retries or flaky checks |
| Integration/review | Candidate base, integrated SHA, rechecks, human attention | Stale feedback, interacting changes, review saturation |
These stages can overlap across jobs. Adding their batch totals does not give elapsed batch time. Similarly, summing stage medians does not recover the median end-to-end latency. Keep the per-job trace and measure batch start-to-finish separately.
A task missing from a ready queue is a different failure from a ready task waiting for a CI slot. The Beads worker-recovery lab examines stale ownership and dependency readiness; resolve those correctness questions before interpreting worker inactivity as insufficient validation capacity.
Do not label the size of .git/objects as network traffic. It is retained storage, with compression and reuse affecting the number. For bytes transferred, instrument the transport separately. A local measurement also cannot tell you WAN latency.
The useful denominator depends on the decision. Candidate checks per minute can size a test service; changes accepted into a validated integration state can describe delivery. Tokens, commits and open PRs describe activity. None is interchangeable with the others.
Three repository preparations, three different costs
There is no single “lightweight checkout” switch. Distinguish the object database, the visible working tree and repository history.
Independent clones
A clone gives each worker its own repository metadata and object store. In the lab, cloning starts with --no-checkout, then materialization is explicit. For a local source, --no-local avoids Git’s local hardlink optimization and uses its normal transport path. That makes the experiment’s mechanism clear; it still does not simulate a remote Git service. Git clone 2.52.0.
Independent repositories are useful when workers need separate lifecycles or trust boundaries. The repository copy is not itself a sandbox, and an independent clone still needs filesystem, process, network and credential controls.
Sparse working trees
Sparse checkout reduces what is materialized. It does not, by itself, filter the clone’s object transfer. Cone mode also retains root files and files beside ancestor directories, which is why a worker may still see root build configuration. Operations and external tools can require additional paths. Git sparse-checkout 2.52.0.
That is useful when a check genuinely needs one package. It is a bad shortcut when the omitted packages contain shared types, generators, fixtures or integration tests required to validate the change. A faster incomplete check is not an optimization of the same task.
Partial clone is a separate mechanism: it can defer objects such as blobs while retaining the commit graph. Missing objects may be fetched when an operation needs them, and server support and connectivity matter. The lab deliberately does not test it. Git’s partial-clone design at v2.52.0.
Linked worktrees
Linked worktrees share the repository’s objects while keeping a separate working directory, index and HEAD. This can avoid repeatedly acquiring the same objects on one trusted host. It still writes files and prepares dependencies. The lab uses detached worktrees and serializes their management operations; it does not force multiple workers onto one checked-out branch. Git worktree 2.52.0.
A shared repository has a cost and an owner. Record its initial preparation, maintenance and lifetime; do not charge every clone for its acquisition while treating the worktree seed as free. Sharing storage also couples lifecycle and trust. Worktrees are not a tenant-isolation mechanism.
A fixed batch through a deliberately small CI gate
The downloadable lab creates an isolated temporary repository with eight packages and real candidate commits. Every measured case processes the same eight jobs, using one, four or eight workers. Each candidate must pass a Node verifier before the lab accepts it. Repository preparation changes between cases; the task and verifier do not.
The CI gate has two slots. A slot includes the real check plus a nominal 500 ms service floor. Any remaining interval is a deliberate wait, subject to timer rounding. This is a controlled queueing experiment, not a claim that our checks need 500 ms, and not a measurement of a hosted CI provider. No dependency installation or model inference is included.
There are three repetitions per preparation/concurrency combination. A fresh seed is measured separately for each case; the operating-system cache is not flushed. “Seed plus batch” means accounted setup cost, not a claim about cold disk caches. The raw records preserve each repetition and job rather than manufacturing a confidence interval from three batches.
The recorded run used Windows x64 build 10.0.26200, Node 24.12.0, Git 2.52.0.windows.1 and an Intel i5-4590 with four logical CPUs and approximately 15.9 GiB RAM. Other article work overlapped the run; the machine was not isolated. All 216 candidate checks passed, and the eight candidate commit identities matched across all 27 cases.
The table reports seconds for the complete eight-job batch. Parentheses show the minimum and maximum of the three repetitions. Queue medians pool 24 jobs per row and are rounded to milliseconds; 0 means below 0.5 ms, not that the code skipped the queue.
| Preparation | Workers | Batch median, s (range) | Seed + batch median, s | Job queue median, ms |
|---|---|---|---|---|
| Full clone | 1 | 26.928 (11.490–30.095) | 30.593 | 0 |
| Full clone | 4 | 9.054 (7.859–11.750) | 9.427 | 0 |
| Full clone | 8 | 6.073 (5.538–9.769) | 6.988 | 584 |
| Sparse clone | 1 | 24.688 (10.969–25.020) | 25.616 | 0 |
| Sparse clone | 4 | 5.858 (5.443–9.824) | 6.202 | 0 |
| Sparse clone | 8 | 7.975 (5.427–12.558) | 9.067 | 703 |
| Shared worktree | 1 | 15.033 (11.990–20.060) | 15.767 | 0 |
| Shared worktree | 4 | 6.298 (5.315–7.646) | 6.822 | 0 |
| Shared worktree | 8 | 9.582 (3.274–12.564) | 11.214 | 0 |
The batch includes editing, committing, file-size sampling and cleanup as well as preparation and checks. The seed-inclusive column is the median of paired seed-plus-batch totals, not the sum of their separate medians. Fixture generation took another 18.847 seconds and is outside both columns. The downloadable records retain that cost and the individual stage timings.
Two observations matter more than a speed ranking. First, the eight-worker clone cases do wait for the CI gate. Second, the eight-worker worktree case has almost no CI wait but a longer median batch than four workers. Its median preparation rises from 783 to 1,968 ms per job, and real checks from 352 to 541 ms. Worktree-management serialization and local resource contention are plausible contributors; this experiment does not isolate their causal shares. The wide ranges rule out treating one row as a generally optimal configuration.
The gate also does not always occupy a slot for 500 ms: observed service durations ranged from 498.512 ms, due to timer granularity, to 2,067.099 ms. Real check processes can exceed the nominal floor. Stage timings describe what ran, rather than assuming every slot has identical service time.
Storage shows a different distinction. These medians pool the recorded candidates for each method; they are logical file lengths, not allocated disk or transfer volume.
| Preparation | Working tree per candidate, MiB | Private objects per candidate, MiB | Initial seed objects, once, MiB |
|---|---|---|---|
| Full clone | 4.002 | 4.008 | 4.007 |
| Sparse clone | 0.501 | 4.008 | 4.007 |
| Shared worktree | 4.002 | 0.000 | 4.007 |
Sparse materialization cuts the visible files here without reducing the independently cloned object store. A linked worktree has no private object database, but its seed and new commit objects still exist in shared storage. Neither row makes that storage free. Live file-size snapshots can miss partially prepared trees, so the raw peakObserved* fields are not exact operating-system disk peaks.
More time in a queue can coexist with a shorter batch: earlier parallel preparation may deliver work to the gate sooner. Conversely, extra workers can compete for disk and process capacity without creating another validation slot. Use both the latency distribution and the fixed-batch completion time before choosing a concurrency limit.
Eight successful candidate checks in this experiment are not eight changes merged into a shared production branch. Each candidate is checked against its own base. The next control demonstrates why that distinction matters.
Two green branches can produce one red integration
Consider two configuration files with a combined resource budget of ten. The base allocates four units to each component. Branch A raises the first allocation to six; branch B raises the second to six. Each branch independently totals ten and passes. The edits affect different files, so Git can combine them without a textual conflict. The combined allocation is twelve and fails the same verifier.
The executed control produced:
| Revision checked | Combined allocation | Check exit | Synthetic acceptance effects |
|---|---|---|---|
| Branch A | 6 + 4 = 10 | 0 | Not applied |
| Branch B | 4 + 6 = 10 | 0 | Not applied |
| Local merge candidate | 6 + 6 = 12 | 1 | 0 |
| New repair commit | 6 + 4 = 10 | 0 | 1 |
The failing merge candidate was 17fece12d2221b3bca876c0062f245d30f54ab93; the revalidated repair was cb9547733ae0b94aeea41e8171183451d6f33486. Git successfully created the local merge commit. The subsequent verifier rejected its acceptance; it did not prevent Git from merging. The effect counter is a local test assertion, not a deployment or hosted merge-queue action.
The failure is not a merge-algorithm defect. The branches have a shared semantic invariant that neither branch violates in isolation. Reducing one allocation and rechecking the new combined commit recovers a valid state. Reusing either earlier green check would not establish that result.
For a real pipeline, bind evidence to the candidate it covers: tested commit SHA, base or merge-group SHA, command, result, environment and relevant configuration. When those inputs change, decide which evidence remains applicable and rerun what does not. The task-contract guide addresses scope and evidence; this control supplies a concrete case where valid evidence for an earlier candidate is insufficient.
A GitHub merge queue is one implementation of testing a candidate against the latest base and earlier queued changes. Its required checks must report against the merge group, rather than borrowing the PR’s previous result. That reduces a specific integration gap; the tests still determine what behavior is covered. GitHub merge-queue documentation.
For GitHub Actions, workflows supplying required queue checks need the additional merge_group trigger. In that event, GITHUB_SHA identifies the merge group. A workflow that checks out a hard-coded PR head can validate the wrong candidate despite a correct trigger. Actions event reference. This lab does not run GitHub Actions or a hosted merge queue.
Run and inspect the experiment
Download the complete lab script, its README, the recorded results and the tabulated summary. The fixture and verifier are generated by the script; it needs no npm packages, credentials, Docker daemon or live service.
Save the script to an ordinary local folder. With Node.js 22+ and Git available, the reproduction command is the same in PowerShell and a POSIX shell:
node git-ci-lab.mjs --output results.json --repetitions 3 --ci-floor-ms 500
Only Node 24.12.0 and Git 2.52.0.windows.1 were exercised for the recorded matrix. Expect several minutes of work and different timings on another host. The README also documents a small environment-isolation control and the post-run validation notes, including the final script’s removal of inherited Git environment overrides.
Keep runtime repositories outside your blog’s public directory. The script uses its own temporary tree and removes it after collecting the result. Published downloads contain the source and sanitized measurements, not working repositories or caches. See the README for supported runtime versions, arguments, output fields and cleanup behavior.
Inspect the records as well as the summary. Confirm that every case contains eight jobs, CI occupancy never exceeds two, every accepted candidate has a successful check for its SHA, and the integration control records both rejection and recovery. A nonzero command result or a missing acceptance invariant should invalidate a comparison, not disappear from the average.
Choose the next change from the measured stage
| Observed constraint | Small intervention to test | What must still be verified |
|---|---|---|
| Repeated acquisition dominates | Reuse an object store or a trusted mirror with an explicit owner | Setup/maintenance cost, revision freshness, isolation requirements |
| Materialization dominates | Narrow a checkout to the check's actual dependencies | Shared code, generators, root configuration and history queries still work |
| Dependency preparation dominates | Reuse compatible caches or a prepared environment | Lockfile/platform/toolchain identity; cache failures and invalidation |
| CI queue dominates | Bound submissions or increase the constrained runner capacity | Execution time and failure rate under the new load; queue versus job cancellation |
| Repeated validation dominates | Check the intended integration candidate and eliminate obsolete work | Required checks and failures cannot be skipped by a stale-result shortcut |
| Review dominates | Reduce change size and attach concise acceptance evidence | Human review time and defects discovered after acceptance |
Change one factor first. Fix the workload, preserve failed attempts, and compare accepted outcomes with the total preparation, checking and review cost. A policy that cancels obsolete work may save capacity, but ensure every still-required candidate gets checked before it can land.
If your workers share one machine, raising their count also changes contention during preparation and tests. If they use separate machines, acquisition and shared-service capacity become different constraints. Repeat measurements in the topology you intend to operate. There is no defensible universal worker count in this fixture.
What this evidence establishes
The lab verifies actual Git preparation paths, bounded validation concurrency and an integration failure followed by a successful repair. Its queue has a constructed service floor; its checks and repository are synthetic. It does not measure token cost, autonomous coding quality, dependency installation, WAN transfer, hosted CI, human review or production defect rates. It does not benchmark Scion.
The practical decision is to stop scaling a worker count in isolation. Locate the constrained stage, account for shared setup, and validate the candidate that will actually be accepted. More workers become useful when the whole path can turn their additional output into verified changes.
Method and provenance: this article and lab were prepared with AI assistance. Primary documentation was checked on October 19, 2026; local commands, measurements and limitations are recorded with the downloadable source. Reported external findings and the local fixture are separate evidence. The cover is a conceptual mechanism with two validation presses, not a plot of the measured timings.
