# 525 CI Jobs in 6 Hours & 3 Linux Traps: Building a Closed-Loop CI Server

> With AI coding agents, writing code stops being the bottleneck; verifying it becomes everything. Here is how I moved verification onto a dedicated bare-metal server in one night, doubled build speed, and cut variable cloud CI cost to $0.
>
> Innovation Chronicle #10 · 2026-12-04 · 8 min read · AI Factory & Infrastructure · Field Report
> Source: https://alohaos.ai/en/chronicle/closed-loop-ci-525-jobs-in-6-hours

A human engineer opens 2 or 3 pull requests a day, so sluggish cloud CI feels tolerable. When my AI agent swarm fired 525 CI jobs in 6 hours (~89/h at peak), I learned I did not need a faster LLM · I needed a verification factory that never jams.

Picture a bakery that buys five high-speed dough robots while keeping one tiny oven with a 40-minute wait and surge electricity billing. That is AI coding on standard cloud CI. So I moved my entire verification loop onto one dedicated bare-metal machine (16 cores / 32 threads Zen 5, DDR5 ECC, NVMe RAID 1), leaving cloud runners strictly as an idle emergency valve.

Even if you are not a Linux engineer, keep reading · I explain all 3 kernel traps I hit that night using plain everyday analogies. These are the exact operational details separating a live AI factory from a slide deck.

## Production Telemetry

- **AI swarm CI load:** 525 / 6 h (~89 verification jobs/hour at agent peak)
- **Storefront build:** 41s → 21s (Min 16s · 2.0× faster than cloud CI)
- **4,812 tests + TS 7:** 68s → 40s (In-RAM PG16 shards: 74s → 39–46s (24/24 pass))
- **Variable cloud CI bill:** $0 (Fixed bare-metal · cloud kept as idle fallback)

## TL;DR

- My AI agent swarm triggered 525 CI jobs in 6 hours (~89 jobs/h peak). Cloud CI became both slow and expensive, so I moved verification onto a single dedicated bare-metal server (16-core / 32-thread Zen 5, DDR5 ECC, NVMe RAID 1).
- In one night I caught and fixed 3 real Linux traps: parallel runners racing on a shared $HOME, 10:1 CPU thrashing (solved with isolated AllowedCPUs lanes), and a silent cgroups v2 memory throttle (88,427 MemoryHigh hits despite 50+ GB of free RAM).
- Storefront build doubled in speed (41s → 21s, min 16s), my 4,812-test check dropped from 68s to 40–44s, and 4 parallel in-memory Postgres 16 DB shards passed 24/24 cleanly (74s → 39–46s) while cutting variable cloud CI cost to $0.
- On top I shipped Aloha Harness v6: test-output compression against Context Rot (max 3 lines instead of 200+), 35ms post-edit lint hooks, a daily 06:15 trajectory miner at $0 LLM cost (Pareto Auto-Routing), plus flake quarantine and wave pacing.

## 01 · Traps 1 & 2 in plain language: why 5 cooks sharing one tiny counter trip over each other

Without per-runner home isolation and pinned CPU lanes, parallel jobs corrupt caches and thrash CPUs 10:1.

First, two concurrent runners collided inside the same pnpm installer directory (failing in 11 seconds) · fixed with an isolated $HOME per runner sharing a content-addressable NVMe store. Next came trap two: across 6 parallel jobs, every Vitest process saw all 32 host threads and spawned 100+ competing workers. Pinning disjoint 4-thread Zen 5 lanes per runner via systemd AllowedCPUs gave every runner its own highway lane and clean L2 cache.

- **Before:** Shared $HOME races and 100+ Vitest workers fighting over 32 threads
- **After:** Isolated $HOME + disjoint 4-thread Zen 5 lanes (AllowedCPUs) per runner

> Parallelism without strict lane isolation turns a fast CPU into gridlock.

## 02 · Trap 3: how Linux throttled a server with 50+ GB of free RAM (and how RAM Postgres hit 24/24)

Linux cgroup v2 counted 7.35 GB of disk page cache against the soft CI memory limit, triggering 88,427 throttle events and 77s p95 spikes.

This was the night’s biggest discovery. Host telemetry showed 50+ GB of free RAM, yet p95 runs spiked to 77 seconds. Kernel counters revealed 88,427 MemoryHigh hits and 15.6 million pgscan_direct reclaims because cgroup v2 billed 7.35 GB of file page cache against the CI slice. Raising the limit live with zero downtime removed the brake instantly. Alongside that, 4 DB test shards now launch ephemeral Postgres 16 right in RAM (/dev/shm, fsync=off, dynamic TCP port, guaranteed cleanup) · passing 24/24 in 39–46s with zero collisions.

- **Before:** 88,427 MemoryHigh hits, 77s tail spikes, and 74s disk-bound DB tests
- **After:** Cgroup v2 brake removed + 4 ephemeral in-RAM Postgres 16 shards (39–46s, 24/24)

> Never guess why latency spikes · read real kernel counters, because the worst brakes stay silent.

## 03 · Closed-Loop control: the system watches its own queues before traffic explodes

Queueing theory (Little’s Law) shows traffic stays smooth below 75% utilization and explodes exponentially above 85%.

Instead of babysitting the server manually, I built a lightweight controller running every 15 minutes. It records every job, computes utilization ρ = (arrival rate × service time) / lanes, tracks p90 queue latency, flags speed drift (EWMA), and catches flaky tests (fail → pass on the same SHA). Agent bursts batch through a Google-style Merge Queue while a 316k-node / 690k-edge code graph refreshes every 30 minutes.

- **Before:** Reacting only after an agent wave has already stalled for 20 minutes
- **After:** 15-min Closed-Loop controller (ρ < 0.75, EWMA, flake detection) + Merge Queue + 316k-node graph

> A true AI Harness measures itself and preserves laminar flow before any agent feels congestion.

## 04 · Aloha Harness v6: protecting agent memory and learning automatically every morning at 06:15

Fast hardware is half the game. The other half is protecting agent attention from Context Rot and mining recurring friction daily at $0 LLM cost.

On top of the CI metal, I layered four lightweight Aloha Harness v6 mechanisms. First, a test-output compressor against Context Rot: green runs return at most 3 summary lines instead of 200+ lines of noise, while red runs strip ANSI clutter down to the exact error and log pointer. Second, an instant PostToolUse loop after every file write: a 35ms (Python/Bash) or <150ms (Biome) hook catches syntax and lint errors before a full build ever starts. Third, a daily 06:15 trajectory miner ($0 LLM cost) scans CI logs and agent wave metrics, computes true First-Pass Rate and cost per task per model (Pareto Auto-Routing), and surfaces the TOP 3 recurring friction points (its very first run caught an npx tsc fallback missing local TypeScript and an FPR dip on harder tasks). Fourth, flake quarantine automatically flags fail → pass flips on identical SHAs while wave pacing spreads bursty agent swarms whenever queue load crosses the safe threshold.

- **Before:** 200+ lines of log noise flooding agent context and manual root-cause hunting
- **After:** Max 3 lines on green · 35ms edit hook · 06:15 daily trajectory report ($0 LLM) · flake quarantine

> The best AI harness wakes up one failure mode smarter every morning at 06:15 without burning extra LLM tokens.

## Honest trade-offs: dedicated bare-metal CI vs cloud runners

### When dedicated bare-metal CI crushes cloud runners

- When AI agents fire dozens or hundreds of runs a day (525 in 6h) · variable cloud spend drops to $0 and builds run 2× faster.
- When you want real in-memory Postgres 16 and deep integration suites without paying per-minute cloud markups.
- When you want full control over CPU lane isolation, NVMe caches, and a live code graph.

### When standard cloud CI is still the better choice

- When you only open a few PRs per week · cloud CI stays nearly free with zero Linux setup.
- Self-hosted metal requires real hygiene (lane isolation, guaranteed cleanup, cgroup monitoring) plus an idle cloud fallback.
- Without closed-loop telemetry, silent kernel brakes like MemoryHigh can quietly erase your hardware advantage.

## What this single overnight upgrade means for ALOHA OS and partners

- Every storefront, checkout, and ALOHA PILOT update clears 4,812 tests and 4 real Postgres 16 shards in ~40 seconds.
- Variable cloud CI cost during intense agent swarms dropped to $0, with cloud kept strictly as an idle safety valve.
- This is living proof of the AI engineering infrastructure running Aloha Fungi and our selective 1:1 D2C partnerships.

> „In the era of AI agent swarms, the winner is not who generates code fastest · it is who verifies it fastest, cheapest, and without loosening a single gate.”

## Questions & Answers

### What does Little’s Law (ρ < 0.75) mean in everyday terms?

Think of grocery checkouts: below 75% capacity, shoppers walk up and pay immediately. Above 85–90%, queues explode exponentially on tiny hiccups. My 15-minute controller keeps our CI server comfortably inside the smooth flow zone.

### What happens if the dedicated CI machine needs maintenance?

Cloud CI stays wired as an idle fallback valve · day to day I pay $0 in variable cloud minutes, while keeping an instant safety net if hardware ever needs servicing.

### Is running test Postgres 16 in RAM (/dev/shm, fsync=off) still realistic?

Yes. Every SQL lock, constraint, migration, and transaction runs on the exact Postgres 16 engine as production; skipping durable disk flushes on disposable test databases cuts shard time from 74s to 39–46s with zero mocking.

---

Author: Mateusz Rosa (Founder & Architect · ALOHA OS / Aloha Fungi)
Contact: matt@alohaos.ai · https://alohaos.ai
