Back

When Agents Outpace Their Infrastructure

Rebuilding our OpenSWE RL validation pipeline with content-hashed caching, workload pools, and resumable state

Published Nov 12, 2026 · 8 min read

When building reinforcement learning (RL) environments for coding agents, getting an agent to diagnose a broken repository or patch a test script is no longer the bottleneck. Agents already inspect codebases, trace dependency failures, and repair environment setups at a speed and scale no human team can match. The bottleneck, now, is all of the validation infrastructure built for human-scale experiments: fresh git clones, uncached container builds, coarse resource locks, upstream API quotas, and brittle export scripts.

In late September 2026, our OpenSWE pipeline validated tasks in batches of 15 to 100. By late October, we were running 500- and 1,000-task batches—processing 3,100 tasks in total and shipping 785 verified, containerized RL environments (~752 GB of artifacts) to production storage. We don’t expect this demand to slow down anytime soon. The latent demand for trustworthy RL environments is practically infinite, and every infrastructure bottleneck we remove immediately translates into more verified training data.

1.The validation bottleneck & grader design

Before making the pipeline fast, we had to define what it was not allowed to break. If an RL grader has a loophole, the policy learns to exploit the grader rather than fix the underlying bug. An agent claiming “I fixed it” means nothing until an independent validator proves it.

Our pipeline pairs repair and review agents—which inspect failure logs, align tests with issue descriptions, and patch broken Dockerfiles—with a deterministic six-stage validator (L0 through L5). Every task must pass progressive gates: static checks and source pinning, semantic review, container builds, red-to-green differential testing, and four-way repeatability runs.

Cheap checks and fixed inputsDeterministic execution and independent validationL0StaticchecksL1PinsourceAgent reviewTask–testalignmentL2Build +inspectL3ExecutetestsL4Controls +regressionL5Stability +isolationRoute failures using evidenceStatic repair / container-based diagnosisRevise setup scripts; preserve protected inputs and evidenceRe-run invalidated stages after a revision; never carry forward an old PASS blindlyWhat each level checksL0Auditable inputs and scriptsValidate fields, patches, and source hashes.Flag leaked answers or skipped tests.L1Exact baseline sourceCheck out the specified commit.Verify assets and an unmodified baseline.L2A clean, runnable environmentBuild; check dependencies and import paths.Inspect source changes and answer leakage.L3Tests actually executeVerify provenance, test IDs, and exit codes.Missing packages are not valid negatives.L4Fail before, pass afterCompare B, B+T, B+G, and B+G+T.Align test IDs; preserve passing regressions.L5Stable scoring and basic isolationRe-run empty and reference candidates.Check repeatability and protect grader assets.B: unfixed baseline source · G: reference (“gold”) patch · T: fixed test patch

Fig. 01Validation stages and the repair loop

L0–L5 are our project’s automated checks, not an industry standard. Agents separately review task–test alignment. Collection failures caused by new symbols follow a separate validation path. Passing L5 does not imply an L6 final review or a comprehensive security guarantee.

That strictness defined our central constraint: we needed 1,000-task throughput without deleting slow tests, weakening assertions, or leaking reference answers into the container. Speed had to come from eliminating wasted work, not lowering the bar.

2.Why naive concurrency multiplies waste

When we first tried to scale from 15 tasks to 1,000, our instinct was simple: spin up more agents. It failed immediately. At thousand-task scale, higher agent concurrency amplified redundant compute, starved local containers, and triggered cascading API rate limits.

The first culprit was self-inflicted rework during iterative repairs. Whenever a repair agent changed a single flag in an evaluation script, the pipeline responded by re-downloading the repository, rebuilding the entire Docker image from scratch, and re-running a full LLM semantic review. More agents meant more repair loops fighting over the same local CPU and disk I/O to repeat identical setup steps.

3.Fresh git clones break layer caches

Even when a container rebuild was genuinely required, Docker’s layer cache was mysteriously failing. Across 1,747 build steps in an early rerun batch, only 48 hit the cache—a 2.7% hit rate.

The culprit wasn’t Docker; it was our source-pinning stage (L1). Re-cloning a repository touched filesystem metadata inside .git, altering the checksum of the COPY layer and invalidating every expensive dependency installation beneath it. What looked like a slow container daemon was actually a cache bust we caused before docker build even started.

4.The fix: Content-hashed incremental runs

We broke through the build wall with two changes: preserving the verified L1 source checkout across repair revisions, and making stage invalidation dependency-aware.

Instead of wiping state on every edit, we lock each stage to cryptographic content hashes across the source tree, runtime configuration, and image ID:

  • Evaluation-script edits reuse both the verified source tree and the built container image.
  • Dockerfile edits reuse the verified source checkout and rebuild only from the modified image layer onward.
  • Incremental semantic reviews inspect only setup or evaluation diffs whenever the issue statement and code patches remain unchanged.
Reuse after identity checksRe-run or revalidateL0L1ReviewL2L3–L5Evaluation-script editRe-runReuseReviewReuseNew test evidenceDockerfile editRe-runReuseReviewRebuildNew test evidenceSource / protected-input editReject the old prefix and validate the new inputs

Fig. 02Invalidate only what changed

Three evaluation-script revisions required zero additional builds. Another revision was denied reuse because its source identity had changed. Checks cover source, runtime, dependencies, and the exact image ID.

Crucially, we cache verified setup, never a stale passing verdict. In our initial pilot, three evaluation-script revisions required zero extra Docker builds, while a task whose git metadata had drifted was automatically caught and forced to rebuild. Preserving source identity restored Docker’s layer cache, cutting individual task rebuilds from 119–260 seconds down to 2–3 seconds. Across a 500-task run, incremental semantic review bypassed full re-reviews 58 times.

Earlier buildSubsequent build050100150200250 sec1192pyosMeta2603invenio-cli103101ICTUAcross runtimes

Fig. 03Build-cache results from individual revisions

These are individual cases, not an aggregate speedup. The cross-runtime ICTU case barely improved: cache reuse depends on stable inputs and execution conditions.

5.Separating pools unlocks idle silicon

Eliminating redundant builds shifted the bottleneck to job queuing and upstream API quotas. Early on, we controlled concurrency with a single global knob. In reality, the pipeline mixes three distinct resource profiles: LLM semantic reviews block on network I/O, container builds saturate local CPU and disk bandwidth, and static script repairs need no container at all. Splitting these into dedicated concurrency pools exposed three hidden throttling layers:

  • Paper saturation in the scheduler: During a 100-task run, host CPU sat at 24.9% while build jobs waited over 11 minutes (664 seconds median) for admission. Reserving 3.5 cores per build (L2) and 3 cores per test run against a 15-core budget filled our accounting ledger at 4 concurrent builds while leaving physical silicon idle. Right-sizing reservations to measured usage—2 cores for builds, 1.5 for tests—unlocked a 5th build slot and cut median admission wait by 68%, down to 213 seconds.
Original reservations664 secRevised reservations213 sec~68% lower median wait · Concurrent builds: 4 → 5

Fig. 04Smaller reservations, shorter admission waits

The batches had different workloads. The 68% change applies to observed queueing time—not end-to-end throughput—and cannot be attributed entirely to the reservation change.
  • Container throttling on an idle host: Conversely, some jobs crawled while the host looked 70% idle. Inspecting Linux cgroups showed a container with a 4-core quota averaging 3.8 cores and getting throttled in 91% of its kernel scheduling periods while overall host utilization read 21–35%. Host-wide averages hid per-container starvation, so we wired per-container cgroup throttling, Linux PSI pressure, and disk IOPS directly into runtime telemetry.
  • Adaptive backpressure for API 429s: Once local compute flowed freely, traffic slammed into the shared LLM gateway. Thirty-two concurrent agents sustained ~126 requests per minute cleanly, but 48 agents triggered a 17% HTTP 429 rate—even across a second EC2 instance sharing the same upstream quota. We built a local proxy using additive-increase/multiplicative-decrease (AIMD) congestion control: any 429 immediately multiplies the in-flight cap by 0.8, while sustained error-free utilization above 80% steps the cap up by 1, queuing excess requests locally. To prevent deadlock—since an AIMD window only grows while traffic flows—any automatic dispatch pause wakes on an independent cooldown timer or lightweight probe.
When the service is overloaded, send less and queue the restReview / repair agentsProduce requestsLocal queueBuffer with bounded waitsConcurrency gateA limit, not a quota guaranteeShared model serviceCapacity varies with loadRate-limited: limit × 0.8 · Stable and near capacity: limit + 1Retry queue timeouts as transient failures; don’t reject the task itself

Fig. 05Match request concurrency to service capacity

Requiring real utilization before increasing the limit prevents it from growing while idle. These settings were calibrated for our service, not proposed as universal defaults.

6.Stop silent stalls via checkpointing

At thousand-task scale, a loud crash is a gift. Our costliest outages came from silent stalls: live processes reporting healthy heartbeats while burning hours without advancing a single task. Three production failures in our 500-task run proved that recovery engineering is throughput engineering:

94-second write lockSource checks held the database lock until the supervisor timed out.Fix: move slow checks outside the transaction; bound lock retries.~4 hours of stranded capacityDead workers still occupied two of five build slots.Fix: confirm the job is dead, then release its slots and reservations.~9 hours without progressOne oversized image triggered 26 retries, each repeating deep verification.Fix: checkpoint substeps, reuse valid checks, and alert after bounded retries.

Fig. 06Three ways to lose useful execution time

These are lock duration, stranded-resource duration, and export-stall duration, respectively. They should not be added together as a total loss.
  1. Database locks around file I/O: A repair worker hashed an 857 MB, 89,000-file source tree inside an open SQLite write transaction, blocking the database for 94 seconds until the supervisor timed out and exited. Moving file hashing outside transactions with optimistic reference checks eliminated the lock.
  2. Phantom worker leases: When that supervisor died, two terminated L2 build workers stayed marked RUNNING in SQLite, silently holding 2 of 5 build slots and 240 GiB of disk reservations for four hours. Our watchdog now cross-checks worker PIDs, active containers, and lease timestamps before reclaiming stranded capacity.
  3. Idempotent vs. resumable exports: After validation completed, a single 5+ GiB container image exceeded S3’s single-PUT limit and raised a SystemExit that bypassed standard exception handling. Treating export as a monolithic step, the control loop retried the entire batch 26 times—re-running 21 minutes of deep checksum verification each cycle and wasting nine hours.

Idempotency (using If-None-Match so retries don’t corrupt S3) kept our data safe, but only resumability saved our wall-clock time. We broke batch delivery into checkpointed substeps (assemble, verify, upload, cleanup), cached per-sample verification markers, routed oversize artifacts into 4 GiB multipart uploads, and enforced bounded retries with explicit alerts.

7.Why raw task throughput misleads

Running 1,000-task batches reliably forced us to change how we keep score. Raw task throughput flatters a pipeline; accepted environments delivered to S3 tell the truth.

In a 500-task batch completed in ~9.3 hours (~54 tasks/hour), strict quality gates automatically closed 305 tasks (61.0%)—catching subtle flaws like tests asserting on private helper names from the reference patch—held 57 ambiguous tasks (11.4%) aside without blocking the batch, and yielded 138 verified RL environments (27.6%). With an 87.2% prompt-cache hit rate, our $223.75 model API bill looked like $0.45 per task processed, but the honest unit cost was $1.62 per accepted environment before EC2 compute and storage.

138 accepted305 closed57 held27.6% accepted61.0% automatically closed11.4% held for laterProcessing rate includes closures and holds, not just accepted tasks.$223.75Model API cost for the batchExcludes compute, storage, and labor87.2%Share of input served from cacheCached context still has a cost≈ $1.62Batch model cost ÷ 138 accepted tasksNot the full production cost

Fig. 07Outcomes from a 500-task batch

The batch processed 500 tasks in about 9.3 hours: roughly 54 tasks per hour. Automatic closure executed without failures; that does not establish zero classification error.

“Validation complete” is also only halfway to dataset delivery. In our 1,000-task run, producing 299 accepted environments (~309 GB of compressed artifacts) took ~15 hours of validation, followed by another 7 hours and 11 minutes to package tarballs, verify checksums, upload 33,227 objects to S3, and prune 373 GB of local Docker images before the next run.

050100150200 minPackage images + evidence216.3Local verification49.6S3 upload103.8S3 verification0.5Local cleanup60.1Annotations + catalog0.4

Fig. 08Post-validation work for a 1,000-task batch

299 accepted tasks, about 309 GB. Durations are derived from stage events. Archiving is part of delivery time, not work to exclude from throughput accounting.

Today, we evaluate pipeline changes by three numbers: accepted environments in S3, stage queueing versus execution time, and hours lost to stalls. Next, we are moving from batch-end drains to streaming S3 exports as individual tasks clear L5, overlapping disk cleanup with incoming batch startups, and testing structured failure memory so repair agents resolve recurring environment bugs in fewer turns.

We deliberately avoid claiming a single headline speedup across batches because task difficulty and shared API load shift daily. Instead, we stand behind concrete systems mechanisms: 260-second builds reduced to 3 seconds via source-identity preservation, 664-second queue waits cut to 213 seconds via calibrated reservations, and nine-hour export loops eliminated via substep checkpointing. We started out thinking agent scaling was a prompt-engineering problem; at 1,000-task scale, classic systems engineering is what lets agents work at agent speed.

More research

All research
When Agents Outpace Their Infrastructure | Corepass Research - Corepass