Factory v5 architecture

The cloud software factory as designed on the roadmap, against what is built to date. Source: project docs and step files; counts below are computed from the step files.

Summary: 27 components built and live, 3 built and unit-tested only, 10 designed and not built (40 total). Build steps: 45 done, 1 open (of 46, steps 5 to 50 in the step files).

Built and live (solid green, "live")Built, unit-tested only; live proof deferred (dashed amber, "unit")Designed, not built (dotted grey, "plan")
GitHubGitHub App + webhookssigned /gh deliveries, check runsliveBranch protection / PRmerge-ready required checkliveCloudflare controller WorkerQueues ingest (202 fast)liveD1 store + migrationsliveWorkflows: VM lifecycleliveR2 junit archiveliveAccess-protected /opsread-only dashboardliveAlerts to Matrixde-dup, open/clearliveAI Gateway (Codex lanes)gateway_calls, fallback provenliveCost tracking / budgetVM cap, gateway cost rowsliveLeak + lost-job reconciledlq_backlog alert inertliveRunnersHetzner VMs, JIT deliverypull-based JIT configliveKeyed snapshot, auto rebuildcontent-keyed imageliveSize classes + recoveryliveUntrusted-job isolationdelete at once, rebuild reuseliveStudio runner classfixed capacity, JIT per jobliveCoding VM (no starvation)liveCoderCoder dispatch (Codex)approved task to PRliveTrusted PR publisherliveGateFast / full, balanced shardsliveFail-fast + failed-firstfailed-first timing claim not met on fast repoliveFlake policy + infra redeliverone rerun, quarantineliveTestmon selectionshadow only, no authorityliveT0 preflightfirst live runs vacuous (0 tests)unitBatching N8 / concurrency sizingtest plan P2, not builtplanMergeMerge-ready check runsblocks-while-red unit-tested onlyliveMerge train (next branch)proven on practice repoliveReleasePreview environmentPages preview; end-to-end live proof deferredunitRelease: Workers pathstaging, health, approval, prod, rollback; canliveRelease: Pages pathunit-tested; live proof deferredunitFirst real product (step 41)step openplanPolicy layer / control centreEvaluator in shadow modePOLICY_MODE=shadow, no authorityliveSlice 1 authority: merge, dispatch, retryplanEscalation queue + ops resolutionSlice 2planSpend / VM scaling via policySlice 3planDaily digestSlice 4planDrift monitor, governed changesSlice 5planPolicy source in git, 6 decision tablesplanDeferred by ownerBare-metal host trialdeferred until host handed overplanTest-result caching, Firecrackerdeferred, no specplan

Flow, top to bottom: GitHub deliveries reach the controller; the controller starts runner VMs; the coder and gate run on them; the merge train and checks land changes; the release controller promotes them; the policy layer will decide and escalate (shadow only today).

Build steps

#TitleStatus
5Worker entry + D1 storedone
6Getting the JIT config onto the VMdone
7Snapshot, A4, live end-to-enddone
8Two VM sizes and recovery of stuck VMs (Stage C, C1 items 1-2)done
9Commission the pool live (Stage C, C1 items 2-5)done
10C2 shadow gate as a replay of 10 studio-gated factory-v3 SHAs (Stage C, C2)done
11C4 G1: instrument the shadow gate (per-phase times, junit, slowest tests) + runner SSH fixdone
12live shadow auto-trigger: every factory-v3 main push replays on v5 by itselfdone
13C4 G2: duration-balanced shards + collect-only count proofdone
14R2 archive: every completed job's junit artifact is copied to R2 before GitHub expires itdone
15Cloudflare Queues ingest: POST /gh verifies, enqueues, returns 202; a queue consumer runs the handlersdone
16read-only ops dashboard at GET /ops, behind Cloudflare Accessdone
17Cloudflare Workflows VM lifecycle: one durable instance per VM, behind a flagdone
18C4 G3: staged fail-fast (lane A)done
19Speed justification: is studio faster per dollar than the VMs?done
20Gate instrumentation: per-test spans, resource peaks, and the push-to-result span chaindone
21Profile the 122 s floor test and spec its fixdone
22Coder dispatch: approved task -> Codex on a fresh coding VM -> trusted PR publisherdone
23isolation policy: trust domains, credential audit, hostile isolation probe, gate-policy protectiondone
24merge authority: the App's factory/merge-ready and factory/post-push check runsdone
25flaky-test policy: classify failures, one diagnostic rerun, quarantinedone
26Release controller: staged, gated, gradual Worker promotion with rollback, plus a D1 migration policy checkerdone
27P0 Measure: telemetry v2, critical-path profile, VM setup breakdown, flake censusdone
28Diagnose the ~4 s per-container floor in factory-v3's testsdone
29automatic leak check and alert rules (B8 + B2 detection)done
30gate before main: a controller-run next branch (N1, Bors pattern)done
31failed-first early signal on a re-push (G4a)done
32infra failures labelled and auto-redelivered once (G4c)done
33Runner snapshot keyed by content and rebuilt automatically (G5a)done
34agent run outcome, stop reason and per-stage wall_ms (V2 + V3)done
35per-test history (B3), good merges per runner-hour (N10), Worker health (B5)done
36pytest-testmon shadow run on replayed SHAs (N9)done
37speed levers, tmpfs scratch (N4) and baked caches (N5), measured per sharddone
38gate/fast and gate/full scripts (G5b) and the B9 reader auditdone
39Cloudflare AI Gateway in front of every coder and reviewer LLM call (N2)done
40the Worker posts alerts to Matrix directly (B2)done
41tessella onto v5 end to end (D24), sub-steps 41a to 41eopen
42a queued coding job must not starve behind idle cpx22 VMs at the VM capdone
43delete a spent untrusted VM at once, not after the 55-minute ruledone
44reuse an untrusted VM by Hetzner rebuild between jobsdone
45compare in-VM sandbox (option B) with rebuild (option A, step 44)done
46a factory-studio runner class, and a benchmark against the Hetzner VM scalerdone
47reconcile jobs that D1 still thinks are running after GitHub finished themdone
48T0, a selective test preflight that feeds failures back to the coderdone
49policy evaluator in shadow mode, then Slice 1 (merge, coder_dispatch, retry)done
50add gh to the runner snapshot (follow-up to the step 41 live-run finding)done

Step 41 is open. Workers release path is proven on a canary Worker (staging and production Workers, health endpoint returns 200). Pages release path is unit-tested; live proof is deferred.