HOSTED-CI-PROGRESS: retries, ci-flakes.py, the cold start, its numbers
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 file changed,
+147
−10
docs/superpowers/plans/HOSTED-CI-PROGRESS.md+147 −10
CI failed — run details
Intent
diff --git a/docs/superpowers/plans/HOSTED-CI-PROGRESS.md b/docs/superpowers/plans/HOSTED-CI-PROGRESS.md| index e22effdc..d712c96d 100644 |
| --- a/docs/superpowers/plans/HOSTED-CI-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-CI-PROGRESS.md |
| @@ -1,4 +1,4 @@ |
| -# Hosted CI (branch hosted-ci) |
| +# 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 |
| @@ -82,8 +82,8 @@ between two delegated cgroups. So: |
| | step | what | |
| |---|---| |
| | `00-prepare` | fetch and verify the pinned programs, pull the image, deepen the clone, set file times | |
| -| `10-compile` | compile every package once, link nothing | |
| -| `20-check@24` | 18 test lanes, the quarantine, `runner-host` (bubblewrap build, pinned codex, namespaces, cgroup move, uncached), and the static checks in four groups | |
| +| `10-compile` | compile every package and its tests once, link no test; build rastrillo and the static check tools | |
| +| `20-check@24` | 18 test lanes, the quarantine, `runner-host` (bubblewrap build, pinned codex, namespaces, cgroup move, uncached), and the static checks in four groups; a failed test is retried once | |
| | `50-perf` | alone, it measures time | |
| | `90-cache` | report and trim the caches | |
| @@ -164,20 +164,157 @@ each time, in a run where all 24 shards started on an empty cache: |
| | 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). None is quarantined yet: a quarantined test |
| -is retried once in the quarantine shard, and whether to widen that to |
| -"retry any failed test once and say FLAKE" is Paul's call. Each lane now |
| -ends with a `machine:` line (load, and how long tasks waited for CPU, |
| -memory and disk), so the next red run says whether the machine was the |
| -cause. |
| +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`. | |
| + |
| + |
| ## Open |
| +- **govulncheck is red on every branch since 2026-11-11**, main included |
| + on its next run: GO-2026-6859, an HTTP/1 server crash in net/http, is |
| + in go1.26.10 and fixed in go1.26.11. The Makefile says to raise |
| + `GOTOOLCHAIN` with each Go security release, but go1.26.11 builds a |
| + different tool proxy, and its digest is certified |
| + (TestToolProxyIsTheCertifiedBuild, `internal/release/manifest.json`). |
| + Raising the toolchain means certifying the tool proxy again, or |
| + building it alone with go1.26.10. That is a release decision, so it is |
| + not made here, and until it is no branch can merge through the gate. |
| +- `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. |
| + 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 |