# Hosted CI (branches hosted-ci, ci-flakes)

Goal: Equipo's CI on amadan's hosted CI, fast, with nothing on docs-t1.
Paul's ruling (2026-11-10): no CI on docs-t1 at all, not even a small
host step. Locally, run only targeted tests.

## What hosted CI is

Each job gets its own single-use arm64 machine (Amazon Linux 2023, up to
32 vCPU), with Go, Docker, git, make and python3 3.9. No bubblewrap, no
systemd user session, no isolation around steps. The clone is one commit
deep. GOCACHE and GOMODCACHE are restored from S3 before the job and
saved after a passing one (limits: 2 GiB compressed, 6 GiB unpacked;
over either, the save is dropped whole). Steps run one after another; a
step's `@N` shards run side by side on the one machine. Only the `ci`
pipeline gives the commit its verdict.

## What Equipo needs that the machine lacks

Most of the suite, not only the old steps 35 and 36, starts real
containment through production code that requires `bubblewrap 0.11.0`
exactly, runs the pinned Codex program, and one test moves a process
between two delegated cgroups. So:

- **The CI box** (`scripts/ci-box.py`, `scripts/ci-box-enter.sh`,
  `scripts/ci-box.json`). Every step runs in one privileged container,
  the official Go 1.26.11 image on Debian 13 (the runner host's own
  system, pinned by digest, pulled, never built), as an ordinary user.
  The pinned programs are fetched by URL and checked by SHA-256 for the
  machine's architecture, then mounted where a runner host has them:
  Debian's bubblewrap 0.11.0-2+deb13u1 at `/usr/bin/bwrap`, codex
  0.165.0 on PATH, and codex, its code mode host and claude 2.1.312 in
  `~/.local/share/equipo/try/bin`. The entry script gives `/etc` its own
  filesystem (containment overlays `/etc`, and the kernel refuses an
  overlay over the container's overlay root), a machine id, a git
  identity, and a cgroup v2 subtree the user may write, at the path a
  systemd user session has. socat (Claude's own sandbox needs it) is
  fetched and pinned like the rest.
- **On a runner host the box is skipped.** `ci-box.py run` runs the
  command directly where `/usr/bin/bwrap` is already 0.11.0 and codex is
  on PATH. `EQUIPO_CI_BOX=on|off` forces it.
- **arm64 pins beside the certified ones** (`codex/pins.go`,
  `claude/pins.go`). The certified amd64 constants are untouched and are
  still the only pins a launcher or a release trusts. The replay tests
  pick the pin for `runtime.GOARCH`. Digests come from the official
  releases:

  | program | arm64 SHA-256 | source |
  |---|---|---|
  | codex 0.165.0 | b32ece31...c543f | openai/codex rust-v0.165.0, aarch64-unknown-linux-musl |
  | codex code mode host | fd7a4a1f...aa14 | same release |
  | claude 2.1.312 | dc4af289...61f5 | the release manifest at downloads.claude.ai |
  | bubblewrap 0.11.0 | ef2316fc...3b59 | Debian 0.11.0-2+deb13u1 arm64, snapshot.debian.org |

  The same sources reproduce the amd64 pins already in the tree (codex
  c06a67fd, host 522935d4, claude 4f4178ce, bwrap 0dfa36b9), which is the
  check that they are the right sources.
- **A missing pinned program fails on CI** instead of skipping
  (`testci.Absent`, `EQUIPO_TEST_TOOLS_REQUIRED=1` set by the box).
- **Chromium for the browser tests.** The `//go:build browser` tests
  run on CI in their own lanes (`BROWSER_LANES` in `scripts/ci-test.py`,
  `-tags browser,testbuild`, only the tests that tag adds, found with go
  list so a new one always runs; `scripts/ci-test.py lanes` prints them).
  The browser is Debian 13's `chromium-headless-shell`, pinned with
  every library it needs that a Debian image lacks: about 75 packages,
  155 MB, in `scripts/ci-chromium.json`, each by snapshot.debian.org URL
  and SHA-256. Chrome for Testing has no Linux arm64 build; Debian builds
  both. `ci-box.py prepare` unpacks them into one tree, mounted at
  `/opt/chromium-<version>`, and the box sets `RASTRILLO_CHROME` to its
  launcher, which `harness.ChromePath` reads first. Raise it with
  `scripts/ci-chromium-pin.py VERSION SNAPSHOT SECURITY_SNAPSHOT`. The
  quarantine runs a quarantined browser test with the browser tag.
  Five browser drives of pre-thin pages (four in equipotest,
  TestConversationLayout in plan3test) failed every time once they ran;
  they were deleted, and their pages are on the slice 7 sweep list
  (thin v1 spec §8).

## Caches across fresh machines

- Fixed paths in the box (`/work/equipo`, `/cache/go-build`,
  `/cache/go-mod`): Go keys a compiled package on its directory.
- `ci-box.py prepare` sets every tracked file's modification time from
  its git blob and every directory's to one fixed time, so go test's
  cached results (keyed on size and time of each file a test opened)
  hold on the next machine. A changed file gets a new time. Measured: a
  rerun on a fresh machine replayed every test package from the cache.
- `ci-box.py prepare` also deepens the clone (hosted clones one commit;
  gitleaks, the mixed-version test and a release test read history). It
  runs on the machine, outside the box, where the job's git credential
  is.
- `ci-box.py cache` (last step) reports the cache sizes and, past 4 GiB,
  drops build cache entries the job did not read. A restore stamps every
  entry "now", so Go's own trim never fires on hosted. One full run
  leaves 1.96 GiB of build cache and 0.79 GiB of modules, under the
  6 GiB limit.

## Steps

| step | what |
|---|---|
| `00-prepare` | fetch and verify the pinned programs and Chromium, pull the image, deepen the clone, set file times |
| `05-copy` | `make copy-release-check`: copy still marked COPY REVIEW REQUIRED fails here, not at the staging build |
| `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 |
| `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 |
| `50-perf` | alone, it measures time |
| `90-cache` | report and trim the caches |

Hosted runs steps one after another and only a step's shards side by
side, so everything that can run together is one step.

## What made it fast, in the order found

1. **/tmp in memory.** With /tmp on the machine's disk every lane took
   twice as long (thintest 35 to 78 s, directlive 88 to 168 s): the tests
   sync small files and databases thousands of times. The installer
   tests, which need user extended attributes a tmpfs refuses before
   Linux 6.6, put their home under the user's home instead.
2. **Compile once, then fan out.** 23 shards on an empty cache each
   compiled the same packages (Go shares no compile between processes
   that start together): every shard took 150 to 370 s and two
   timing-sensitive tests failed under the load.
3. **Lanes split by test name** (`scripts/ci-test.py` LANES), from
   measured times: headless six lanes, runner three, equipotest four. A
   lane that names no tests runs whatever its package's other lanes do
   not, so a new test always lands somewhere. directlive stays whole:
   two of its lanes side by side both failed with
   `provider_account_containment`.
4. **Static checks beside the tests**, not before them.

To rebalance: each shard's log ends with its time and its five slowest
tests; move names between lanes of a package, keep `20-check@N` equal to
the lanes plus the extra shards. `make lanes-check` (in the static checks
shard) fails when a lane names a test or package that is gone, two lanes
take the same test, a split package has no lane for the rest, or the
count is wrong. "The rebalance of 2026-11-12" below says how to get every
test's and subtest's time, which the five slowest do not give.

## Before (docs-t1)

Main c6319a5 on docs-t1 (load 26 to 44): failed after 512 s; the
headless lane ran 470 s and failed, thintest failed at 102 s. Best warm
docs-t1 run (ci-speed 5258905, nothing changed): 217 s.

## Runs on hosted (32 CPUs, arm64)

Proved in the scratch repository `oficina/equipo-hostedci` (hosted is
per repository, and main's old steps cannot pass there). Times are the
sum of steps; push to verdict adds the machine's boot and the cache
restore, about 110 s, which is amadan's side.

| run | what | steps | slowest shard |
|---|---|---|---|
| 0d5e136 | first full run, cold, 9 shards, old layout | 351 s, red | headless 265 s |
| d4ea8db | /tmp on disk | 397 s, red | headless 312 s |
| dd9e43c | 23 shards, no compile step | 384 s, red | equipotest 373 s |
| dd7960c | compile step, /tmp in memory | 249 s, red | equipotest 196 s |
| 42e4278 | rebalanced, 24 shards, cold | **202 s, green** | directlive 121 s |
| 42e4278 rerun | nothing changed, fresh machine, warm cache | **100 s, green** | runner-host 26 s |
| 10ae706 | main 85404a0 merged in (app code changed), warm cache | **168 s, green** | directlive 92 s |

In the cold green run: prepare 10 s, compile 42 s, checks 121 s, perf
28 s. In the warm rerun: prepare 11 s, compile 38 s (it still linked
every test binary; it no longer does), checks 26 s, perf 24 s.
In the merge run: prepare 11 s, compile 39 s (core packages changed),
checks 92 s, perf 25 s; the runner lanes it did not touch replayed from
the cache.

On `oficina/equipo` itself (hosted on at 32 CPUs since 2026-11-11):

| run | what | steps |
|---|---|---|
| cdc159e | `hosted-ci` tip, cold (the repository had no cache yet) | 216 s, green |
| 4462596 | main after the merge, cold | red twice, then 201 s, green |

## Flakes seen on hosted

Main went green on its third run. Each red was one test, a different one
each time, in a run where all 24 shards started on an empty cache:

| test | runs | what it said |
|---|---|---|
| TestHeadless/1_first_token (headless) | 2 | `runner exited: provider_uncertain` after 45 s |
| TestContractTransferTooLarge (thintest) | 1 | `waiting for send_pack: context deadline exceeded` after 45 s |
| TestNamespaceRecoveryCrashBeforeExit (containment, in runner-host) | 1 | `invalid argument` |
| TestCoordinatorRecoveryCallRefusalKeepsServing (runner) | 1 | `runner.invalid` |
| TestGateVerifyByMarkerAlone (runner/mac) | 2 | fixed: the test raced the child's exec |

The transfer and first token ones are the family CI-PROGRESS.md already
lists (timeouts under load). Paul's controller ruled on them on
2026-11-11 (R13): retry once, record every flake, report repeat
offenders, and fix the cold start. The next three sections are that.

## A failed test is retried once

Every test lane, the quarantine shard and `runner-host` retry a failed
test once, in the same shard (`scripts/ci-test.py`, `retry_failures`).
The lane reads which tests failed from what `rastrillo budget test`
prints, then runs only those again with `go test -count=1 -run`, the
deepest failed subtest and not its parent. A test that never finished (a
timeout, a panic beside it) counts as failed. Red means the test failed
twice.

A pass on the retry keeps the shard green and prints one line, between
two rules of `#`:

    FLAKE <package>:<test> <lane> <commit> <seconds>s <load>
    FLAKE ./internal/headless:TestHeadless/1_first_token headless-rest 3d86170a0f3f75b82091f4838cf26fcae1eb1d11 45.02s 31.50

The seconds are how long the failed attempt took and the load is the
machine's one minute load average when it failed; either is `unknown`
when it cannot be read. The failed attempt's output is in the log above
the line. The line is in the job log, so `amadan ci status oficina/equipo
-branch B -json` carries it.

Not retried: a package that does not build, a failure that names no test
(a budget), and a lane with more than 10 failed tests, which is a broken
change and not a flake.

## Repeat offenders: scripts/ci-flakes.py

    scripts/ci-flakes.py                  main and every branch git knows on origin
    scripts/ci-flakes.py -branch main -branch my-branch
    scripts/ci-flakes.py -log saved-job.log

It reads the FLAKE lines of each branch's latest run through `amadan ci
status oficina/equipo -branch B -json` and counts them per test over the
last 7 days (`-days`). amadan keeps one run per branch, so the script
adds each run it sees to a history file, `~/.cache/equipo/ci-flakes.jsonl`
(`-history`), and counts over that. Run it after a push or once a day,
from the same account. A run it never saw is not counted.

A test with 3 flakes (`-times`) in the window is a repeat offender. For
each one the script prints what whoever runs it then does:

1. Make the test call `testci.Quarantine(t)` first and add the printed
   line to `scripts/ci-quarantine.txt`.
2. File it, with the two commands as printed, full arguments and all:
   `amadan discuss new oficina/equipo -title "Flaky test: ..." -body -`
   (the body, with each flake's commit, lane, time and load, is printed
   as a here-document), then `amadan discuss type oficina/equipo <id>
   -type Issue` with the id the first command printed.

The script files nothing itself.

## The cold start

A cold run is one with an empty build cache: every shard compiles and no
test result replays. A commit that carries the file `.amadan/cold` gets
one: prepare empties the restored build cache (`ci-box.py`, hosted
machines only). Push it on a scratch branch and never merge it.

Measured on main 3d86170 that way (`ci-cold-base`, 47c407f): the 24
shards held the load at 83 to 109 on 32 CPUs for the whole check step,
with tasks waiting for a CPU 40 to 50 % of the time, and directlive
failed with `provider_account_containment`. Three changes:

- **The compile step builds what the shards shared.** `go list -export
  -test` compiles every test package without linking it, where the six
  headless lanes, four equipotest lanes, three runner lanes and the
  quarantine each compiled their package's tests again. It also builds
  rastrillo, staticcheck, govulncheck and gitleaks. Warm, all of it is a
  few seconds.
- **Each shard's go commands run 8 actions at once** (`GOFLAGS=-p=8`; 16
  for `rest`, where it is also how many packages test at once), and the
  static checks run on 8 threads (`GOMAXPROCS`).
- **The shards that load does not hurt start late**: the equipotest
  lanes, plan3test, rest and the static checks wait 10 seconds, then
  until tasks have waited for a CPU under 10 % of the last ten seconds,
  30 seconds at most (`LATE` in `ci-test.py`). The lanes that have timed
  out (headless, thintest, runner, directlive) start at once. On a warm
  run the wait is the 10 seconds, in shards that finish early anyway.

Cold runs, each on a scratch branch with `.amadan/cold`. All three went
red at govulncheck or a test (below), so perf and the cache step did not
run; add 26 s for them.

| run | what | prepare | compile | check | load at lane ends | CPU waiting |
|---|---|---|---|---|---|---|
| 47c407f `ci-cold-base` | main 3d86170 | 29 s | 33 s | 120 s | 83 to 109 | 40 to 51 % |
| e5342ae `ci-cold-1` | the changes, waiting 5 s | 13 s | 61 s | 112 s | 34 to 58 | 18 to 37 % |
| 6adf2ef `ci-cold-2` | the changes as merged, waiting 10 s | 14 s | 55 s | 112 s | 23 to 57 | 7 to 33 % |

The time did not change: about 208 s of steps before, about 207 s
after. The work moved from the shards into the compile step (33 to 55 s)
and the check step is as long as directlive (108 s of tests, cold),
which nothing here shortens. What changed is the load: half, and the
lanes that time out now start on a machine with a load under 30.
Most lanes are 10 to 30 s shorter (runner-bug 73 to 44 s, thintest 53 to
40 s). In the before run directlive failed (`provider_account_containment`
and `namespace_identity_unproven`); in the two after runs no test timed
out, and one test flaked for another reason and passed its retry.

What each red was:

- `ci-cold-base`: directlive, as above, and govulncheck (see Open).
- `ci-cold-1`: this run also raised the gate's Go to 1.26.11, and
  TestToolProxyIsTheCertifiedBuild failed twice, rightly (see Open). No
  retry hides a real failure.
- `ci-cold-2`: govulncheck only. `rest` printed
  `FLAKE ./internal/runner/provider/claude:TestClaudeFailureDiagnostics/partial rest 6adf2ef75d99a52cd2808e3f191b82d4f8d36fa3 0.11s 48.71`
  and stayed green; `scripts/ci-flakes.py -branch ci-cold-2` listed it.

## Fixed, and only retried

| test | state |
|---|---|
| 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. |
| TestGateVerifyByMarkerAlone | fixed in the previous round (the test raced the child's exec). |
| 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. |
| 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. |
| 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`. |


## The rebalance of 2026-11-12 (branch ci-rebalance)

The check step had grown from about 63 s to 154 to 158 s on any run
whose tests missed the cache: headless-rest took 154 s, with
browser-headless-rest (118 to 131 s), thintest (106 to 109 s) and the
quarantine (91 to 99 s) behind it. The browser lanes and the new
Research, metered and preview tests had grown them.

**Every test's time.** A shard's log names only its five slowest
top-level tests, and headless-rest was mostly 25 subtests of
TestHeadless. Scratch commit 43529308 (branch ci-rebalance-times,
closed) carries `.amadan/cold` and an `.amadan/times` switch that makes
each lane run `go test -json` in place of rastrillo and print the time
of every test and subtest; its check step took 156 s, as main's did, so
the switch costs nothing measurable. Cherry-pick it onto a scratch
branch to measure again; never merge it. The quarantine now prints each
test's time and each run's wall time itself.

**What moved** (seconds are test time on that cold run):

- headless (448 s over six lanes): 25 TestHeadless subtests and two
  token tests left headless-rest (153 s) for the other five lanes. Each
  is now 67 to 77 s.
- thintest (105 s, no parallel tests): thintest-contract takes
  `^TestContract` (57 s), thintest the rest (48 s). The one new shard.
- equipotest: its long tests call t.Parallel and wait together, about
  15 s, so a lane is its serial tests plus that wait. The lanes take
  letters by serial time: A to D and Q (36 s), E to P (39 s), R (42 s),
  the rest (40 s). equipotest-d is now equipotest-e.
- browser (409 s): browser-headless-connections takes the connections
  and paste-box drives (77 s); chat, work and rest are 79 s each.
  browser-thintest is gone: thintest's browser tests (91 s) joined
  plan3test's in browser-rest, whose shard had run 5 s.
- quarantine: its nine TestHeadlessConnections subtests took 91 to 105 s
  in one go test. More than five entries of one test now run as even
  runs of at most five, side by side (`QUARANTINE_RUN`).

**The guard.** `scripts/ci-test.py check` (`make lanes-check`, in the
static checks shard) reads every package's test files and fails when a
lane names a test, subtest or package that is gone, two lanes take the
same test or subtest, a split package has no lane for the tests nobody
names, a browser lane's pattern also takes a plain test, or
`20-check@N` is not the lane count. TestLanesRunEveryTestOnce
(internal/testci) holds its rules; each was broken once and seen red.

**Measured**, each run on its own fresh machine, `.amadan/cold` except
where it says warm. Check step, then its slowest shards:

| run | layout | check | slowest shards |
|---|---|---|---|
| 2cc2894 main (tests missed the cache) | before | 154 s | headless-rest 154, browser-headless-rest 118, thintest 106 |
| ccfa18e connections-s2-pi (same) | before | 158 s | headless-rest 158, browser-headless-rest 131, thintest 109 |
| 52c8da1 ci-rebalance-cold-before | before | 154 s | headless-rest 154, browser-headless-rest 120, thintest 106 |
| 4352930 ci-rebalance-times | before | 156 s | headless-rest 156, browser-headless-rest 121, thintest 107 |
| 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 |
| 07ed24e ci-rebalance-cold-after-2 | first cut | 106 s | quarantine 106, browser-rest 100, headless-guards 93 |
| c224aca ci-rebalance-cold-after-3 | final | 101 s | browser-rest 101, headless-guards 94, equipotest-r 93 |
| b0f6606 ci-rebalance-cold-after-4 | final | 101 s | browser-rest 101, headless-guards 94, equipotest-r 92 |
| 26055a6 ci-rebalance, warm | final | 76 s | browser-headless-chat 76, equipotest-r 70, equipotest-a 63 |

Steps on a cold run: about 237 s before, 188 s after (prepare 14,
copy 20, compile 22, check 101, perf 30).

**The machine is busy at the start.** At the lane ends, before: load
35 to 54, tasks waiting for a CPU 22 to 32 % of the last minute; after:
load 42 to 62, 28 to 38 %. Memory and disk never waited. The work did
not grow; it moved from the tail (headless-rest alone at load 15) into
the first 90 s. So the step has one shard more and not several, and
the next shard to add is a second thintest browser lane (browser-rest,
101 s) only if the load allows it. In the first cut's run 1, two tests
ran into a 45 s wait at load 28 to 35 and passed their retry
(TestHeadless/1_first_token, a known one, and
TestHeadless/3_empty_engineering); none did in the four runs after.

**Warm runs** are unchanged at about 75 s (main 70e1e85: 72 s). An
equipotest lane whose tests read a changed file reruns whole, 60 to 70 s
with its wait: equipotest-r on both warm runs (TestReleaseStampContract
first), main's D to P lane after main's change, and here equipotest-a,
whose TestCIGateSteps reads scripts/ci-test.py. browser-headless-chat
reran because its previous run flaked, and a flaked run leaves no cached
pass. No lane split shortens these.



## Open

- Closed: the tool proxy no longer needs certifying. See "The
  certification sweep" below.
- `exactPID` in `internal/runner/containment/recovery.go` treats only
  ESRCH from `pidfd_open` as "the process is gone". EINVAL, the kernel
  part way through a reap, comes back as an error. The test no longer
  trips on it; the production path is unchanged.
- amadan keeps one run per branch. `scripts/ci-flakes.py` keeps its own
  history of the runs it saw; a list of a repository's past runs from
  amadan would make that file unnecessary.

- Timing budgets are reported, not enforced (`EQUIPO_CI_DEDICATED` is
  unset). The machine is the job's own, but 24 shards share it; set the
  variable once a week of hosted times says the budgets hold.
- `provider_account_containment` in directlive when two of its lanes run
  side by side: cause unknown, worked around by keeping it one lane. It
  also failed alone on a cold run at load 55 to 109 (47c407f).
- TestGateVerifyByMarkerAlone (runner/mac) failed twice on cold, loaded
  runs: the test started a marked process and Verify looked before the
  kernel showed the new environment, so it settled with the process
  alive. The test now waits for the marker. The same window exists for a
  real marked process caught in the middle of its exec; not changed here.
- TestCoordinatorRecoveryCallRefusalKeepsServing (runner) failed once
  under the load of the uncompiled 23 shard run and not since.
- The image is pinned by digest and pulled from the public ECR mirror of
  Docker Hub each job (8 s). The pinned programs come from GitHub,
  downloads.claude.ai and snapshot.debian.org each job (4 s).

## The certification sweep (thin v1 slice 7, the certification part)

go1.26.11 builds the tool proxy to other bytes than go1.26.10 did, and
the old digest was pinned through live-gate evidence that only a person
with two Claude accounts could make again. The thin v1 spec (section 3,
"Dropped for owner mode", and section 8, slice 7) had already dropped
per-turn certification; nothing had removed it. This removes it.

### What consulted certification, before

Found by reading every non-test caller of `release.Manifest`'s
certificate methods and of `internal/runner/certified`.

**The thin runtime (`equipo-runner run`, `internal/runner/thin`): nothing.**
It builds each policy itself (`runner.PolicyInputs`, then
`provider.BuildPolicy`), hashes it itself, and compares the claude and
codex executables with the digests pinned in the provider packages. It
never read a certificate, an evidence file or the tool proxy's digest.
Its one use of `certified` was `certified.LauncherVersion()`, which
returned the manifest's `launcher_version`, the same string as
`provider.LauncherVersion` (`direct-v3`). The policy hashes do not move.
`internal/equipo/chat` read none of it either.

**At runtime, outside a turn** (these mattered, and are why a new proxy
digest would have broken a release, not a conversation):

| where | what it consulted |
|---|---|
| `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. |
| `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. |
| `equipo-runner preflight` and `reset` (the rev 3 `runner.Runtime`) | `verifyRelease()`: the same five digests. |
| 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. |
| rev 3 instance (`ownermode.AutoCandidate`, `execution_startup.go`) | `HasCertifiedAction` and the manifest's `verified_isolation_tuples`, for a report that was not owner mode. |

**Only in tests and release checks:**

- `TestToolProxyIsTheCertifiedBuild`, and the manifest, refresh, starter
  set and inventory tests in `internal/release`.
- `make direct-release-check` (`scripts/runner-release-check.py`): every
  evidence file by SHA-256, each certificate against its evidence;
  `--helper` for the proxy; `scripts/runner-install-manifest.py`'s
  asserts; `cp -R internal/release/evidence` into both releases.
- `packaging/install/install-v1.sh`: asserted certificates in the install
  manifest.
- `scripts/staging-thin.py build`: found "any released tool proxy" for
  the release check to hash.
- `internal/directlive`, `internal/tryequipo`, `cmd/equipo-try`,
  `scripts/try-equipo.sh`, `scripts/live-gate.sh`: the live gate itself.
- `scripts/staged-artifacts.py` consulted none of it: it already
  compared hashes of what staging ran.

So the thin runtime needed none of it, and the sweep went ahead.

### What replaced it: build provenance

- `internal/release/manifest.json` (schema 3) pins the four programs this
  repository does not build: claude, codex, its code mode host, bwrap.
  It carries no tool proxy digest, no certificates, no tuples.
- `make release-runner` builds the tool proxy first, then links its
  SHA-256 into both runners and the instance
  (`-X .../internal/release.toolProxySHA256=<hex>`). `BuildManifest()`
  adds that as the fifth binary. A build made any other way has no tool
  proxy digest, so it can neither install a runner nor serve one.
- `scripts/runner-install-manifest.py` records the same digest in the
  release's `manifest.json` and the install manifest's targets.
  `InstallManifest.Validate` (the runner), `InstallAssets.Available` (the
  instance) and `install-v1.sh` (the bootstrap) each refuse unless the
  install manifest, the linked manifest and the bytes agree.
- `make release` ends with `scripts/staged-artifacts.py manifest`: the
  provenance manifest `releases/equipo-linux-arm64-<version>.manifest.json`
  with the commit, the Go version and the SHA-256 of the instance, the
  runner, the tool proxy and the Mac runner, written from a clean tree.
  It refuses a runner release that does not name its own bytes.
- `staged-artifacts.py verify` recomputes all of it. `staging-thin.py`
  runs it after `build`, before `deploy` and before installing a runner,
  and compares its own copies. `record` and `check` (so `make
  staged-check`, so `scripts/cutover-thin.sh`) run it first: production
  gets the bytes one build made and staging passed.
- `make direct-release-check` is now the pins: manifest, provider
  package constants and installed programs name the same bytes, and the
  copy check.

Raising `GOTOOLCHAIN` now changes the proxy's bytes, the build records
the new digest, and nobody signs anything.

### What was not weakened

- Every runtime containment check is as it was: the bubblewrap arguments
  (`provider.NamespaceArguments`, compared in `InstallManifest.Validate`),
  the deny profiles, the egress hosts, the policy hash computed by the
  runner on each launch, the claude and codex digests checked before
  each launch, `VerifyInstalled` on five programs.
- The rev 3 code that used to accept a certificate now refuses: a
  non-owner route returns `provider_policy_uncertified`
  (`runtime_direct.go`), a report that is not owner mode is never a
  coordinator candidate (`ownermode/candidate.go`), and the instance's
  store is given no verified tuples at startup. Owner mode, the only
  mode thin v1 has, is unchanged.
- The containment tests stay: `internal/runner/containment`
  (`TestNamespace*`, `ProbeIsolation` and its boundary tests), the
  provider policy tests, `runner-host` on hosted.

### Deleted

`internal/release/evidence` (447 files), `internal/runner/certified`,
`internal/directlive`, `internal/tryequipo`, `cmd/equipo-try`,
`internal/runner/provider/providertest`; in `internal/release` the policy
inventory, relocation and refresh files and their tests; in
`internal/runner/provider` the evidence types and validators
(`direct_certification.go`, `direct_live_config.go`,
`direct_requirements.json`, `direct_groups.go`, `direct_scope.go`,
`control_checks.go`, `path_tools.go`, `claude_native_evidence.go`,
`policy_relocation.go`); `runner/capture_evidence.go`;
`containment.ControllerAlive`; the `direct_live` build tag's files in
`cmd/equipo-runner`; `scripts/live-gate.sh`, `scripts/try-equipo.sh`;
`docs/live-gate.md`, `docs/superpowers/plans/LIVE-GATE-plan-3.md`; the
try guide's strings in `copy.go`; the `directlive` lane (the step is now
`20-check@23`) and two time budgets.

Renamed: `runner.CertificationInputs` is `runner.PolicyInputs`,
`provider.DigestDirectEvidence` is `provider.ManifestDigest`.

### Left, on purpose

- `equipo.WithVerifiedIsolationTuples` and `team.IsolationTuple` stay.
  The rev 3 suites (`equipotest`, `plan3test`) build their fixtures on
  them. Production passes none. They go with `equipo/team` in the rest of
  slice 7.
- Four runtime strings in `copy.go` still say "certified"
  (`connections.owner_mode`, `runner.install.release`,
  `runner.install.bwrap`, `specialists.unavailable`), and
  `CopyCalibrationFunding` is unused. Changing copy needs Paul's pass.
- `docs/plan-3-acceptance.md` (accepted copy) still links to the deleted
  `LIVE-GATE-plan-3.md` and speaks of live certification. The older plans
  and reports are history and were not edited.

### Verified

Guards, each broken once and seen red, then restored:

| broken | test that failed |
|---|---|
| `InstallManifest.Validate` ignores the tool proxy digest | `TestBootstrapPartialRelease/proxy_mismatch`, `TestOnboardingInstallPackaging` |
| `Validate` ignores the Linux runner target | `TestBootstrapPartialRelease/runner_mismatch` |
| `Installable` without a tool proxy | `TestManifestPinsNoToolProxy`, `TestPlan3ReleaseBoundaries`, `TestDirectReleaseContract`, `TestRunnerReleaseContract` |
| `InstallAssets` serves any tool proxy | `TestEmbeddedInstallAssets/proxy_digest` |
| `staged-artifacts.py verify` ignores the hashes | `TestStagedArtifactsGate` |
| `staged-artifacts.py manifest` ignores self-consistency | `TestStagedArtifactsGate` |
| rev 3 direct or coordinator launch admits a non-owner | `TestLaunchRefusesAnyoneButTheOwner` |
| a report that is not owner mode becomes a candidate | `TestAutoCandidateIsOwnerModeOnly` |

A real `make release` at bbf490e in a scratch clone on docs-t1, with
go1.26.11 and the installed pinned programs, no person involved: 35 s.
The tool proxy built to `f3c3d3ea...c9d03a`, the runner printed it as
its fifth binary (`equipo-runner version`), accepted its own install
manifest (`verify-install-manifest`), the bootstrap's check passed,
`TestBundledInstallAssets` passed inside the instance build, and
`staged-artifacts.py verify` passed. One byte added to the tool proxy:
`verify` refused. `make staged-check` refused, rightly: no staging run.

Hosted CI on bbf490e: passed, all 23 shards of `20-check`. The
containment tests ran there on the real bubblewrap 0.11.0: shard 18,
`make runner-host` (`TestDirect|TestProvider|TestCheckSandbox` in
`runner/provider/...` and `runner/checks`, then `^TestNamespace` in
`runner/containment`, uncached), and the whole of
`internal/runner/containment` in the `rest` lane. Two tests passed on
their retry: `TestHeadless/4c_rebase` (9 s, load 41) and
`TestContractTransferTooLarge` (45 s wait, load 32, a known one).

### Security review, round 1: three fixes

Astra found no runtime containment weakened and no teammate route
opened, and asked for three things. Each has a test that was red first.

1. **Provenance establishes the commit.** `make release` is now
   `scripts/release-isolated.sh`: a fresh clone checked out at HEAD under
   `$TMPDIR`, clean and at the commit before the build and after it. A
   clone, not a git worktree: go stamps a binary with its commit only
   where `.git` is a directory, and in a worktree it walked up to a stray
   `.git` and failed. `staged-artifacts.py manifest` reads each binary's
   build information (`go version -m`) and writes nothing unless
   `vcs.revision` is the commit and `vcs.modified` is false. The tool
   proxy lost `-buildvcs=false`. A refusal leaves nothing in `releases/`.
   Tests: `TestReleaseBuildsFromOneCommit` (dirty, untracked, changed
   during the build, another revision, modified, no build information),
   `TestStagedArtifactsGate`.
2. **Every pinned program is verified before it runs.**
   `containment.New` hashes bubblewrap and compares it with its pin
   before running it (`TestNamespaceBubblewrapDigest`: the real program
   with one byte appended still says 0.11.0 and is refused). The pins are
   the manifest's amd64 digest and, for tests on arm64, the CI box's
   (`TestBubblewrapPins`). `equipo-runner verify-installed` holds all
   five programs in a runner's own configuration to its release
   (`TestVerifyInstalledHoldsEveryProgramToTheRelease`);
   `staging-thin.py` runs it before enrolment and before a unit starts,
   `cutover-thin.sh` before enrol and start
   (`TestCutoverVerifiesInstalledProgramsBeforeStarting`). The Mac
   worker's `srt` was already checked against its pin by its probes.
3. **A retry needs a clean exit.** `scripts/ci-test.py`: a process that
   exits non-zero has failed whatever its tests printed, and a retry is
   green only when its process exits 0 and each test passed
   (`TestRetryNeedsACleanExit`: PASS, then a panic in a cleanup).

Each guard was broken once more and seen red: no check after the build,
build information not read, a dirty tree let through, the bubblewrap
digest not compared, the cutover without `verify-installed`.

The real thing, at ca9262c on docs-t1: `make release` in 11 s from the
isolated clone; all four binaries say `vcs.revision=ca9262c9...`,
`vcs.modified=false`; `verify` passes; the released runner's
`verify-installed` passes against the installed bubblewrap, claude and
codex with its own tool proxy, and refuses production's current one.
