oficina / equipo Public

Narrow the hosted runners plan to slice 1a after Astra round 2

Controller decision: slice 1a keeps the containment fixes, the
isolatedjob adapter (facts first, fake, contract suite, AWS, provider
guard with named composition points), the controller job table,
monotonic controller time, launch intents, stop proof, pause
generations, prepared resume epochs, the reaper, the simulation, the
signed API and the flag-gated instance client, with the human gates.

Round 2 fixes kept here: resume prepares its epoch durably before the
provider call, with crash and lost-reply recovery; restart never
extends deadlines or orphan grace, trusts provider age only from one
provider response, and stops jobs whose elapsed time is unknown; I3
covers orphan cleanup only and scheduled reaper passes run while time
advances. Egress, credentials, image and certification move to a
slice 1b outline with Astra's open findings; checkpoint tests move to
slice 4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 7add57ad5bbc04e9a207b41bd90adbcbe18c9b4f parent bb8e73b
3 files changed, +427 −1,495
  • docs/superpowers/plans/2026-11-19-hosted-runners-slice-1.md +0 −1,488
  • docs/superpowers/plans/2026-11-19-hosted-runners-slice-1a.md +427 −0
  • scripts/runner-reference-allowlist.json +0 −7

CI cancelled — superseded by a newer push — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/design-hosted-runners: Type  Size Avail | ext4   96G   86G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   86G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.4s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.7s
ci-box: opencode: installed and verified in 1.9s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.9s
ci-box: clone deepened in 2.9s
ci-box: file times set from content: 2679 files, 174 directories
ci-box: ready in 16.3s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipotest	0.241s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  1.1s
+ go list -export -test -tags testbuild -f  ./...
  0.5s
+ go list -export -test -tags browser,testbuild -f  ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  0.2s
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-11 02:51:11 +0000 UTC

go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m19s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.583s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.58s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 33.88, cpu waiting 20.18%, memory waiting 0.00%, io waiting 1.10%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m20.173s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m18.628s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m18.63s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 32.52, cpu waiting 20.18%, memory waiting 0.00%, io waiting 1.10%
--- shard 2 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-connections: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m21.766s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m19.77s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m9.5s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.64s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.63s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 32.52, cpu waiting 19.85%, memory waiting 0.00%, io waiting 1.06%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m16.906s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m15.437s amadan.net/oficina/equipo/internal/headless
receipt: slow test 36.14s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 19.86s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.99s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.44s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 33.88, cpu waiting 20.39%, memory waiting 0.00%, io waiting 1.14%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m33.938s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m32.344s amadan.net/oficina/equipo/internal/headless
receipt: slow test 57.85s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.75s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 9.62s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.48s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.64s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 31.04, cpu waiting 16.67%, memory waiting 0.00%, io waiting 0.87%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 3m5.068s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3m3.232s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m42.8s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 23.59s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.09s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 8s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.27s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 7.56, cpu waiting 3.63%, memory waiting 0.00%, io waiting 0.18%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 321ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m58.418s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 7.73s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.74s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 3.88s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.47s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.36s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
machine: 32 CPUs, load 1.42, cpu waiting 0.00%, memory waiting 0.00%, io waiting 4.06%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 349ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m6.756s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 6.77s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 3.72s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.34s amadan.net/oficina/equipo/internal/thintest TestContractPreview
receipt: slow test 2.01s amadan.net/oficina/equipo/internal/thintest TestContractHostedBindingRules
receipt: slow test 1.77s amadan.net/oficina/equipo/internal/thintest TestContractTokenConnection
machine: 32 CPUs, load 1.42, cpu waiting 0.52%, memory waiting 0.00%, io waiting 4.06%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
cache miss: amadan.net/oficina/equipo/internal/runner/thin: its inputs changed

amadan: job cancelled — a newer push superseded it
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 47.506s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 46.431s amadan.net/oficina/equipo/internal/runner
receipt: slow test 26.4s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 27.85, cpu waiting 19.60%, memory waiting 0.00%, io waiting 1.88%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 46.452s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 44.545s amadan.net/oficina/equipo/internal/runner
receipt: slow test 34.62s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 30.35s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.38s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.53s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 27.85, cpu waiting 19.45%, memory waiting 0.00%, io waiting 1.95%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 34.562s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 33.732s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.11s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.24s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.12s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.62s amadan.net/oficina/equipo/internal/runner TestCoordinatorTransientRefusalKeepsServing
machine: 32 CPUs, load 20.48, cpu waiting 14.73%, memory waiting 0.00%, io waiting 2.30%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 29.3%, load 15.64
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m3.416s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m1.502s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 25.86s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 25.84s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 23.9s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 21.45s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 21.26s amadan.net/oficina/equipo/internal/equipotest TestBudgetLoweringBelowUsage
machine: 32 CPUs, load 29.04, cpu waiting 16.67%, memory waiting 0.00%, io waiting 0.87%
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 29.3%, load 15.64
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest

receipt: test step 554ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m12.593s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 19.02s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 19.01s amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
receipt: slow test 18.98s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 18.96s amadan.net/oficina/equipo/internal/equipotest TestProjectBindingUniqueness
receipt: slow test 18.87s amadan.net/oficina/equipo/internal/equipotest TestProjectRequestActorAndUpdate
machine: 32 CPUs, load 15.64, cpu waiting 11.65%, memory waiting 0.00%, io waiting 2.46%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 29.3%, load 15.64
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m13.678s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m2.436s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.49s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.68s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.6s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 9.57s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 6.54s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 24.88, cpu waiting 14.18%, memory waiting 0.00%, io waiting 0.73%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 27.8%, load 15.64
test lane equipotest-rest: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test[A-D]|^TestQ|^Test[E-P]|^TestR' ./internal/equipotest

receipt: test step 387ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m4.891s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 24.23s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 23.15s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 23.13s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 21.36s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedOnce
receipt: slow test 21.32s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsRollbackAndUnavailable
machine: 32 CPUs, load 15.64, cpu waiting 11.65%, memory waiting 0.00%, io waiting 2.46%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 27.8%, load 15.64
test lane plan3test: ./internal/plan3test
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/plan3test

receipt: test step 436ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 50.134s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.53s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 3.48s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 1.54s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.44s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.23s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorMessageSourcesUpgrade
machine: 32 CPUs, load 15.64, cpu waiting 10.82%, memory waiting 0.00%, io waiting 2.54%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 27.8%, load 15.64
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget note: internal/equipo took 20.611s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/chat took 10.188s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 10.085s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/idtest took 41.767s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/runner/containment took 38.71s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m14.157s against a 60s target (the gate's other steps are not in this figure)
receipt: 11 packages ran, 49 cached, 18 without tests, 0 failed
receipt: slow package 52.618s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 52.251s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 41.767s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 38.71s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 35.914s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 22s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 15.27s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 15.14s amadan.net/oficina/equipo/cmd/equipo-runner TestReleaseRunnerHasNoFakeWorker
receipt: slow test 12.05s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 8.99s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringMissingModuleCache
machine: 32 CPUs, load 10.33, cpu waiting 5.07%, memory waiting 0.00%, io waiting 0.25%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m21.458s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m20.098s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.19s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 15s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.36s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.55s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.58s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 32.52, cpu waiting 19.26%, memory waiting 0.00%, io waiting 1.03%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m29.835s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m28.261s amadan.net/oficina/equipo/internal/headless
receipt: slow test 25.09s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 21.9s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.96s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.9s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.89s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 31.04, cpu waiting 17.17%, memory waiting 0.00%, io waiting 0.90%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m39.019s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m37.43s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.33s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 12.9s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 12.84s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 10.25s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
receipt: slow test 10.16s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
machine: 32 CPUs, load 26.87, cpu waiting 15.12%, memory waiting 0.00%, io waiting 0.79%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
rastrillo: budget test: go test failed
=== RUN   TestBrowserCopyContinue
time=2026-11-19T14:15:40.032Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-19T14:15:40.032Z level=INFO msg="startup phase done" phase=state_lock took=207µs
time=2026-11-19T14:15:40.032Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-19T14:15:40.032Z level=INFO msg="startup phase done" phase=claim_roots took=237µs
time=2026-11-19T14:15:40.032Z level=INFO msg="startup phase" phase=sweep
time=2026-11-19T14:15:40.068Z level=INFO msg="startup phase done" phase=sweep took=35.395ms
time=2026-11-19T14:15:40.068Z level=INFO msg="startup phase" phase=credentials
time=2026-11-19T14:15:40.068Z level=INFO msg="startup phase done" phase=credentials took=200µs
time=2026-11-19T14:15:40.068Z level=INFO msg="startup phase" phase=open_state
time=2026-11-19T14:15:40.124Z level=INFO msg="startup phase done" phase=open_state took=56.485ms
time=2026-11-19T14:15:40.125Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-19T14:15:40.129Z level=INFO msg=connecting host=127.0.0.1:34233 protocol=26
time=2026-11-19T14:15:40.132Z level=INFO msg=connected host=127.0.0.1:34233 took=1.043ms
time=2026-11-19T14:15:40.132Z level=INFO msg="capabilities gathering"
time=2026-11-19T14:15:40.132Z level=INFO msg="capabilities gathered" took=522µs tags=linux,claude,go
time=2026-11-19T14:15:40.133Z level=INFO msg="hello sent" protocol=26
time=2026-11-19T14:15:40.139Z level=INFO msg=welcome protocol=26 role=primary generation=1
    browser_copy_test.go:93: continue did not reach Checks: 0 <nil>
--- FAIL: TestBrowserCopyContinue (1.77s)

--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-19T14:16:10.440Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-19T14:16:10.441Z level=INFO msg="startup phase done" phase=state_lock took=63µs
time=2026-11-19T14:16:10.441Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-19T14:16:10.441Z level=INFO msg="startup phase done" phase=claim_roots took=78µs
time=2026-11-19T14:16:10.441Z level=INFO msg="startup phase" phase=sweep
time=2026-11-19T14:16:10.470Z level=INFO msg="startup phase done" phase=sweep took=29.071ms
time=2026-11-19T14:16:10.470Z level=INFO msg="startup phase" phase=credentials
time=2026-11-19T14:16:10.470Z level=INFO msg="startup phase done" phase=credentials took=118µs
time=2026-11-19T14:16:10.470Z level=INFO msg="startup phase" phase=open_state
time=2026-11-19T14:16:10.509Z level=INFO msg="startup phase done" phase=open_state took=39.178ms
time=2026-11-19T14:16:10.509Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-19T14:16:10.511Z level=INFO msg=connecting host=127.0.0.1:33073 protocol=26
time=2026-11-19T14:16:10.514Z level=INFO msg=connected host=127.0.0.1:33073 took=2.867ms
time=2026-11-19T14:16:10.514Z level=INFO msg="capabilities gathering"
time=2026-11-19T14:16:10.514Z level=INFO msg="capabilities gathered" took=406µs tags=linux,claude,go
time=2026-11-19T14:16:10.515Z level=INFO msg="hello sent" protocol=26
time=2026-11-19T14:16:10.519Z level=INFO msg=welcome protocol=26 role=primary generation=1
time=2026-11-19T14:16:11.536Z level=INFO msg="connection checked" connection=claude-1 state=healthy
    browser_receipts_test.go:169: waiting for [...document.querySelectorAll('[equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes("I'm your coordinator")): context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserEmptyExplore (5.83s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m25.262s
FAIL	amadan.net/oficina/equipo/internal/headless	85.562s


receipt: test step 1m26.624s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m25.262s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.85s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 10.89s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.4s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 10.11s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 7.84s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$|^TestBrowserEmptyExplore$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest 7add57ad5bbc04e9a207b41bd90adbcbe18c9b4f 1.77s 30.96
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
##############################################################################
FLAKE ./internal/headless:TestBrowserEmptyExplore browser-headless-rest 7add57ad5bbc04e9a207b41bd90adbcbe18c9b4f 5.83s 30.96
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 29.04, cpu waiting 15.63%, memory waiting 0.00%, io waiting 0.81%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor)$' ./internal/idtest

receipt: test step 257ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1.647s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 1.65s amadan.net/oficina/equipo/internal/idtest TestBrowserOficinaIDDoor
browser lane browser-rest: ./internal/plan3test
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestTeamsHierarchyBrowser)$' ./internal/plan3test

receipt: test step 205ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1.95s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 1.95s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserCoordinatorQueue|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackStarCentre)$' ./internal/thintest

receipt: test step 284ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 3m2.437s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 17.69s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.35s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 10.83s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 9.13s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 8.6s amadan.net/oficina/equipo/internal/thintest TestBrowserInnerScreens
machine: 32 CPUs, load 1.42, cpu waiting 0.52%, memory waiting 0.00%, io waiting 4.06%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless   (51s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.11s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.23s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.09s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.51s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.66s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless   (61s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 12.23s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 13.61s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 20.27s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 12.78s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (21s)
ok ./internal/headless TestMixedVersions 19.35s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (1s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.78s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (0s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 32.52, cpu waiting 20.95%, memory waiting 0.00%, io waiting 1.49%
--- shard 24 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 24: make runner-host
python3 scripts/runner-prerequisites.py
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks

receipt: test step 8.062s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 3 without tests, 0 failed
receipt: slow package 7.048s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 158ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 66ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 5.07s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.6s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 290ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 160ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 70ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 3.037s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.71s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 270ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryReusedPID
machine: 32 CPUs, load 6.01, cpu waiting 4.17%, memory waiting 0.00%, io waiting 3.44%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 27.8%, load 15.64
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2393 text files, 2747 matches, 0 failures
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 87 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipo	2.409s
machine: 32 CPUs, load 26.44, cpu waiting 18.86%, memory waiting 0.00%, io waiting 2.01%
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 27.8%, load 15.64
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 15.64, cpu waiting 11.65%, memory waiting 0.00%, io waiting 2.46%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 27.8%, load 15.64
shard 27: make govulncheck
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
=== Symbol Results ===

No vulnerabilities found.

Your code is affected by 0 vulnerabilities.
This scan also found 0 vulnerabilities in packages you import and 5
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 20.48, cpu waiting 14.73%, memory waiting 0.00%, io waiting 2.30%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 27.8%, load 15.64
shard 28: make gitleaks
2:15PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
2:15PM INF 1006 commits scanned.
2:15PM INF scanned ~59716750 bytes (59.72 MB) in 12.4s
2:15PM INF no leaks found
machine: 32 CPUs, load 26.44, cpu waiting 18.21%, memory waiting 0.00%, io waiting 2.08%
diff --git a/docs/superpowers/plans/2026-11-19-hosted-runners-slice-1.md b/docs/superpowers/plans/2026-11-19-hosted-runners-slice-1.md
deleted file mode 100644
index be1901f1..00000000
--- a/docs/superpowers/plans/2026-11-19-hosted-runners-slice-1.md
+++ /dev/null
@@ -1,1488 +0,0 @@
-# Hosted runners, slice 1: foundation (plan, 2026-11-19, revision 2)
-
-> **For agentic workers:** REQUIRED SUB-SKILL: use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task by task. Steps use checkbox (`- [ ]`) syntax for tracking. Tasks and steps marked **HUMAN** are not agent work: stop and ask Paul.
-
-**Goal:** Build the hosted runner foundation in the dev AWS account, behind a flag and with nothing user-facing. That means the isolated job runner adapter, the controller, the egress stack, the image pipeline, the certification gate and the leaked-VM reaper. Slice 1 ends with a certified image that slice 2 (hosted checks) can launch.
-
-**Architecture:** A provider-neutral `isolatedjob.Runner` (interface, in-memory fake, AWS adapter) sits under `equipo-hosted-controller`. The controller owns the job table, launch intents with immutable per-launch policy snapshots, controller time, deadlines, pause generations, epochs, VM keys and proxy credentials, and the reaper, and answers a signed HTTPS API. An authenticated egress proxy and a per-launch resolver are the VM's only network. Inside the image, a root init fixes the managed mounts and starts an unprivileged foundation probe, which stands in for the runner until slice 2. Certification runs the containment suite and a trusted egress matrix inside a real VM. An operator then signs a certificate binding the image, policies, report provenance and guard mutation evidence, and the controller requires it before any ordinary launch.
-
-**Tech stack:** Go (module floor 1.26.0, gate `GOTOOLCHAIN=go1.26.11`, `CGO_ENABLED=0`), modernc SQLite through `database/sql` for the controller, `crypto/ed25519` and `crypto/x509`, `golang.org/x/net/dns/dnsmessage`, aws-sdk-go-v2 inside the AWS adapter only, and OpenTofu, which is new to this repository (Task 36, open question 2).
-
-**Spec:** `docs/superpowers/specs/2026-11-18-hosted-runners-microvms.md` (approved 2026-11-19, rulings in §16, authority rules in §17). Executors read the spec and this plan together.
-
-**Baseline:** `design-hosted-runners` at `f201a020`. Implement Tasks 1 to 38 in order. Each task builds and tests only with what earlier tasks created. H2 can start now. The production items wait until before slice 2 production.
-
-**Revision 2** answers Astra's round 1 review (`review1.md` in the planning workspace, verdict rework). Where each finding lands:
-
-| Finding | Where |
-| --- | --- |
-| 1 Certification evidence | Tasks 5, 11, 30, 31, 33 to 35 |
-| 2 Resume and renewal | Tasks 15 to 17, 26 to 29 |
-| 3 Bootstrap TLS and operator stop | Tasks 14, 19, 22, 24, 29 |
-| 4 Launch-bound policy | Tasks 10, 12, 13, 22, 25, 29 |
-| 5 Unknown provider state | Tasks 6 to 8, 14, 17, 18 |
-| 6 Clock | Tasks 6, 12, 17, 18 |
-| 7 Darwin | Task 1 |
-| 8 Image inputs and probe privileges | Tasks 27, 32, 34, 37 |
-| 9 Mutation strength | Tasks 16, 18, 32, 34 |
-| 10 Ordering | Phase order, Tasks 5, 9 to 12, 22, 27 to 29 |
-| 11 Hosted CI | Tasks 5, 37 |
-| 12 Production scope | "Before slice 2 production", Task 38 |
-
-## Global constraints
-
-- **Provider-neutral core.** AWS SDK types and AWS names appear only under `internal/isolatedjob/awsjob/` and `cmd/equipo-hosted-controller/`. The guard in Task 8 enforces this.
-- **Every launch:** `NO_INGRESS`; the VPC connector as the only egress; no execution role; no idle policy; maximum duration at most 28,800 s; x86_64; `additionalOsCapabilities: ["ALL"]`. Sizes: Small 2 GB / 1 vCPU, Large 4 GB / 2 vCPU. Region `eu-west-1`.
-- **Time.** All controller deadlines, grace periods and expiries are measured in controller time (Task 12), which advances with the monotonic clock and never moves back. The deadline is launch plus MaxLifetime (8 h by default) and never moves. Suspended time counts.
-- **Provider state.** A state the adapter does not recognise is `unknown`. It is neither live nor terminal, and it is never stop proof.
-- **Leaked VMs.** The reaper runs every 60 s. An incomplete `List` skips the pass. A live launch intent is replayed first. An unmatched VM is stopped after 10 minutes of controller time, once ownership is rechecked. A VM past its stop time is stopped.
-- **Pause barrier.** Suspend only on a `quiescent` acknowledgement for the current generation. No acknowledgement within 2 minutes cancels that generation, and late or future acknowledgements are refused. Resume carries an operation ID and raises the epoch once.
-- **Authority in the VM.** The run payload carries a single-use, 2-minute bootstrap proxy code, never a token or key. A per-VM key generated at `/run` is the only authority for every later credential (renewal and post-resume exchange). A failed renewal stops the VM (spec §10), and the controller enforces this.
-- **Egress.** Each launch record holds an immutable snapshot of exact service names and the policy version. The proxy and resolver enforce the authenticated launch's own snapshot on every request. Names are exact fully qualified hostnames on port 443, with no suffix or wildcard. The six denied names (`proxy.golang.org`, `sum.golang.org`, `registry.npmjs.org`, `pypi.org`, `files.pythonhosted.org`, `amadan.net`) are refused. An unset name blocks launch. Logs carry no credentials, request bodies or model text.
-- **Scope.** Slice 1 issues no forge token and no gateway token, runs no model work and holds no provider key. The policy version built here refuses a gateway hostname.
-- **Flags.** The controller refuses every launch unless `EQUIPO_HOSTED_ENABLED=1`. Stop, get and reaping keep working with the flag off. The instance-side client (Task 21) refuses construction unless `EQUIPO_HOSTED_RUNNERS=1`, and nothing in the instance calls it in this slice. No UI, no copy strings.
-- **AWS.** Slice 1 runs in the dev account `640012953448` with profile `kass`, tag `purpose=equipo-hosted-dev`. Nothing is applied to the production account `149757027610` (`equipo-hosted`) in this slice, and no agent sets up access to it. Every AWS change, deployment, image registration, certificate signing and destructive drill needs Paul's GO.
-- **Tests and mutations.** Tests come first. Each guard gets a mutation check: break the guard, watch the named test fail, restore it (spec §17). Guards in tasks marked **(certified guards)** go further. Their mutations are committed as patches under `internal/hostedcert/mutations/` and registered in `internal/hostedcert/guards.json` (Task 5). Task 33 replays them for the certificate. Record every command and result in `docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md`.
-- **Verification.** Run targeted tests locally: `go test ./internal/<pkg> -run 'TestX' -count=1`. CI runs the full suite. No sudo. Scratch goes under `$TMPDIR`. Test servers bind `127.0.0.1`. Go caches stay at their defaults. Each new package stays inside its 10 s test budget and 5,000 source lines. Live AWS tests use build tag `hostedlive` and never run in CI.
-- **Git.** Commit subjects under 80 characters. Never merge, never push the default branch, never deploy without Paul's GO.
-
-## Review focus
-
-1. **The VM is gone while the controller is down.** On restart the job table still says running. The controller must find the VM terminal, record stop proof and revoke its access, or find it in an unknown state and refuse proof. Tests: `TestRestartFindsVMGone`, `TestUnknownStateIsNeverProof` (Task 14).
-2. **The controller host's wall clock steps backwards, while running or across a restart.** Deadlines and the orphan wait must keep counting real elapsed time. Test: `TestRollbackThenElapsedTime` (Task 12), and the reaper's `TestReaperUnderRollback` (Task 17).
-3. **A long-lived tunnel survives revocation.** A stream opened before stop or an epoch change must be cut. Test: `TestRevocationClosesOpenTunnels` (Task 23).
-4. **Hostname spelling variants** (`Instance.Example.`, upper case, punycode, `host:443`) must match the launch's snapshot exactly once normalised, and nothing else. Tests: `TestSnapshotNameNormalisation` (Task 10), `TestProxyAuthorityNormalisation` (Task 24), `TestResolverNameNormalisation` (Task 25).
-5. **Two retries of one launch race each other.** The result must be exactly one intent and one VM. Test: `TestConcurrentLaunchSameAttempt` (Task 13).
-
----
-
-## HUMAN task now
-
-### H2: Rulings and names before dev bring-up (Paul)
-
-- [ ] Answer the open questions at the end of this plan or accept the recommendations. Questions 3 and 6 qualify spec text and need an explicit yes.
-- [ ] Choose the exact hostnames: the dev staging instance, registered against its instance key (Task 20), and the controller endpoint. Gateway and mirror are `none` for slice 1.
-- [ ] Choose who holds the certification signing key (open question 4).
-- [ ] Say whether agents may run `tofu apply`, image registration and the destructive drills in `kass`, or whether Paul runs them. Task 38 assumes Paul does.
-
-## Before slice 2 production (HUMAN, deferred, not slice 1 work)
-
-- [ ] Set up access to `equipo-hosted` (`149757027610`) through the `titogo` management account: a CLI profile `equipo-hosted` with MFA, confirmed with `aws sts get-caller-identity --profile equipo-hosted`.
-- [ ] Create the OpenTofu state bucket and lock table there. Write and apply `infra/hosted/envs/prod`.
-- [ ] Record the applied MicroVM memory quota for `eu-west-1` in that account (spec §10).
-- [ ] Enable CloudTrail data events for the MicroVM APIs (spec §11).
-- [ ] Deploy the controller and proxies there, register the image, and certify it in that account.
-
----
-
-## Phase A: containment suite fixes (spec §7)
-
-### Task 1: Retry `poll` on `EINTR`, on Linux and Darwin
-
-`recovery.go` has no build constraint and builds for the Mac runner, so the helper must too.
-
-**Files:**
-- Create `internal/runner/containment/poll_unix.go` (`//go:build linux || darwin`) and `poll_unix_test.go`.
-- Modify `internal/runner/containment/linux_test.go` (`exited`, `alive`, and the stop check near line 489) and `recovery.go:78-79`.
-
-**Interfaces:** Produces `pollRetry(fds []unix.PollFd, timeout time.Duration, poll func([]unix.PollFd, int) (int, error)) (int, error)` and `pollFD(fds []unix.PollFd, timeout time.Duration) (int, error)`. `pollRetry` retries on `unix.EINTR` with the remaining time and never extends the overall timeout.
-
-- [ ] **Red:** `TestPollRetriesEINTR`: a stub returns `EINTR` twice, then `(1, nil)`. Expect `(1, nil)` after three calls. `TestPollRetryKeepsDeadline`: a stub sleeps 30 ms and returns `EINTR` forever, with a 100 ms timeout. Expect `n == 0` within 200 ms. Run `go test ./internal/runner/containment -run 'TestPollRetr' -count=1`.
-- [ ] **Implement:** use `pollFD` in the three test helpers and in `recovery.go`'s zero-timeout exit check. Today an `EINTR` there reports `errIdentity`.
-- [ ] **Green:** run the same command, then `make build vet` (vet covers `GOOS=darwin GOARCH=arm64 ./internal/runner/...`). On a runner host, also run `go test ./internal/runner/containment -run 'TestNamespaceParentDeath|TestRecover' -count=1`.
-- [ ] **Mutation:** return on the first `EINTR`. `TestPollRetriesEINTR` fails. Restore.
-- [ ] **Commit:** `containment: retry poll on EINTR on Linux and Darwin`.
-
-### Task 2: Source-reading tests run from the source tree only
-
-**Files:**
-- Modify `internal/runner/containment/helper_version_test.go` and `bubblewrap_pin_test.go`.
-- Modify `scripts/ci-test.py`, only where a lane names either test.
-
-**Interfaces:** Produces the `TestSource` prefix and the certification skip pattern `^TestSource` (Task 34).
-
-- [ ] **Red:**
- - Rename `TestNamespaceVersionTracksImplementation` to `TestSourceNamespaceVersionTracksImplementation`.
- - Split the `ci-box.json` comparison out of `TestBubblewrapPins` into `TestSourceBubblewrapPinsMatchCIBox`.
- - Add `TestSourceTestsAreNamed`. It parses the package's `_test.go` files with `go/parser` and fails when a test outside the prefix calls `os.ReadFile` or `os.Open` with a relative path literal.
-- [ ] **Green:**
- - `go test ./internal/runner/containment -run 'TestSource|TestBubblewrapPins' -count=1`
- - `python3 scripts/ci-test.py check`
- - `go test -c -o $TMPDIR/containment.test ./internal/runner/containment && (cd $TMPDIR && ./containment.test -test.run TestBubblewrapPins -test.skip '^TestSource')`. This passes outside the tree. Remove the binary afterwards.
-- [ ] **Mutation:** move the `ci-box.json` read back into `TestBubblewrapPins`. `TestSourceTestsAreNamed` fails. Restore.
-- [ ] **Commit:** `containment: name the source-reading tests TestSource`.
-
-### Task 3: Skip the delegated-cgroup test where no user session exists
-
-**Files:** Modify `internal/runner/containment/linux_test.go` and `Makefile` (`runner-namespace-test`).
-
-**Interfaces:** Produces `cgroupSkip(base string, stat func(string) error, require bool) (skip bool, reason string, fail bool)` and env `EQUIPO_REQUIRE_USER_SESSION=1`. `runner-namespace-test` sets the env, so the CI runner host still has to prove the cgroup move.
-
-- [ ] **Red:** `TestCgroupSessionRule`:
- - With no `user@UID.service` directory and `require=false`, it skips with the reason `no systemd user session; production containment does not use cgroups`.
- - With `require=true`, it fails.
- - With the directory present, it neither skips nor fails.
-- [ ] **Implement and green:** `go test ./internal/runner/containment -run 'TestCgroupSessionRule' -count=1`. On docs-t1, `TestNamespaceCgroupMoveKeepsMembership` still passes.
-- [ ] **Mutation:** ignore `require`. The test fails. Restore.
-- [ ] **Commit:** `containment: skip the cgroup test without a user session`.
-
----
-
-## Phase B: facts, contracts and skeletons
-
-### Task 4: Record the MicroVM API facts before any dependent code
-
-Astra's view on open question 1: settle the API, hooks and idempotency before building on them.
-
-**Files:** Create `internal/isolatedjob/awsjob/doc.go`, a package comment only.
-
-- [ ] Read AWS's MicroVM documentation and the SDK module list. Record these facts:
- - whether aws-sdk-go-v2 publishes a MicroVM service package;
- - the operation names;
- - where `additionalOsCapabilities`, the connector and maximum duration are set;
- - the client-token idempotency window, and the error for a reused token with changed parameters;
- - the complete state vocabulary;
- - the hook transport, and whether `/run` and `/resume` carry a payload;
- - how a process inside the VM learns its VM ID;
- - the maximum run-payload size;
- - whether the AWS OpenTofu provider has resources for connectors and images.
-- [ ] Any fact that contradicts this plan stops the work, and the controller asks Paul. Examples: no client token, no `/resume` hook, no way to learn the VM ID.
-- [ ] **Commit:** `awsjob: record the MicroVM API facts the adapter relies on`.
-
-### Task 5: Guard registry (certified guard skeleton)
-
-**Files:**
-- Create `internal/hostedcert/guards.json` (empty list), `internal/hostedcert/mutations/` and `internal/hostedcert/guards_test.go`.
-- Modify `Makefile` (`hosted-guards-check`, added to `ci`) and `scripts/ci-test.py`. Add the target to the existing static-checks entry of `EXTRA_SHARDS`, so the `20-check@N` count is unchanged.
-
-**Interfaces:** Produces the registry format: `[{"id", "package", "test", "patch", "spec"}]`. `patch` is a path under `mutations/`. `spec` cites the spec section the guard protects.
-
-- [ ] **Red:** `TestGuardRegistry` checks:
- - IDs are unique;
- - every `test` exists by that name in `package` (via `go/parser`);
- - every patch passes `git apply --check` at HEAD;
- - no patch touches a `_test.go` file.
-
- Use one throwaway sample entry to watch it fail, then remove it.
-- [ ] **Green:** `go test ./internal/hostedcert -run TestGuardRegistry -count=1`, then `python3 scripts/ci-test.py check`.
-- [ ] **Commit:** `hostedcert: registry for certified guard mutations`.
-
-### Task 6: `isolatedjob` types, validation and clock
-
-**Files:** Create `internal/isolatedjob/{isolatedjob.go,validate.go,clock.go,isolatedjob_test.go}`.
-
-**Interfaces (produces):** The spec §2 `Runner`, `LaunchSpec`, `Job` and `Limits`, exactly as written there, plus:
-
-```go
-type Ref string
-type ImageDigest string // "sha256:" + 64 lower-case hex
-type Size string // SizeSmall "small" (2 GB, 1 vCPU), SizeLarge "large" (4 GB, 2 vCPU)
-type State string // starting running suspending suspended stopping stopped failed unknown
-func (State) Live() bool // starting, running, suspending, suspended, stopping
-func (State) Terminal() bool // stopped, failed; unknown is neither
-const HardMaxLifetime = 28800 * time.Second
-var ErrNotFound, ErrInvalid, ErrConflict, ErrThrottled, ErrIncomplete, ErrBootstrapTooLarge error
-func (s LaunchSpec) Validate(l Limits) error
-type Clock interface {
- Wall() time.Time // may jump
- Mono() time.Duration // monotonic since process start; never decreases
-}
-type ImageRegistry interface {
- Register(ctx context.Context, src ImageSource) (ImageDigest, error)
- Status(ctx context.Context, d ImageDigest) (ImageStatus, error)
-}
-type NetworkAuditor interface{ AuditNetwork(ctx context.Context) (NetworkAudit, error) }
-type NetworkAudit struct {
- ResolverDisabled, IngressClosed, RouteOutAbsent bool
- EgressOnly []netip.AddrPort
-}
-func (a NetworkAudit) OK(want []netip.AddrPort) error
-```
-
-- [ ] **Red:**
- - `TestLaunchSpecValidate`, a table with these rows:
- - AttemptID empty, over 64 bytes, or outside `[A-Za-z0-9-]`;
- - a malformed image;
- - an unknown size;
- - MaxLifetime zero, above `Limits.MaxLifetime`, or above 28,800 s (28,801 s is refused);
- - Bootstrap empty or one byte over the limit;
- - and a passing row at exactly each limit.
- - `TestStateSets`: `unknown` is neither Live nor Terminal, and every other state is exactly one of them.
- - `TestNetworkAuditOK`.
-- [ ] **Green:** `go test ./internal/isolatedjob -count=1`.
-- [ ] **Mutations:** make `unknown` Terminal, and `TestStateSets` fails. Use `>=` for the lifetime limit, and the at-limit row fails. Restore.
-- [ ] **Commit:** `isolatedjob: runner interface, validation and two-part clock`.
-
-### Task 7: In-memory fake and the shared contract suite
-
-**Files:** Create `internal/isolatedjob/{fake.go,fake_test.go}` and `internal/isolatedjob/isolatedjobtest/{contract.go,clock.go}`.
-
-**Interfaces (produces):**
-
-```go
-func NewFake(c Clock, l Limits) *Fake // Runner, ImageRegistry, NetworkAuditor
-func (*Fake) Inject(op Op, f Fault) // FaultThrottle, FaultLostReply (apply, then error), FaultIncompleteList, FaultUnknownState
-func (*Fake) Tick() // AWS-style expiry at MaxLifetime, counting suspended time
-func (*Fake) SetBackstop(on bool)
-func (*Fake) Plant(s LaunchSpec) Ref
-func (*Fake) LiveByAttempt() map[string]int
-func (*Fake) StopsIssued() []Ref
-// isolatedjobtest:
-type FakeClock struct{ /* SetWall, AdvanceMono, Advance (both) */ }
-type Harness struct{ Runner isolatedjob.Runner; Image isolatedjob.ImageDigest; Settle func(ctx context.Context, ref isolatedjob.Ref, want func(isolatedjob.State) bool) (isolatedjob.Job, error) }
-func Contract(t *testing.T, h Harness)
-```
-
-The fake's limits match the spike: MaxLifetime 8 h, `SuspendUsesLifetime` true, `ConnectionsSurvive` false.
-
-- [ ] **Red:** `Contract` has these subtests:
- - `LaunchIdempotentOnAttempt`;
- - `ChangedSpecConflicts`;
- - `StopTwice`;
- - `StopUnknownRef`;
- - `GetAfterStop`, which gives a terminal state or `ErrNotFound`, never `unknown`;
- - `SuspendResumeRoundTrip`;
- - `OversizeBootstrapRefusedBeforeProvider`;
- - `LimitsAreSane`.
-
- `TestFakeContract` runs `Contract` on the fake. `TestFakeFaults` covers each fault. With `FaultUnknownState`, Get reports `unknown` while the VM stays live.
-- [ ] **Green:** `go test ./internal/isolatedjob/... -count=1`.
-- [ ] **Mutations:** key idempotency on Ref instead of AttemptID, and `LaunchIdempotentOnAttempt` fails. Exclude suspended time from `Tick`, and `TestFakeFaults` fails. Restore.
-- [ ] **Commit:** `isolatedjob: in-memory fake and adapter contract suite`.
-
-### Task 8: AWS adapter (certified guards)
-
-**Files:**
-- Create `internal/isolatedjob/awsjob/{runner.go,images.go,network.go,errors.go,runner_test.go,network_test.go,live_test.go}` and `internal/isolatedjob/providerguard_test.go`.
-- Modify `go.mod` and `go.sum`.
-
-**Interfaces:**
-- Consumes Tasks 4, 6 and 7.
-- Produces `New(cfg Config, api API) (*Runner, error)`, `NewRegistry(cfg Config, api API) (*Registry, error)` and `Config{Region, ConnectorID, VPCID, VMSubnetID, VMSecurityGroupID string; ProxyAndResolver []netip.AddrPort}`. `API` is a narrow interface in the SDK's own types, or SigV4 calls if Task 4 found no SDK package.
-
-- [ ] **Red:**
- - `TestRunRequestShape`, against a recording `API` stub, asserts:
- - `NO_INGRESS`;
- - egress only through the connector;
- - no execution role;
- - no idle policy;
- - maximum duration equal to MaxLifetime;
- - x86_64;
- - `additionalOsCapabilities` exactly `["ALL"]`;
- - memory 2048 or 4096;
- - client token equal to AttemptID;
- - payload byte for byte;
- - the registered version for the digest. An unregistered digest gives `ErrInvalid`, so a suspended VM's snapshot can never be a launch source.
- - `TestStateMapping`: every documented state maps, and an unfamiliar state gives `unknown` with the raw value in `Reason`.
- - `TestErrorMapping`.
- - `TestListAllPages`: an error on page two gives `ErrIncomplete` and no jobs.
- - `TestAuditNetwork`.
- - `TestProviderTypesStayInAdapter`: `go list -deps -f` over `./...`. Any package other than `awsjob` (and its subpackages) and `cmd/equipo-hosted-controller` that depends on `github.com/aws/` or on `awsjob` fails. This holds at every later task.
-- [ ] **Green:**
- - `go test ./internal/isolatedjob/... -run 'TestRunRequestShape|TestStateMapping|TestErrorMapping|TestListAllPages|TestAuditNetwork|TestProviderTypesStayInAdapter' -count=1`
- - `make build vet govulncheck`
-- [ ] **Mutations (register each):**
- - Set a role, an idle policy, or drop the capabilities field: `TestRunRequestShape` fails.
- - Map an unfamiliar state to `failed`: `TestStateMapping` fails.
- - Return partial pages: `TestListAllPages` fails.
- - Import `awsjob` from `internal/isolatedjob`: the guard fails.
-- [ ] **Live (after Task 38's network exists, with Paul's GO):** `live_test.go` (`//go:build hostedlive`) runs `Contract` in `kass` and lists afterwards to confirm teardown.
-- [ ] **Commit:** `isolatedjob: AWS MicroVM adapter behind the runner interface`.
-
-### Task 9: Shared wire types and signatures (`hostedwire`, certified guards)
-
-This is the shared skeleton. The controller, proxy, probe and instance client all build on these types.
-
-**Files:** Create `internal/hostedwire/{sign.go,verify.go,identity.go,vmkey.go,api.go,sign_test.go,vmkey_test.go}`.
-
-**Interfaces (produces):**
-
-```go
-type KeyID string
-type Role string // RoleInstance, RoleOperator, RoleProxy
-func SignRequest(r *http.Request, body []byte, id KeyID, key ed25519.PrivateKey, now time.Time, nonce string) error
-type NonceStore interface{ Remember(ctx context.Context, id KeyID, nonce string, until time.Time) (fresh bool, err error) }
-type Verifier struct{ Keys map[KeyID]VerifyKey; Nonces NonceStore; Now func() time.Time } // VerifyKey{Public; Role; InstanceHost string}
-func (*Verifier) Verify(r *http.Request, body []byte) (KeyID, VerifyKey, error)
-func SignResponse(h http.Header, status int, requestNonce string, body []byte, key ed25519.PrivateKey)
-func VerifyResponse(resp *http.Response, body []byte, requestNonce string, pub ed25519.PublicKey) error
-const MaxBody = 1 << 20
-// identity.go: proxy credential identity, URI SAN
-// equipo-hosted://launch/<launch>/attempt/<attempt>/vm/<vm>/epoch/<n>
-type Identity struct{ LaunchID, AttemptID, VMRef string; Epoch int64 }
-func ParseIdentity(c *x509.Certificate) (Identity, error)
-// vmkey.go: VM-key proofs, signed by the per-VM key made at /run
-func RedeemMessage(launch, vm string, codeSHA256 [32]byte, vmKey, credKey ed25519.PublicKey) []byte
-func ExchangeMessage(launch, vm string, epoch int64, challenge string, credKey ed25519.PublicKey) []byte
-// api.go: request and response structs for every Task 20 route, strict JSON
-type Bootstrap struct{ Version int; LaunchID string; Purpose string; ProxyCode string; InstanceCode string }
-// FeedLaunch and FeedPage are added by Task 10, which owns the snapshot type they carry.
-```
-
-Request message: `"equipo-hosted-request-v1\n" + method + "\n" + escaped path and raw query + "\n" + timestamp + "\n" + nonce + "\n" + hex(sha256(body))`. Response message: `"equipo-hosted-response-v1\n" + status + "\n" + request nonce + "\n" + hex(sha256(body))`. The skew limit is 60 s, and nonces are kept 10 minutes. Each VM-key message starts with its own domain string (`equipo-hosted-redeem-v1`, `equipo-hosted-exchange-v1`), so neither can stand in for the other.
-
-- [ ] **Red:**
- - `TestSignedRequestRoundTrip`
- - `TestSignatureCoversEveryField`
- - `TestSkewRefused`
- - `TestNonceReplayRefused`
- - `TestNonceStoreErrorDenies`
- - `TestResponseBoundToRequestNonce`
- - `TestOversizeBodyRefused`
- - `TestIdentityRoundTrip`
- - `TestVMKeyMessagesAreDomainSeparated`: a redeem signature never verifies as an exchange signature.
-- [ ] **Green:** `go test ./internal/hostedwire -count=1`.
-- [ ] **Mutations (register each):**
- - Drop the body hash: `TestSignatureCoversEveryField` fails.
- - Skip `Remember`: `TestNonceReplayRefused` fails.
- - Treat a store error as fresh: `TestNonceStoreErrorDenies` fails.
- - Drop the domain strings: `TestVMKeyMessagesAreDomainSeparated` fails.
-- [ ] **Commit:** `hostedwire: signatures, identities and controller wire types`.
-
-### Task 10: Egress policy with per-launch snapshots (certified guards)
-
-**Files:**
-- Create `internal/egresspolicy/{names.go,snapshot.go,rules.go,policy_test.go}`.
-- Create `internal/hostedwire/feed.go`: `FeedLaunch{LaunchID, AttemptID, VMRef, State, Purpose string; Epoch int64; Snapshot egresspolicy.Snapshot}` and `FeedPage{Revision int64; Launches []FeedLaunch}`.
-
-**Interfaces (produces):**
-
-```go
-const None = "none"
-var ErrUnset, ErrDeniedName, ErrBadName error
-func ParseName(s string, allowNone bool) (string, error) // lower-case, one trailing dot stripped, IDNA to ASCII
-type Purpose string // PurposeJob, PurposeCertification
-type Snapshot struct { // immutable, stored in the launch record
- Version string // "hosted-egress-1"
- Instance string // exact host of the requesting instance key
- Gateway string // None in this version
- Mirror string // exact host or None
- Purpose Purpose
- Report string // controller report host; set only for certification
-}
-func NewSnapshot(version, instance, gateway, mirror, report string, p Purpose) (Snapshot, error)
-func (Snapshot) Digest() string // sha256 of canonical JSON
-type Rules struct{ /* compiled from one snapshot */ }
-func Compile(s Snapshot) (*Rules, error)
-type Request struct{ Host, Method, RawPath string; WebSocket bool }
-type Decision struct{ Allowed bool; Service, PathClass, Reason string }
-func (*Rules) Decide(q Request) Decision
-func (*Rules) Hosts() []string
-func RulesDigest(version string) string // path classes and methods only; the certificate binds this
-```
-
-Path classes for `hosted-egress-1`:
-
-| Service | Method | Path | WebSocket |
-| --- | --- | --- | --- |
-| instance | GET | `/healthz` | no |
-| instance | POST | `/api/hosted/enrol` | no |
-| instance | GET | `/api/runner/stream` | required |
-| instance | GET, POST | `/api/runner/v2/` prefix, `/api/runner/protocol` | no |
-| mirror | GET, HEAD | `/v1/objects/sha256/{64 hex}` | no |
-| report (certification purpose only) | POST | `/v1/certification/report` | no |
-
-The following are refused before matching:
-- percent-encoded `/`, `.` or `%`;
-- dot segments;
-- `//`;
-- a fragment;
-- a query on the mirror class.
-
-A gateway other than `none` is a `NewSnapshot` error in this version.
-
-- [ ] **Red:**
- - `TestNamesRefuse`: a wildcard, a leading dot, IP literals, a port, userinfo, each of the six denied names, and an empty label.
- - `TestSnapshotNameNormalisation`.
- - `TestUnsetBlocks`.
- - `TestNoneDeniesService`.
- - `TestPathClasses`: every row in the table above, plus near misses.
- - `TestGatewayRefusedInThisVersion`.
- - `TestReportOnlyForCertification`.
- - `TestRulesAreSnapshotBound`: two snapshots with different instance hosts each allow only their own host.
- - `TestDigestCoversEveryField`.
-- [ ] **Green:** `go test ./internal/egresspolicy ./internal/hostedwire -count=1`.
-- [ ] **Mutations (register each):**
- - Suffix-match names: normalisation fails.
- - Decode the path before matching: the `%2F` row fails.
- - Allow the report class for jobs: its test fails.
- - Use one global host list: `TestRulesAreSnapshotBound` fails.
-- [ ] **Commit:** `egresspolicy: per-launch snapshots, exact names and path classes`.
-
-### Task 11: Certificate format and the trusted matrix definition (certified guards)
-
-The expected outcomes live here, in the repository, and are embedded in the verifier. A report supplies observations only.
-
-**Files:** Create `internal/hostedcert/{certificate.go,matrix.json,definition.go,certificate_test.go}`.
-
-**Interfaces (produces):**
-
-```go
-type MatrixRow struct { // from matrix.json, embedded
- Name, Actor string // actor: root, runner, sandbox
- Expect string // allowed, proxy_refused:<reason>, nxdomain, unreachable, denied_locally
- Control string // name of the positive-control row that must pass for this refusal to count; "" for allowed rows
-}
-func Matrix() []MatrixRow
-type Observation struct{ Name, Outcome, Evidence string } // the only thing a report says about a row
-type Report struct {
- Containment SuiteResult // Total, Passed int; Failed, Skipped []string
- Rows []Observation
-}
-type Provenance struct{ LaunchID, VMRef string; Epoch int64; SnapshotDigest string; ReceivedAt time.Time; ReportSHA256 string } // recorded by the controller from the authenticated identity and the launch record, not the VM
-type GuardEvidence struct{ Commit string; Guards []GuardResult; SHA256 string } // GuardResult{ID, Test string; FailedUnderMutation, PassedAfterRestore bool}
-type Certificate struct {
- Version int
- Image isolatedjob.ImageDigest
- BuildCommit string // from release provenance
- RunnerSHA256, ToolProxySHA256, ProbeSHA256 string
- SandboxPolicyDigest string
- PolicyVersion string
- RulesDigest string // egresspolicy.RulesDigest
- Gateway, Mirror string // as in snapshots; "none" in slice 1
- MirrorConfigDigest string
- ReportPolicyDigest string // the certification launch's own snapshot digest, bound separately
- ProxyRootSHA256, InterceptRootSHA256 string // roots pinned in the image
- Report Report
- Provenance Provenance
- Network isolatedjob.NetworkAudit
- Guards GuardEvidence
- IssuedAt time.Time
- KeyID string
-}
-type Signed struct{ Payload, Signature []byte }
-type Expectation struct { // built from repository data and the controller's configuration, never from a report
- Image isolatedjob.ImageDigest
- BuildCommit, RunnerSHA256, ToolProxySHA256, ProbeSHA256, SandboxPolicyDigest string
- PolicyVersion, Gateway, Mirror, MirrorConfigDigest string
- ProxyRootSHA256, InterceptRootSHA256 string
- ContainmentTotal int // from the image manifest (Task 32)
- AllowedSkips []string // exactly {"TestNamespaceCgroupMoveKeepsMembership"}
- Guards []string // every id in guards.json
-}
-func Sign(c Certificate, id string, key ed25519.PrivateKey) (Signed, error)
-func Verify(s Signed, keys map[string]ed25519.PublicKey, want Expectation) (Certificate, string, error)
-```
-
-`Verify` checks each of these:
-- every `Matrix()` row has exactly one observation, and its outcome equals the row's `Expect`;
-- every refusal's control row passed;
-- no observation names a row the definition lacks;
-- `Containment` matches the expected total and skips;
-- `Provenance.ReportSHA256` equals the hash of the report;
-- `ReportPolicyDigest` equals `Provenance.SnapshotDigest`, and that snapshot has the certification purpose and the certified policy version;
-- every registered guard appears with both flags true, at `BuildCommit`;
-- the network audit passes;
-- every Expectation field matches.
-
-- [ ] **Red:**
- - `TestCertificateVerifies`.
- - `TestCertificateRefusesEachMismatch`: one row per Expectation field.
- - `TestReportCannotChooseExpectations`: an observation that mirrors a wrong expectation still fails.
- - `TestRefusalNeedsPassingControl`.
- - `TestUnknownRowRefused`.
- - `TestGuardEvidenceRequired`: a missing guard, a guard that did not fail under mutation, and evidence from another commit each fail.
- - `TestProvenanceBindsReport`.
- - `TestStrictDecoding`.
-- [ ] **Green:** `go test ./internal/hostedcert -count=1`.
-- [ ] **Mutations (register each):**
- - Compare against the report's outcome instead of `Expect`: `TestReportCannotChooseExpectations` fails.
- - Skip the control check: `TestRefusalNeedsPassingControl` fails.
- - Skip the commit comparison: `TestGuardEvidenceRequired` fails.
-- [ ] **Commit:** `hostedcert: certificate, trusted matrix and guard evidence`.
-
----
-
-## Phase C: the controller (spec §2, §3, §10)
-
-### Task 12: Controller store, controller time and the controller skeleton (certified guards)
-
-**Files:** Create `internal/hostedctl/{store.go,clock.go,controller.go,schema/0001_jobs.sql,store_test.go,clock_test.go}`.
-
-**Interfaces (produces):**
-
-```go
-type T time.Duration // controller time; persists across restarts, never decreases
-type CtlClock struct{ /* base T restored from store + Clock.Mono() */ }
-func (*CtlClock) Now() T
-func Open(ctx context.Context, path string, c isolatedjob.Clock, alert func(Alert)) (*Store, error)
-func (*Store) Tx(ctx context.Context, fn func(*sql.Tx) error) error
-func (*Store) Clock() *CtlClock
-func (*Store) Remember(...) // hostedwire.NonceStore
-func appendAudit(tx *sql.Tx, a Audit) error // Audit{Actor hostedwire.KeyID; Account, Task, Attempt, Action, Reason string; At T}
-type Alert struct{ Kind, Detail string; At T }
-type Alerter interface{ Alert(ctx context.Context, a Alert) error } // implemented in Task 20; tests record
-type Issuer interface { // implemented by Task 15's CA
- Issue(id hostedwire.Identity, credKey ed25519.PublicKey, lifetime time.Duration) ([]byte, error)
-}
-type Config struct{ Enabled bool } // later tasks add fields
-type Deps struct {
- Store *Store
- Runner isolatedjob.Runner
- Auditor isolatedjob.NetworkAuditor
- Issuer Issuer
- Alerter Alerter
-}
-type Controller struct{ /* fields wired by New; methods added by later tasks */ }
-func New(cfg Config, d Deps) (*Controller, error) // refuses a nil dependency
-```
-
-Controller time works like this:
-- Every reaper pass checkpoints `(T, wall)`.
-- On open, `T0 = persisted T + max(0, wall now - persisted wall)`. Wall time that moved forward counts as downtime, which is conservative because deadlines arrive earlier.
-- If the wall clock is behind the persisted wall by more than 2 s, no downtime is credited and the store raises a `clock_rollback` alert.
-- While running, `T` advances only with `Mono()`, so a wall-clock jump has no effect.
-
-For live jobs after a restart, Task 14 also takes elapsed time as the larger of controller-time elapsed and the provider-reported age. AWS's own maximum duration remains the backstop.
-
-Tables:
-- `jobs`:
- - keys: attempt_id (primary), launch_id (unique), vm_ref (unique, nullable);
- - who and what: task_id, account_id, actor_key, purpose, replaces_attempt;
- - the exact `LaunchSpec`: spec_json and spec_sha256;
- - policy: snapshot_json and snapshot_digest (immutable after insert), certificate_digest;
- - proxy code: proxy_code_sha256, proxy_code_expires_t, proxy_code_used_t;
- - VM key: vm_public_key;
- - state, launched_t, deadline_t, drain_t, stop_t;
- - epoch, resume_operation_id, exchange_open_until_t, last_credential_t;
- - pause: pause_generation, pause_started_t, pause_quiescent, pause_cancelled;
- - stop: stop_requested_t, stop_reason, stop_proof_json;
- - revision.
-- `challenges`
-- `unmatched_vms` (vm_ref, first_seen_t)
-- `certificates`
-- `reports` (launch_id, sha256, payload, provenance_json)
-- `nonces`
-- `audit`
-- `clock` (t, wall)
-- `feed` (revision)
-
-A trigger refuses any update to `snapshot_json`, `snapshot_digest` or `spec_json`.
-
-- [ ] **Red:**
- - `TestStoreMigratesTwice`
- - `TestStoreRefusesNewerSchema`
- - `TestAuditRollsBackWithTx`
- - `TestSnapshotImmutable`
- - `TestRollbackThenElapsedTime` (review focus 2):
- - set the wall clock back one hour while running, advance Mono 10 minutes, and `Now` has advanced exactly 10 minutes;
- - close, set the wall clock back again, and reopen: `T` does not go back and one `clock_rollback` alert is raised;
- - advance Mono 5 minutes, and `T` has advanced exactly 5 minutes.
- - `TestForwardJumpAcrossRestartCountsAsDowntime`
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestStore|TestAudit|TestSnapshotImmutable|TestRollback|TestForwardJump' -count=1`.
-- [ ] **Mutations (register each):**
- - Derive `T` from the wall clock: `TestRollbackThenElapsedTime` fails.
- - Credit negative downtime: it fails.
- - Drop the trigger: `TestSnapshotImmutable` fails.
-- [ ] **Commit:** `hostedctl: store, controller time and controller skeleton`.
-
-### Task 13: Launch with intent replay, snapshots and certified admission (certified guards)
-
-**Files:** Create `internal/hostedctl/{launch.go,launch_test.go}` and `internal/hostedctl/testcert_test.go`. The latter signs test certificates with a throwaway key and a test Expectation.
-
-**Interfaces:** Consumes Tasks 6 to 12. Produces:
-
-```go
-type Config struct { // extends Task 12's Config
- Enabled bool // EQUIPO_HOSTED_ENABLED=1
- PolicyVersion, Gateway, Mirror, ReportHost string
- Expect func(isolatedjob.ImageDigest) (hostedcert.Expectation, error)
- CertificateKeys map[string]ed25519.PublicKey
- AuditMaxAge time.Duration // 5 min, controller time
-}
-type LaunchRequest struct {
- AttemptID, TaskID, Account, Replaces string
- Image isolatedjob.ImageDigest; Size isolatedjob.Size
- MaxLifetime time.Duration // default 8 h
- InstanceCode []byte
- Purpose egresspolicy.Purpose
-}
-type JobView struct{ AttemptID, LaunchID, State string; VMRef isolatedjob.Ref; Epoch int64; DeadlineIn, DrainIn, StopIn time.Duration; CertificateDigest, SnapshotDigest string }
-func (*Controller) Launch(ctx context.Context, by hostedwire.KeyID, key hostedwire.VerifyKey, q LaunchRequest) (JobView, error)
-func (*Controller) Replay(ctx context.Context) error
-func Deadlines(launched T, max time.Duration) (deadline, drain, stop T) // drain = deadline-45m, stop = deadline-10m, clamped to launched
-var ErrDisabled, ErrUncertified, ErrNetworkAudit, ErrReplacementLive error
-```
-
-`Launch` runs in this order:
-1. Refuse unless enabled.
-2. Build the snapshot. The instance host comes from the calling key's `InstanceHost`, never from the request. Gateway and mirror come from configuration. An unset name refuses.
-3. A job purpose needs `RoleInstance` and a stored certificate that verifies against `Expect`, whose Gateway and Mirror equal the snapshot's. A certification purpose needs `RoleOperator` and a registered image.
-4. Require a passing audit no older than `AuditMaxAge`.
-5. `Replaces` needs stop proof.
-6. Transaction 1 saves the intent: spec, snapshot, deadlines, proxy-code hash, certificate digest. If the request hash already matches an existing intent, return it. If it differs, return `ErrConflict`.
-7. Call `Runner.Launch`.
-8. Transaction 2 saves the Ref and the `starting` state.
-
-`ErrThrottled` leaves state `waiting`.
-
-- [ ] **Red:**
- - `TestLaunchSavesIntentBeforeProvider`
- - `TestLaunchIdempotentOnAttempt`
- - `TestLaunchConflictOnChangedRequest`
- - `TestConcurrentLaunchSameAttempt` (review focus 5)
- - `TestCrashBetweenLaunchAndSave`
- - `TestSnapshotUsesKeyHost`: a request cannot name another instance.
- - `TestConfigChangeLeavesOldSnapshots`
- - `TestLaunchRefusals`, a table:
- - flag off;
- - an unset name;
- - no certificate;
- - a certificate for another mirror;
- - a stale audit;
- - a failing audit;
- - the wrong role for the purpose;
- - a live replaced attempt.
- - `TestThrottleWaitsThenReplays`
- - `TestDeadlines`
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestLaunch|TestConcurrentLaunch|TestCrashBetween|TestSnapshotUses|TestConfigChange|TestThrottle|TestDeadlines' -count=1`.
-- [ ] **Mutations (register each):**
- - Take the instance host from the request: `TestSnapshotUsesKeyHost` fails.
- - Skip certificate verification: `TestLaunchRefusals` fails.
- - Skip the Replaces check: it fails.
-- [ ] **Commit:** `hostedctl: launch intents, replay, snapshots and certified admission`.
-
-### Task 14: Get, stop, stop proof and unknown states (certified guards)
-
-**Files:** Create `internal/hostedctl/{stop.go,stop_test.go}`.
-
-**Interfaces (produces):**
-- `Get(ctx, by, attemptID) (JobView, error)`.
-- `Stop(ctx, by hostedwire.KeyID, key hostedwire.VerifyKey, attemptID, reason string) (StopProof, error)`. An instance key may stop only its own jobs. An operator key may stop only the certification launches it created.
-- `StopProof{AttemptID string; VMRef isolatedjob.Ref; State isolatedjob.State; ObservedAt T}`.
-- `Refresh(ctx) error`.
-- `ErrStopPending`, `ErrStateUnknown`.
-
-Stop runs in this order:
-1. Record `stop_requested_t` and bump the feed revision.
-2. Call `Runner.Stop`.
-3. Call `Runner.Get`.
-
-Proof needs a terminal state, or `ErrNotFound` after the stop request. An `unknown` state gives `ErrStateUnknown`, with no proof and no replacement. `Refresh` after a restart uses the larger of controller-time elapsed and the provider-reported age (Task 12).
-
-- [ ] **Red:**
- - `TestStopRevokesBeforeProvider`
- - `TestStopProofNeedsTerminalState`
- - `TestUnknownStateIsNeverProof` (review focus 1): `FaultUnknownState`, so no proof and a replacement launch is refused.
- - `TestLostStopReplyRetries`
- - `TestStopOfGoneVMSucceeds`
- - `TestRestartFindsVMGone`
- - `TestStopRoles`: an instance key cannot stop another instance's job; an operator stops its own certification launch but cannot stop a job; a proxy key stops nothing.
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestStop|TestUnknownState|TestLostStop|TestRestartFinds' -count=1`.
-- [ ] **Mutations (register each):**
- - Accept `stopping`, or accept `unknown`, as proof: its test fails.
- - Call the provider before recording the stop: `TestStopRevokesBeforeProvider` fails.
-- [ ] **Commit:** `hostedctl: stop proof, unknown states and stop roles`.
-
-### Task 15: VM keys, credentials, the resume exchange and the feed (certified guards)
-
-**Files:** Create `internal/hostedctl/{ca.go,credential.go,feed.go,credential_test.go,feed_test.go}`.
-
-**Interfaces (produces):**
-
-```go
-func LoadCA(path string) (*CA, error) // Ed25519 x509 CA; key file 0600; implements Task 12's Issuer
-const CredentialLifetime = 15 * time.Minute
-const ExchangeWindow = 2 * time.Minute
-// Redeem: once per launch. Registers the VM key and returns the first credential.
-func (*Controller) Redeem(ctx context.Context, r hostedwire.RedeemRequest) (certDER []byte, err error)
-// RedeemRequest{LaunchID, VMRef, ProxyCode string; VMKey, CredKey ed25519.PublicKey; Proof []byte /* VM key over RedeemMessage */}
-// Challenge: a nonce bound to (launch, current epoch), single use, ExchangeWindow.
-func (*Controller) Challenge(ctx context.Context, launchID string) (challenge string, epoch int64, err error)
-// Exchange: renewal and post-resume rotation. Authority is the registered VM key only.
-func (*Controller) Exchange(ctx context.Context, r hostedwire.ExchangeRequest) (certDER []byte, err error)
-// ExchangeRequest{LaunchID, VMRef string; Epoch int64; Challenge string; CredKey ed25519.PublicKey; Proof []byte /* VM key over ExchangeMessage */}
-func (*Controller) Feed(ctx context.Context, after int64) (hostedwire.FeedPage, error) // signed by the controller key; long poll
-```
-
-The rules:
-- **Redeem** requires all of these: the code is unused; its expiry has not passed (2 min after the provider call returned, in controller time); `VMRef` equals the saved Ref; the job is live with no stop requested; the proof verifies under `VMKey`.
-- **Exchange** requires the registered VM key, the current epoch, an unused challenge for that epoch, and a live state that is neither suspended nor stop-requested.
-- **Credentials** are bound to `(launch, attempt, VM, epoch)` in `Identity`. `last_credential_t` is updated on every issue.
-- **The feed** carries each launch's state, epoch and immutable snapshot, and bumps its revision on every change.
-
-- [ ] **Red:**
- - `TestRedeemSingleUse`
- - `TestRedeemWrongVMRefused`
- - `TestRedeemExpiredCode`
- - `TestRedeemNeedsProofOfKey`
- - `TestRedeemStoresOnlyCodeHash`
- - `TestExchangeNeedsRegisteredKey`: a fresh key with a valid challenge fails.
- - `TestExchangeChallengeSingleUse`
- - `TestExchangeOldEpochRefused`
- - `TestExchangeRefusedWhileSuspendedOrStopping`
- - `TestFeedCarriesSnapshotAndEpoch`
- - `TestFeedSigned`
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestRedeem|TestExchange|TestFeed' -count=1`.
-- [ ] **Mutations (register each):**
- - Skip the used check: `TestRedeemSingleUse` fails.
- - Skip the VM comparison: `TestRedeemWrongVMRefused` fails.
- - Accept any key in Exchange: `TestExchangeNeedsRegisteredKey` fails.
- - Skip the epoch check: `TestExchangeOldEpochRefused` fails.
-- [ ] **Commit:** `hostedctl: VM keys, credential exchange and launch feed`.
-
-### Task 16: Pause generations and resume epochs (certified guards)
-
-**Files:** Create `internal/hostedctl/{pause.go,pause_test.go}`.
-
-**Interfaces (produces):**
-- `Drain(ctx, by, attemptID) (generation int64, error)`
-- `Quiescent(ctx, by, attemptID string, generation int64) error`
-- `Suspend(ctx, by, attemptID string, generation int64) error`
-- `Reopen(ctx, by, attemptID string, generation int64) error`
-- `Resume(ctx, by, attemptID, operationID string) (epoch int64, error)`
-- `ErrGenerationCancelled`, `ErrNotQuiescent`, `ErrPastDeadline`
-- `PauseAckTimeout = 2 * time.Minute` (controller time)
-
-`Resume` calls `Runner.Resume`, raises the epoch once per operation ID, bumps the feed (which revokes old-epoch credentials), and opens the exchange window (`exchange_open_until_t = now + ExchangeWindow`). The instance owns admission, which comes in slice 2.
-
-- [ ] **Red:**
- - `TestSuspendNeedsCurrentAck`: no acknowledgement, an older generation, a future generation (current + 1) and a cancelled generation are each refused.
- - `TestLateAckIgnored`: an acknowledgement at 2 min 1 s.
- - `TestResumeRaisesEpochOnce`
- - `TestResumeRevokesOldEpoch`
- - `TestResumeOpensExchangeWindow`
- - `TestResumePastDeadlineRefused`
- - `TestSuspendedTimeCountsToDeadline`
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestSuspend|TestLateAck|TestResume' -count=1`.
-- [ ] **Mutations (register each):**
- - Compare generations with `>=`: the future-generation row fails.
- - Raise the epoch on every call: `TestResumeRaisesEpochOnce` fails.
-- [ ] **Commit:** `hostedctl: pause generations and resume epochs`.
-
-### Task 17: Reaper, deadlines, credential lapse and network audit (certified guards)
-
-**Files:** Create `internal/hostedctl/{reaper.go,reaper_test.go}`.
-
-**Interfaces (produces):**
-- `Reap(ctx) (ReapReport, error)`, where `ReapReport{Skipped bool; Replayed, Drained, Stopped, OrphansSeen, OrphansStopped, Lapsed, Unknown int}`.
-- `Loop(ctx, every time.Duration)`.
-- `ReapInterval = 60 * time.Second`, `OrphanGrace = 10 * time.Minute`, `LapseGrace = 2 * time.Minute`.
-
-Each pass runs these steps in order:
-1. Checkpoint the clock.
-2. Replay live intents.
-3. Refresh live jobs.
-4. `List`. Skip the rest on `ErrIncomplete`.
-5. Handle orphans. Record `first_seen_t` for each. After `OrphanGrace`, recheck ownership: replay again, re-read the table and `List` again. Only then call `Stop`.
-6. Mark jobs past `drain_t` as draining.
-7. Stop jobs past `stop_t`.
-8. Stop each running, unsuspended job whose credential has lapsed, with reason `credential_lapsed`. Lapsed means more than `CredentialLifetime + LapseGrace` past `last_credential_t`, or past `exchange_open_until_t + LapseGrace` after a resume without an exchange (spec §10: a failed renewal stops the VM).
-9. Re-issue Stop for `unknown` states and alert after three passes.
-10. Run the network audit. A failure refuses launches until it passes and alerts.
-
-On controller start, each live job's lapse clock restarts at the start time. This is restore reconciliation, so VMs whose credentials expired during an outage get one exchange window before they are stopped (open question 3).
-
-- [ ] **Red:**
- - `TestReapSkipsIncompleteList`
- - `TestReapReplaysIntentFirst`
- - `TestReapStopsOrphanAfterTenMinutes`: 9 min 59 s gives no stop; 10 min gives a stop.
- - `TestReapRechecksOwnership`
- - `TestReapDrainsThenStops`
- - `TestReaperUnderRollback`: the wall clock goes back two hours mid-run, and the orphan is still stopped after 10 minutes of Mono time.
- - `TestLapsedCredentialStopsVM`
- - `TestNoExchangeAfterResumeStopsVM`
- - `TestRestartGivesOneExchangeWindow`
- - `TestUnknownStateRetriedAndAlerted`
- - `TestFailingAuditBlocksLaunch`
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestReap|TestLapsed|TestNoExchange|TestRestartGives|TestUnknownStateRetried|TestFailingAudit' -count=1`.
-- [ ] **Mutations (register each):**
- - Reap on an incomplete List: its test fails.
- - Drop the recheck: `TestReapRechecksOwnership` fails.
- - Skip the lapse stop: `TestLapsedCredentialStopsVM` fails.
-- [ ] **Commit:** `hostedctl: reaper, deadlines and credential lapse stops`.
-
-### Task 18: Lifecycle simulation with invariants (spec §14, certified guards)
-
-**Files:** Create `internal/hostedctl/{sim_test.go,sim_model_test.go}`.
-
-**Interfaces:** Consumes Tasks 7 and 12 to 17. Produces `TestLifecycleSimulation`. It runs 200 seeds by default, inside the 10 s budget; `EQUIPO_SIM_SEEDS=n` runs longer. A failure prints its seed and step log.
-
-Each step picks one of these operations at random:
-- launch (fresh, replacement, or a concurrent duplicate);
-- crash and reopen, at any point, including between the provider call and transaction 2;
-- lost reply on Launch or Stop;
-- throttle;
-- incomplete List;
-- unknown state;
-- drain;
-- an acknowledgement (current, stale, future or late);
-- suspend;
-- resume (new or repeated operation ID);
-- redeem, challenge or exchange, with valid, replayed, wrong-VM or old-epoch inputs;
-- a feed authorisation check;
-- plant an orphan;
-- a wall-clock jump of up to 3 h either way;
-- advance Mono by up to 9 h;
-- a reaper tick;
-- stop.
-
-The fake's own lifetime backstop is off.
-
-| ID | Invariant (checked after every step) | Mutation that must break it |
-| --- | --- | --- |
-| I1 | At most one live VM per attempt ID | Drop the client token (launch with a fresh token each replay) |
-| I2 | Recoverable ownership: every VM the fake holds is a saved Ref, matches a stored intent's attempt, or is a planted orphan | Save the intent after the provider call |
-| I3 | No premature stop: no stop is ever issued for a VM with a job or intent, and no orphan is stopped before 10 min of controller time | Stop orphans on first sight; drop the ownership recheck |
-| I4 | No VM is live past its job's `stop_t` plus one reaper interval of Mono time | Reap only at `deadline_t`; use wall time |
-| I5 | A provider Suspend happens only with an acknowledgement for the current, uncancelled generation | Accept `>=` generations |
-| I6 | A replacement launches only after stop proof, and proof never comes from `unknown` | Treat `unknown` as terminal |
-| I7 | A feed authorisation succeeds only for the current epoch, a live state and the credential's own snapshot | Skip the epoch comparison |
-| I8 | A proxy code is redeemed at most once, only for its own VM; an exchange succeeds only with the registered VM key | Skip the used check; accept any key |
-| I9 | A running, unsuspended job with no credential issued for `CredentialLifetime + LapseGrace` is stopped within one interval | Skip the lapse stop |
-
-- [ ] **Red:** write the model and invariants. Apply each mutation in the table alone. Each must fail within the default seeds. Record which seed caught it.
-- [ ] **Green:** `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1`, then once with `EQUIPO_SIM_SEEDS=5000`.
-- [ ] **Commit:** `hostedctl: randomised lifecycle simulation with nine invariants`.
-
-Slice 2 adds the instance's two invariants: nothing starts while draining, and only one attempt publishes.
-
-### Task 19: Controller HTTP API and command
-
-**Files:** Create `internal/hostedctl/{http.go,http_test.go}` and `cmd/equipo-hosted-controller/{main.go,config.go,config_test.go}`.
-
-**Interfaces:** Consumes Tasks 9 and 12 to 17, plus `awsjob` in `main` only. Routes take strict JSON, enforce `MaxBody` and sign every response:
-
-| Route | Callers |
-| --- | --- |
-| `POST /v1/jobs` | instance (job), operator (certification) |
-| `GET /v1/jobs/{attempt}`, `POST /v1/jobs/{attempt}/stop` | the creating instance; the creating operator for certification launches |
-| `POST /v1/jobs/{attempt}/drain`, `/quiescent`, `/suspend`, `/reopen`, `/resume` | the creating instance |
-| `GET /v1/vms`, `PUT /v1/certificates/{image}`, `GET /v1/reports/{launch}` | operator |
-| `GET /v1/feed?after=n` | proxy |
-| `POST /v1/vm/redeem`, `/v1/vm/challenge`, `/v1/vm/exchange` | proxy, forwarding unchanged bodies from its bootstrap listener; the controller does all verification |
-| `POST /v1/vm/report` | proxy, forwarding with the authenticated Identity from the egress listener; accepted only for a live certification launch; the controller records Provenance |
-
-Configuration comes from the file named by `-config`:
-- the listen address (required, no default);
-- TLS files;
-- the database, CA and signing key paths;
-- verify keys with roles and, for instance keys, `InstanceHost`;
-- certification public keys;
-- gateway, mirror and report host;
-- the policy version;
-- region and network IDs.
-
-`Enabled` comes only from `EQUIPO_HOSTED_ENABLED=1`.
-
-- [ ] **Red:**
- - `TestRoutesEnforceRoles`: each route with each wrong role returns 403 and is audited.
- - `TestInstanceKeySeesOnlyItsJobs`
- - `TestOperatorStopsOwnCertificationLaunch`
- - `TestReportOnlyFromCertificationLaunch`
- - `TestReportProvenanceFromIdentity`: VM-supplied provenance fields are ignored.
- - `TestUnknownFieldsRefused`
- - `TestResponsesSigned`
- - `TestConfigRefusesMissingListenOrKeys`
- - `TestDisabledRefusesLaunchButServesStop`
-- [ ] **Green:**
- - `go test ./internal/hostedctl ./cmd/equipo-hosted-controller -run 'TestRoutes|TestInstanceKey|TestOperatorStops|TestReport|TestUnknownFields|TestResponsesSigned|TestConfig|TestDisabled' -count=1`
- - `make build vet`
-- [ ] **Mutations:**
- - Drop the creator check: `TestInstanceKeySeesOnlyItsJobs` fails.
- - Take provenance from the body: `TestReportProvenanceFromIdentity` fails.
-- [ ] **Commit:** `hosted controller: signed HTTPS API and command`.
-
-### Task 20: Metrics and alerts
-
-**Files:** Create `internal/hostedctl/{metrics.go,alerts.go,metrics_test.go}` and `internal/isolatedjob/awsjob/alerts.go`.
-
-**Interfaces (produces):**
-- Implementations of Task 12's `Alerter`: a deduplicating wrapper and `awsjob.SNSAlerter`.
-- Alert kinds:
- - `leaked_vm`
- - `network_audit_failed` (covers VPC DNS switched on)
- - `no_healthy_proxy` (no proxy has polled the feed for 2 minutes)
- - `clock_rollback`
- - `unknown_state`
- - `credential_lapsed`
-- `MetricsHandler()` serves on a separate listener. It counts jobs by state, launches, launch errors by kind, orphans stopped, credential issues and lapses, and audit status.
-- `awsjob.SNSAlerter`.
-
-Daily-spend alerts wait for slice 3.
-
-- [ ] **Red:**
- - `TestOrphanStopRaisesLeakAlert`
- - `TestAuditFailureAlertsOnce`
- - `TestNoHealthyProxyAlert`
- - `TestMetricsCountJobsByState`
- - `TestAlertCarriesNoSecrets`
-- [ ] **Green:** `go test ./internal/hostedctl -run 'TestOrphanStopRaises|TestAuditFailureAlerts|TestNoHealthyProxy|TestMetrics|TestAlertCarries' -count=1`.
-- [ ] **Mutation:** alert on every failing tick. `TestAuditFailureAlertsOnce` fails. Restore.
-- [ ] **Commit:** `hostedctl: lifecycle metrics and alerts`.
-
-### Task 21: Instance-side controller client (flag off, no callers)
-
-**Files:** Create `internal/hostedclient/{client.go,client_test.go}`.
-
-**Interfaces (produces):** `New(cfg Config) (*Client, error)`, where `Config{BaseURL string; KeyID hostedwire.KeyID; Key ed25519.PrivateKey; ControllerKey ed25519.PublicKey; HTTP *http.Client}`. `New` refuses unless `EQUIPO_HOSTED_RUNNERS=1`. Methods mirror the instance routes and verify every response against their own request nonce.
-
-- [ ] **Red:**
- - `TestClientAgainstController`: real handler over `httptest` TLS, with the fake runner.
- - `TestClientRefusesUnsignedResponse`
- - `TestClientRefusesWithoutFlag`
- - `TestInstanceDoesNotCallHostedClient`: `go list -deps ./cmd/equipo` has no `internal/hostedclient`. Slice 2 deletes this test.
-- [ ] **Green:** `go test ./internal/hostedclient -count=1`.
-- [ ] **Mutation:** skip response verification. Its test fails. Restore.
-- [ ] **Commit:** `hostedclient: signed controller client behind a flag`.
-
----
-
-## Phase D: the egress stack (spec §6)
-
-### Task 22: Proxy core: two listeners, feed and per-launch rules (certified guards)
-
-**Files:** Create `internal/egressproxy/{server.go,bootstrap.go,feed.go,tunnel.go,server_test.go,bootstrap_test.go,feed_test.go}`.
-
-**Interfaces:** Consumes Tasks 9, 10 and 15. Never imports `hostedctl`. Produces:
-
-```go
-type Server struct {
- Feed *Feed
- ClientRoots *x509.CertPool // controller CA
- ServerCert tls.Certificate // from the proxy root pinned in the image
- InterceptCA crypto.Signer // per-host leaves; root pinned in the image
- Upstream Upstream // Task 24; a direct test dialer until then
- Log DecisionLog
- Now func() time.Time
-}
-func (*Server) ServeEgress(ctx context.Context, l net.Listener) error // TLS 1.3, client certificate required
-func (*Server) ServeBootstrap(ctx context.Context, l net.Listener) error // TLS 1.3, server-authenticated only
-type Feed struct{ /* polls GET /v1/feed with a proxy key; verifies the controller signature; compiles Rules per snapshot digest */ }
-func (*Feed) Authorise(id hostedwire.Identity) (*egresspolicy.Rules, error)
-const FeedGrace = 15 * time.Minute // open question 3
-```
-
-The two listeners divide the work:
-- **The bootstrap listener** accepts exactly three routes: `POST /v1/vm/redeem`, `/v1/vm/challenge` and `/v1/vm/exchange`. Each body is size-checked and its shape validated, then forwarded unchanged to the controller with the proxy's signature. Authority for each route comes from the controller's checks in Task 15: the code, or the VM-key proof. Each launch ID is rate-limited.
-- **The egress listener** authorises every connection, and every request, against the authenticated identity's own snapshot rules. In this task it supports a minimal CONNECT-and-tunnel path, so Tasks 23 and 24 have something to extend.
-
-`Authorise` refuses in each of these cases: the epoch differs from the feed's; the VM differs; the state is not live; stop is requested; or the last good poll is older than `FeedGrace`.
-
-- [ ] **Red:**
- - `TestEgressRefusesClientCerts`, a table: no certificate; expired; another CA; an unparseable identity; an old epoch; a stopped or stop-requested launch; another VM's certificate.
- - `TestBootstrapListenerNeedsNoClientCert`
- - `TestBootstrapForwardsOnlyThreeShapes`
- - `TestRequestsUseOwnSnapshot`: launches A and B with different instance hosts; A cannot reach B's host even though B is live.
- - `TestFeedGraceThenDeny`: the controller goes away, a live launch keeps working until 15 minutes, then is denied.
- - `TestFeedVerifiesControllerSignature`
-- [ ] **Green:** `go test ./internal/egressproxy -run 'TestEgressRefuses|TestBootstrap|TestRequestsUseOwnSnapshot|TestFeedGrace|TestFeedVerifies' -count=1`.
-- [ ] **Mutations (register each):**
- - Skip the epoch check: its row fails.
- - Use one rule set for all launches: `TestRequestsUseOwnSnapshot` fails.
- - Ignore feed age: `TestFeedGraceThenDeny` fails.
-- [ ] **Commit:** `egressproxy: bootstrap and egress listeners with per-launch rules`.
-
-### Task 23: Revocation of open tunnels (certified guards)
-
-**Files:** Modify `internal/egressproxy/tunnel.go`. Create `internal/egressproxy/revoke_test.go`.
-
-**Interfaces:** Produces a tunnel registry keyed by launch and epoch. Feed changes close affected tunnels.
-
-- [ ] **Red:** `TestRevocationClosesOpenTunnels` (review focus 3): stop, and separately an epoch change, each close an open tunnel within one feed poll. `TestUnrelatedTunnelsSurvive`.
-- [ ] **Green:** `go test ./internal/egressproxy -run 'TestRevocation|TestUnrelated' -count=1`.
-- [ ] **Mutation (register):** check only new connections. `TestRevocationClosesOpenTunnels` fails. Restore.
-- [ ] **Commit:** `egressproxy: close open tunnels on stop and epoch change`.
-
-### Task 24: CONNECT inspection, origin TLS and decision logs (certified guards)
-
-**Files:** Create `internal/egressproxy/{inspect.go,upstream.go,log.go,inspect_test.go,log_test.go}`. Modify `tunnel.go`.
-
-**Interfaces (produces):**
-- `NewUpstream(resolvers []netip.AddrPort, resolverName string, roots *x509.CertPool) Upstream` resolves over DNS over TLS to the pinned addresses and TLS name only, with no fallback (Astra's view on open question 8). It refuses answers in private, loopback, link-local (including 169.254.169.254) and unique-local ranges.
-- `DecisionLog` writes JSON lines: `{at, vm, task, attempt, launch, host, method, path_class, decision, reason, bytes_up, bytes_down}`. It never writes headers, query strings, bodies or credentials.
-- Refusals return status 403 with the header `Equipo-Egress-Refusal: <reason>`, so a probe can tell a policy refusal from a network failure.
-
-Per connection:
-- The CONNECT target must be an exact host from the launch's rules, on port 443.
-- The proxy terminates the inner TLS with a leaf signed by `InterceptCA`.
-- SNI must be present and equal the CONNECT host.
-- A ClientHello carrying the encrypted ClientHello extension (`0xfe0d`) is refused.
-
-Per request:
-- Host or `:authority` must equal the CONNECT host, allowing an explicit `:443`.
-- These are refused: an absolute-form target naming another authority; userinfo; `CONNECT`; `Upgrade: h2c`; a WebSocket outside the stream class.
-- The launch's `Rules.Decide` must allow the request.
-- The report class is never tunnelled to an origin. The proxy terminates it and forwards the body to the controller's `POST /v1/vm/report`, with its proxy signature and the authenticated `Identity`.
-
-Origin TLS goes to the exact host and validates against system roots. A 3xx response whose `Location` names another host becomes 502, logged as `redirect_refused`.
-
-- [ ] **Red:**
- - `TestProxyInspection`, a table:
- - allowed `/healthz`;
- - allowed stream WebSocket;
- - SNI differs;
- - SNI missing;
- - ECH;
- - Host differs;
- - HTTP/2 `:authority` differs;
- - IPv4 and IPv6 literal CONNECT;
- - port 8443;
- - each of the six denied names;
- - userinfo;
- - `%2e%2e`;
- - `%2F`;
- - nested CONNECT;
- - h2c;
- - WebSocket on `/healthz`;
- - mirror `PUT` and `GET` while the mirror is `none`;
- - cross-host redirect;
- - an origin resolving to 169.254.169.254;
- - the report route from a job launch.
- - `TestProxyAuthorityNormalisation` (review focus 4).
- - `TestUpstreamResolverPinned`: a wrong TLS name, or an unreachable pinned resolver, fails with no fallback.
- - `TestDecisionLogCarriesNoSecrets`.
-- [ ] **Green:** `go test ./internal/egressproxy -run 'TestProxyInspection|TestProxyAuthority|TestUpstreamResolver|TestDecisionLog' -count=1`.
-- [ ] **Mutations (register each):** dropping the SNI comparison, the Host comparison, the ECH refusal, the cross-host redirect refusal or the private-answer refusal each make its row fail. Restore each.
-- [ ] **Commit:** `egressproxy: CONNECT inspection, origin TLS and decision log`.
-
-### Task 25: Per-launch resolver (certified guards)
-
-The VMs share one source address, so a plain DNS query cannot say which launch it came from.
-
-**Files:** Create `internal/egressdns/{server.go,server_test.go}`. Modify `go.mod` (`golang.org/x/net`).
-
-**Interfaces (produces):** `Server{Feed *egressproxy.Feed; Answer []netip.Addr; Log DecisionLog}` with:
-- `ServePlain(ctx, net.PacketConn, net.Listener) error`: answers every name NXDOMAIN, with recursion-available off.
-- `ServeTLS(ctx, net.Listener) error`: DNS over TLS on 853, client certificate required. Answers the authenticated launch's snapshot hosts with the proxy addresses for type A; other types for known names get no data; unknown names get NXDOMAIN. ANY, AXFR and multiple questions are refused.
-
-Spec §6 says "answers only the launch record's exact service names". Answering by authenticated launch is the only way to keep that exact while VMs share a source address.
-
-- [ ] **Red:**
- - `TestPlainResolverAnswersNothing`
- - `TestTLSResolverAnswersOwnSnapshot`: A cannot resolve B's instance host.
- - `TestResolverNameNormalisation`
- - `TestResolverNeverRecurses`
- - `TestResolverRefusesStaleOrRevoked`
-- [ ] **Green:** `go test ./internal/egressdns -count=1`, then `make govulncheck`.
-- [ ] **Mutations (register each):**
- - Answer the union of all launches: `TestTLSResolverAnswersOwnSnapshot` fails.
- - Answer plain queries: `TestPlainResolverAnswersNothing` fails.
-- [ ] **Commit:** `egressdns: resolver answering only the caller's launch names`.
-
-### Task 26: Proxy command, dialer and VM credential manager
-
-**Files:** Create `cmd/equipo-egress-proxy/{main.go,config_test.go}` and `internal/egressproxy/client/{dialer.go,credential.go,dialer_test.go,credential_test.go}`. The client package builds for darwin and linux, because slice 2 wires it into the runner.
-
-**Interfaces (produces):**
-- `client.Dialer{Proxies []string; Credential *Credential; ProxyRoots, InterceptRoots *x509.CertPool}`, with `DialContext` (tries each proxy in turn) and `HTTPClient()`.
-- `client.Credential`:
- - `NewCredential(bootstrap hostedwire.Bootstrap, vmRef string, bootstrapURLs []string, roots *x509.CertPool) (*Credential, error)` generates the VM key in memory.
- - `Start(ctx) error` redeems, then renews through challenge and exchange at half the lifetime.
- - `Rotate(ctx) error` runs the exchange after a resume.
- - `Current() (*tls.Certificate, error)` returns an error once the credential has expired. It never returns a stale credential.
-
-The command serves the egress listener, the bootstrap listener, plain and TLS DNS, and metrics, each on an explicit configured address.
-
-- [ ] **Red:**
- - `TestDialerFailsOverToSecondProxy`
- - `TestCredentialRenewsAtHalfLife`
- - `TestRotateUsesVMKey`
- - `TestExpiredCredentialNeverUsed`
- - `TestProxyConfigRefusesWildcardListen`: `0.0.0.0`, `::` and a bare `:port`.
-- [ ] **Green:** `go test ./internal/egressproxy/... ./cmd/equipo-egress-proxy -count=1`, then `GOOS=darwin GOARCH=arm64 go vet ./internal/egressproxy/client`.
-- [ ] **Mutation:** return the last credential after expiry. `TestExpiredCredentialNeverUsed` fails. Restore.
-- [ ] **Commit:** `egress proxy command, dialer and VM credential manager`.
-
----
-
-## Phase E: the VM side and the end-to-end foundation test
-
-### Task 27: Root init and lifecycle hooks (certified guards)
-
-**Files:** Create `cmd/equipo-vm-init/main.go`, `internal/vminit/{init_linux.go,hooks.go,drop_linux.go,control.go,init_test.go}` and `internal/isolatedjob/awsjob/vmhooks/{hooks.go,hooks_test.go}`.
-
-**Interfaces (produces):**
-- `vminit.Hooks interface{ Ready(ctx) error; Run(ctx, payload []byte) error; Resume(ctx) error }`.
-- `vminit.New(sys Sys, cfg Config) (*Init, error)`. `Sys` wraps mount, chown, prctl and exec.
-- `Config{Resolver netip.Addr; User string /*"equipo"*/; StateDir string; ProbePath string}`.
-- `vmhooks.Serve(ctx, h vminit.Hooks)` uses the transport recorded in Task 4. It is the only provider-specific code in the image.
-
-As root, init does the following:
-1. Bind-mounts generated `/etc/resolv.conf` (the plain resolver, which answers nothing) and `/etc/hosts` over the managed mounts, then remounts them read-only.
-2. Becomes the child subreaper.
-3. Creates the empty state directory, owned by the runner user.
-
-The hooks:
-- **`Ready`** fails if anything exists in the state directory, or if any machine key, token, SSH host key or `.aws` directory exists.
-- **`Run`**:
- 1. Validates the `hostedwire.Bootstrap` payload and its size.
- 2. Generates the machine ID and random seed.
- 3. Writes the payload to `/run/equipo/bootstrap.json` (mode 0400, runner user).
- 4. Learns the VM ID by the method recorded in Task 4.
- 5. For a job launch, starts `equipo-vm-probe serve` through `equipo-vm-init drop`, which sets no-new-privileges, clears the bounding and ambient capability sets, sets the user's IDs and execs.
- 6. For a certification launch, starts `equipo-vm-probe certify` as root. The harness drops its own privileges after the root rows (Task 34).
-- **`Resume`** writes `rotate` to the probe's control socket (`/run/equipo/control`, mode 0600, probe user) and waits up to 30 s for the probe's acknowledgement. Slice 2 points the same socket at the runner.
-
-- [ ] **Red:**
- - `TestInitReplacesResolverMounts`
- - `TestReadyRefusesState`: one row per forbidden item.
- - `TestRunWritesBootstrapForProbeOnly`
- - `TestRunRefusesOversizePayload`
- - `TestDropClearsCapabilities`: the recorded calls must appear in order.
- - `TestCertificationStartsAsRoot`
- - `TestResumeSignalsRotation`
- - `TestHooksTransport`
-- [ ] **Green:** `go test ./internal/vminit ./internal/isolatedjob/awsjob/vmhooks -count=1`, then `make build`.
-- [ ] **Mutations (register each):**
- - Skip the read-only remount: `TestInitReplacesResolverMounts` fails.
- - Skip the bounding-set clear: `TestDropClearsCapabilities` fails.
-- [ ] **Commit:** `vm init: resolver mounts, reaping, privilege drop and hooks`.
-
-### Task 28: Foundation probe, the runner's stand-in for slice 1
-
-The runner has no hosted bootstrap reader or rotation handler yet. Slice 2 adds both. Until then, this probe is the trusted in-VM process.
-
-**Files:** Create `cmd/equipo-vm-probe/main.go` and `internal/vmprobe/{serve.go,serve_test.go}`.
-
-**Interfaces:** Consumes Tasks 26 and 27. `vmprobe.Serve(ctx, cfg Config) error`:
-1. Reads the bootstrap.
-2. Starts the `Credential`.
-3. Calls `GET /healthz` on the snapshot's instance host through the dialer every 30 s.
-4. Handles `rotate` from the control socket by calling `Credential.Rotate` and acknowledging.
-5. Exits non-zero when `Current()` errors.
-
-- [ ] **Red:** `TestProbeRotatesOnSignal`, `TestProbeExitsOnLapse`, `TestProbeNeverReadsOtherFiles`. The last runs the probe under an `os.DirFS` jail with only the bootstrap file.
-- [ ] **Green:** `go test ./internal/vmprobe -count=1`.
-- [ ] **Commit:** `vm probe: trusted stand-in for the runner in slice 1`.
-
-### Task 29: End-to-end foundation test through real handlers and TLS (certified guards)
-
-**Files:** Create `internal/hostedtest/{rig_test.go,foundation_test.go}`.
-
-**Interfaces:** Consumes every earlier task. The rig runs these in one process on `127.0.0.1`, with real TLS listeners and test CAs:
-- the controller HTTP handler, with the fake runner and its own store;
-- the proxy's egress and bootstrap listeners;
-- the TLS resolver;
-- an instance stub (`/healthz`) for each of two instance hosts;
-- `vminit` with a recording `Sys`, whose `Run` and `Resume` hooks drive an in-process probe.
-
-- [ ] **Red:** `TestFoundationEndToEnd` subtests:
- - `BootstrapThenEgress`: launch, Run hook, the probe redeems over the bootstrap listener without a client certificate, then reaches its instance over mTLS through CONNECT.
- - `ReplayedCodeAndWrongVM`: both refused.
- - `SuspendResumeExchange`: drain, quiescent, suspend, resume. The Resume hook leads to a VM-key exchange. The new epoch works, the old certificate is refused, and the open tunnel is cut.
- - `RenewalFailureStopsVM`: the challenge route is blocked at the proxy. The probe's credential lapses, the probe exits, and the reaper stops the VM with `credential_lapsed` and proof.
- - `OperatorCertificationLaunch`: an operator launches a certification VM, the report is accepted with provenance, and the operator stops it with proof. An instance key cannot stop it.
- - `ControllerOutage`: with the controller stopped, the tunnel keeps working inside `FeedGrace` and is refused after it. Restart grants one exchange window.
- - `TwoInstancesIsolated`: launches for two instance keys each reach and resolve only their own host.
-- [ ] **Green:** `go test ./internal/hostedtest -count=1`, inside the 10 s budget.
-- [ ] **Mutations (register each):** forward client-certificate-only routes on the bootstrap listener, or skip the exchange on resume. The matching subtest fails.
-- [ ] **Commit:** `hostedtest: end-to-end foundation flows over real TLS`.
-
----
-
-## Phase F: §17 guards, the image and certification
-
-### Task 30: Checkpoint binding and quoting (spec §3, §17; certified guards)
-
-Slice 4 builds checkpointing. These guards land now so that certification covers them from the first image.
-
-**Files:** Create `internal/hostedcheckpoint/{bind.go,quote.go,bind_test.go,quote_test.go}`. If the injection-defences work has landed a shared quoting helper by then, build on it rather than duplicating it.
-
-**Interfaces (produces):**
-- `Record{Task, Repository, Base, Candidate, Attempt, LaunchID string}`.
-- `Claim{Record; PackSHA256, NoteSHA256 string}`.
-- `Bind(rec Record, c Claim, pack, note []byte) (Ack, error)` refuses any field mismatch and any digest mismatch.
-- `Resumable(ack *Ack) error` refuses a nil (unacknowledged) checkpoint.
-- `ResumePrompt(rec Record, ack Ack, notes []string, personWords []string) string` labels the task, attempt and checkpoint digest. It carries each note as a JSON-quoted string under a `checkpoint note (runner output, untrusted)` label, and keeps composer-origin person words in a separate block.
-
-- [ ] **Red:**
- - `TestBindRefusesEachMismatch`: one row each for task, repository, base, candidate, attempt, launch ID, pack hash and note hash.
- - `TestUnacknowledgedCannotResume`.
- - `TestNoteCannotEscapeQuoting`: notes containing closing quotes, backslashes, newlines, the label text, a fake `person words` block header, and the prompt's own delimiters all stay inside one JSON string, and the parsed prompt shows exactly one person block.
- - `TestNotesNeverInPersonBlock`.
-- [ ] **Green:** `go test ./internal/hostedcheckpoint -count=1`.
-- [ ] **Mutations (register each):**
- - Skip the task comparison: its row fails.
- - Concatenate notes unquoted: `TestNoteCannotEscapeQuoting` fails.
-- [ ] **Commit:** `hostedcheckpoint: bound acknowledgements and quoted notes`.
-
-### Task 31: Hosted admission check (spec §7 and §17 M8; certified guards)
-
-**Files:** Create `internal/hostedadmit/{admit.go,admit_test.go}`.
-
-**Interfaces (produces):**
-- `LaunchRecord{AttemptID, LaunchID, VMRef string; Epoch int64; Image isolatedjob.ImageDigest; CertificateDigest string}` comes from the controller via `hostedclient.Get`.
-- `Hello{VMRef, Image, Profile string; Epoch int64}` is what the runner claims.
-- `Admit(rec LaunchRecord, current map[isolatedjob.ImageDigest]string /*image to current certificate digest*/, h Hello) (Admission, error)`.
-
-`Admission` is built only from `rec`. The hello can cause a refusal but never grants anything. Slice 2 calls `Admit` on every hosted admission path.
-
-- [ ] **Red:**
- - `TestForgedImageHelloRefused`: the hello claims a certified image that differs from the record.
- - `TestReplayedHelloRefused`: another VM's ref.
- - `TestEpochMismatchRefused`.
- - `TestRecordWithoutCurrentCertificateRefused`.
- - `TestAdmissionIgnoresHelloProfile`: a hello saying `bubblewrap` on an uncertified record is refused.
-- [ ] **Green:** `go test ./internal/hostedadmit -count=1`.
-- [ ] **Mutation (register):** take the image from the hello. `TestForgedImageHelloRefused` fails. Restore.
-- [ ] **Commit:** `hostedadmit: admission from the launch record, not the hello`.
-
-### Task 32: Image inventory, manifest and deterministic build
-
-**Files:**
-- Create `internal/hostedimage/{manifest.go,manifest.json,inventory.go,build.go,build_test.go,inventory_test.go}` and `cmd/equipo-hosted-image/main.go`.
-- Modify `Makefile` (`hosted-image-check`, in `ci`) and `scripts/ci-test.py` (the same target in the static-checks `EXTRA_SHARDS` entry).
-
-**Interfaces (produces):**
-
-```go
-type Manifest struct {
- Version int
- Base string // OCI base image by digest
- Provenance string // the release provenance manifest's commit and digests (Task 37)
- Files []File // Path, SHA256, Mode, Owner, Source
- Executables []string // every program the suite or probe executes, each present in Files
- ProxyRootSHA256, InterceptRootSHA256 string
- ContainmentTests int // containment.test -test.list, minus ^TestSource
-}
-func Load() (Manifest, error)
-func Inventory(testSources fs.FS) ([]string, error) // absolute program paths and bare names exec'd by the containment tests
-func Build(ctx context.Context, m Manifest, inputs fs.FS, out string) (isolatedjob.ImageDigest, error)
-```
-
-The image contains:
-- `equipo-vm-init`, `equipo-vm-probe` and `containment.test`;
-- the runner and the tool proxy (`equipo-tool-proxy`), with digests taken from release provenance, not `release.BuildManifest()`;
-- the pinned bubblewrap;
-- the release-pinned codex (open question 5);
-- the Go toolchain at `go1.26.11`, because the tests run `go env GOROOT` and Go builds;
-- `make`, `bash`, `python3`, `git`, and the coreutils the tests name (`true`, `false`, `cat`, `sleep`, `touch`);
-- the two pinned roots.
-
-- [ ] **Red:**
- - `TestInventoryCoversSuite`: every program the inventory finds in the containment tests' sources is in `Executables` and `Files`.
- - `TestBuildIsDeterministic`: inputs with deliberately different mtimes, set with `os.Chtimes` to two dates a year apart, give one digest.
- - `TestBuildRefusesDigestMismatch`.
- - `TestBuildRefusesForbiddenPaths`: `.ssh`, `.aws`, `*.pem`, `*.key`, runner state and OAuth homes.
- - `TestManifestPinsBubblewrap`: equals `containment.BubblewrapSHA256`.
- - `TestContainmentCountMatchesSuite`.
-- [ ] **Green:** `go test ./internal/hostedimage -count=1`, `make hosted-image-check`, and `python3 scripts/ci-test.py check`.
-- [ ] **Mutations:**
- - Remove `make` from the manifest: `TestInventoryCoversSuite` fails.
- - Drop the fixed mtime: `TestBuildIsDeterministic` fails.
- - Change one pin byte: `TestManifestPinsBubblewrap` fails.
-- [ ] **Commit:** `hosted image: inventory, pinned manifest and reproducible build`.
-
-### Task 33: Guard mutation evidence
-
-**Files:** Create `scripts/hosted-guard-evidence.py`, plus a `--self-test` with two fixture guards under `scripts/testdata/`.
-
-**Interfaces (produces):** `python3 scripts/hosted-guard-evidence.py run --commit <sha> --out <file>` works like this:
-1. Clones the commit into a fresh `mktemp -d` under `$TMPDIR`.
-2. For each guard in `guards.json`:
- 1. Applies the patch.
- 2. Runs `go test ./<package> -run '^<test>$' -count=1` and expects failure.
- 3. Reverts the patch.
- 4. Reruns the test and expects a pass.
-3. Writes `hostedcert.GuardEvidence` as JSON with its sha256.
-4. Removes the clone.
-
-This replays the guards registered so far. It runs once per certification, not in a loop. It refuses a dirty clone.
-
-- [ ] **Red:** `--self-test`. A fixture guard whose test still passes under its mutation must be reported as `FailedUnderMutation: false`, and the run must exit non-zero.
-- [ ] **Green:** `python3 scripts/hosted-guard-evidence.py --self-test`. Then run it once at HEAD and record the guard count and the time taken.
-- [ ] **Commit:** `scripts: replay certified guard mutations as evidence`.
-
-### Task 34: In-VM certification harness and the egress matrix
-
-**Files:** Create `internal/vmprobe/{certify_linux.go,probes_linux.go,certify_test.go}`. Modify `internal/hostedcert/matrix.json` to add every row below.
-
-**Interfaces:**
-- Consumes Tasks 2, 3, 11 and 26 to 28.
-- Produces `vmprobe.Certify(ctx, cfg Config) error`, which starts as root and runs four phases in order.
-- The report carries observations only (`hostedcert.Report`). It is posted to the report route through the proxy with the VM's credential.
-
-The four phases:
-1. **Root rows.**
-2. **Drop.** Re-exec through `equipo-vm-init drop`.
-3. **Runner rows.** Run the containment suite as the runner user: `containment.test -test.v -test.count=1 -test.skip '^TestSource'`.
-4. **Sandbox rows.** Run inside the containment manager with the hosted launch policy, exactly as checks will run.
-
-Each refusal row names a positive control that proves the probe itself works:
-
-| Rows | Actor | Expect | Control |
-| --- | --- | --- | --- |
-| `root_metadata_no_credentials`, `root_no_aws_files` | root | denied_locally | `root_metadata_reachable` (allowed: region only) |
-| `root_managed_resolver_<n>`, `root_direct_v4`, `root_direct_v6` | root | unreachable | `root_proxy_port_reachable` |
-| `runner_instance_healthz` | runner | allowed | — |
-| `runner_proxy_port_reachable`, `runner_bootstrap_listener_reachable` | runner | allowed | — |
-| `runner_direct_instance_v4`, `runner_direct_instance_v6` (connect to the instance's real addresses, bypassing the proxy) | runner | unreachable | `runner_proxy_port_reachable` |
-| `runner_managed_resolver_<n>`, `runner_metadata` | runner | unreachable or denied_locally | `runner_proxy_port_reachable` |
-| `runner_no_credential`, `runner_expired_credential`, `runner_other_vm_credential`, `runner_old_epoch` | runner | proxy_refused:credential | `runner_instance_healthz` |
-| `sni_mismatch`, `missing_sni`, `ech`, `host_mismatch`, `h2_authority_mismatch`, `redirect_cross_host`, `encoded_authority`, `nested_connect`, `ip_literal_v4`, `ip_literal_v6`, `other_proxy_port` | runner | proxy_refused:<reason> | `runner_instance_healthz` |
-| `denied_<name>` (six), `mirror_get_none`, `mirror_upload`, `mirror_cache_miss_url`, `gateway_route`, `report_route_as_job` | runner | proxy_refused:<reason> | `runner_instance_healthz` |
-| `plain_dns_any_name` | runner | nxdomain | `tls_dns_own_instance` (allowed) |
-| `resolver_files_read_only`, `no_capabilities`, `no_new_privileges`, `no_setuid_binaries` | runner | denied_locally | `runner_can_write_state_dir` (allowed) |
-| `sandbox_any_host`, `sandbox_resolver`, `sandbox_proxy`, `sandbox_bootstrap_listener`, `sandbox_metadata`, `sandbox_ipv6`, `sandbox_shell_dns`, `sandbox_build_script_network` | sandbox | unreachable | `sandbox_loopback_listener` (allowed: a listener inside the sandbox) |
-
-`mirror_get_none` is a refusal row. There is no allowed mirror case while the mirror is `none`. Its control is the instance row, and the expected reason is `service_none`, which tells a policy refusal from a broken probe.
-
-- [ ] **Red:**
- - `TestMatrixDefinitionCoversSpec`: every network item in spec §14 and §17 names a row.
- - `TestEveryRefusalHasControl`.
- - `TestRootRowsRunBeforeDrop`.
- - `TestReportHasNoExpectations`: the report type has no field for them.
- - `TestReportCarriesNoSecrets`.
- - `TestOutcomeClassification`, with injected dialers: a timeout or `ENETUNREACH` is `unreachable`; a 403 carrying `Equipo-Egress-Refusal` is `proxy_refused:<reason>`; a 403 without that header, or any other status, is an error outcome that matches no expectation.
-- [ ] **Green:** `go test ./internal/vmprobe ./internal/hostedcert -count=1`.
-- [ ] **Mutation (register):** classify a timeout as `proxy_refused`. `TestOutcomeClassification` fails. Restore.
-- [ ] **Commit:** `certification: in-VM harness, trusted matrix rows and controls`.
-
-### Task 35: Certification flow: online collection, offline signing
-
-Astra's view on open question 4: keep report collection online and signing under the operator's control, as separate steps.
-
-**Files:** Create `cmd/equipo-hosted-controller/certify.go`, `internal/hostedctl/{certify.go,certify_test.go}` and `internal/hostedcert/bundle.go`.
-
-**Interfaces (produces):**
-- `equipo-hosted-controller certify collect -image <digest> -client <operator config> -out <bundle>`, with the operator API key:
- 1. Launches a Large certification VM.
- 2. Waits up to 20 minutes for the report.
- 3. Fetches the report with its controller-recorded Provenance and the audit taken during the run.
- 4. Stops the VM with proof.
- 5. Writes a bundle.
-- `equipo-hosted-controller certify sign -bundle <file> -evidence <guard evidence> -provenance <release provenance> -key <certification key> -out <signed>`, offline, with no network:
- 1. Builds the Expectation from repository data (`guards.json`, `matrix.json`, the image manifest and release provenance).
- 2. Verifies everything.
- 3. Signs.
-- `equipo-hosted-controller certify upload -signed <file>` sends `PUT /v1/certificates/{image}`.
-- `(*Controller) StoreCertificate(ctx, by, hostedcert.Signed) error` verifies before storing and records the audit.
-
-- [ ] **Red:**
- - `TestSignRefusesFailedBundle`: each `Verify` failure class.
- - `TestSignNeedsNoNetwork`: runs with a `Dialer` that panics.
- - `TestStoreCertificateVerifiesFirst`.
- - `TestCertifiedImageThenLaunches`: on the fake, launch is refused, then certify, then launch is accepted with the digest recorded.
- - `TestCertificationLaunchCannotEnrol`: an empty `InstanceCode`.
-- [ ] **Green:** `go test ./internal/hostedctl ./internal/hostedcert -run 'TestSign|TestStoreCertificate|TestCertified|TestCertificationLaunch' -count=1`.
-- [ ] **Mutation:** store without verifying. `TestStoreCertificateVerifiesFirst` fails. Restore.
-- [ ] **Commit:** `certification: online collection, offline signing and upload`.
-
----
-
-## Phase G: infrastructure, release and dev bring-up
-
-### Task 36: OpenTofu for the dev hosted network, controller and proxies
-
-The repository has no infrastructure code. This task proposes `infra/hosted/` in OpenTofu, following carlos/platform's `infra/modules` style (open question 2). Only the dev environment is written in this slice.
-
-**Files:** Create `infra/hosted/modules/{network,controller,proxies}/{main.tf,variables.tf,outputs.tf}`, `infra/hosted/envs/dev/{main.tf,backend.tf}` (account `640012953448`, profile `kass`, `eu-west-1`, tag `purpose=equipo-hosted-dev`), `infra/hosted/README.md`, `scripts/hosted-infra-check.py` and a fixture under `scripts/testdata/`.
-
-**Network:**
-- A VPC with `enable_dns_support = false` and `enable_dns_hostnames = false`.
-- VM subnets in two zones, with no default route.
-- An egress subnet per zone for the proxies.
-- The VM security group has no ingress. Its egress goes only to the two proxies' egress and bootstrap ports and the resolver's ports 53 and 853.
-- The proxy security group allows only those ports, from the VM group. Its egress is 443 to anywhere, plus 853 to the pinned upstream resolver addresses only.
-
-**Controller:**
-- One arm64 instance, with its database on an encrypted volume.
-- An instance profile allowed only:
- - the MicroVM operations;
- - writes to its own image repository;
- - the EC2 `Describe*` calls the audit needs;
- - `sns:Publish` to its topic.
-
-**Proxies:** two instances in two zones, with fixed private addresses. No role is attached to any VM. Resources the OpenTofu AWS provider lacks (Task 4) come from an idempotent `equipo-hosted-controller ops ensure` command instead.
-
-- [ ] **Red:** `python3 scripts/hosted-infra-check.py --self-test` reads `tofu show -json`. It fails on any of these:
- - DNS support on;
- - a default route on a VM subnet;
- - a VM ingress rule;
- - VM egress beyond the proxy and resolver;
- - a role outside the controller;
- - a controller action outside its list.
-- [ ] **Implement:** run `tofu fmt -check` and `tofu validate`.
-- [ ] **Green:** the self-test. With `kass`, `tofu plan -out` in `envs/dev`, then the check over its JSON. The agent may run plan only.
-- [ ] **Mutation:** flip DNS support in the fixture. The self-test fails. Restore.
-- [ ] **Commit:** `infra: OpenTofu for the dev hosted network, controller and proxies`.
-
-### Task 37: Hosted release artifacts and CI wiring
-
-**Files:** Modify `Makefile` (`release-hosted`) and `scripts/release-isolated.sh` (a hosted mode). Create `scripts/hosted-release-check.py`.
-
-**Interfaces (produces):** `make release-hosted` builds in an isolated clean tree at one commit. Its output feeds the image manifest's `Provenance`:
-- `equipo-hosted-controller` and `equipo-egress-proxy`, for linux/arm64;
-- for linux/amd64: `equipo-vm-init`, `equipo-vm-probe`, `containment.test` (built with `go test -c -trimpath`), the runner and `equipo-tool-proxy`;
-- a provenance manifest of commit and sha256 in the format of `scripts/staged-artifacts.py`.
-
-- [ ] **Red:** `python3 scripts/hosted-release-check.py --self-test`. A binary whose build information names another commit, a dirty-tree flag, or a missing artifact (including the tool proxy) each fail.
-- [ ] **Green:**
- - the self-test;
- - `make release-hosted` once, then the check over its output;
- - `python3 scripts/ci-test.py check`, which confirms `hosted-guards-check` and `hosted-image-check` are in both `make ci` and the hosted static-checks shard.
-- [ ] **Commit:** `release: hosted artifacts with provenance, wired into CI`.
-
-### Task 38: Dev bring-up, certification and drills (HUMAN-gated)
-
-Each step marked **HUMAN** needs Paul's GO. Agents run the read-only checks and the non-destructive drills with `kass`.
-
-- [ ] **HUMAN:** apply `infra/hosted/envs/dev`. The agent then runs `hosted-infra-check.py` against the applied state.
-- [ ] **HUMAN:** deploy the controller and both proxies from a `release-hosted` build, with the H2 hostnames, gateway `none`, mirror `none`, and `EQUIPO_HOSTED_ENABLED=1`.
-- [ ] Agent, with GO: run Task 8's live contract test, and record the teardown proof.
-- [ ] **HUMAN:** register the image (`equipo-hosted-image build`, then `register`). The agent records the digest.
-- [ ] Agent: run `certify collect` and `hosted-guard-evidence.py run`. Record the full containment result (every test passes except the cgroup skip, against the spike's 71 of 79), every matrix row and the guard count.
-- [ ] **HUMAN:** the certification key holder runs `certify sign` offline, then `certify upload`.
-- [ ] Agent, non-destructive drills:
- - launch a Small job with an operator-supplied dummy instance code, then stop it with proof;
- - kill the controller between launch and save, restart it, and see exactly one VM;
- - suspend and resume a job, and see the probe exchange and the old credential refused;
- - give a 15-minute lifetime, and see it drained at once and stopped at 5 minutes.
-- [ ] **HUMAN GO, then agent, destructive drills:**
- - plant an orphan with the AWS CLI and see it stopped after 10 minutes;
- - stop one proxy and see failover, then both and see the trusted route refused with no fallback;
- - stop the controller past `FeedGrace` and see egress refused, then restart and see the exchange;
- - switch VPC DNS support on, and see the audit fail, launches refuse and the alert fire, then switch it off.
-- [ ] Agent: list every VM, confirm none remain, and record the dev spend.
-- [ ] One whole-branch review (Astra or Fable, as Paul directs), at most three rounds. Paul lands it.
-
-**Slice 1 is done when** all of these hold:
-- a certified image digest exists in dev;
-- the controller launches it only with that certificate;
-- the end-to-end test and the drills pass;
-- no VM is left running;
-- everything is off unless `EQUIPO_HOSTED_ENABLED=1`.
-
----
-
-## What slice 2 then needs
-
-1. **Dependency mirror and importer.** Spec §6 and Paul's ruling 4 require it before any hosted code runs. Set its exact host in configuration and recertify; the matrix gains an allowed mirror row with its control.
-2. **Enrolment on the instance.** Covers:
- - `POST /api/hosted/enrol` (bootstrap code, VM ID, machine key);
- - instance-minted codes passed as `InstanceCode`;
- - the 1-hour runner bearer, renewable to the deadline;
- - epochs;
- - the 2-minute enrolment timeout: stop, retry once, then fail with a reason.
-3. **Runner changes.** Covers:
- - the runner replaces the probe;
- - it reads the bootstrap, uses `egressproxy/client` and its `Credential`, and handles `rotate` on the control socket;
- - `Link` reads the current bearer on each dial;
- - a Linux checks worker on the containment manager with namespace proof (`thin.Run` starts the worker loop only on a Mac or the fake).
-
- Changing `vminit` to start the runner changes the image, so recertify.
-4. **Instance admission.** Every hosted admission path calls `hostedadmit.Admit` with the controller's record. The instance accepts `bubblewrap` from a worker only through it. A hosted VM is a worker bound to one job (`fits`, authorisation and dispatch).
-5. **Placement and limits:**
- - the project setting (off by default) read by `place` before its early return;
- - `waiting_hosted`;
- - the offline-withdrawal exemption;
- - per person: 2 running VMs, 8 VM-hours a day and $50 a month.
-6. **The instance half of the pause barrier**, if checks pause at all: `draining` with the generation in the admission transaction.
-7. **Wiring and testing:**
- - wire `hostedclient`, and delete `TestInstanceDoesNotCallHostedClient`;
- - add the launch-to-enrolled metric;
- - run the slice 2 end-to-end test (pack transfer, checks in the sandbox, certified report);
- - add the instance invariants to Task 18's model.
-8. **Production.** The deferred section above.
-
-## Open questions
-
-1. **MicroVM API and SDK.** *Recommendation:* use the SDK package if one exists. Otherwise, a SigV4 client inside `awsjob`. *Astra:* agrees, provided the API, hook and idempotency facts are settled first. Task 4 now does that, and stops the work on any contradiction.
-2. **Where infrastructure code lives.** *Recommendation:* `infra/hosted/` in this repository, OpenTofu, in carlos/platform's module style. *Astra:* agrees.
-3. **Controller outage versus a stale feed.** Spec §10 says running VMs continue while the controller is down, and that nothing falls back to open egress. A proxy that denies on a stale feed breaks the first; one that never denies would keep honouring stops and epochs it has not heard about. *Recommendation:* bounded continuation. The proxy serves from the last signed feed for up to 15 minutes, the credential lifetime, then refuses. Outages longer than that make steps wait, as "Proxy down" does. On restart, the controller reconciles with the provider and grants each live VM one exchange window before lapse stops apply (Task 17). This qualifies §10's "Running VMs continue" to "for up to 15 minutes", so Paul should approve it as a spec interpretation. *Astra:* SQLite and a single instance suit dev, with restore reconciliation defined, which this now does. For production durability, add continuous replication to S3 in the same account before slice 2 production.
-4. **Who holds the certification key.** *Recommendation:* an Ed25519 key held by Paul or a named operator, offline, for dev. For production, a key only a certification role can use in `equipo-hosted`. The controller pins the public key. *Astra:* agrees, with collection and signing separated, which Task 35 now does.
-5. **Codex in the image.** *Recommendation:* include the release-pinned codex binary with no credentials, plus every executable the suite runs (Task 32's inventory), so the full suite passes as §7 requires. *Astra:* agrees.
-6. **Gateway and mirror before they exist.** *Recommendation:* an explicit `none` value, recorded in every snapshot and the certificate, which denies the route. Unset still blocks. Setting either name requires recertification, enforced because the certificate binds both. *Astra:* reasonable, but this interpretation of §6 needs Paul's explicit approval.
-7. **Getting certification results out of the VM.** *Recommendation:* one report route through the proxy, allowed only for certification launches. Per Astra, its policy and provenance are bound separately in the certificate (`ReportPolicyDigest`, `Provenance`) rather than left outside it.
-8. **Upstream DNS for the proxies with VPC DNS off.** *Recommendation:* DNS over TLS to pinned resolver addresses with a pinned TLS name and no fallback, keeping one VPC. *Astra:* agrees with that pinning.
diff --git a/docs/superpowers/plans/2026-11-19-hosted-runners-slice-1a.md b/docs/superpowers/plans/2026-11-19-hosted-runners-slice-1a.md
new file mode 100644
index 00000000..41e2e8bf
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-19-hosted-runners-slice-1a.md
@@ -0,0 +1,427 @@
+# Hosted runners, slice 1a: adapter and controller core (plan, 2026-11-19, revision 3)
+
+> **For agentic workers:** REQUIRED SUB-SKILL: use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task by task. Steps use checkbox (`- [ ]`) syntax. Steps marked **HUMAN** are not agent work: stop and ask Paul.
+
+**Goal:** The provider-neutral isolated job runner and the controller core, tested in depth and checked once against real VMs in the dev account. Nothing user-facing; off unless flagged.
+
+**Architecture:** `isolatedjob.Runner` (spec §2) has an in-memory fake, a shared contract suite and an AWS adapter. `equipo-hosted-controller` owns the job table, controller time, launch intents, stop proof, pause generations, resume epochs and the reaper, behind a signed HTTPS API that the instance reaches through a flag-gated client. Egress, credentials, the image and certification are slice 1b (outline at the end).
+
+**Tech stack:** Go (floor 1.26.0, gate `GOTOOLCHAIN=go1.26.11`, `CGO_ENABLED=0`), modernc SQLite through `database/sql`, `crypto/ed25519`, aws-sdk-go-v2 only in the AWS adapter.
+
+**Spec:** `docs/superpowers/specs/2026-11-18-hosted-runners-microvms.md` (approved 2026-11-19). §2, §3, §10 and §14 drive this plan; read them with it.
+
+**Baseline:** `design-hosted-runners` at `bb8e73b6`. Tasks 1 to 17, in order; each builds and tests only with earlier tasks' code. Revision 3 narrows revision 2 to slice 1a (controller decision after Astra round 2) and fixes the round 2 findings that stay here.
+
+## Global constraints
+
+- AWS SDK types appear only under `internal/isolatedjob/awsjob/` and in the composition commands listed in Task 7's guard. Core packages stay provider-neutral.
+- Launch request shape, sizes, region and the 28,800 s limit: spec §3 and §2, enforced by Task 7.
+- Controller deadlines, grace periods and timeouts use controller time (Task 9), never the wall clock.
+- A provider state the adapter does not recognise is `unknown`: neither live nor terminal, never stop proof.
+- Reaper rules (60 s pass, incomplete `List` skips, intents replayed first, orphans stopped after 10 min once ownership is rechecked): spec §10.
+- Pause barrier and resume epoch rules: spec §3. Resume prepares its new epoch durably before calling the provider (Task 12).
+- The controller refuses launches unless `EQUIPO_HOSTED_ENABLED=1`; get, stop and reaping work regardless. The instance client refuses construction unless `EQUIPO_HOSTED_RUNNERS=1`, and nothing in the instance calls it in this slice.
+- Slice 1a holds no egress stack, so a launched VM has no route anywhere and cannot enrol. Launches admit only image digests in the controller's configured allowlist; slice 1b replaces that with certificates.
+- AWS work is in the dev account `640012953448` (profile `kass`) only, with Paul's GO for every change (Task 17). Nothing touches `149757027610` (`equipo-hosted`).
+- Tests first. Each guard gets a mutation check: break it, watch the named test fail, restore (spec §17). Record commands and results in `docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md`.
+- Local runs are targeted (`go test ./internal/<pkg> -run 'TestX' -count=1`); CI runs everything. No sudo; scratch under `$TMPDIR`; test servers on `127.0.0.1`; default Go caches; 10 s and 5,000-line budgets per package. Live AWS tests use build tag `hostedlive`.
+- Commit subjects under 80 characters. Never merge, push the default branch or deploy without Paul's GO.
+
+## Review focus
+
+1. A VM ends while the controller is down: `TestRestartFindsVMGone`, `TestUnknownStateIsNeverProof` (Task 11).
+2. The wall clock goes backwards during a run or across a restart: `TestRollbackThenElapsedTime`, `TestRestartWithUnknownDowntime` (Task 9), `TestReaperUnderRollback` (Task 13).
+3. A crash or lost reply during resume: `TestResumeCrashBeforeProvider`, `TestResumeCrashAfterProvider`, `TestResumeLostReply` (Task 12).
+4. Two retries of one launch race: `TestConcurrentLaunchSameAttempt` (Task 10).
+5. A plausible VM found by `List` that a pending intent will claim: `TestReapReplaysIntentFirst`, `TestReapRechecksOwnership` (Task 13).
+
+---
+
+## H2: rulings before Task 17 (HUMAN, Paul)
+
+- [ ] Answer or accept the open questions at the end.
+- [ ] Decide who creates the throwaway dev network for Task 17 and whether agents may run its live steps.
+
+## Phase A: containment suite fixes (spec §7)
+
+### Task 1: Retry `poll` on `EINTR`, on Linux and Darwin
+
+**Files:** Create `internal/runner/containment/poll_unix.go` (`//go:build linux || darwin`), `poll_unix_test.go`. Modify `linux_test.go` (`exited`, `alive`, the stop check near line 489) and `recovery.go:78-79` (no build constraint; builds for the Mac runner).
+
+**Interfaces:** `pollRetry(fds []unix.PollFd, timeout time.Duration, poll func([]unix.PollFd, int) (int, error)) (int, error)` retries `EINTR` within the original timeout; `pollFD(fds, timeout)` wraps `unix.Poll`.
+
+- [ ] **Red:** `TestPollRetriesEINTR` (two `EINTR`, then `(1, nil)`: three calls). `TestPollRetryKeepsDeadline` (endless `EINTR` at 30 ms, 100 ms timeout: returns `n == 0` within 200 ms).
+- [ ] **Implement**; today an `EINTR` in `recovery.go` reports `errIdentity`.
+- [ ] **Green:** `go test ./internal/runner/containment -run 'TestPollRetr' -count=1`; `make build vet` (includes darwin vet of `./internal/runner/...`).
+- [ ] **Mutation:** return on the first `EINTR`; `TestPollRetriesEINTR` fails.
+- [ ] **Commit:** `containment: retry poll on EINTR on Linux and Darwin`.
+
+### Task 2: Source-reading tests run from the source tree only
+
+**Files:** Modify `internal/runner/containment/helper_version_test.go`, `bubblewrap_pin_test.go`; `scripts/ci-test.py` only where a lane names either test.
+
+**Interfaces:** the `TestSource` prefix; a compiled test binary run outside the tree uses `-test.skip '^TestSource'`.
+
+- [ ] **Red:** rename `TestNamespaceVersionTracksImplementation` to `TestSourceNamespaceVersionTracksImplementation`; move the `ci-box.json` comparison out of `TestBubblewrapPins` into `TestSourceBubblewrapPinsMatchCIBox`; add `TestSourceTestsAreNamed` (parses the package's test files; fails if a test outside the prefix opens a relative path literal).
+- [ ] **Green:** `go test ./internal/runner/containment -run 'TestSource|TestBubblewrapPins' -count=1`; `python3 scripts/ci-test.py check`; a `go test -c` binary in `$TMPDIR` passes `-test.run TestBubblewrapPins -test.skip '^TestSource'` (then remove it).
+- [ ] **Mutation:** put the `ci-box.json` read back in `TestBubblewrapPins`; `TestSourceTestsAreNamed` fails.
+- [ ] **Commit:** `containment: name the source-reading tests TestSource`.
+
+### Task 3: Skip the delegated-cgroup test without a user session
+
+**Files:** Modify `internal/runner/containment/linux_test.go`, `Makefile` (`runner-namespace-test` sets `EQUIPO_REQUIRE_USER_SESSION=1`).
+
+**Interfaces:** `cgroupSkip(base string, stat func(string) error, require bool) (skip bool, reason string, fail bool)`.
+
+- [ ] **Red:** `TestCgroupSessionRule`: no session gives skip with reason `no systemd user session; production containment does not use cgroups`; with `require` it fails instead; a session gives neither.
+- [ ] **Green:** `go test ./internal/runner/containment -run TestCgroupSessionRule -count=1`; on docs-t1 `TestNamespaceCgroupMoveKeepsMembership` still passes.
+- [ ] **Mutation:** ignore `require`; the test fails.
+- [ ] **Commit:** `containment: skip the cgroup test without a user session`.
+
+## Phase B: the isolated job runner adapter (spec §2)
+
+### Task 4: Record the MicroVM API facts first
+
+**Files:** Create `internal/isolatedjob/awsjob/doc.go` (package comment only).
+
+- [ ] From AWS documentation and the SDK module list, record: whether aws-sdk-go-v2 has a MicroVM package; operation names; where `additionalOsCapabilities`, the connector and maximum duration go; the client-token idempotency window and the mismatch error; the full state vocabulary; whether `Get` returns a start time and whether responses carry a server `Date`; whether `Resume` on a running VM succeeds; the hook transport and how the VM learns its ID (for slice 1b); the run-payload limit.
+- [ ] A fact that contradicts this plan (no client token, no start time, no idempotent resume) stops the work; ask Paul.
+- [ ] **Commit:** `awsjob: record the MicroVM API facts the adapter relies on`.
+
+### Task 5: Types, validation and the two-part clock
+
+**Files:** Create `internal/isolatedjob/{isolatedjob.go,validate.go,clock.go,isolatedjob_test.go}`.
+
+**Interfaces:** spec §2's `Runner`, `LaunchSpec`, `Job`, `Limits`, plus:
+
+```go
+type Ref string
+type ImageDigest string // "sha256:" + 64 lower-case hex
+type Size string // SizeSmall "small", SizeLarge "large" (spec §2)
+type State string // starting running suspending suspended stopping stopped failed unknown
+func (State) Live() bool; func (State) Terminal() bool // unknown is neither
+// Job gains: ProviderAge time.Duration; AgeKnown bool (provider server time minus provider start time, Task 7)
+const HardMaxLifetime = 28800 * time.Second
+var ErrNotFound, ErrInvalid, ErrConflict, ErrThrottled, ErrIncomplete, ErrBootstrapTooLarge error
+func (s LaunchSpec) Validate(l Limits) error
+type Clock interface{ Wall() time.Time; Mono() time.Duration } // Mono never decreases
+type NetworkAuditor interface{ AuditNetwork(ctx context.Context) (NetworkAudit, error) }
+type NetworkAudit struct{ ResolverDisabled, IngressClosed, RouteOutAbsent bool; EgressOnly []netip.AddrPort }
+func (NetworkAudit) OK(want []netip.AddrPort) error
+```
+
+- [ ] **Red:** `TestLaunchSpecValidate` (table: bad AttemptID, image, size; lifetime zero, over the limit, 28,801 s; bootstrap empty or one byte over; a passing row at each limit). `TestStateSets`. `TestNetworkAuditOK`.
+- [ ] **Green:** `go test ./internal/isolatedjob -count=1`.
+- [ ] **Mutations:** make `unknown` terminal (`TestStateSets` fails); `>=` on the lifetime limit (at-limit row fails).
+- [ ] **Commit:** `isolatedjob: runner interface, validation and two-part clock`.
+
+### Task 6: In-memory fake and the contract suite
+
+**Files:** Create `internal/isolatedjob/{fake.go,fake_test.go}`, `internal/isolatedjob/isolatedjobtest/{contract.go,clock.go}`.
+
+**Interfaces:**
+
+```go
+func NewFake(c Clock, l Limits) *Fake // Runner and NetworkAuditor; limits as the spike found (spec §15)
+func (*Fake) Inject(op Op, f Fault) // FaultThrottle, FaultLostReply (apply, then error), FaultIncompleteList, FaultUnknownState, FaultAgeUnknown
+func (*Fake) Tick(); func (*Fake) SetBackstop(on bool); func (*Fake) Plant(s LaunchSpec) Ref
+func (*Fake) LiveByAttempt() map[string]int; func (*Fake) StopsIssued() []Ref
+// isolatedjobtest:
+type FakeClock struct{ /* SetWall, AdvanceMono */ }
+type Harness struct{ Runner isolatedjob.Runner; Image isolatedjob.ImageDigest; Settle func(context.Context, isolatedjob.Ref, func(isolatedjob.State) bool) (isolatedjob.Job, error) }
+func Contract(t *testing.T, h Harness)
+```
+
+- [ ] **Red:** `Contract` subtests: `LaunchIdempotentOnAttempt`, `ChangedSpecConflicts`, `StopTwice`, `StopUnknownRef`, `GetAfterStop` (terminal or `ErrNotFound`, never `unknown`), `SuspendResumeRoundTrip`, `ResumeRunningIsNoop`, `OversizeBootstrapRefusedBeforeProvider`, `LimitsAreSane`. `TestFakeContract`. `TestFakeFaults` (one row per fault; `Tick` counts suspended time).
+- [ ] **Green:** `go test ./internal/isolatedjob/... -count=1`.
+- [ ] **Mutations:** key idempotency on Ref (`LaunchIdempotentOnAttempt` fails); exclude suspended time from `Tick` (`TestFakeFaults` fails).
+- [ ] **Commit:** `isolatedjob: in-memory fake and adapter contract suite`.
+
+### Task 7: AWS adapter and the provider guard
+
+**Files:** Create `internal/isolatedjob/awsjob/{runner.go,network.go,errors.go,alerts.go,runner_test.go,network_test.go,live_test.go}`, `internal/isolatedjob/providerguard_test.go`. Modify `go.mod`, `go.sum`.
+
+**Interfaces:** `New(cfg Config, api API) (*Runner, error)` with `Config{Region, ConnectorID, VPCID, VMSubnetID, VMSecurityGroupID string; Images map[isolatedjob.ImageDigest]string; Egress []netip.AddrPort}`; `API` is a narrow interface in SDK types (or SigV4 calls, per Task 4); `SNSAlerter` implements Task 9's `Alerter` (it compiles against an interface declared here and satisfied structurally, so Task 9 need not exist yet).
+
+- [ ] **Red:** `TestRunRequestShape` (every spec §3 field: `NO_INGRESS`, connector-only egress, no role, no idle policy, maximum duration, x86_64, `additionalOsCapabilities: ["ALL"]`, memory by size, client token = AttemptID, payload byte for byte, image version from the map; an unmapped digest gives `ErrInvalid`). `TestStateMapping` (an unfamiliar state gives `unknown`, raw value in `Reason`). `TestProviderAge` (age from the response's server time minus the VM's start time; either missing gives `AgeKnown false`). `TestErrorMapping`. `TestListAllPages` (a page-two error gives `ErrIncomplete`, no jobs). `TestAuditNetwork`. `TestProviderTypesStayInAdapter`: over `go list -deps ./...`, only `internal/isolatedjob/awsjob/...` and the composition points `cmd/equipo-hosted-controller` (slice 1b adds `cmd/equipo-vm-init` and `cmd/equipo-hosted-image`) may depend on `github.com/aws/` or `awsjob`; the allowed list itself may contain only `cmd/` paths.
+- [ ] **Green:** `go test ./internal/isolatedjob/... -count=1`; `make build vet govulncheck`.
+- [ ] **Mutations:** set a role, an idle policy, or drop the capabilities field (`TestRunRequestShape`); map an unfamiliar state to `failed` (`TestStateMapping`); take age from the local clock (`TestProviderAge`); return partial pages (`TestListAllPages`); import `awsjob` from `internal/isolatedjob` (guard); add an `internal/` path to the allowed list (guard).
+- [ ] **Commit:** `isolatedjob: AWS MicroVM adapter and provider guard`.
+
+## Phase C: the controller (spec §2, §3, §10)
+
+### Task 8: Signed requests and wire types (`hostedwire`)
+
+**Files:** Create `internal/hostedwire/{sign.go,verify.go,api.go,sign_test.go}`.
+
+**Interfaces:**
+
+```go
+type KeyID string; type Role string // RoleInstance, RoleOperator
+func SignRequest(r *http.Request, body []byte, id KeyID, key ed25519.PrivateKey, now time.Time, nonce string) error
+type NonceStore interface{ Remember(ctx context.Context, id KeyID, nonce string, until time.Time) (bool, error) }
+type Verifier struct{ Keys map[KeyID]VerifyKey; Nonces NonceStore; Now func() time.Time } // VerifyKey{Public; Role}
+func (*Verifier) Verify(r *http.Request, body []byte) (KeyID, VerifyKey, error)
+func SignResponse(h http.Header, status int, requestNonce string, body []byte, key ed25519.PrivateKey)
+func VerifyResponse(resp *http.Response, body []byte, requestNonce string, pub ed25519.PublicKey) error
+const MaxBody = 1 << 20
+type Bootstrap struct{ Version int; LaunchID string; InstanceCode string } // slice 1b adds ProxyCode
+// api.go: strict-JSON request and response types for every Task 15 route
+```
+
+Signed message: `"equipo-hosted-request-v1\n" + method + "\n" + escaped path and raw query + "\n" + timestamp + "\n" + nonce + "\n" + hex(sha256(body))`; responses: `"equipo-hosted-response-v1\n" + status + "\n" + request nonce + "\n" + hex(sha256(body))`. Skew 60 s; nonces kept 10 min.
+
+- [ ] **Red:** `TestSignedRequestRoundTrip`, `TestSignatureCoversEveryField`, `TestSkewRefused`, `TestNonceReplayRefused`, `TestNonceStoreErrorDenies`, `TestResponseBoundToRequestNonce`, `TestOversizeBodyRefused`.
+- [ ] **Green:** `go test ./internal/hostedwire -count=1`.
+- [ ] **Mutations:** drop the body hash; skip `Remember`; treat a store error as fresh. Each fails its test.
+- [ ] **Commit:** `hostedwire: signed requests and responses for the controller`.
+
+### Task 9: Store, controller time and the controller skeleton
+
+**Files:** Create `internal/hostedctl/{store.go,clock.go,controller.go,schema/0001_jobs.sql,store_test.go,clock_test.go}`.
+
+**Interfaces:**
+
+```go
+type T time.Duration // controller time
+type CtlClock struct{ /* restored base + Clock.Mono() */ }
+func (*CtlClock) Now() T
+func Open(ctx context.Context, path string, c isolatedjob.Clock) (*Store, error)
+func (*Store) Tx(ctx context.Context, fn func(*sql.Tx) error) error
+func (*Store) Clock() *CtlClock
+func (*Store) DowntimeUnknown() bool // set by Open after a rollback across restart
+func (*Store) Remember(...) // hostedwire.NonceStore
+func appendAudit(tx *sql.Tx, a Audit) error // Audit{Actor hostedwire.KeyID; Account, Task, Attempt, Action, Reason string; At T}
+type Alert struct{ Kind, Detail string; At T }
+type Alerter interface{ Alert(ctx context.Context, a Alert) error }
+type Config struct{ Enabled bool; Images map[isolatedjob.ImageDigest]bool } // later tasks add fields
+type Deps struct{ Store *Store; Runner isolatedjob.Runner; Auditor isolatedjob.NetworkAuditor; Alerter Alerter }
+func New(cfg Config, d Deps) (*Controller, error) // refuses a nil dependency
+```
+
+Controller time:
+- While running, `T` advances only with `Mono()`. Every reaper pass checkpoints `(T, wall)`.
+- On `Open`, if the wall clock is at or after the checkpoint, `T0 = T + (wall now − checkpoint wall)`. Downtime is credited, so deadlines and orphan grace can only arrive earlier.
+- If the wall clock is behind the checkpoint, downtime is unknown. `T0 = checkpoint T`, `DowntimeUnknown()` is true, and a `clock_rollback` alert is raised. Task 11 and Task 13 then assume the worst case (below), so unknown downtime never lengthens a deadline or a grace period.
+- Provider-reported age (Task 7) is trusted only when one provider response carries both the provider's server time and the VM's start time. It never uses this host's clock.
+
+Tables: `jobs` (attempt_id primary key; launch_id unique; vm_ref unique nullable; task_id, account_id, actor_key, purpose, replaces_attempt; spec_json and spec_sha256, immutable by trigger; state; launched_t, deadline_t, drain_t, stop_t; epoch, resume_op_id, resume_epoch_prepared, resume_prepared_t; pause_generation, pause_started_t, pause_quiescent, pause_cancelled; stop_requested_t, stop_reason, stop_proof_json; revision), `unmatched_vms` (vm_ref, first_seen_t), `nonces`, `audit`, `clock`.
+
+- [ ] **Red:** `TestStoreMigratesTwice`, `TestStoreRefusesNewerSchema`, `TestAuditRollsBackWithTx`, `TestSpecImmutable`. `TestRollbackThenElapsedTime`: the wall clock goes back 1 h mid-run, Mono advances 10 min, and `Now` advances exactly 10 min. `TestRestartCreditsDowntime`: the wall clock moves forward 30 min across a restart and `T` advances 30 min. `TestRestartWithUnknownDowntime`: the wall clock goes back across a restart; `T` does not decrease, `DowntimeUnknown` is true, and one alert is raised.
+- [ ] **Green:** `go test ./internal/hostedctl -run 'TestStore|TestAudit|TestSpecImmutable|TestRollback|TestRestart' -count=1`.
+- [ ] **Mutations:** derive `T` from the wall clock (`TestRollbackThenElapsedTime`); credit no downtime on a forward restart (`TestRestartCreditsDowntime`); drop the trigger (`TestSpecImmutable`).
+- [ ] **Commit:** `hostedctl: store, controller time and controller skeleton`.
+
+### Task 10: Launch with intents and replay
+
+**Files:** Create `internal/hostedctl/{launch.go,launch_test.go}`.
+
+**Interfaces:**
+
+```go
+type LaunchRequest struct{ AttemptID, TaskID, Account, Replaces string; Image isolatedjob.ImageDigest; Size isolatedjob.Size; MaxLifetime time.Duration; InstanceCode string }
+type JobView struct{ AttemptID, LaunchID, State string; VMRef isolatedjob.Ref; Epoch int64; DeadlineIn, DrainIn, StopIn time.Duration }
+func (*Controller) Launch(ctx context.Context, by hostedwire.KeyID, key hostedwire.VerifyKey, q LaunchRequest) (JobView, error)
+func (*Controller) Replay(ctx context.Context) error
+func Deadlines(launched T, max time.Duration) (deadline, drain, stop T) // drain = deadline−45m, stop = deadline−10m, clamped
+var ErrDisabled, ErrImageNotAllowed, ErrNetworkAudit, ErrReplacementLive error
+```
+
+`Launch` order: refuse when the flag is off; require `RoleInstance`; require the image in `Config.Images`; require a passing audit at most 5 min old; require stop proof for `Replaces`; transaction 1 saves the intent (exact spec, deadlines) or returns the matching one (a different request hash gives `ErrConflict`); `Runner.Launch`; transaction 2 saves the Ref and `starting`. `ErrThrottled` leaves state `waiting` for `Replay`.
+
+- [ ] **Red:** `TestLaunchSavesIntentBeforeProvider`, `TestLaunchIdempotentOnAttempt`, `TestLaunchConflictOnChangedRequest`, `TestConcurrentLaunchSameAttempt` (20 goroutines: one intent, one VM), `TestCrashBetweenLaunchAndSave` (lost reply, reopen, `Replay`: one VM, Ref saved), `TestLaunchRefusals` (table: flag off, operator role, image not allowed, stale audit, failing audit, live replaced attempt), `TestThrottleWaitsThenReplays`, `TestDeadlines` (8 h gives 7 h 15 and 7 h 50; 15 min gives 0 and 5 min).
+- [ ] **Green:** `go test ./internal/hostedctl -run 'TestLaunch|TestConcurrentLaunch|TestCrashBetween|TestThrottle|TestDeadlines' -count=1`.
+- [ ] **Mutations:** save the intent after the provider call (`TestLaunchSavesIntentBeforeProvider`); skip the image check or the Replaces check (`TestLaunchRefusals`).
+- [ ] **Commit:** `hostedctl: launch intents and replay`.
+
+### Task 11: Get, stop, stop proof and restart reconciliation
+
+**Files:** Create `internal/hostedctl/{stop.go,refresh.go,stop_test.go}`.
+
+**Interfaces:** `Get(ctx, by, attemptID) (JobView, error)`; `Stop(ctx, by, key, attemptID, reason string) (StopProof, error)` (the creating instance only); `StopProof{AttemptID string; VMRef isolatedjob.Ref; State isolatedjob.State; ObservedAt T}`; `Refresh(ctx) error`; `ErrStopPending`, `ErrStateUnknown`.
+
+Stop records `stop_requested_t`, then calls `Runner.Stop`, then `Runner.Get`. Proof needs a terminal state, or `ErrNotFound` after the request. `unknown` gives `ErrStateUnknown` and no proof.
+
+`Refresh` reconciles every live job with `Get`. After a restart it re-bases each live job conservatively:
+- With a trusted provider age, `launched_t = min(launched_t, now − age)`.
+- If downtime is unknown and the age is untrusted, the elapsed time is unknown. The job is treated as past `stop_t` and stopped, with the reason `elapsed_unknown`.
+
+- [ ] **Red:** `TestStopRecordsRequestBeforeProvider`, `TestStopProofNeedsTerminalState`, `TestUnknownStateIsNeverProof` (no proof; a replacement is refused), `TestLostStopReplyRetries`, `TestStopOfGoneVMSucceeds`, `TestRestartFindsVMGone`, `TestRestartUsesProviderAge` (deadlines move earlier, never later), `TestRestartStopsWhenElapsedUnknown`, `TestStopRoles` (another instance and an operator are refused).
+- [ ] **Green:** `go test ./internal/hostedctl -run 'TestStop|TestUnknownState|TestLostStop|TestRestart' -count=1`.
+- [ ] **Mutations:** accept `stopping` or `unknown` as proof; use `max` instead of `min` when re-basing (`TestRestartUsesProviderAge`); keep jobs whose elapsed time is unknown (`TestRestartStopsWhenElapsedUnknown`).
+- [ ] **Commit:** `hostedctl: stop proof, unknown states and restart reconciliation`.
+
+### Task 12: Pause generations and prepared resume epochs
+
+**Files:** Create `internal/hostedctl/{pause.go,resume.go,pause_test.go,resume_test.go}`.
+
+**Interfaces:** `Drain(ctx, by, attemptID) (generation int64, error)`; `Quiescent(ctx, by, attemptID string, generation int64) error`; `Suspend(ctx, by, attemptID string, generation int64) error`; `Reopen(ctx, by, attemptID string, generation int64) error`; `Resume(ctx, by, attemptID, operationID string) (epoch int64, error)`; `ErrGenerationCancelled`, `ErrNotQuiescent`, `ErrPastDeadline`, `ErrResumePending`; `PauseAckTimeout = 2 * time.Minute`.
+
+Suspend records `suspending` before calling the provider; `Refresh` settles it from `Get`.
+
+Resume runs in three steps:
+1. **Prepare.** One transaction records the operation ID, `resume_epoch_prepared = epoch + 1`, `resume_prepared_t` and state `resuming`. A second call with the same ID returns the committed epoch, or carries on with the pending one. A different ID while one is pending gives `ErrResumePending`.
+2. **Provider.** Call `Runner.Resume`.
+3. **Commit.** Once `Get` reports `running`, set `epoch = resume_epoch_prepared` and clear the pending fields.
+
+Slice 1b issues new-epoch credentials from the prepared epoch, so the VM's resume hook can complete synchronously before the commit. If the controller crashes or the provider reply is lost, `Refresh` finishes the operation from `Get`:
+- `suspended`: call `Runner.Resume` again;
+- `running`: commit;
+- `unknown`: leave it pending and retry next pass;
+- terminal: record proof and mark the job stopped.
+
+- [ ] **Red:**
+ - `TestSuspendNeedsCurrentAck`: no acknowledgement, an older generation, the next generation and a cancelled generation are each refused.
+ - `TestLateAckIgnored` (an acknowledgement at 2 min 1 s).
+ - `TestSuspendedTimeCountsToDeadline`.
+ - `TestResumePreparesEpochBeforeProvider`: the stub sees the pending epoch in the store.
+ - `TestResumeCrashBeforeProvider`, `TestResumeCrashAfterProvider` and `TestResumeLostReply`: each ends with one provider resume (or a no-op) and the epoch raised exactly once.
+ - `TestResumeRetrySameOperation`.
+ - `TestResumeOtherOperationWhilePending`.
+ - `TestResumePastDeadlineRefused`.
+- [ ] **Green:** `go test ./internal/hostedctl -run 'TestSuspend|TestLateAck|TestResume' -count=1`.
+- [ ] **Mutations:**
+ - Compare generations with `>=`: the next-generation row fails.
+ - Call the provider before preparing: `TestResumePreparesEpochBeforeProvider` fails.
+ - Raise the epoch on each call: `TestResumeRetrySameOperation` fails.
+ - Commit without `Get` showing `running`: `TestResumeLostReply` fails.
+- [ ] **Commit:** `hostedctl: pause generations and prepared resume epochs`.
+
+### Task 13: Reaper and the network audit loop
+
+**Files:** Create `internal/hostedctl/{reaper.go,reaper_test.go}`.
+
+**Interfaces:** `Reap(ctx) (ReapReport, error)`, `ReapReport{Skipped bool; Replayed, Drained, Stopped, OrphansSeen, OrphansStopped, Unknown int}`; `Loop(ctx, every time.Duration)`; `ReapInterval = 60 * time.Second`; `OrphanGrace = 10 * time.Minute`.
+
+Pass order: checkpoint the clock; `Replay`; `Refresh`; `List` (skip the rest on `ErrIncomplete`); orphans: record `first_seen_t`, and after `OrphanGrace` replay again, re-read the table and `List` again before `Stop` (after a restart with unknown downtime, existing orphans count their grace as already spent; the recheck still applies); mark jobs past `drain_t` as draining; stop jobs past `stop_t`; re-issue Stop for `unknown` and alert after three passes; run the audit, refusing launches and alerting (once per episode) while it fails.
+
+- [ ] **Red:** `TestReapSkipsIncompleteList`, `TestReapReplaysIntentFirst`, `TestReapStopsOrphanAfterTenMinutes` (9 min 59 s no, 10 min yes), `TestReapRechecksOwnership`, `TestReapDrainsThenStops`, `TestReaperUnderRollback` (the wall clock goes back 2 h mid-run; the orphan is still stopped at 10 min of Mono time), `TestOrphanGraceAfterUnknownDowntime`, `TestUnknownStateRetriedAndAlerted`, `TestFailingAuditBlocksLaunchAndAlertsOnce`.
+- [ ] **Green:** `go test ./internal/hostedctl -run 'TestReap|TestOrphanGrace|TestUnknownStateRetried|TestFailingAudit' -count=1`.
+- [ ] **Mutations:** reap on an incomplete `List`; drop the recheck; use wall time for grace. Each fails its test.
+- [ ] **Commit:** `hostedctl: leaked-VM reaper and network audit loop`.
+
+### Task 14: Lifecycle simulation with invariants (spec §14)
+
+**Files:** Create `internal/hostedctl/{sim_test.go,sim_model_test.go}`.
+
+**Interfaces:** `TestLifecycleSimulation`: 200 seeds by default within the 10 s budget, `EQUIPO_SIM_SEEDS=n` for more; a failure prints its seed and step log.
+
+Each step picks one operation at random:
+- launch: fresh, replacement, or a concurrent duplicate;
+- crash and reopen at any point, including between a provider call and its follow-up transaction;
+- provider faults: lost reply on Launch, Stop or Resume; throttle; incomplete `List`; unknown state; unknown age;
+- pause and resume: drain; an acknowledgement (current, stale, next or late); suspend; resume (new or repeated operation ID);
+- plant an orphan; stop;
+- a wall-clock jump of up to 3 h either way;
+- a time advance of up to 9 h.
+
+A time advance moves Mono in steps of at most `ReapInterval` and runs the scheduled reaper pass at each step, as `Loop` would. The fake's own lifetime backstop is off.
+
+| ID | Invariant, checked after every step | Mutation that must break it |
+| --- | --- | --- |
+| I1 | At most one live VM per attempt ID | Replay with a fresh client token |
+| I2 | Every VM the fake holds is a saved Ref, matches a stored intent's attempt, or is a planted orphan | Save the intent after the provider call |
+| I3 | Orphan cleanup stops only VMs with no job or intent, and none before 10 min of controller time | Stop orphans on first sight; drop the recheck |
+| I4 | No VM is live past its job's `stop_t` plus one reaper interval | Reap at `deadline_t`; use wall time |
+| I5 | A provider Suspend happens only with an acknowledgement for the current, uncancelled generation | Accept `>=` generations |
+| I6 | A replacement launches only after stop proof, and proof never comes from `unknown` | Treat `unknown` as terminal |
+| I7 | Each resume operation ID raises the epoch exactly once, prepared before the provider call and committed only after `running` | Raise the epoch before preparing; commit on a lost reply |
+
+- [ ] **Red:** write the model; apply each mutation alone and see it fail within the default seeds (record the seed).
+- [ ] **Green:** `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1`, then once with `EQUIPO_SIM_SEEDS=5000`.
+- [ ] **Commit:** `hostedctl: randomised lifecycle simulation with seven invariants`.
+
+### Task 15: Controller HTTP API, command and metrics
+
+**Files:** Create `internal/hostedctl/{http.go,metrics.go,http_test.go}`, `cmd/equipo-hosted-controller/{main.go,config.go,config_test.go}`.
+
+**Interfaces:** strict JSON, `MaxBody`, every response signed; the creating instance only for job routes.
+
+| Route | Role |
+| --- | --- |
+| `POST /v1/jobs`; `GET /v1/jobs/{attempt}`; `POST /v1/jobs/{attempt}/stop`, `/drain`, `/quiescent`, `/suspend`, `/reopen`, `/resume` | instance |
+| `GET /v1/vms` | operator |
+
+Metrics on a separate listener: jobs by state, launches and errors by kind, orphans stopped, audit status, alerts by kind. `main` is the composition point that wires `awsjob` and `SNSAlerter`. Config comes from the file `-config`: listen address (required, no default), TLS files, database path, signing key, verify keys with roles, image allowlist, region and network IDs; `Enabled` only from `EQUIPO_HOSTED_ENABLED=1`.
+
+- [ ] **Red:** `TestRoutesEnforceRoles` (403 and audited), `TestInstanceKeySeesOnlyItsJobs`, `TestUnknownFieldsRefused`, `TestResponsesSigned`, `TestConfigRefusesMissingListenOrKeys`, `TestConfigRefusesWildcardListen` (`0.0.0.0`, `::`, bare `:port`), `TestDisabledRefusesLaunchButServesStop`, `TestMetricsCountJobsByState`.
+- [ ] **Green:** `go test ./internal/hostedctl ./cmd/equipo-hosted-controller -run 'TestRoutes|TestInstanceKey|TestUnknownFields|TestResponsesSigned|TestConfig|TestDisabled|TestMetrics' -count=1`; `make build vet`; the Task 7 guard still passes.
+- [ ] **Mutation:** drop the creator check; `TestInstanceKeySeesOnlyItsJobs` fails.
+- [ ] **Commit:** `hosted controller: signed HTTPS API, command and metrics`.
+
+### Task 16: Instance-side client behind its flag
+
+**Files:** Create `internal/hostedclient/{client.go,client_test.go}`.
+
+**Interfaces:** `New(cfg Config) (*Client, error)`, `Config{BaseURL string; KeyID hostedwire.KeyID; Key ed25519.PrivateKey; ControllerKey ed25519.PublicKey; HTTP *http.Client}`; refuses without `EQUIPO_HOSTED_RUNNERS=1`; one method per instance route, each verifying the response against its own request nonce.
+
+- [ ] **Red:** `TestClientAgainstController` (real handler over `httptest` TLS, fake runner: launch, get, drain, quiescent, suspend, resume, stop with proof), `TestClientRefusesUnsignedResponse`, `TestClientRefusesWithoutFlag`, `TestInstanceDoesNotCallHostedClient` (`go list -deps ./cmd/equipo`; slice 2 deletes it).
+- [ ] **Green:** `go test ./internal/hostedclient -count=1`.
+- [ ] **Mutation:** skip response verification; `TestClientRefusesUnsignedResponse` fails.
+- [ ] **Commit:** `hostedclient: signed controller client behind a flag`.
+
+### Task 17: Live check in the dev account (HUMAN-gated)
+
+- [ ] **HUMAN:** a throwaway network in `kass` (`eu-west-1`): a VPC with DNS support off, a VM subnet with no default route, a security group with no rules, one connector, tagged `purpose=equipo-hosted-dev`. Record it in the progress file. A minimal image is registered by hand and its digest is added to the allowlist.
+- [ ] **Agent, with GO:** `AWS_PROFILE=kass go test -tags hostedlive ./internal/isolatedjob/awsjob -run TestLiveContract -count=1`, then `List` to confirm teardown.
+- [ ] **Agent, with GO:** run the controller on docs-t1 bound to `127.0.0.1`, with `kass` credentials and `EQUIPO_HOSTED_ENABLED=1`. Through `hostedclient`: launch a Small VM, drain, quiescent, suspend, resume (record epoch and timings) and stop with proof. Kill the controller between the provider call and transaction 2, restart, and see one VM.
+- [ ] **HUMAN GO, then agent:** plant an orphan with the AWS CLI and watch the reaper stop it after 10 minutes.
+- [ ] **HUMAN:** tear the network down. The agent confirms by type and tag, and records the dev spend.
+- [ ] One whole-branch review (Astra or Fable, as Paul directs); Paul lands it.
+
+**Slice 1a is done when** the contract suite passes against the fake and AWS, the simulation passes 5,000 seeds, the live check is recorded with nothing left running, and everything is off unless flagged.
+
+---
+
+## Slice 1b outline (planned after 1a lands)
+
+1b gets its own plan once 1a is merged. It ends where slice 2 can start (spec §8 lists slice 2's needs).
+
+**Components:**
+- egress policy with immutable per-launch snapshots;
+- the authenticated proxy:
+ - its bootstrap listener (server TLS only, three routes) and its egress listener (mTLS);
+ - the signed launch feed;
+ - CONNECT, SNI, Host and `:authority` inspection, and origin TLS;
+ - decision logs and revocation of open tunnels;
+- the resolver: plain DNS answers nothing; DNS over TLS answers per launch;
+- per-VM keys: redeem, challenge and exchange, and lapse stops;
+- the root init with its hooks, and the foundation probe standing in for the runner;
+- the end-to-end test over real TLS;
+- the image inventory and reproducible build;
+- the hosted admission check (forged-image hello);
+- certification:
+ - the trusted matrix with positive controls;
+ - the report route with provenance;
+ - the mutation-evidence registry and replay;
+ - online collection and offline signing;
+- OpenTofu for dev, release artifacts and CI wiring, and the dev bring-up drills.
+
+**Open findings from Astra rounds 1 and 2 that 1b must close:**
+- **Certificate verification inputs:** verify the canonical certification snapshot (purpose, version), not only its digest. Bind the allowed deployment names, and define the certification launch's target host for operator keys.
+- **TLS-stage refusal outcomes:** missing or expired client certificates, and refused ClientHellos, fail at the TLS layer. A cross-host redirect gives 502. Define outcomes and controls per stage, and test real TLS failures.
+- **Mutation evidence:** a guard counts only if its named test compiled, ran (at least one test executed) and failed with its assertion. Build errors, infrastructure errors and zero-test runs are rejected.
+- **Outage recovery and VM-key persistence:** keep the trusted renewal process and VM key alive while work stops, or terminate and replace the VM. Persist an explicit recovery-window deadline of one 2-minute window, not a reset lifetime.
+- **Resume hook:** the exchange issues credentials for 1a's prepared epoch, so the hook completes before the epoch commits (Task 12). Test the synchronous hook.
+- **Ordering:** define the release provenance and the `Upstream` and `DecisionLog` contracts before the tasks that consume them.
+- **Provider guard:** add `cmd/equipo-vm-init` and `cmd/equipo-hosted-image` as composition points.
+- **Certification evidence from round 1:** the trusted matrix decides expected outcomes, never the report. Include direct IPv4 and IPv6 bypass probes, root probes run before the privilege drop, and the forged-image hello test.
+- **Q3, controller outage versus a stale feed:** bounded continuation needs Paul's approval. Astra's conditions:
+ - access ends at the earliest of credential expiry, feed expiry or known revocation;
+ - feed freshness is measured on the monotonic clock;
+ - existing tunnels are closed at expiry;
+ - 15 minutes is a maximum stale window, not guaranteed continuation;
+ - a test covers a partitioned proxy while the controller stays up.
+- **Moved to slice 4:** the checkpoint boundary-injection and task or hash mismatch tests (§17), together with round 2's substitution finding (render only verified checkpoint contents). Slice 4 is where checkpoints are built.
+
+**1b decisions to carry:** OpenTofu lives in `infra/hosted/` here (Astra agrees); Paul or a named operator holds the certification key offline; collection and signing are separate; the image includes the pinned codex and every executable the suite runs; gateway and mirror use an explicit `none`, which needs Paul's approval, and setting either forces recertification; the upstream resolver for the proxies is pinned by address and TLS name, with no fallback; the controller's production durability is SQLite plus continuous replication to S3 before slice 2 production.
+
+## Before slice 2 production (HUMAN, deferred)
+
+- [ ] A profile `equipo-hosted` for `149757027610` via `titogo`, with MFA; the state bucket; the applied MicroVM quota in `eu-west-1` (spec §10); CloudTrail data events (spec §11); the production OpenTofu environment, deployment and certification there.
+
+## Open questions
+
+1. **MicroVM SDK.** *Recommendation:* the SDK package if one exists, otherwise SigV4 calls inside `awsjob`. Task 4 settles the facts first, as Astra asked.
+2. **Restart with unknown elapsed time.** When the wall clock went back across a restart and AWS gives no trusted age, Task 11 stops the job. *Recommendation:* accept this. It is rare, and the alternative is guessing a lifetime. Paul should know it can stop work after a clock fault.
+3. **Where the 1a controller runs for the live check.** *Recommendation:* on docs-t1, bound to `127.0.0.1`, using `kass` credentials, for Task 17 only. The controller host in the hosted account is a 1b decision.
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index ae6a4ee3..a01def4d 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -15853,12 +15853,5 @@
"match": "equipo-runner",
"count": 1,
"reason": "Hosted runners spec (design-hosted-runners): names the runner executable and the denied package registries; this line grants no runtime authority."
- },
- {
- "path": "docs/superpowers/plans/2026-11-19-hosted-runners-slice-1.md",
- "line_sha256": "666ae9f23ef549f2af4049e0af743e92bee864633639566af9a18a8503333af8",
- "match": "npm",
- "count": 1,
- "reason": "Hosted runners slice 1 plan (design-hosted-runners): names the denied package registries; this line grants no runtime authority."
}
]