oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Hosted CI (branches hosted-ci, ci-flakes)
2
3Goal: Equipo's CI on amadan's hosted CI, fast, with nothing on docs-t1.
4Paul's ruling (2026-11-10): no CI on docs-t1 at all, not even a small
5host step. Locally, run only targeted tests.
6
7## What hosted CI is
8
9Each job gets its own single-use arm64 machine (Amazon Linux 2023, up to
1032 vCPU), with Go, Docker, git, make and python3 3.9. No bubblewrap, no
11systemd user session, no isolation around steps. The clone is one commit
12deep. GOCACHE and GOMODCACHE are restored from S3 before the job and
13saved after a passing one (limits: 2 GiB compressed, 6 GiB unpacked;
14over either, the save is dropped whole). Steps run one after another; a
15step's `@N` shards run side by side on the one machine. Only the `ci`
16pipeline gives the commit its verdict.
17
18## What Equipo needs that the machine lacks
19
20Most of the suite, not only the old steps 35 and 36, starts real
21containment through production code that requires `bubblewrap 0.11.0`
22exactly, runs the pinned Codex program, and one test moves a process
23between two delegated cgroups. So:
24
25- **The CI box** (`scripts/ci-box.py`, `scripts/ci-box-enter.sh`,
26 `scripts/ci-box.json`). Every step runs in one privileged container,
27 the official Go 1.26.11 image on Debian 13 (the runner host's own
28 system, pinned by digest, pulled, never built), as an ordinary user.
29 The pinned programs are fetched by URL and checked by SHA-256 for the
30 machine's architecture, then mounted where a runner host has them:
31 Debian's bubblewrap 0.11.0-2+deb13u1 at `/usr/bin/bwrap`, codex
32 0.165.0 on PATH, and codex, its code mode host and claude 2.1.312 in
33 `~/.local/share/equipo/try/bin`. The entry script gives `/etc` its own
34 filesystem (containment overlays `/etc`, and the kernel refuses an
35 overlay over the container's overlay root), a machine id, a git
36 identity, and a cgroup v2 subtree the user may write, at the path a
37 systemd user session has. socat (Claude's own sandbox needs it) is
38 fetched and pinned like the rest.
39- **On a runner host the box is skipped.** `ci-box.py run` runs the
40 command directly where `/usr/bin/bwrap` is already 0.11.0 and codex is
41 on PATH. `EQUIPO_CI_BOX=on|off` forces it.
42- **arm64 pins beside the certified ones** (`codex/pins.go`,
43 `claude/pins.go`). The certified amd64 constants are untouched and are
44 still the only pins a launcher or a release trusts. The replay tests
45 pick the pin for `runtime.GOARCH`. Digests come from the official
46 releases:
47
48 | program | arm64 SHA-256 | source |
49 |---|---|---|
50 | codex 0.165.0 | b32ece31...c543f | openai/codex rust-v0.165.0, aarch64-unknown-linux-musl |
51 | codex code mode host | fd7a4a1f...aa14 | same release |
52 | claude 2.1.312 | dc4af289...61f5 | the release manifest at downloads.claude.ai |
53 | bubblewrap 0.11.0 | ef2316fc...3b59 | Debian 0.11.0-2+deb13u1 arm64, snapshot.debian.org |
54
55 The same sources reproduce the amd64 pins already in the tree (codex
56 c06a67fd, host 522935d4, claude 4f4178ce, bwrap 0dfa36b9), which is the
57 check that they are the right sources.
58- **A missing pinned program fails on CI** instead of skipping
59 (`testci.Absent`, `EQUIPO_TEST_TOOLS_REQUIRED=1` set by the box).
60- **Chromium for the browser tests.** The `//go:build browser` tests
61 run on CI in their own lanes (`BROWSER_LANES` in `scripts/ci-test.py`,
62 `-tags browser,testbuild`, only the tests that tag adds, found with go
63 list so a new one always runs; `scripts/ci-test.py lanes` prints them).
64 The browser is Debian 13's `chromium-headless-shell`, pinned with
65 every library it needs that a Debian image lacks: about 75 packages,
66 155 MB, in `scripts/ci-chromium.json`, each by snapshot.debian.org URL
67 and SHA-256. Chrome for Testing has no Linux arm64 build; Debian builds
68 both. `ci-box.py prepare` unpacks them into one tree, mounted at
69 `/opt/chromium-<version>`, and the box sets `RASTRILLO_CHROME` to its
70 launcher, which `harness.ChromePath` reads first. Raise it with
71 `scripts/ci-chromium-pin.py VERSION SNAPSHOT SECURITY_SNAPSHOT`. The
72 quarantine runs a quarantined browser test with the browser tag.
73 Five browser drives of pre-thin pages (four in equipotest,
74 TestConversationLayout in plan3test) failed every time once they ran;
75 they were deleted, and their pages are on the slice 7 sweep list
76 (thin v1 spec §8).
77
78## Caches across fresh machines
79
80- Fixed paths in the box (`/work/equipo`, `/cache/go-build`,
81 `/cache/go-mod`): Go keys a compiled package on its directory.
82- `ci-box.py prepare` sets every tracked file's modification time from
83 its git blob and every directory's to one fixed time, so go test's
84 cached results (keyed on size and time of each file a test opened)
85 hold on the next machine. A changed file gets a new time. Measured: a
86 rerun on a fresh machine replayed every test package from the cache.
87- `ci-box.py prepare` also deepens the clone (hosted clones one commit;
88 gitleaks, the mixed-version test and a release test read history). It
89 runs on the machine, outside the box, where the job's git credential
90 is.
91- `ci-box.py cache` (last step) reports the cache sizes and, past 4 GiB,
92 drops build cache entries the job did not read. A restore stamps every
93 entry "now", so Go's own trim never fires on hosted. One full run
94 leaves 1.96 GiB of build cache and 0.79 GiB of modules, under the
95 6 GiB limit.
96
97## Steps
98
99| step | what |
100|---|---|
101| `00-prepare` | fetch and verify the pinned programs and Chromium, pull the image, deepen the clone, set file times |
102| `05-copy` | `make copy-release-check`: copy still marked COPY REVIEW REQUIRED fails here, not at the staging build |
103| `10-compile` | compile every package and its tests once (the browser packages with `-tags browser` too), link no test; build rastrillo and the static check tools |
104| `20-check@29` | 18 test lanes, 5 browser lanes, the quarantine, `runner-host` (bubblewrap build, pinned codex, namespaces, cgroup move, uncached), and the static checks in four groups (with `make lanes-check`); a failed test is retried once |
105| `50-perf` | alone, it measures time |
106| `90-cache` | report and trim the caches |
107
108Hosted runs steps one after another and only a step's shards side by
109side, so everything that can run together is one step.
110
111## What made it fast, in the order found
112
1131. **/tmp in memory.** With /tmp on the machine's disk every lane took
114 twice as long (thintest 35 to 78 s, directlive 88 to 168 s): the tests
115 sync small files and databases thousands of times. The installer
116 tests, which need user extended attributes a tmpfs refuses before
117 Linux 6.6, put their home under the user's home instead.
1182. **Compile once, then fan out.** 23 shards on an empty cache each
119 compiled the same packages (Go shares no compile between processes
120 that start together): every shard took 150 to 370 s and two
121 timing-sensitive tests failed under the load.
1223. **Lanes split by test name** (`scripts/ci-test.py` LANES), from
123 measured times: headless six lanes, runner three, equipotest four. A
124 lane that names no tests runs whatever its package's other lanes do
125 not, so a new test always lands somewhere. directlive stays whole:
126 two of its lanes side by side both failed with
127 `provider_account_containment`.
1284. **Static checks beside the tests**, not before them.
129
130To rebalance: each shard's log ends with its time and its five slowest
131tests; move names between lanes of a package, keep `20-check@N` equal to
132the lanes plus the extra shards. `make lanes-check` (in the static checks
133shard) fails when a lane names a test or package that is gone, two lanes
134take the same test, a split package has no lane for the rest, or the
135count is wrong. "The rebalance of 2026-11-12" below says how to get every
136test's and subtest's time, which the five slowest do not give.
137
138## Before (docs-t1)
139
140Main c6319a5 on docs-t1 (load 26 to 44): failed after 512 s; the
141headless lane ran 470 s and failed, thintest failed at 102 s. Best warm
142docs-t1 run (ci-speed 5258905, nothing changed): 217 s.
143
144## Runs on hosted (32 CPUs, arm64)
145
146Proved in the scratch repository `oficina/equipo-hostedci` (hosted is
147per repository, and main's old steps cannot pass there). Times are the
148sum of steps; push to verdict adds the machine's boot and the cache
149restore, about 110 s, which is amadan's side.
150
151| run | what | steps | slowest shard |
152|---|---|---|---|
153| 0d5e136 | first full run, cold, 9 shards, old layout | 351 s, red | headless 265 s |
154| d4ea8db | /tmp on disk | 397 s, red | headless 312 s |
155| dd9e43c | 23 shards, no compile step | 384 s, red | equipotest 373 s |
156| dd7960c | compile step, /tmp in memory | 249 s, red | equipotest 196 s |
157| 42e4278 | rebalanced, 24 shards, cold | **202 s, green** | directlive 121 s |
158| 42e4278 rerun | nothing changed, fresh machine, warm cache | **100 s, green** | runner-host 26 s |
159| 10ae706 | main 85404a0 merged in (app code changed), warm cache | **168 s, green** | directlive 92 s |
160
161In the cold green run: prepare 10 s, compile 42 s, checks 121 s, perf
16228 s. In the warm rerun: prepare 11 s, compile 38 s (it still linked
163every test binary; it no longer does), checks 26 s, perf 24 s.
164In the merge run: prepare 11 s, compile 39 s (core packages changed),
165checks 92 s, perf 25 s; the runner lanes it did not touch replayed from
166the cache.
167
168On `oficina/equipo` itself (hosted on at 32 CPUs since 2026-11-11):
169
170| run | what | steps |
171|---|---|---|
172| cdc159e | `hosted-ci` tip, cold (the repository had no cache yet) | 216 s, green |
173| 4462596 | main after the merge, cold | red twice, then 201 s, green |
174
175## Flakes seen on hosted
176
177Main went green on its third run. Each red was one test, a different one
178each time, in a run where all 24 shards started on an empty cache:
179
180| test | runs | what it said |
181|---|---|---|
182| TestHeadless/1_first_token (headless) | 2 | `runner exited: provider_uncertain` after 45 s |
183| TestContractTransferTooLarge (thintest) | 1 | `waiting for send_pack: context deadline exceeded` after 45 s |
184| TestNamespaceRecoveryCrashBeforeExit (containment, in runner-host) | 1 | `invalid argument` |
185| TestCoordinatorRecoveryCallRefusalKeepsServing (runner) | 1 | `runner.invalid` |
186| TestGateVerifyByMarkerAlone (runner/mac) | 2 | fixed: the test raced the child's exec |
187
188The transfer and first token ones are the family CI-PROGRESS.md already
189lists (timeouts under load). Paul's controller ruled on them on
1902026-11-11 (R13): retry once, record every flake, report repeat
191offenders, and fix the cold start. The next three sections are that.
192
193## A failed test is retried once
194
195Every test lane, the quarantine shard and `runner-host` retry a failed
196test once, in the same shard (`scripts/ci-test.py`, `retry_failures`).
197The lane reads which tests failed from what `rastrillo budget test`
198prints, then runs only those again with `go test -count=1 -run`, the
199deepest failed subtest and not its parent. A test that never finished (a
200timeout, a panic beside it) counts as failed. Red means the test failed
201twice.
202
203A pass on the retry keeps the shard green and prints one line, between
204two rules of `#`:
205
206 FLAKE <package>:<test> <lane> <commit> <seconds>s <load>
207 FLAKE ./internal/headless:TestHeadless/1_first_token headless-rest 3d86170a0f3f75b82091f4838cf26fcae1eb1d11 45.02s 31.50
208
209The seconds are how long the failed attempt took and the load is the
210machine's one minute load average when it failed; either is `unknown`
211when it cannot be read. The failed attempt's output is in the log above
212the line. The line is in the job log, so `amadan ci status oficina/equipo
213-branch B -json` carries it.
214
215Not retried: a package that does not build, a failure that names no test
216(a budget), and a lane with more than 10 failed tests, which is a broken
217change and not a flake.
218
219## Repeat offenders: scripts/ci-flakes.py
220
221 scripts/ci-flakes.py main and every branch git knows on origin
222 scripts/ci-flakes.py -branch main -branch my-branch
223 scripts/ci-flakes.py -log saved-job.log
224
225It reads the FLAKE lines of each branch's latest run through `amadan ci
226status oficina/equipo -branch B -json` and counts them per test over the
227last 7 days (`-days`). amadan keeps one run per branch, so the script
228adds each run it sees to a history file, `~/.cache/equipo/ci-flakes.jsonl`
229(`-history`), and counts over that. Run it after a push or once a day,
230from the same account. A run it never saw is not counted.
231
232A test with 3 flakes (`-times`) in the window is a repeat offender. For
233each one the script prints what whoever runs it then does:
234
2351. Make the test call `testci.Quarantine(t)` first and add the printed
236 line to `scripts/ci-quarantine.txt`.
2372. File it, with the two commands as printed, full arguments and all:
238 `amadan discuss new oficina/equipo -title "Flaky test: ..." -body -`
239 (the body, with each flake's commit, lane, time and load, is printed
240 as a here-document), then `amadan discuss type oficina/equipo <id>
241 -type Issue` with the id the first command printed.
242
243The script files nothing itself.
244
245## The cold start
246
247A cold run is one with an empty build cache: every shard compiles and no
248test result replays. A commit that carries the file `.amadan/cold` gets
249one: prepare empties the restored build cache (`ci-box.py`, hosted
250machines only). Push it on a scratch branch and never merge it.
251
252Measured on main 3d86170 that way (`ci-cold-base`, 47c407f): the 24
253shards held the load at 83 to 109 on 32 CPUs for the whole check step,
254with tasks waiting for a CPU 40 to 50 % of the time, and directlive
255failed with `provider_account_containment`. Three changes:
256
257- **The compile step builds what the shards shared.** `go list -export
258 -test` compiles every test package without linking it, where the six
259 headless lanes, four equipotest lanes, three runner lanes and the
260 quarantine each compiled their package's tests again. It also builds
261 rastrillo, staticcheck, govulncheck and gitleaks. Warm, all of it is a
262 few seconds.
263- **Each shard's go commands run 8 actions at once** (`GOFLAGS=-p=8`; 16
264 for `rest`, where it is also how many packages test at once), and the
265 static checks run on 8 threads (`GOMAXPROCS`).
266- **The shards that load does not hurt start late**: the equipotest
267 lanes, plan3test, rest and the static checks wait 10 seconds, then
268 until tasks have waited for a CPU under 10 % of the last ten seconds,
269 30 seconds at most (`LATE` in `ci-test.py`). The lanes that have timed
270 out (headless, thintest, runner, directlive) start at once. On a warm
271 run the wait is the 10 seconds, in shards that finish early anyway.
272
273Cold runs, each on a scratch branch with `.amadan/cold`. All three went
274red at govulncheck or a test (below), so perf and the cache step did not
275run; add 26 s for them.
276
277| run | what | prepare | compile | check | load at lane ends | CPU waiting |
278|---|---|---|---|---|---|---|
279| 47c407f `ci-cold-base` | main 3d86170 | 29 s | 33 s | 120 s | 83 to 109 | 40 to 51 % |
280| e5342ae `ci-cold-1` | the changes, waiting 5 s | 13 s | 61 s | 112 s | 34 to 58 | 18 to 37 % |
281| 6adf2ef `ci-cold-2` | the changes as merged, waiting 10 s | 14 s | 55 s | 112 s | 23 to 57 | 7 to 33 % |
282
283The time did not change: about 208 s of steps before, about 207 s
284after. The work moved from the shards into the compile step (33 to 55 s)
285and the check step is as long as directlive (108 s of tests, cold),
286which nothing here shortens. What changed is the load: half, and the
287lanes that time out now start on a machine with a load under 30.
288Most lanes are 10 to 30 s shorter (runner-bug 73 to 44 s, thintest 53 to
28940 s). In the before run directlive failed (`provider_account_containment`
290and `namespace_identity_unproven`); in the two after runs no test timed
291out, and one test flaked for another reason and passed its retry.
292
293What each red was:
294
295- `ci-cold-base`: directlive, as above, and govulncheck (see Open).
296- `ci-cold-1`: this run also raised the gate's Go to 1.26.11, and
297 TestToolProxyIsTheCertifiedBuild failed twice, rightly (see Open). No
298 retry hides a real failure.
299- `ci-cold-2`: govulncheck only. `rest` printed
300 `FLAKE ./internal/runner/provider/claude:TestClaudeFailureDiagnostics/partial rest 6adf2ef75d99a52cd2808e3f191b82d4f8d36fa3 0.11s 48.71`
301 and stayed green; `scripts/ci-flakes.py -branch ci-cold-2` listed it.
302
303## Fixed, and only retried
304
305| test | state |
306|---|---|
307| TestNamespaceRecoveryCrashBeforeExit | fixed: a race in the test. `pidfd_open` says EINVAL, not ESRCH, while the kernel is part way through reaping the process; the test failed on anything but ESRCH and now keeps polling. |
308| TestGateVerifyByMarkerAlone | fixed in the previous round (the test raced the child's exec). |
309| TestHeadless/1_first_token, TestContractTransferTooLarge, TestCoordinatorRecoveryCallRefusalKeepsServing | not changed: 45 second waits that ran out at a load near 100. The cold start now runs at half that load, and they are retried. None failed in the two cold runs after. |
310| directlive `provider_account_containment`, `namespace_identity_unproven` | retried only. Seen at load 55 to 109, and earlier with two directlive lanes side by side. The cause is in the containment proofs, which is production code. |
311| TestClaudeFailureDiagnostics/partial | retried only. Failed in 0.11 s with `protocol_rejected`, last frame `malformed`: not a timeout, so likely a race in the test's fake or in the frame reader. First seen on `ci-cold-2`. |
312
313
314## The rebalance of 2026-11-12 (branch ci-rebalance)
315
316The check step had grown from about 63 s to 154 to 158 s on any run
317whose tests missed the cache: headless-rest took 154 s, with
318browser-headless-rest (118 to 131 s), thintest (106 to 109 s) and the
319quarantine (91 to 99 s) behind it. The browser lanes and the new
320Research, metered and preview tests had grown them.
321
322**Every test's time.** A shard's log names only its five slowest
323top-level tests, and headless-rest was mostly 25 subtests of
324TestHeadless. Scratch commit 43529308 (branch ci-rebalance-times,
325closed) carries `.amadan/cold` and an `.amadan/times` switch that makes
326each lane run `go test -json` in place of rastrillo and print the time
327of every test and subtest; its check step took 156 s, as main's did, so
328the switch costs nothing measurable. Cherry-pick it onto a scratch
329branch to measure again; never merge it. The quarantine now prints each
330test's time and each run's wall time itself.
331
332**What moved** (seconds are test time on that cold run):
333
334- headless (448 s over six lanes): 25 TestHeadless subtests and two
335 token tests left headless-rest (153 s) for the other five lanes. Each
336 is now 67 to 77 s.
337- thintest (105 s, no parallel tests): thintest-contract takes
338 `^TestContract` (57 s), thintest the rest (48 s). The one new shard.
339- equipotest: its long tests call t.Parallel and wait together, about
340 15 s, so a lane is its serial tests plus that wait. The lanes take
341 letters by serial time: A to D and Q (36 s), E to P (39 s), R (42 s),
342 the rest (40 s). equipotest-d is now equipotest-e.
343- browser (409 s): browser-headless-connections takes the connections
344 and paste-box drives (77 s); chat, work and rest are 79 s each.
345 browser-thintest is gone: thintest's browser tests (91 s) joined
346 plan3test's in browser-rest, whose shard had run 5 s.
347- quarantine: its nine TestHeadlessConnections subtests took 91 to 105 s
348 in one go test. More than five entries of one test now run as even
349 runs of at most five, side by side (`QUARANTINE_RUN`).
350
351**The guard.** `scripts/ci-test.py check` (`make lanes-check`, in the
352static checks shard) reads every package's test files and fails when a
353lane names a test, subtest or package that is gone, two lanes take the
354same test or subtest, a split package has no lane for the tests nobody
355names, a browser lane's pattern also takes a plain test, or
356`20-check@N` is not the lane count. TestLanesRunEveryTestOnce
357(internal/testci) holds its rules; each was broken once and seen red.
358
359**Measured**, each run on its own fresh machine, `.amadan/cold` except
360where it says warm. Check step, then its slowest shards:
361
362| run | layout | check | slowest shards |
363|---|---|---|---|
364| 2cc2894 main (tests missed the cache) | before | 154 s | headless-rest 154, browser-headless-rest 118, thintest 106 |
365| ccfa18e connections-s2-pi (same) | before | 158 s | headless-rest 158, browser-headless-rest 131, thintest 109 |
366| 52c8da1 ci-rebalance-cold-before | before | 154 s | headless-rest 154, browser-headless-rest 120, thintest 106 |
367| 4352930 ci-rebalance-times | before | 156 s | headless-rest 156, browser-headless-rest 121, thintest 107 |
368| c3cef28 ci-rebalance-cold-after-1 | first cut | 136 s | headless-guards 136 and headless-mac 123: two 45 s timeouts, each passed its retry |
369| 07ed24e ci-rebalance-cold-after-2 | first cut | 106 s | quarantine 106, browser-rest 100, headless-guards 93 |
370| c224aca ci-rebalance-cold-after-3 | final | 101 s | browser-rest 101, headless-guards 94, equipotest-r 93 |
371| b0f6606 ci-rebalance-cold-after-4 | final | 101 s | browser-rest 101, headless-guards 94, equipotest-r 92 |
372| 26055a6 ci-rebalance, warm | final | 76 s | browser-headless-chat 76, equipotest-r 70, equipotest-a 63 |
373
374Steps on a cold run: about 237 s before, 188 s after (prepare 14,
375copy 20, compile 22, check 101, perf 30).
376
377**The machine is busy at the start.** At the lane ends, before: load
37835 to 54, tasks waiting for a CPU 22 to 32 % of the last minute; after:
379load 42 to 62, 28 to 38 %. Memory and disk never waited. The work did
380not grow; it moved from the tail (headless-rest alone at load 15) into
381the first 90 s. So the step has one shard more and not several, and
382the next shard to add is a second thintest browser lane (browser-rest,
383101 s) only if the load allows it. In the first cut's run 1, two tests
384ran into a 45 s wait at load 28 to 35 and passed their retry
385(TestHeadless/1_first_token, a known one, and
386TestHeadless/3_empty_engineering); none did in the four runs after.
387
388**Warm runs** are unchanged at about 75 s (main 70e1e85: 72 s). An
389equipotest lane whose tests read a changed file reruns whole, 60 to 70 s
390with its wait: equipotest-r on both warm runs (TestReleaseStampContract
391first), main's D to P lane after main's change, and here equipotest-a,
392whose TestCIGateSteps reads scripts/ci-test.py. browser-headless-chat
393reran because its previous run flaked, and a flaked run leaves no cached
394pass. No lane split shortens these.
395
396
397
398## Open
399
400- Closed: the tool proxy no longer needs certifying. See "The
401 certification sweep" below.
402- `exactPID` in `internal/runner/containment/recovery.go` treats only
403 ESRCH from `pidfd_open` as "the process is gone". EINVAL, the kernel
404 part way through a reap, comes back as an error. The test no longer
405 trips on it; the production path is unchanged.
406- amadan keeps one run per branch. `scripts/ci-flakes.py` keeps its own
407 history of the runs it saw; a list of a repository's past runs from
408 amadan would make that file unnecessary.
409
410- Timing budgets are reported, not enforced (`EQUIPO_CI_DEDICATED` is
411 unset). The machine is the job's own, but 24 shards share it; set the
412 variable once a week of hosted times says the budgets hold.
413- `provider_account_containment` in directlive when two of its lanes run
414 side by side: cause unknown, worked around by keeping it one lane. It
415 also failed alone on a cold run at load 55 to 109 (47c407f).
416- TestGateVerifyByMarkerAlone (runner/mac) failed twice on cold, loaded
417 runs: the test started a marked process and Verify looked before the
418 kernel showed the new environment, so it settled with the process
419 alive. The test now waits for the marker. The same window exists for a
420 real marked process caught in the middle of its exec; not changed here.
421- TestCoordinatorRecoveryCallRefusalKeepsServing (runner) failed once
422 under the load of the uncompiled 23 shard run and not since.
423- The image is pinned by digest and pulled from the public ECR mirror of
424 Docker Hub each job (8 s). The pinned programs come from GitHub,
425 downloads.claude.ai and snapshot.debian.org each job (4 s).
426
427## The certification sweep (thin v1 slice 7, the certification part)
428
429go1.26.11 builds the tool proxy to other bytes than go1.26.10 did, and
430the old digest was pinned through live-gate evidence that only a person
431with two Claude accounts could make again. The thin v1 spec (section 3,
432"Dropped for owner mode", and section 8, slice 7) had already dropped
433per-turn certification; nothing had removed it. This removes it.
434
435### What consulted certification, before
436
437Found by reading every non-test caller of `release.Manifest`'s
438certificate methods and of `internal/runner/certified`.
439
440**The thin runtime (`equipo-runner run`, `internal/runner/thin`): nothing.**
441It builds each policy itself (`runner.PolicyInputs`, then
442`provider.BuildPolicy`), hashes it itself, and compares the claude and
443codex executables with the digests pinned in the provider packages. It
444never read a certificate, an evidence file or the tool proxy's digest.
445Its one use of `certified` was `certified.LauncherVersion()`, which
446returned the manifest's `launcher_version`, the same string as
447`provider.LauncherVersion` (`direct-v3`). The policy hashes do not move.
448`internal/equipo/chat` read none of it either.
449
450**At runtime, outside a turn** (these mattered, and are why a new proxy
451digest would have broken a release, not a conversation):
452
453| where | what it consulted |
454|---|---|
455| `release.InstallAssets.Available` (the instance, `/releases/<version>/...`) | `Manifest.InstallCertified()`, and the served tool proxy against the certified digest. A mismatch meant 503 for the Linux install and for a Mac worker's self-update, and no install command on the onboarding page. |
456| `equipo-runner install` and `verify-install-manifest` (`cmd/equipo-runner/install.go`, `runner/setup/install.go`) | `InstallCertified()`; the five installed programs against the manifest's digests, the certified tool proxy among them. |
457| `equipo-runner preflight` and `reset` (the rev 3 `runner.Runtime`) | `verifyRelease()`: the same five digests. |
458| rev 3 dispatch (`runner/runtime_direct.go`), which no command reaches (`runner.Run` has no caller) | `certified.RequireAction`, `CertifiedPolicyHash`, `CoordinatorLaunchCertified` for a route that was not the owner's. |
459| rev 3 instance (`ownermode.AutoCandidate`, `execution_startup.go`) | `HasCertifiedAction` and the manifest's `verified_isolation_tuples`, for a report that was not owner mode. |
460
461**Only in tests and release checks:**
462
463- `TestToolProxyIsTheCertifiedBuild`, and the manifest, refresh, starter
464 set and inventory tests in `internal/release`.
465- `make direct-release-check` (`scripts/runner-release-check.py`): every
466 evidence file by SHA-256, each certificate against its evidence;
467 `--helper` for the proxy; `scripts/runner-install-manifest.py`'s
468 asserts; `cp -R internal/release/evidence` into both releases.
469- `packaging/install/install-v1.sh`: asserted certificates in the install
470 manifest.
471- `scripts/staging-thin.py build`: found "any released tool proxy" for
472 the release check to hash.
473- `internal/directlive`, `internal/tryequipo`, `cmd/equipo-try`,
474 `scripts/try-equipo.sh`, `scripts/live-gate.sh`: the live gate itself.
475- `scripts/staged-artifacts.py` consulted none of it: it already
476 compared hashes of what staging ran.
477
478So the thin runtime needed none of it, and the sweep went ahead.
479
480### What replaced it: build provenance
481
482- `internal/release/manifest.json` (schema 3) pins the four programs this
483 repository does not build: claude, codex, its code mode host, bwrap.
484 It carries no tool proxy digest, no certificates, no tuples.
485- `make release-runner` builds the tool proxy first, then links its
486 SHA-256 into both runners and the instance
487 (`-X .../internal/release.toolProxySHA256=<hex>`). `BuildManifest()`
488 adds that as the fifth binary. A build made any other way has no tool
489 proxy digest, so it can neither install a runner nor serve one.
490- `scripts/runner-install-manifest.py` records the same digest in the
491 release's `manifest.json` and the install manifest's targets.
492 `InstallManifest.Validate` (the runner), `InstallAssets.Available` (the
493 instance) and `install-v1.sh` (the bootstrap) each refuse unless the
494 install manifest, the linked manifest and the bytes agree.
495- `make release` ends with `scripts/staged-artifacts.py manifest`: the
496 provenance manifest `releases/equipo-linux-arm64-<version>.manifest.json`
497 with the commit, the Go version and the SHA-256 of the instance, the
498 runner, the tool proxy and the Mac runner, written from a clean tree.
499 It refuses a runner release that does not name its own bytes.
500- `staged-artifacts.py verify` recomputes all of it. `staging-thin.py`
501 runs it after `build`, before `deploy` and before installing a runner,
502 and compares its own copies. `record` and `check` (so `make
503 staged-check`, so `scripts/cutover-thin.sh`) run it first: production
504 gets the bytes one build made and staging passed.
505- `make direct-release-check` is now the pins: manifest, provider
506 package constants and installed programs name the same bytes, and the
507 copy check.
508
509Raising `GOTOOLCHAIN` now changes the proxy's bytes, the build records
510the new digest, and nobody signs anything.
511
512### What was not weakened
513
514- Every runtime containment check is as it was: the bubblewrap arguments
515 (`provider.NamespaceArguments`, compared in `InstallManifest.Validate`),
516 the deny profiles, the egress hosts, the policy hash computed by the
517 runner on each launch, the claude and codex digests checked before
518 each launch, `VerifyInstalled` on five programs.
519- The rev 3 code that used to accept a certificate now refuses: a
520 non-owner route returns `provider_policy_uncertified`
521 (`runtime_direct.go`), a report that is not owner mode is never a
522 coordinator candidate (`ownermode/candidate.go`), and the instance's
523 store is given no verified tuples at startup. Owner mode, the only
524 mode thin v1 has, is unchanged.
525- The containment tests stay: `internal/runner/containment`
526 (`TestNamespace*`, `ProbeIsolation` and its boundary tests), the
527 provider policy tests, `runner-host` on hosted.
528
529### Deleted
530
531`internal/release/evidence` (447 files), `internal/runner/certified`,
532`internal/directlive`, `internal/tryequipo`, `cmd/equipo-try`,
533`internal/runner/provider/providertest`; in `internal/release` the policy
534inventory, relocation and refresh files and their tests; in
535`internal/runner/provider` the evidence types and validators
536(`direct_certification.go`, `direct_live_config.go`,
537`direct_requirements.json`, `direct_groups.go`, `direct_scope.go`,
538`control_checks.go`, `path_tools.go`, `claude_native_evidence.go`,
539`policy_relocation.go`); `runner/capture_evidence.go`;
540`containment.ControllerAlive`; the `direct_live` build tag's files in
541`cmd/equipo-runner`; `scripts/live-gate.sh`, `scripts/try-equipo.sh`;
542`docs/live-gate.md`, `docs/superpowers/plans/LIVE-GATE-plan-3.md`; the
543try guide's strings in `copy.go`; the `directlive` lane (the step is now
544`20-check@23`) and two time budgets.
545
546Renamed: `runner.CertificationInputs` is `runner.PolicyInputs`,
547`provider.DigestDirectEvidence` is `provider.ManifestDigest`.
548
549### Left, on purpose
550
551- `equipo.WithVerifiedIsolationTuples` and `team.IsolationTuple` stay.
552 The rev 3 suites (`equipotest`, `plan3test`) build their fixtures on
553 them. Production passes none. They go with `equipo/team` in the rest of
554 slice 7.
555- Four runtime strings in `copy.go` still say "certified"
556 (`connections.owner_mode`, `runner.install.release`,
557 `runner.install.bwrap`, `specialists.unavailable`), and
558 `CopyCalibrationFunding` is unused. Changing copy needs Paul's pass.
559- `docs/plan-3-acceptance.md` (accepted copy) still links to the deleted
560 `LIVE-GATE-plan-3.md` and speaks of live certification. The older plans
561 and reports are history and were not edited.
562
563### Verified
564
565Guards, each broken once and seen red, then restored:
566
567| broken | test that failed |
568|---|---|
569| `InstallManifest.Validate` ignores the tool proxy digest | `TestBootstrapPartialRelease/proxy_mismatch`, `TestOnboardingInstallPackaging` |
570| `Validate` ignores the Linux runner target | `TestBootstrapPartialRelease/runner_mismatch` |
571| `Installable` without a tool proxy | `TestManifestPinsNoToolProxy`, `TestPlan3ReleaseBoundaries`, `TestDirectReleaseContract`, `TestRunnerReleaseContract` |
572| `InstallAssets` serves any tool proxy | `TestEmbeddedInstallAssets/proxy_digest` |
573| `staged-artifacts.py verify` ignores the hashes | `TestStagedArtifactsGate` |
574| `staged-artifacts.py manifest` ignores self-consistency | `TestStagedArtifactsGate` |
575| rev 3 direct or coordinator launch admits a non-owner | `TestLaunchRefusesAnyoneButTheOwner` |
576| a report that is not owner mode becomes a candidate | `TestAutoCandidateIsOwnerModeOnly` |
577
578A real `make release` at bbf490e in a scratch clone on docs-t1, with
579go1.26.11 and the installed pinned programs, no person involved: 35 s.
580The tool proxy built to `f3c3d3ea...c9d03a`, the runner printed it as
581its fifth binary (`equipo-runner version`), accepted its own install
582manifest (`verify-install-manifest`), the bootstrap's check passed,
583`TestBundledInstallAssets` passed inside the instance build, and
584`staged-artifacts.py verify` passed. One byte added to the tool proxy:
585`verify` refused. `make staged-check` refused, rightly: no staging run.
586
587Hosted CI on bbf490e: passed, all 23 shards of `20-check`. The
588containment tests ran there on the real bubblewrap 0.11.0: shard 18,
589`make runner-host` (`TestDirect|TestProvider|TestCheckSandbox` in
590`runner/provider/...` and `runner/checks`, then `^TestNamespace` in
591`runner/containment`, uncached), and the whole of
592`internal/runner/containment` in the `rest` lane. Two tests passed on
593their retry: `TestHeadless/4c_rebase` (9 s, load 41) and
594`TestContractTransferTooLarge` (45 s wait, load 32, a known one).
595
596### Security review, round 1: three fixes
597
598Astra found no runtime containment weakened and no teammate route
599opened, and asked for three things. Each has a test that was red first.
600
6011. **Provenance establishes the commit.** `make release` is now
602 `scripts/release-isolated.sh`: a fresh clone checked out at HEAD under
603 `$TMPDIR`, clean and at the commit before the build and after it. A
604 clone, not a git worktree: go stamps a binary with its commit only
605 where `.git` is a directory, and in a worktree it walked up to a stray
606 `.git` and failed. `staged-artifacts.py manifest` reads each binary's
607 build information (`go version -m`) and writes nothing unless
608 `vcs.revision` is the commit and `vcs.modified` is false. The tool
609 proxy lost `-buildvcs=false`. A refusal leaves nothing in `releases/`.
610 Tests: `TestReleaseBuildsFromOneCommit` (dirty, untracked, changed
611 during the build, another revision, modified, no build information),
612 `TestStagedArtifactsGate`.
6132. **Every pinned program is verified before it runs.**
614 `containment.New` hashes bubblewrap and compares it with its pin
615 before running it (`TestNamespaceBubblewrapDigest`: the real program
616 with one byte appended still says 0.11.0 and is refused). The pins are
617 the manifest's amd64 digest and, for tests on arm64, the CI box's
618 (`TestBubblewrapPins`). `equipo-runner verify-installed` holds all
619 five programs in a runner's own configuration to its release
620 (`TestVerifyInstalledHoldsEveryProgramToTheRelease`);
621 `staging-thin.py` runs it before enrolment and before a unit starts,
622 `cutover-thin.sh` before enrol and start
623 (`TestCutoverVerifiesInstalledProgramsBeforeStarting`). The Mac
624 worker's `srt` was already checked against its pin by its probes.
6253. **A retry needs a clean exit.** `scripts/ci-test.py`: a process that
626 exits non-zero has failed whatever its tests printed, and a retry is
627 green only when its process exits 0 and each test passed
628 (`TestRetryNeedsACleanExit`: PASS, then a panic in a cleanup).
629
630Each guard was broken once more and seen red: no check after the build,
631build information not read, a dirty tree let through, the bubblewrap
632digest not compared, the cutover without `verify-installed`.
633
634The real thing, at ca9262c on docs-t1: `make release` in 11 s from the
635isolated clone; all four binaries say `vcs.revision=ca9262c9...`,
636`vcs.modified=false`; `verify` passes; the released runner's
637`verify-installed` passes against the installed bubblewrap, claude and
638codex with its own tool proxy, and refuses production's current one.
639