oficina / equipo Public

hostedctl: randomised lifecycle simulation with seven invariants

TestLifecycleSimulation drives the real controller, store and fake
provider through launches, crashes, provider faults, pauses, resumes,
orphans, stops, wall-clock jumps and time advances, 200 seeds by default
(EQUIPO_SIM_SEEDS=n for more), and checks I1 to I7 of spec section 14
after every step and reaper pass. Each invariant's mutation fails within
the default seeds; 5,000 seeds pass. Test only; no production change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 62a26d463ba016ed83f0d300baa57c25461f0274 parent 60dd690
3 files changed, +1,561 −0
  • docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md +46 −0
  • internal/hostedctl/sim_model_test.go +629 −0
  • internal/hostedctl/sim_test.go +886 −0

CI passed — 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/hosted-runners-1a: Type  Size Avail | ext4   96G   85G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   85G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.6s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
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.5s
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.7s
ci-box: clone deepened in 3.4s
ci-box: file times set from content: 2885 files, 192 directories
ci-box: ready in 16.7s
=== 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.249s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  1.2s
+ go list -export -test -tags testbuild -f  ./...
  1.1s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  0.3s
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 1m21.822s 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.225s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m20.22s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 34.56, cpu waiting 21.82%, memory waiting 0.00%, io waiting 0.54%
--- 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 1m23.257s 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 1m21.627s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m21.63s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 34.56, cpu waiting 21.82%, memory waiting 0.00%, io waiting 0.54%
--- 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 1m25.902s 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 1m23.77s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m13.21s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.77s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.78s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 33.24, cpu waiting 20.80%, memory waiting 0.00%, io waiting 0.50%
--- 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 1m19.866s 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.214s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.13s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 20.82s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.6s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.67s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 35.92, cpu waiting 22.22%, memory waiting 0.00%, io waiting 0.55%
--- 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 1m37.916s 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 1m36.263s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m0.25s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.22s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 10.04s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.86s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.88s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 29.96, cpu waiting 17.33%, memory waiting 0.00%, io waiting 0.41%
--- 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 3m10.031s 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 3m7.991s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m45.19s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 24.32s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.6s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 8.19s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.36s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 8.54, cpu waiting 3.76%, memory waiting 0.00%, io waiting 0.08%
--- 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 1.076s 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 2m1.624s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 7.84s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.74s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.31s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
receipt: slow test 3.81s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.52s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
machine: 32 CPUs, load 6.93, cpu waiting 0.06%, memory waiting 0.00%, io waiting 2.10%
--- 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 1.079s 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 1m26.784s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.08s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.03s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.41s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.4s amadan.net/oficina/equipo/internal/thintest TestContractPreview
receipt: slow test 2.34s amadan.net/oficina/equipo/internal/thintest TestContractPublishNameTaken
machine: 32 CPUs, load 6.93, cpu waiting 1.11%, memory waiting 0.00%, io waiting 2.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
budget note: internal/runner/thin took 4m30.509s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m43.492s 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 4m30.509s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.98s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.93s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.83s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.48s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.79s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.46, cpu waiting 0.80%, memory waiting 0.00%, io waiting 0.01%
--- 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 46.979s 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 45.915s amadan.net/oficina/equipo/internal/runner
receipt: slow test 25.89s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 38.90, cpu waiting 21.08%, memory waiting 0.00%, io waiting 0.99%
--- 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 47.158s 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 45.364s amadan.net/oficina/equipo/internal/runner
receipt: slow test 35.39s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 30.36s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.41s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.54s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 38.90, cpu waiting 21.08%, memory waiting 0.00%, io waiting 0.99%
--- 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.555s 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.682s 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.11s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.12s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 27.54, cpu waiting 14.29%, memory waiting 0.00%, io waiting 1.21%
--- 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 28.1%, load 23.49
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 1m4.428s 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.347s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.4s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.29s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 24.36s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 21.94s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 21.73s amadan.net/oficina/equipo/internal/equipotest TestAuthorityReadsOneSnapshot
machine: 32 CPUs, load 31.69, cpu waiting 18.49%, memory waiting 0.00%, io waiting 0.44%
--- 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 28.1%, load 23.49
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 1.171s 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.399s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 19.2s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 19.12s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
receipt: slow test 19.11s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 19.11s amadan.net/oficina/equipo/internal/equipotest TestProjectRetryAndRevision
receipt: slow test 19.08s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
machine: 32 CPUs, load 27.54, cpu waiting 11.44%, memory waiting 0.00%, io waiting 1.29%
--- 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 28.1%, load 23.49
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 1m15.659s 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 1m3.663s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.72s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.6s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.58s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.52s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.47s amadan.net/oficina/equipo/internal/equipotest TestRosterProtectsLastOwner
machine: 32 CPUs, load 27.80, cpu waiting 15.20%, memory waiting 0.00%, io waiting 0.36%
--- 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 28.1%, load 23.49
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 364ms 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.231s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 24.45s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 23.28s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 23.2s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 21.61s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsUpgrade
receipt: slow test 21.57s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsRollbackAndUnavailable
machine: 32 CPUs, load 23.49, cpu waiting 11.44%, memory waiting 0.00%, io waiting 1.29%
--- 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 28.1%, load 23.49
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 545ms 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 48.756s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.61s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.41s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.5s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.47s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.21s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
machine: 32 CPUs, load 27.54, cpu waiting 11.44%, memory waiting 0.00%, io waiting 1.29%
--- 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 28.1%, load 23.49
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/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/hostedctl ./internal/hostedwire ./internal/idtest ./internal/isolatedjob ./internal/isolatedjob/awsjob ./internal/isolatedjob/guardfixture ./internal/isolatedjob/isolatedjobtest ./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/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/hostedctl ./internal/hostedwire ./internal/idtest ./internal/isolatedjob ./internal/isolatedjob/awsjob ./internal/isolatedjob/guardfixture ./internal/isolatedjob/isolatedjobtest ./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/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/isolatedjob: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: 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/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: 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 45.275s, 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 12.529s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/hostedctl took 12.639s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 39.84s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/release took 34.981s, 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 39.918s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m15.021s against a 60s target (the gate's other steps are not in this figure)
receipt: 13 packages ran, 52 cached, 20 without tests, 0 failed
receipt: slow package 53.301s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.59s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 45.275s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 39.918s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 39.84s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 22.74s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 14.4s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 11.27s amadan.net/oficina/equipo/internal/hostedctl TestLifecycleSimulation
receipt: slow test 10.89s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 10.82s amadan.net/oficina/equipo/internal/equipo TestAgentReadRechecksIdentity
machine: 32 CPUs, load 11.84, cpu waiting 5.61%, memory waiting 0.00%, io waiting 0.12%
--- 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 1m22.85s 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 1m21.371s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.34s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 15.2s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.58s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.71s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.89s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 34.56, cpu waiting 21.37%, memory waiting 0.00%, io waiting 0.52%
--- 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 1m33.563s 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 1m31.982s amadan.net/oficina/equipo/internal/headless
receipt: slow test 26.62s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 23.25s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 14.2s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 10.24s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.89s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 31.69, cpu waiting 18.49%, memory waiting 0.00%, io waiting 0.44%
--- 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 1m41.085s 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 1m39.455s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.4s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.06s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 13.05s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 10.27s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.21s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 27.80, cpu waiting 16.25%, memory waiting 0.00%, io waiting 0.38%
--- 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
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN   TestBrowserCopyContinue
time=2026-11-22T19:29:54.973Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-22T19:29:54.973Z level=INFO msg="startup phase done" phase=state_lock took=68µs
time=2026-11-22T19:29:54.973Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-22T19:29:54.973Z level=INFO msg="startup phase done" phase=claim_roots took=79µs
time=2026-11-22T19:29:54.973Z level=INFO msg="startup phase" phase=sweep
time=2026-11-22T19:29:55.006Z level=INFO msg="startup phase done" phase=sweep took=33.109ms
time=2026-11-22T19:29:55.006Z level=INFO msg="startup phase" phase=credentials
time=2026-11-22T19:29:55.006Z level=INFO msg="startup phase done" phase=credentials took=98µs
time=2026-11-22T19:29:55.006Z level=INFO msg="startup phase" phase=open_state
time=2026-11-22T19:29:55.050Z level=INFO msg="startup phase done" phase=open_state took=43.987ms
time=2026-11-22T19:29:55.051Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-22T19:29:55.053Z level=INFO msg=connecting host=127.0.0.1:44875 protocol=28
time=2026-11-22T19:29:55.055Z level=INFO msg=connected host=127.0.0.1:44875 took=1.043ms
time=2026-11-22T19:29:55.055Z level=INFO msg="capabilities gathering"
time=2026-11-22T19:29:55.055Z level=INFO msg="capabilities gathered" took=586µs tags=linux,claude,go
time=2026-11-22T19:29:55.059Z level=INFO msg="hello sent" protocol=28
time=2026-11-22T19:29:55.061Z level=INFO msg=welcome protocol=28 role=primary generation=1
    browser_copy_test.go:93: continue did not reach Checks: 0 <nil>
--- FAIL: TestBrowserCopyContinue (1.79s)

--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-22T19:30:26.344Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-22T19:30:26.344Z level=INFO msg="startup phase done" phase=state_lock took=66µs
time=2026-11-22T19:30:26.344Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-22T19:30:26.344Z level=INFO msg="startup phase done" phase=claim_roots took=87µs
time=2026-11-22T19:30:26.344Z level=INFO msg="startup phase" phase=sweep
time=2026-11-22T19:30:26.375Z level=INFO msg="startup phase done" phase=sweep took=30.594ms
time=2026-11-22T19:30:26.375Z level=INFO msg="startup phase" phase=credentials
time=2026-11-22T19:30:26.375Z level=INFO msg="startup phase done" phase=credentials took=104µs
time=2026-11-22T19:30:26.375Z level=INFO msg="startup phase" phase=open_state
time=2026-11-22T19:30:26.418Z level=INFO msg="startup phase done" phase=open_state took=42.501ms
time=2026-11-22T19:30:26.418Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-22T19:30:26.419Z level=INFO msg=connecting host=127.0.0.1:37451 protocol=28
time=2026-11-22T19:30:26.420Z level=INFO msg=connected host=127.0.0.1:37451 took=1.126ms
time=2026-11-22T19:30:26.420Z level=INFO msg="capabilities gathering"
time=2026-11-22T19:30:26.421Z level=INFO msg="capabilities gathered" took=411µs tags=linux,claude,go
time=2026-11-22T19:30:26.421Z level=INFO msg="hello sent" protocol=28
time=2026-11-22T19:30:26.425Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-22T19:30:27.452Z 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: <nil>)
--- FAIL: TestBrowserEmptyExplore (5.82s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m27.452s
FAIL	amadan.net/oficina/equipo/internal/headless	87.746s


receipt: test step 1m28.837s 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 1m27.452s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.25s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 11.33s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.43s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 10.4s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 8.2s 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 62a26d463ba016ed83f0d300baa57c25461f0274 1.79s 33.24
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
##############################################################################
FLAKE ./internal/headless:TestBrowserEmptyExplore browser-headless-rest 62a26d463ba016ed83f0d300baa57c25461f0274 5.82s 33.24
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 27.80, cpu waiting 16.25%, memory waiting 0.00%, io waiting 0.38%
--- 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/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation)$' ./internal/equipo

receipt: test step 1.019s 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 573ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 570ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
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 812ms 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.673s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 1.67s 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 296ms 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.856s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 1.86s 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|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|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|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest

receipt: test step 1.145s 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 3m20.199s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 17.52s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.35s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.02s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.55s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 7.93s amadan.net/oficina/equipo/internal/thintest TestBrowserInnerScreens
machine: 32 CPUs, load 6.93, cpu waiting 1.72%, memory waiting 0.00%, io waiting 2.00%
--- 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   (53s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.33s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.30s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.71s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.90s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.64s
+ 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   (81s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 21.64s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 14.55s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 20.41s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 22.43s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (22s)
ok ./internal/headless TestMixedVersions 20.28s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (1s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.76s
+ 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 34.56, cpu waiting 21.82%, memory waiting 0.00%, io waiting 0.54%
--- 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.332s 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.266s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 208ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 95ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 3ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow test 5.14s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.75s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 210ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 90ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
CGO_ENABLED=0 EQUIPO_REQUIRE_USER_SESSION=1 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.206s 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.891s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 260ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 200ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceExitStatus
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryMalformedRecord
machine: 32 CPUs, load 16.05, cpu waiting 4.89%, memory waiting 0.00%, io waiting 1.75%
--- 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 28.1%, load 23.49
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2598 text files, 2854 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: 94 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipo	2.512s
machine: 32 CPUs, load 37.15, cpu waiting 20.38%, memory waiting 0.00%, io waiting 1.02%
--- 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 28.1%, load 23.49
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 27.54, cpu waiting 12.54%, memory waiting 0.00%, io waiting 1.25%
--- 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 28.1%, load 23.49
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 34.38, cpu waiting 17.17%, memory waiting 0.00%, io waiting 1.13%
--- 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 28.1%, load 23.49
shard 28: make gitleaks
7:29PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
7:29PM INF 1128 commits scanned.
7:29PM INF scanned ~61961223 bytes (61.96 MB) in 13.8s
7:29PM INF no leaks found
machine: 32 CPUs, load 37.15, cpu waiting 20.38%, memory waiting 0.00%, io waiting 1.02%
=== perf ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -require TestPerfScreens,TestPerfBoot -tags perf -count=1 -p 1 -parallel 1 -run '^TestPerf' ./...
perf: GET /: median 1.056ms, worst 1.087ms, budget 150ms
perf: GET /api/runner/protocol: median 86µs, worst 107µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 588µs, worst 633µs, budget 150ms
perf: GET /api/v1/accounts: median 407µs, worst 441µs, budget 150ms
perf: GET /api/v1/auth/devices: median 464µs, worst 485µs, budget 150ms
perf: GET /api/v1/budgets: median 477µs, worst 518µs, budget 150ms
perf: GET /api/v1/capabilities: median 258µs, worst 303µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.196ms, worst 1.256ms, budget 150ms
perf: GET /api/v1/connections: median 621µs, worst 686µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 582µs, worst 624µs, budget 150ms
perf: GET /api/v1/conversation: median 978µs, worst 1.005ms, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.581ms, worst 1.7ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.977ms, worst 2.055ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 472µs, worst 503µs, budget 150ms
perf: GET /api/v1/journey: median 7.912ms, worst 8.064ms, budget 150ms
perf: GET /api/v1/me: median 461µs, worst 489µs, budget 150ms
perf: GET /api/v1/me/settings: median 527µs, worst 610µs, budget 150ms
perf: GET /api/v1/needs-you: median 7.713ms, worst 7.959ms, budget 150ms
perf: GET /api/v1/notifications: median 1.822ms, worst 4.425ms, budget 150ms
perf: GET /api/v1/onboarding: median 392µs, worst 442µs, budget 150ms
perf: GET /api/v1/people: median 434µs, worst 470µs, budget 150ms
perf: GET /api/v1/playbooks: median 587µs, worst 620µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 534µs, worst 600µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 858µs, worst 1.01ms, budget 150ms
perf: GET /api/v1/preferences: median 782µs, worst 889µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 437µs, worst 441µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 566µs, worst 647µs, budget 150ms
perf: GET /api/v1/roster: median 450µs, worst 471µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 424µs, worst 480µs, budget 150ms
perf: GET /api/v1/specialists: median 7.977ms, worst 8.088ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.876ms, worst 7.952ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 796µs, worst 871µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.066ms, worst 1.138ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 694µs, worst 754µs, budget 150ms
perf: GET /api/v1/teams: median 404µs, worst 456µs, budget 150ms
perf: GET /api/v1/templates: median 582µs, worst 601µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 435µs, worst 456µs, budget 150ms
perf: GET /auth/callback: median 72µs, worst 99µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.173ms, worst 3.221ms, budget 150ms
perf: GET /auth/verify: median 81µs, worst 116µs, budget 150ms
perf: GET /connections: median 3.478ms, worst 3.565ms, budget 150ms
perf: GET /conversation: median 7.205ms, worst 7.503ms, budget 150ms
perf: GET /conversation/connections: median 241µs, worst 272µs, budget 150ms
perf: GET /conversation/notebook: median 250µs, worst 272µs, budget 150ms
perf: GET /conversation/settings: median 3.962ms, worst 4.016ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.51ms, worst 3.628ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.455ms, worst 9.197ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.564ms, worst 6.737ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.591ms, worst 3.657ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 4.018ms, worst 4.156ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.321ms, worst 4.401ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.565ms, worst 4.749ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.412ms, worst 3.465ms, budget 150ms
perf: GET /conversation/settings/thinking: median 4.023ms, worst 4.107ms, budget 150ms
perf: GET /housekeeping: median 3.918ms, worst 4.069ms, budget 150ms
perf: GET /invites/new: median 621µs, worst 645µs, budget 150ms
perf: GET /invites/{id}: median 671µs, worst 707µs, budget 150ms
perf: GET /jobs: median 3.386ms, worst 4.933ms, budget 150ms
perf: GET /jobs/{id}: median 4.487ms, worst 4.601ms, budget 150ms
perf: GET /journey: median 12.289ms, worst 12.469ms, budget 150ms
perf: GET /nav/rail: median 3.124ms, worst 3.206ms, budget 150ms
perf: GET /needs-you: median 11.992ms, worst 12.228ms, budget 150ms
perf: GET /onboarding: median 4.135ms, worst 4.315ms, budget 150ms
perf: GET /people: median 3.503ms, worst 3.545ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.976ms, worst 5.09ms, budget 150ms
perf: GET /playbooks: median 4.719ms, worst 7.163ms, budget 150ms
perf: GET /playbooks/new: median 5.047ms, worst 5.29ms, budget 150ms
perf: GET /playbooks/{id}: median 4.605ms, worst 4.742ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.577ms, worst 4.685ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 3.759ms, worst 4.054ms, budget 150ms
perf: GET /preferences: median 4.362ms, worst 4.466ms, budget 150ms
perf: GET /preferences/sources/{source}: median 4.028ms, worst 4.13ms, budget 150ms
perf: GET /projects: median 5.209ms, worst 5.366ms, budget 150ms
perf: GET /projects/accounts: median 3.566ms, worst 3.655ms, budget 150ms
perf: GET /projects/new: median 3.596ms, worst 3.662ms, budget 150ms
perf: GET /projects/{id}: median 10.663ms, worst 13.307ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.77ms, worst 3.879ms, budget 150ms
perf: GET /runners/enrol: median 4.354ms, worst 4.473ms, budget 150ms
perf: GET /settings: median 3.304ms, worst 3.381ms, budget 150ms
perf: GET /settings/coordinator: median 5.174ms, worst 5.391ms, budget 150ms
perf: GET /settings/devices: median 3.084ms, worst 3.212ms, budget 150ms
perf: GET /settings/recovery: median 3.273ms, worst 3.353ms, budget 150ms
perf: GET /settings/recovery/release: median 3.29ms, worst 3.387ms, budget 150ms
perf: GET /settings/thinking: median 249µs, worst 289µs, budget 150ms
perf: GET /signin: median 312µs, worst 350µs, budget 150ms
perf: GET /specialists/new: median 3.277ms, worst 3.327ms, budget 150ms
perf: GET /specialists/{key}: median 10.648ms, worst 10.846ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.749ms, worst 5.935ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 3.869ms, worst 4.06ms, budget 150ms
perf: GET /tasks: median 5.334ms, worst 5.486ms, budget 150ms
perf: GET /tasks/new: median 3.337ms, worst 3.486ms, budget 150ms
perf: GET /tasks/{id}: median 5.604ms, worst 5.905ms, budget 150ms
perf: GET /tasks/{id}/merge: median 4.841ms, worst 4.912ms, budget 150ms
perf: GET /tasks/{id}/move: median 4.802ms, worst 4.951ms, budget 150ms
perf: GET /tasks/{id}/plan: median 6.008ms, worst 6.101ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.559ms, worst 1.588ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 5.269ms, worst 5.452ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 5.031ms, worst 7.131ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.46ms, worst 4.682ms, budget 150ms
perf: GET /tasks/{id}/thread: median 8.093ms, worst 8.48ms, budget 150ms
perf: GET /team/{specialist}: median 4.292ms, worst 4.561ms, budget 150ms
perf: GET /teams: median 9.978ms, worst 10.153ms, budget 150ms
perf: GET /templates: median 3.388ms, worst 3.481ms, budget 150ms
perf: GET /usage: median 4.186ms, worst 4.244ms, budget 150ms
perf: GET /work: median 3.02ms, worst 3.271ms, budget 150ms
perf: cold boot: median 263ms of [262.509612ms 262.83784ms 264.322556ms], budget 500ms

receipt: test step 31.919s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 90 without tests, 0 failed
receipt: slow package 8.927s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-runner
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-tool-proxy
receipt: slow package 0s amadan.net/oficina/equipo/internal/advice
receipt: slow package 0s amadan.net/oficina/equipo/internal/attach
receipt: slow test 8.09s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 840ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 3.96 GiB in 24203 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 0.90 GiB in 32632 files
diff --git a/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
index 2f3288cb..3d9d762d 100644
--- a/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
+++ b/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
@@ -627,3 +627,49 @@ subtest with no change launches once.
| --- | --- | --- | --- |
| G1 ownership lock taken after the checks again (before `markDispatch`) | `^TestReapWaitingDispatchChecksGatesAfter$` | subtests stop time passes, audit goes stale, audit fails: `reaper_test.go:1070: provider launches after the wait = 1, want 0` | yes, passes |
| R2 (re-run) R23 write lock dropped | `^TestReapOwnershipLockHoldsClaims$` | `reaper_test.go:828: VM vm-0002 was stopped as an orphan while a job held it` | yes, passes |
+
+## Task 14
+
+`internal/hostedctl/sim_test.go` (the driver: seeds, steps, time) and `sim_model_test.go` (the
+provider wrapper, the snapshot and the invariants). `TestLifecycleSimulation` drives the real
+controller over the real store and `isolatedjob.Fake` (backstop off) on `isolatedjobtest.FakeClock`,
+through public methods and `Reap`. 200 seeds by default on up to 8 workers, 40 steps a seed;
+`EQUIPO_SIM_SEEDS=n` runs seeds 1 to n and `EQUIPO_SIM_SEED=s` replays one. A failure prints the
+seed, the step, the violations and the last 400 lines of the step log. I1 to I7 are checked after
+every step and every reaper pass; I3, I5, I6 (replacement launch) and I7 (prepared before the call)
+also at the provider call itself. No production change.
+
+Two test-only speed measures, without which 200 seeds took 23 s: each seed copies one store migrated
+once per run (its clock row removed, so Open still starts fresh), and the test turns off SQLite disk
+syncs on the store's pinned connection after each Open (`PRAGMA synchronous = OFF`; a crash here is
+Close and Open, never a power cut).
+
+- RED: each mutation below, applied alone, fails within the default 200 seeds with the invariant
+ named; the unmutated run passes. Mutations were edits to the tree, each restored with
+ `git checkout -- <file>`; `git diff -- '*.go' ':!internal/hostedctl/sim*_test.go'` is empty.
+- GREEN: `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1` ok 2.49 to 3.05 s over
+ six runs at load average 4 to 8; `EQUIPO_SIM_SEEDS=5000` ok 69.6 s; whole package ok 6.1 to
+ 7.3 s; 40 seeds under `-race` ok; vet, gofmt, staticcheck v0.7.0, `make budget`, dead-reference
+ scan 0 failures. Test lines in the directory 6,756 of 8,000.
+- I5's `>=` alone (only `currentGen`) is held by a second guard: Suspend's and Quiescent's UPDATEs
+ still filter on the named generation, so the call errors with 0 rows and no provider Suspend is
+ sent (0 of 200 seeds fail, as no invariant breaks). The I5 row applies `>=` with the UPDATEs keyed
+ on the stored generation. Under I1, 3 of 154 failing seeds first report I2 (the replayed VM's
+ reply was lost too, so it is neither saved nor any intent's); 151 report I1.
+
+Command for every row: `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1`. Seeds
+failing of 200 in brackets.
+
+| Mutation | Observed failure (first seed) | Restored |
+| --- | --- | --- |
+| I1 Replay with a fresh client token (`spec.AttemptID += "-r"` on replay) | `sim_test.go:82: seed 1 failed at step 15: I1: attempt a2 has 2 live VMs: [vm-0003 vm-0004]` (151) | yes, passes |
+| I2 save the intent after the provider call (Launch calls the provider before `saveIntent`) | `seed 1 failed at step 38: I2: VM vm-0006 (attempt a4, starting) is no saved Ref, matches no stored intent and was not planted` (171) | yes, passes |
+| I3a stop orphans on first sight (`graceOver` true) | `seed 1 failed at step 2: I3: orphan stop of vm-0001 at 9s, first seen at 9s: grace not over` (106) | yes, passes |
+| I3b drop the recheck (stop every expired orphan, no replay, List or R22 check) | `seed 77 failed at step 26: I3: orphan stop of vm-0001, the VM of waiting intent a1` (7) | yes, passes |
+| I4a reap at `deadline_t` | `seed 1 failed at step 18: I4: VM vm-0003 of a2 is running at 8m19s, its stop time 6m47s (allowed until 7m47s)` (139) | yes, passes |
+| I4b wall time in `reapJob` (base plus wall time since Open) | `seed 1 failed at step 18: I4: VM vm-0003 of a2 is running at 8m19s, its stop time 6m47s (allowed until 7m47s)` (25; the wall was net 10 min back) | yes, passes |
+| I4c skip deadline stops on an incomplete List | `seed 3 failed at step 14: I4: VM vm-0003 of a3 is running at 5m34s, its stop time 3m34s (allowed until 4m34s)` (22) | yes, passes |
+| I5 accept `>=` generations (`currentGen`, UPDATEs on the stored generation) | `seed 17 failed at step 7: I5: provider suspend of vm-0001 (a1) for generation 2; the model's pause is &{gen:1 ... acked:true}` (11) | yes, passes |
+| I6 treat `unknown` as terminal (refreshOne) | `seed 4 failed at step 5: I6: a1 holds proof from state "unknown"` (85) | yes, passes |
+| I7a raise the epoch before preparing (prepare UPDATE sets `epoch = epoch + 1`) | `seed 5 failed at step 21: I7: provider resume of vm-0001 for operation op-1 prepared at epoch 1 while the job's epoch is 1` (13) | yes, passes |
+| I7b commit on a lost reply (driveResume commits on `ErrLostReply`) | `seed 25 failed at step 21: I7: a2 operation op-1 committed with no running read of vm-0002 after its last resume call` (6) | yes, passes |
diff --git a/internal/hostedctl/sim_model_test.go b/internal/hostedctl/sim_model_test.go
new file mode 100644
index 00000000..ef39e75d
--- /dev/null
+++ b/internal/hostedctl/sim_model_test.go
@@ -0,0 +1,629 @@
+package hostedctl
+
+import (
+ "context"
+ "database/sql"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "maps"
+ "slices"
+ "strings"
+ "sync"
+
+ "amadan.net/oficina/equipo/internal/hostedwire"
+ "amadan.net/oficina/equipo/internal/isolatedjob"
+)
+
+// This file holds what the lifecycle simulation (sim_test.go) checks: the
+// provider wrapper that sees every call the controller makes, the snapshot
+// of the store and the fake, and the seven invariants of spec §14.
+
+// simVM is what the simulation knows about one VM the fake holds.
+type simVM struct {
+ attempt string // the spec's attempt ID (the client token), or the planted name
+ launchID string // from the bootstrap; empty for a planted VM
+ planted bool
+ created T // model controller time when the VM appeared
+}
+
+// simGen names the Suspend call the simulation is making: its attempt and
+// the generation it asked for.
+type simGen struct {
+ attempt string
+ gen int64
+}
+
+// simRunner wraps the fake provider. It queues the simulation's faults and
+// hands each one to the fake (Inject) just before the call it is meant for,
+// so the fake's own queue is empty between calls and the checks can read the
+// fake directly. It records every VM the fake creates, whatever the reply
+// said, and checks the call-time invariants (I3, I5, I6, I7) against the
+// store as the call is made; no transaction is open across a provider call,
+// so the store can be read here.
+type simRunner struct {
+ fake *isolatedjob.Fake
+ w *simWorld
+
+ mu sync.Mutex
+ pending map[isolatedjob.Op][]isolatedjob.Fault
+ incomplete int // reaper passes left whose List calls all come back incomplete
+ listBad bool // the pass running now is one of them
+ vms map[isolatedjob.Ref]*simVM
+ throttled map[isolatedjob.Ref]int // Stop calls the fake throttled, per VM
+ sawRunning map[isolatedjob.Ref]bool // a Get read running since the last Resume call
+ suspendOp *simGen
+ bad []string // call-time violations, reported by the next check
+}
+
+func newSimRunner(fake *isolatedjob.Fake, w *simWorld) *simRunner {
+ return &simRunner{fake: fake, w: w, pending: map[isolatedjob.Op][]isolatedjob.Fault{},
+ vms: map[isolatedjob.Ref]*simVM{}, throttled: map[isolatedjob.Ref]int{}, sawRunning: map[isolatedjob.Ref]bool{}}
+}
+
+func (r *simRunner) queue(op isolatedjob.Op, f isolatedjob.Fault) {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.pending[op] = append(r.pending[op], f)
+}
+
+// inject hands the fault for this call of op to the fake. The caller holds
+// r.mu.
+func (r *simRunner) inject(op isolatedjob.Op) isolatedjob.Fault {
+ var f isolatedjob.Fault
+ if q := r.pending[op]; len(q) > 0 {
+ f, r.pending[op] = q[0], q[1:]
+ }
+ if op == isolatedjob.OpList && r.listBad {
+ f = isolatedjob.FaultIncompleteList
+ }
+ if f != "" {
+ r.fake.Inject(op, f)
+ }
+ return f
+}
+
+func (r *simRunner) violate(format string, args ...any) {
+ r.bad = append(r.bad, fmt.Sprintf(format, args...))
+}
+
+// visibleLocked returns the Refs the fake shows now.
+func (r *simRunner) visibleLocked() map[isolatedjob.Ref]bool {
+ vms, _ := r.fake.List(context.Background())
+ out := make(map[isolatedjob.Ref]bool, len(vms))
+ for _, vm := range vms {
+ out[vm.Ref] = true
+ }
+ return out
+}
+
+func (r *simRunner) Launch(ctx context.Context, s isolatedjob.LaunchSpec) (isolatedjob.Ref, error) {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.checkReplacementLocked(s)
+ before := r.visibleLocked()
+ var f isolatedjob.Fault
+ if s.Validate(r.fake.Limits()) == nil { // a spec the fake refuses uses up no fault
+ f = r.inject(isolatedjob.OpLaunch)
+ }
+ ref, err := r.fake.Launch(ctx, s)
+ for now := range r.visibleLocked() {
+ if !before[now] {
+ r.vms[now] = &simVM{attempt: s.AttemptID, launchID: bootLaunchID(s.Bootstrap), created: r.w.now()}
+ }
+ }
+ r.w.logf(" provider launch %s%s -> %s %s", s.AttemptID, faultNote(f), ref, errText(err))
+ return ref, err
+}
+
+func (r *simRunner) Get(ctx context.Context, ref isolatedjob.Ref) (isolatedjob.Job, error) {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ f := r.inject(isolatedjob.OpGet)
+ j, err := r.fake.Get(ctx, ref)
+ if err == nil && j.State == isolatedjob.StateRunning {
+ r.sawRunning[ref] = true
+ }
+ if f != "" || err != nil {
+ r.w.logf(" provider get %s%s -> %s %s", ref, faultNote(f), j.State, errText(err))
+ }
+ return j, err
+}
+
+func (r *simRunner) Suspend(ctx context.Context, ref isolatedjob.Ref) error {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.checkSuspendLocked(ref)
+ f := r.inject(isolatedjob.OpSuspend)
+ err := r.fake.Suspend(ctx, ref)
+ r.w.logf(" provider suspend %s%s -> %s", ref, faultNote(f), errText(err))
+ return err
+}
+
+func (r *simRunner) Resume(ctx context.Context, ref isolatedjob.Ref) error {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.checkResumeLocked(ref)
+ r.sawRunning[ref] = false
+ f := r.inject(isolatedjob.OpResume)
+ err := r.fake.Resume(ctx, ref)
+ r.w.logf(" provider resume %s%s -> %s", ref, faultNote(f), errText(err))
+ return err
+}
+
+func (r *simRunner) Stop(ctx context.Context, ref isolatedjob.Ref, reason string) error {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ if reason == reasonOrphan {
+ r.checkOrphanStopLocked(ref)
+ }
+ f := r.inject(isolatedjob.OpStop)
+ err := r.fake.Stop(ctx, ref, reason)
+ if errors.Is(err, isolatedjob.ErrThrottled) {
+ r.throttled[ref]++
+ }
+ r.w.logf(" provider stop %s (%s)%s -> %s", ref, reason, faultNote(f), errText(err))
+ return err
+}
+
+func (r *simRunner) List(ctx context.Context) ([]isolatedjob.Job, error) {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ f := r.inject(isolatedjob.OpList)
+ vms, err := r.fake.List(ctx)
+ if f != "" {
+ r.w.logf(" provider list%s -> %d VMs %s", faultNote(f), len(vms), errText(err))
+ }
+ return vms, err
+}
+
+func (r *simRunner) Limits() isolatedjob.Limits { return r.fake.Limits() }
+
+// plant adds an orphan VM no Launch asked for.
+func (r *simRunner) plant(name string) isolatedjob.Ref {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ ref := r.fake.Plant(isolatedjob.LaunchSpec{AttemptID: name})
+ r.vms[ref] = &simVM{attempt: name, planted: true, created: r.w.now()}
+ return ref
+}
+
+// beginPass applies the next incomplete-List window, if any, to the pass
+// about to run.
+func (r *simRunner) beginPass() {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.listBad = r.incomplete > 0
+ if r.listBad {
+ r.incomplete--
+ }
+}
+
+func (r *simRunner) endPass() {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ r.listBad = false
+}
+
+// ownerLocked is the attempt a VM belongs to: the job whose launch ID its
+// bootstrap carries, or else the attempt ID it was launched (or planted)
+// under. The caller holds r.mu.
+func (r *simRunner) ownerLocked(s *simSnap, ref isolatedjob.Ref) string {
+ v := r.vms[ref]
+ if v == nil {
+ return ""
+ }
+ if j := s.byLaunch[v.launchID]; v.launchID != "" && j != nil {
+ return j.attempt
+ }
+ return v.attempt
+}
+
+func bootLaunchID(b []byte) string {
+ var boot hostedwire.Bootstrap
+ if json.Unmarshal(b, &boot) != nil {
+ return ""
+ }
+ return boot.LaunchID
+}
+
+// simJob is one jobs row as the checks read it.
+type simJob struct {
+ attempt, launchID, state, replaces string
+ ref isolatedjob.Ref // empty when none is saved
+ stopT, drainT T
+ epoch, gen int64
+ stopRequested bool
+ proof string // stop_proof_json; empty when none
+}
+
+// simResumeOp is one resume_ops row.
+type simResumeOp struct {
+ attempt, id, status string
+ prepared int64
+ result sql.NullInt64
+}
+
+// simSnap is the store and the fake at one moment.
+type simSnap struct {
+ jobs map[string]*simJob
+ order []string // attempt IDs, sorted
+ byRef map[isolatedjob.Ref]*simJob
+ byLaunch map[string]*simJob
+ ops []simResumeOp
+ unmatched map[isolatedjob.Ref]T
+ vms []isolatedjob.Job // every VM the fake shows, read directly
+ vm map[isolatedjob.Ref]isolatedjob.Job
+}
+
+// errSimRead rolls back the simulation's read transaction, so reading
+// writes no checkpoint and costs no disk sync.
+var errSimRead = errors.New("simulation read only")
+
+// read takes a snapshot: the jobs, resume operations and unmatched VMs in
+// one rolled-back transaction, then the fake's VMs.
+func (w *simWorld) read() (*simSnap, error) {
+ s := &simSnap{jobs: map[string]*simJob{}, byRef: map[isolatedjob.Ref]*simJob{}, byLaunch: map[string]*simJob{},
+ unmatched: map[isolatedjob.Ref]T{}, vm: map[isolatedjob.Ref]isolatedjob.Job{}}
+ err := w.store.Tx(w.ctx, func(tx *sql.Tx) error {
+ rows, err := tx.QueryContext(w.ctx, `SELECT attempt_id, launch_id, state, coalesce(replaces_attempt, ''),
+ coalesce(vm_ref, ''), stop_t, drain_t, epoch, pause_generation, stop_requested_t IS NOT NULL,
+ coalesce(stop_proof_json, '') FROM jobs ORDER BY attempt_id`)
+ if err != nil {
+ return err
+ }
+ for rows.Next() {
+ j := &simJob{}
+ if err := rows.Scan(&j.attempt, &j.launchID, &j.state, &j.replaces, &j.ref, &j.stopT, &j.drainT,
+ &j.epoch, &j.gen, &j.stopRequested, &j.proof); err != nil {
+ _ = rows.Close()
+ return err
+ }
+ s.jobs[j.attempt], s.byLaunch[j.launchID] = j, j
+ s.order = append(s.order, j.attempt)
+ if j.ref != "" {
+ s.byRef[j.ref] = j
+ }
+ }
+ if err := errors.Join(rows.Err(), rows.Close()); err != nil {
+ return err
+ }
+ rows, err = tx.QueryContext(w.ctx, `SELECT attempt_id, operation_id, status, prepared_epoch, result_epoch
+ FROM resume_ops ORDER BY attempt_id, operation_id`)
+ if err != nil {
+ return err
+ }
+ for rows.Next() {
+ var o simResumeOp
+ if err := rows.Scan(&o.attempt, &o.id, &o.status, &o.prepared, &o.result); err != nil {
+ _ = rows.Close()
+ return err
+ }
+ s.ops = append(s.ops, o)
+ }
+ if err := errors.Join(rows.Err(), rows.Close()); err != nil {
+ return err
+ }
+ um, err := unmatchedVMs(w.ctx, tx)
+ s.unmatched = um
+ if err != nil {
+ return err
+ }
+ return errSimRead
+ })
+ if !errors.Is(err, errSimRead) {
+ return nil, fmt.Errorf("read the store: %w", err)
+ }
+ if s.vms, err = w.fake.List(context.Background()); err != nil {
+ return nil, fmt.Errorf("read the fake: %w", err)
+ }
+ for _, vm := range s.vms {
+ s.vm[vm.Ref] = vm
+ }
+ return s, nil
+}
+
+// quiet reports whether no reaper pass can change anything: no VM that is
+// not terminal, no intent, orphan, open stop, pause or pending resume.
+func (s *simSnap) quiet() bool {
+ for _, vm := range s.vms {
+ if !vm.State.Terminal() {
+ return false
+ }
+ }
+ if len(s.unmatched) > 0 {
+ return false
+ }
+ for _, j := range s.jobs {
+ if j.state == JobWaiting || (j.proof == "" && (j.ref != "" || j.stopRequested)) || pauseState(j.state) {
+ return false
+ }
+ }
+ for _, o := range s.ops {
+ if o.status == opPending {
+ return false
+ }
+ }
+ return true
+}
+
+// nextEvent is the earliest recorded drain or stop time after now.
+func (s *simSnap) nextEvent(now T) (T, bool) {
+ var next T
+ found := false
+ for _, j := range s.jobs {
+ for _, at := range []T{j.drainT, j.stopT} {
+ if at > now && (!found || at < next) {
+ next, found = at, true
+ }
+ }
+ }
+ return next, found
+}
+
+// liveOwnedLocked lists the live VMs that belong to attempt. The caller
+// holds r.mu.
+func (r *simRunner) liveOwnedLocked(s *simSnap, attempt string) []string {
+ var out []string
+ for _, vm := range s.vms {
+ if vm.State.Live() && r.ownerLocked(s, vm.Ref) == attempt {
+ out = append(out, fmt.Sprintf("%s %s", vm.Ref, vm.State))
+ }
+ }
+ return out
+}
+
+// checkOrphanStopLocked is I3, as the orphan stop is sent: the VM is no
+// job's saved Ref and no waiting intent's VM, was recorded unmatched, and
+// has had OrphanGrace of controller time since (by the store's record and
+// by the simulation's own record of when the VM appeared), unless it was
+// recorded before this process opened the store after a restart.
+func (r *simRunner) checkOrphanStopLocked(ref isolatedjob.Ref) {
+ s, err := r.w.read()
+ if err != nil {
+ r.violate("I3: %v", err)
+ return
+ }
+ now := r.w.now()
+ if j := s.byRef[ref]; j != nil {
+ r.violate("I3: orphan stop of %s, the saved Ref of %s", ref, j.attempt)
+ }
+ if j := s.jobs[r.ownerLocked(s, ref)]; j != nil && j.state == JobWaiting {
+ r.violate("I3: orphan stop of %s, the VM of waiting intent %s", ref, j.attempt)
+ }
+ first, ok := s.unmatched[ref]
+ early := r.w.store.Restarted() && first < r.w.store.OpenedAt()
+ switch {
+ case !ok:
+ r.violate("I3: orphan stop of %s, which unmatched_vms does not hold", ref)
+ case now-first < T(OrphanGrace) && !early:
+ r.violate("I3: orphan stop of %s at %v, first seen at %v: grace not over", ref, simDur(now), simDur(first))
+ }
+ if v := r.vms[ref]; v != nil && now-v.created < T(OrphanGrace) && !(r.w.restarted && v.created < r.w.openedAt) {
+ r.violate("I3: orphan stop of %s at %v; the VM appeared at %v", ref, simDur(now), simDur(v.created))
+ }
+}
+
+// checkSuspendLocked is I5, as the provider Suspend is sent: the model
+// holds an in-time acknowledgement for the job's current generation, its
+// pause still open. The generation is the one the simulation's Suspend call
+// named, or the stored one for a suspend Refresh sends again.
+func (r *simRunner) checkSuspendLocked(ref isolatedjob.Ref) {
+ s, err := r.w.read()
+ if err != nil {
+ r.violate("I5: %v", err)
+ return
+ }
+ j := s.byRef[ref]
+ if j == nil {
+ r.violate("I5: provider suspend of %s, which no job holds", ref)
+ return
+ }
+ gen := j.gen
+ if r.suspendOp != nil && r.suspendOp.attempt == j.attempt {
+ gen = r.suspendOp.gen
+ }
+ p := r.w.m.pause[j.attempt]
+ if p == nil || !p.open || !p.acked || p.gen != gen {
+ r.violate("I5: provider suspend of %s (%s) for generation %d; the model's pause is %+v", ref, j.attempt, gen, p)
+ }
+}
+
+// checkReplacementLocked is I6's launch half: a replacement's provider
+// Launch needs the replaced attempt to hold stop proof and have no live VM.
+func (r *simRunner) checkReplacementLocked(spec isolatedjob.LaunchSpec) {
+ s, err := r.w.read()
+ if err != nil {
+ r.violate("I6: %v", err)
+ return
+ }
+ j := s.byLaunch[bootLaunchID(spec.Bootstrap)]
+ if j == nil {
+ j = s.jobs[spec.AttemptID]
+ }
+ if j == nil || j.replaces == "" {
+ return
+ }
+ if old := s.jobs[j.replaces]; old == nil || old.proof == "" {
+ r.violate("I6: replacement %s launched before %s holds stop proof", j.attempt, j.replaces)
+ }
+ if live := r.liveOwnedLocked(s, j.replaces); len(live) > 0 {
+ r.violate("I6: replacement %s launched while %s still has %v", j.attempt, j.replaces, live)
+ }
+}
+
+// checkResumeLocked is I7's call half: a provider Resume needs a pending
+// operation prepared at one above the job's epoch, which is not yet raised.
+func (r *simRunner) checkResumeLocked(ref isolatedjob.Ref) {
+ s, err := r.w.read()
+ if err != nil {
+ r.violate("I7: %v", err)
+ return
+ }
+ j := s.byRef[ref]
+ if j == nil {
+ r.violate("I7: provider resume of %s, which no job holds", ref)
+ return
+ }
+ var pending []simResumeOp
+ for _, o := range s.ops {
+ if o.attempt == j.attempt && o.status == opPending {
+ pending = append(pending, o)
+ }
+ }
+ switch {
+ case len(pending) != 1:
+ r.violate("I7: provider resume of %s (%s) with %d prepared operations", ref, j.attempt, len(pending))
+ case pending[0].prepared != j.epoch+1:
+ r.violate("I7: provider resume of %s for operation %s prepared at epoch %d while the job's epoch is %d",
+ ref, pending[0].id, pending[0].prepared, j.epoch)
+ }
+}
+
+// check runs every invariant on snapshot s and returns the violations,
+// those the provider calls found first. M0 lines are the model's own
+// consistency (the simulation's clock and deadlines agree with the store).
+func (w *simWorld) check(s *simSnap) []string {
+ r := w.run
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ bad := r.bad
+ r.bad = nil
+ add := func(format string, args ...any) { bad = append(bad, fmt.Sprintf(format, args...)) }
+ now := w.now()
+ if st := w.store.Clock().Now(); st != now {
+ add("M0: store clock reads %v, the model %v", simDur(st), simDur(now))
+ }
+ for _, id := range s.order {
+ if _, ok := w.m.stopAt[id]; !ok {
+ w.m.stopAt[id] = w.opT + T(w.m.req[id].MaxLifetime-StopBefore)
+ if got := s.jobs[id].stopT; got != w.m.stopAt[id] {
+ add("M0: %s saved with stop time %v, the model expects %v", id, simDur(got), simDur(w.m.stopAt[id]))
+ }
+ }
+ }
+
+ // I1: at most one live VM per attempt.
+ live := map[string][]string{}
+ for _, vm := range s.vms {
+ if vm.State.Live() {
+ o := r.ownerLocked(s, vm.Ref)
+ live[o] = append(live[o], string(vm.Ref))
+ }
+ }
+ for _, o := range sortedKeys(live) {
+ if len(live[o]) > 1 {
+ add("I1: attempt %s has %d live VMs: %v", o, len(live[o]), live[o])
+ }
+ }
+
+ // I2: every VM is a saved Ref, matches a stored intent's attempt, or
+ // was planted.
+ for _, vm := range s.vms {
+ v := r.vms[vm.Ref]
+ switch {
+ case s.byRef[vm.Ref] != nil:
+ case v == nil:
+ add("I2: VM %s appeared without a Launch or a Plant", vm.Ref)
+ case v.planted, s.jobs[v.attempt] != nil:
+ default:
+ add("I2: VM %s (attempt %s, %s) is no saved Ref, matches no stored intent and was not planted", vm.Ref, v.attempt, vm.State)
+ }
+ }
+
+ // I4: no recorded job's VM live past its stop time plus one reaper
+ // interval (plus one per throttled stop call; a restart counts from
+ // the open, as the first pass comes at most an interval later).
+ for _, id := range s.order {
+ j := s.jobs[id]
+ vm, ok := s.vm[j.ref]
+ if j.ref == "" || !ok || !vm.State.Live() || vm.State == isolatedjob.StateStopping {
+ continue
+ }
+ stop := min(j.stopT, w.m.stopAt[id])
+ allow := T(ReapInterval) * T(1+r.throttled[j.ref])
+ if from := max(stop, w.openedAt); now > from+allow {
+ add("I4: VM %s of %s is %s at %v, its stop time %v (allowed until %v)", j.ref, id, vm.State,
+ simDur(now), simDur(stop), simDur(from+allow))
+ }
+ }
+
+ // I6: proof only from a terminal state, and never while a VM of the
+ // attempt is live.
+ for _, id := range s.order {
+ j := s.jobs[id]
+ if j.proof == "" {
+ continue
+ }
+ var p hostedwire.StopProof
+ if err := json.Unmarshal([]byte(j.proof), &p); err != nil || !p.State.Terminal() {
+ add("I6: %s holds proof from state %q (%v)", id, p.State, err)
+ }
+ if l := r.liveOwnedLocked(s, id); len(l) > 0 {
+ add("I6: %s holds stop proof while %v", id, l)
+ }
+ }
+
+ // I7: the epoch is the number of done operations, each raised it by
+ // exactly one, a newly done one followed a running read after its last
+ // resume call, and done operations stay done with their epoch.
+ ops := map[string][]simResumeOp{}
+ done := map[[2]string]int64{}
+ for _, o := range s.ops {
+ ops[o.attempt] = append(ops[o.attempt], o)
+ if o.status == opDone {
+ done[[2]string{o.attempt, o.id}] = o.result.Int64
+ }
+ }
+ for _, id := range s.order {
+ j := s.jobs[id]
+ n := int64(0)
+ for _, o := range ops[id] {
+ if o.status == opDone {
+ n++
+ }
+ }
+ seen := map[int64]bool{}
+ for _, o := range ops[id] {
+ if o.status != opDone {
+ continue
+ }
+ // n done operations with distinct epochs in 1..n: each raised
+ // the epoch by one, once.
+ if !o.result.Valid || o.result.Int64 != o.prepared || o.prepared < 1 || o.prepared > n || seen[o.prepared] {
+ add("I7: %s operation %s done with epoch %v, prepared %d, of %d done", id, o.id, o.result, o.prepared, n)
+ }
+ seen[o.prepared] = true
+ key := [2]string{id, o.id}
+ if _, known := w.m.done[key]; !known {
+ if !r.sawRunning[j.ref] {
+ add("I7: %s operation %s committed with no running read of %s after its last resume call", id, o.id, j.ref)
+ }
+ w.m.done[key] = o.result.Int64
+ w.closePause(id)
+ }
+ }
+ if j.epoch != n {
+ add("I7: %s has epoch %d after %d done resume operations", id, j.epoch, n)
+ }
+ }
+ for _, key := range sortedKeys(w.m.done) {
+ if e, ok := done[key]; !ok || e != w.m.done[key] {
+ add("I7: %s operation %s was done at epoch %d; now %v", key[0], key[1], w.m.done[key], e)
+ }
+ }
+ for _, x := range w.m.returned {
+ if e, ok := done[[2]string{x.attempt, x.op}]; !ok || e != x.epoch {
+ add("I7: Resume(%s, %s) returned epoch %d; the store holds %d (done %v)", x.attempt, x.op, x.epoch, e, ok)
+ }
+ }
+ w.m.returned = w.m.returned[:0]
+ return bad
+}
+
+// sortedKeys returns m's keys in a fixed order, so reports are stable.
+func sortedKeys[K comparable, V any](m map[K]V) []K {
+ out := slices.Collect(maps.Keys(m))
+ slices.SortFunc(out, func(a, b K) int { return strings.Compare(fmt.Sprint(a), fmt.Sprint(b)) })
+ return out
+}
diff --git a/internal/hostedctl/sim_test.go b/internal/hostedctl/sim_test.go
new file mode 100644
index 00000000..5098fc8f
--- /dev/null
+++ b/internal/hostedctl/sim_test.go
@@ -0,0 +1,886 @@
+package hostedctl
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "math/rand"
+ "os"
+ "path/filepath"
+ "runtime"
+ "runtime/debug"
+ "slices"
+ "strconv"
+ "strings"
+ "sync"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/hostedwire"
+ "amadan.net/oficina/equipo/internal/isolatedjob"
+ "amadan.net/oficina/equipo/internal/isolatedjob/isolatedjobtest"
+)
+
+// TestLifecycleSimulation drives the real controller, over the real store
+// and the fake provider, through random launches, crashes, provider faults,
+// pauses, resumes, orphans, stops, wall-clock jumps and time advances, and
+// checks the invariants of spec §14 (I1 to I7, sim_model_test.go) after
+// every step and every reaper pass. Each seed fixes the random choices;
+// EQUIPO_SIM_SEEDS=n runs seeds 1 to n (default 200) and EQUIPO_SIM_SEED=s
+// runs seed s alone. A failure prints its seed and step log.
+func TestLifecycleSimulation(t *testing.T) {
+ seeds := []int64{}
+ n := 200
+ if v := os.Getenv("EQUIPO_SIM_SEEDS"); v != "" {
+ var err error
+ if n, err = strconv.Atoi(v); err != nil || n < 1 {
+ t.Fatalf("EQUIPO_SIM_SEEDS=%q: want a positive count", v)
+ }
+ }
+ for s := 1; s <= n; s++ {
+ seeds = append(seeds, int64(s))
+ }
+ if v := os.Getenv("EQUIPO_SIM_SEED"); v != "" {
+ s, err := strconv.ParseInt(v, 10, 64)
+ if err != nil {
+ t.Fatalf("EQUIPO_SIM_SEED=%q: want a seed", v)
+ }
+ seeds = []int64{s}
+ }
+ dir := t.TempDir()
+ template := simTemplate(t, dir)
+ var mu sync.Mutex
+ var fails []*simFailure
+ next := make(chan int64)
+ var wg sync.WaitGroup
+ for range min(runtime.GOMAXPROCS(0), 8, len(seeds)) {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ for seed := range next {
+ if f := runSimSeed(dir, seed, template); f != nil {
+ mu.Lock()
+ fails = append(fails, f)
+ mu.Unlock()
+ }
+ }
+ }()
+ }
+ for _, seed := range seeds {
+ mu.Lock()
+ stop := len(fails) >= 3 // enough to show; the rest would only repeat it
+ mu.Unlock()
+ if stop {
+ break
+ }
+ next <- seed
+ }
+ close(next)
+ wg.Wait()
+ slices.SortFunc(fails, func(a, b *simFailure) int { return int(a.seed - b.seed) })
+ for _, f := range fails {
+ t.Errorf("seed %d failed at step %d:\n %s", f.seed, f.step, strings.Join(f.bad, "\n "))
+ }
+ if len(fails) > 0 {
+ log := fails[0].log
+ if lines := strings.Split(log, "\n"); len(lines) > simLogLines {
+ log = fmt.Sprintf("(%d earlier lines left out)\n%s", len(lines)-simLogLines, strings.Join(lines[len(lines)-simLogLines:], "\n"))
+ }
+ t.Logf("step log of seed %d (EQUIPO_SIM_SEED=%d replays it):\n%s", fails[0].seed, fails[0].seed, log)
+ }
+}
+
+// simTemplate migrates one store and returns its file with the clock
+// checkpoint removed, so each seed starts from a copy that Open still
+// treats as fresh (T at 0, not restarted). Creating a store from nothing
+// costs tens of milliseconds of disk syncs; a copy costs almost none.
+func simTemplate(t *testing.T, dir string) []byte {
+ t.Helper()
+ path := filepath.Join(dir, "template.db")
+ s, err := Open(context.Background(), path, isolatedjobtest.NewFakeClock(testWall))
+ if err != nil {
+ t.Fatalf("open the template store: %v", err)
+ }
+ if err := s.Close(); err != nil {
+ t.Fatalf("close the template store: %v", err)
+ }
+ db, err := sql.Open("sqlite", path)
+ if err != nil {
+ t.Fatalf("open the template file: %v", err)
+ }
+ if _, err := db.Exec(`DELETE FROM clock`); err != nil {
+ t.Fatalf("template: remove the clock checkpoint: %v", err)
+ }
+ if err := db.Close(); err != nil {
+ t.Fatalf("close the template file: %v", err)
+ }
+ b, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("read the template: %v", err)
+ }
+ return b
+}
+
+// simSteps is how many operations one seed runs; simLogLines is how much
+// of a failing seed's step log is printed.
+const (
+ simSteps = 40
+ simLogLines = 400
+)
+
+const simActor hostedwire.KeyID = "inst-1"
+
+type simFailure struct {
+ seed int64
+ step int
+ bad []string
+ log string
+}
+
+// simPause is the model of one attempt's pause barrier.
+type simPause struct {
+ gen int64
+ drainedAt T
+ open bool // drained and not reopened or resumed since
+ acked bool // the current generation was acknowledged in time
+}
+
+// simReturned is an epoch a Resume call returned, checked against the store.
+type simReturned struct {
+ attempt, op string
+ epoch int64
+}
+
+// simModel is what the simulation itself expects, kept only as far as the
+// invariants need it.
+type simModel struct {
+ next, nextOp, nextOrphan int
+ req map[string]LaunchRequest
+ stopAt map[string]T // stop time from the launch step's time and the lifetime
+ pause map[string]*simPause
+ ops map[string][]string // resume operation IDs used, per attempt
+ done map[[2]string]int64 // (attempt, operation) -> epoch, once seen done
+ returned []simReturned
+}
+
+// simWorld is one seed's controller, store, fake and model clock.
+type simWorld struct {
+ seed int64
+ rng *rand.Rand
+ ctx context.Context
+ path string
+ clk *isolatedjobtest.FakeClock
+ fake *isolatedjob.Fake
+ run *simRunner
+ cfg Config
+ store *Store
+ c *Controller
+
+ // The model's controller clock: restored at open as the store should,
+ // from the checkpoint written at close.
+ opened bool
+ restarted bool
+ base, openedAt T
+ monoAtOpen time.Duration
+ cpT T
+ cpWall time.Time
+ opT T // controller time when the current step began
+ auditBad int
+ step int
+ snap *simSnap
+ m simModel
+ bad []string
+ logMu sync.Mutex
+ lines []string
+ off []bool // simOps kinds this seed leaves out (swarm testing)
+ follow string // the step the runner's protocol takes next, if any
+ short bool // the next time advance is a short one
+}
+
+func newSimWorld(dir string, seed int64) *simWorld {
+ clk := isolatedjobtest.NewFakeClock(testWall)
+ fake := isolatedjob.NewFake(clk, isolatedjob.SpikeLimits())
+ fake.SetBackstop(false)
+ w := &simWorld{
+ seed: seed, rng: rand.New(rand.NewSource(seed)), ctx: context.Background(),
+ path: filepath.Join(dir, fmt.Sprintf("sim-%d.db", seed)), clk: clk, fake: fake,
+ cfg: Config{Enabled: true, Images: map[isolatedjob.ImageDigest]bool{imgA: true}},
+ m: simModel{req: map[string]LaunchRequest{}, stopAt: map[string]T{}, pause: map[string]*simPause{},
+ ops: map[string][]string{}, done: map[[2]string]int64{}},
+ }
+ w.run = newSimRunner(fake, w)
+ // Swarm testing: each seed leaves out some kinds of step, so some
+ // seeds run long pause and resume sequences that a stop would cut
+ // short, and others pile up faults. Launches and time always run.
+ w.off = make([]bool, len(simOps))
+ for i, o := range simOps {
+ w.off[i] = !o.always && w.rng.Intn(5) < 2
+ }
+ return w
+}
+
+func (w *simWorld) now() T { return w.base + T(w.clk.Mono()-w.monoAtOpen) }
+
+func (w *simWorld) logf(format string, args ...any) {
+ w.logMu.Lock()
+ defer w.logMu.Unlock()
+ w.lines = append(w.lines, fmt.Sprintf(format, args...))
+}
+
+func runSimSeed(dir string, seed int64, template []byte) (f *simFailure) {
+ w := newSimWorld(dir, seed)
+ defer w.cleanup()
+ if err := os.WriteFile(w.path, template, 0o600); err != nil {
+ return &simFailure{seed: seed, bad: []string{err.Error()}}
+ }
+ fail := func(bad ...string) *simFailure {
+ return &simFailure{seed: seed, step: w.step, bad: bad, log: strings.Join(w.lines, "\n")}
+ }
+ defer func() {
+ if p := recover(); p != nil {
+ f = fail(fmt.Sprintf("panic: %v\n%s", p, debug.Stack()))
+ }
+ }()
+ if err := w.open(); err != nil {
+ return fail(err.Error())
+ }
+ if !w.pass() {
+ return fail(w.bad...)
+ }
+ for w.step = 1; w.step <= simSteps; w.step++ {
+ w.opT = w.now()
+ op := w.pickOp()
+ w.logf("step %d at %v: %s", w.step, simDur(w.opT), op.name)
+ w.logf(" %s", op.run(w))
+ if w.bad == nil {
+ w.verify()
+ }
+ if w.bad != nil {
+ return fail(w.bad...)
+ }
+ }
+ return nil
+}
+
+func (w *simWorld) cleanup() {
+ if w.opened {
+ _ = w.store.Close()
+ }
+ for _, suffix := range []string{"", "-wal", "-shm"} {
+ _ = os.Remove(w.path + suffix)
+ }
+}
+
+// open opens the store and builds a controller, as the process starting.
+// The model restores controller time the way the store must: the
+// checkpoint's time plus the wall time since it, never less.
+func (w *simWorld) open() error {
+ s, err := Open(w.ctx, w.path, w.clk)
+ if err != nil {
+ return fmt.Errorf("open: %w", err)
+ }
+ // A crash here is Close and Open, never a power cut, so the store's
+ // disk syncs buy the simulation nothing and cost most of its time.
+ // Only this test connection changes; it must run outside a transaction.
+ if _, err := s.conn.ExecContext(w.ctx, `PRAGMA synchronous = OFF`); err != nil {
+ _ = s.Close()
+ return fmt.Errorf("open: turn off disk syncs: %w", err)
+ }
+ w.base = 0
+ if w.cpWall != (time.Time{}) {
+ w.restarted = true
+ w.base = w.cpT
+ if wall := w.clk.Wall(); wall.After(w.cpWall) {
+ w.base += T(wall.Sub(w.cpWall))
+ }
+ }
+ w.monoAtOpen, w.openedAt = w.clk.Mono(), w.base
+ c, err := New(w.cfg, Deps{Store: s, Runner: w.run, Auditor: w.fake, Alerter: &recordingAlerter{}})
+ if err != nil {
+ _ = s.Close()
+ return fmt.Errorf("new: %w", err)
+ }
+ w.store, w.c, w.opened = s, c, true
+ return nil
+}
+
+// close closes the store, as the process exiting; Close checkpoints.
+func (w *simWorld) close() error {
+ w.cpT, w.cpWall = w.now(), w.clk.Wall()
+ w.opened = false
+ return w.store.Close()
+}
+
+// verify reads a snapshot and runs every invariant; it records the first
+// violations in w.bad.
+func (w *simWorld) verify() bool {
+ s, err := w.read()
+ if err != nil {
+ w.bad = []string{err.Error()}
+ return false
+ }
+ w.snap = s
+ if bad := w.check(s); len(bad) > 0 {
+ w.bad = bad
+ return false
+ }
+ return true
+}
+
+// pass runs one reaper pass, as Loop would, then the invariants.
+func (w *simWorld) pass() bool {
+ a := isolatedjob.NetworkAudit{ResolverDisabled: true, IngressClosed: true, RouteOutAbsent: true}
+ if w.auditBad > 0 {
+ w.auditBad--
+ a.ResolverDisabled = false
+ }
+ w.fake.SetAudit(a, nil)
+ w.run.beginPass()
+ rep, err := w.c.Reap(w.ctx)
+ w.run.endPass()
+ w.logf(" pass at %v: %+v %s", simDur(w.now()), rep, errText(err))
+ return w.verify()
+}
+
+// advance moves time forward by d in steps of at most ReapInterval, with
+// the provider's progress (Tick) and a reaper pass at each step. While
+// nothing can change it skips ahead, but never past a recorded drain or stop
+// time, where a pass runs.
+func (w *simWorld) advance(d time.Duration) string {
+ passes := 0
+ for d > 0 && w.bad == nil {
+ step := min(d, ReapInterval)
+ if step > time.Second && w.rng.Intn(4) == 0 {
+ step = time.Duration(1+w.rng.Int63n(int64(step/time.Second))) * time.Second
+ }
+ if d > ReapInterval && w.snap.quiet() {
+ skip := d
+ if at, ok := w.snap.nextEvent(w.now()); ok && time.Duration(at-w.now()) < skip {
+ skip = time.Duration(at - w.now())
+ }
+ if skip > step {
+ step = skip
+ skipped := int(skip / ReapInterval)
+ w.auditBad = max(0, w.auditBad-skipped)
+ w.run.mu.Lock()
+ w.run.incomplete = max(0, w.run.incomplete-skipped)
+ w.run.mu.Unlock()
+ w.logf(" quiet: skip %v", skip)
+ }
+ }
+ w.clk.AdvanceMono(step)
+ w.clk.SetWall(w.clk.Wall().Add(step))
+ d -= step
+ w.fake.Tick()
+ w.pass()
+ passes++
+ }
+ return fmt.Sprintf("%d passes", passes)
+}
+
+// simOp is one kind of step. Its weight is multiplied by simBoost while
+// some job without proof is ready for it (boost), so the runner's side of
+// the pause protocol (drain, acknowledge, suspend, resume) is followed
+// often enough to reach its later steps; the step itself still picks any
+// job, and the generation or operation it names, at random.
+type simOp struct {
+ name string
+ weight int
+ boost func(w *simWorld, j *simJob) bool
+ run func(w *simWorld) string
+ always bool // never left out of a seed
+}
+
+// The pause protocol's next step for job j, by the model.
+func simToDrain(_ *simWorld, j *simJob) bool { return j.state == JobRunning }
+
+func simToAck(w *simWorld, j *simJob) bool {
+ p := w.m.pause[j.attempt]
+ return j.state == JobDraining && p != nil && p.open && !p.acked
+}
+
+func simToSuspend(w *simWorld, j *simJob) bool {
+ p := w.m.pause[j.attempt]
+ return j.state == JobDraining && p != nil && p.acked
+}
+
+func simToResume(_ *simWorld, j *simJob) bool {
+ return j.state == JobSuspended || j.state == JobResuming
+}
+
+const simBoost = 4
+
+var simOps = []simOp{
+ {"launch", 10, nil, (*simWorld).opLaunch, true},
+ {"launch a replacement", 5, nil, (*simWorld).opReplace, false},
+ {"launch a concurrent duplicate", 3, nil, (*simWorld).opDuplicate, false},
+ {"crash and reopen", 4, nil, (*simWorld).opCrash, false},
+ {"fault: lost reply", 4, nil, (*simWorld).opLostReply, false},
+ {"fault: throttle", 3, nil, (*simWorld).opThrottle, false},
+ {"fault: incomplete lists", 3, nil, (*simWorld).opIncomplete, false},
+ {"fault: unknown state", 3, nil, (*simWorld).opUnknownState, false},
+ {"fault: unknown age", 2, nil, (*simWorld).opUnknownAge, false},
+ {"fault: failing network audit", 3, nil, (*simWorld).opAuditFails, false},
+ {"drain", 4, simToDrain, (*simWorld).opDrain, false},
+ {"acknowledge quiescent", 3, simToAck, (*simWorld).opAck, false},
+ {"suspend", 3, simToSuspend, (*simWorld).opSuspend, false},
+ {"reopen", 1, nil, (*simWorld).opReopen, false},
+ {"resume", 3, simToResume, (*simWorld).opResume, false},
+ {"plant an orphan", 3, nil, (*simWorld).opPlant, false},
+ {"stop", 5, nil, (*simWorld).opStop, false},
+ {"a VM ends by itself", 1, nil, (*simWorld).opEnd, false},
+ {"the provider forgets a stopped VM", 1, nil, (*simWorld).opVanish, false},
+ {"wall-clock jump", 3, nil, (*simWorld).opWall, false},
+ {"time advance", 16, nil, (*simWorld).opAdvance, true},
+}
+
+func (w *simWorld) pickOp() simOp {
+ // A runner follows the pause protocol promptly: after a drain it
+ // usually acknowledges, then suspends, then waits for the VM, then
+ // resumes. Any other step may still come in between.
+ if next := w.follow; next != "" {
+ w.follow = ""
+ for i, o := range simOps {
+ if o.name == next && !w.off[i] && w.rng.Intn(10) < 7 {
+ return o
+ }
+ }
+ }
+ weights := make([]int, len(simOps))
+ total := 0
+ for i, o := range simOps {
+ if w.off[i] {
+ continue
+ }
+ weights[i] = o.weight
+ if o.boost != nil && w.anyJob(o.boost) {
+ weights[i] *= simBoost
+ }
+ total += weights[i]
+ }
+ n := w.rng.Intn(total)
+ for i, o := range simOps {
+ if n -= weights[i]; n < 0 {
+ return o
+ }
+ }
+ return simOps[len(simOps)-1]
+}
+
+// simLives are the lifetimes launches ask for, short ones often so stop
+// times come within a few passes.
+var simLives = []struct {
+ d time.Duration
+ weight int
+}{{11 * time.Minute, 3}, {12 * time.Minute, 2}, {15 * time.Minute, 3}, {20 * time.Minute, 3}, {30 * time.Minute, 4},
+ {45 * time.Minute, 4}, {time.Hour, 4}, {2 * time.Hour, 2}, {8 * time.Hour, 1}}
+
+func (w *simWorld) newRequest(replaces string) LaunchRequest {
+ w.m.next++
+ id := fmt.Sprintf("a%d", w.m.next)
+ total := 0
+ for _, l := range simLives {
+ total += l.weight
+ }
+ n, life := w.rng.Intn(total), simLives[0].d
+ for _, l := range simLives {
+ if n -= l.weight; n < 0 {
+ life = l.d
+ break
+ }
+ }
+ q := LaunchRequest{AttemptID: id, TaskID: "task-" + id, Account: "acct-1", Replaces: replaces,
+ Image: imgA, Size: isolatedjob.SizeSmall, MaxLifetime: life, InstanceCode: testCode}
+ w.m.req[id] = q
+ return q
+}
+
+// anyJob reports whether some job without proof satisfies ok.
+func (w *simWorld) anyJob(ok func(*simWorld, *simJob) bool) bool {
+ for _, id := range w.snap.order {
+ if j := w.snap.jobs[id]; j.proof == "" && ok(w, j) {
+ return true
+ }
+ }
+ return false
+}
+
+// pickReady returns, four times in five, a random job without proof that
+// satisfies ready; otherwise, or when there is none, pickJob(states...).
+func (w *simWorld) pickReady(ready func(*simWorld, *simJob) bool, states ...string) string {
+ var ids []string
+ for _, id := range w.snap.order {
+ if j := w.snap.jobs[id]; j.proof == "" && ready(w, j) {
+ ids = append(ids, id)
+ }
+ }
+ if len(ids) > 0 && w.rng.Intn(5) != 0 {
+ return ids[w.rng.Intn(len(ids))]
+ }
+ return w.pickJob(states...)
+}
+
+// pickJob returns a random attempt in one of states (any state when none
+// is given) that holds no proof, or "" when there is none.
+func (w *simWorld) pickJob(states ...string) string {
+ var ids []string
+ for _, id := range w.snap.order {
+ j := w.snap.jobs[id]
+ if j.proof == "" && (len(states) == 0 || slices.Contains(states, j.state)) {
+ ids = append(ids, id)
+ }
+ }
+ if len(ids) == 0 {
+ if len(states) > 0 && len(w.snap.order) > 0 && w.rng.Intn(6) == 0 {
+ return w.snap.order[w.rng.Intn(len(w.snap.order))] // a job in the wrong state is refused
+ }
+ return ""
+ }
+ return ids[w.rng.Intn(len(ids))]
+}
+
+func (w *simWorld) maybeLost(op isolatedjob.Op, oneIn int) string {
+ if w.rng.Intn(oneIn) != 0 {
+ return ""
+ }
+ w.run.queue(op, isolatedjob.FaultLostReply)
+ return " (reply lost)"
+}
+
+func (w *simWorld) opLaunch() string {
+ q := w.newRequest("")
+ lost := w.maybeLost(isolatedjob.OpLaunch, 4)
+ v, err := w.c.Launch(w.ctx, simActor, instKey, q)
+ return fmt.Sprintf("launch %s life %v%s -> %s", q.AttemptID, q.MaxLifetime, lost, viewText(v, err))
+}
+
+func (w *simWorld) opReplace() string {
+ var proven, all []string
+ for _, id := range w.snap.order {
+ all = append(all, id)
+ if w.snap.jobs[id].proof != "" {
+ proven = append(proven, id)
+ }
+ }
+ if len(all) == 0 {
+ return w.opLaunch()
+ }
+ old := all[w.rng.Intn(len(all))]
+ if len(proven) > 0 && w.rng.Intn(4) != 0 {
+ old = proven[w.rng.Intn(len(proven))]
+ }
+ q := w.newRequest(old)
+ lost := w.maybeLost(isolatedjob.OpLaunch, 4)
+ v, err := w.c.Launch(w.ctx, simActor, instKey, q)
+ return fmt.Sprintf("launch %s replacing %s%s -> %s", q.AttemptID, old, lost, viewText(v, err))
+}
+
+func (w *simWorld) opDuplicate() string {
+ var q LaunchRequest
+ if len(w.snap.order) > 0 && w.rng.Intn(3) == 0 {
+ q = w.m.req[w.snap.order[w.rng.Intn(len(w.snap.order))]]
+ } else {
+ q = w.newRequest("")
+ }
+ lost := w.maybeLost(isolatedjob.OpLaunch, 3)
+ out := make([]string, 2)
+ var wg sync.WaitGroup
+ for i := range out {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ v, err := w.c.Launch(w.ctx, simActor, instKey, q)
+ out[i] = viewText(v, err)
+ }()
+ }
+ wg.Wait()
+ return fmt.Sprintf("launch %s twice at once%s -> %s; %s", q.AttemptID, lost, out[0], out[1])
+}
+
+func (w *simWorld) opCrash() string {
+ if err := w.close(); err != nil {
+ w.bad = []string{"close: " + err.Error()}
+ return "close failed"
+ }
+ var down time.Duration
+ if w.rng.Intn(2) == 0 {
+ down = time.Duration(1+w.rng.Intn(1200)) * time.Second
+ }
+ wall := w.clk.Wall().Add(down)
+ if w.rng.Intn(3) == 0 {
+ wall = wall.Add(time.Duration(w.rng.Intn(7200)-3600) * time.Second)
+ }
+ w.clk.AdvanceMono(down)
+ w.clk.SetWall(wall)
+ if down > 0 {
+ w.fake.Tick()
+ }
+ switch {
+ case w.cfg.Enabled && w.rng.Intn(8) == 0:
+ w.cfg.Enabled = false
+ case !w.cfg.Enabled && w.rng.Intn(2) == 0:
+ w.cfg.Enabled = true
+ }
+ if err := w.open(); err != nil {
+ w.bad = []string{err.Error()}
+ return "reopen failed"
+ }
+ out := fmt.Sprintf("down %v, wall moved %v, launches enabled %v", down, wall.Sub(w.cpWall), w.cfg.Enabled)
+ if w.rng.Intn(10) < 7 {
+ w.pass()
+ out += ", first pass run"
+ }
+ return out
+}
+
+func (w *simWorld) opLostReply() string {
+ op := []isolatedjob.Op{isolatedjob.OpLaunch, isolatedjob.OpStop, isolatedjob.OpResume}[w.rng.Intn(3)]
+ w.run.queue(op, isolatedjob.FaultLostReply)
+ return fmt.Sprintf("the next %s reply is lost", op)
+}
+
+func (w *simWorld) opThrottle() string {
+ ops := []isolatedjob.Op{isolatedjob.OpLaunch, isolatedjob.OpGet, isolatedjob.OpSuspend, isolatedjob.OpResume,
+ isolatedjob.OpStop, isolatedjob.OpList}
+ op := ops[w.rng.Intn(len(ops))]
+ w.run.queue(op, isolatedjob.FaultThrottle)
+ return fmt.Sprintf("the next %s is throttled", op)
+}
+
+func (w *simWorld) opIncomplete() string {
+ k := 1 + w.rng.Intn(6)
+ w.run.mu.Lock()
+ w.run.incomplete += k
+ w.run.mu.Unlock()
+ return fmt.Sprintf("every List is incomplete for %d more passes", k)
+}
+
+func (w *simWorld) opUnknownState() string {
+ w.run.queue(isolatedjob.OpGet, isolatedjob.FaultUnknownState)
+ return "the next Get reads unknown"
+}
+
+func (w *simWorld) opUnknownAge() string {
+ w.run.queue(isolatedjob.OpGet, isolatedjob.FaultAgeUnknown)
+ return "the next Get gives no age"
+}
+
+func (w *simWorld) opAuditFails() string {
+ k := 5 + w.rng.Intn(16)
+ w.auditBad += k
+ return fmt.Sprintf("the network audit fails for %d more passes", k)
+}
+
+// genChoice picks a generation to name: the current one mostly, else the
+// one before or the one after.
+func (w *simWorld) genChoice(id string) (int64, string) {
+ cur := int64(0)
+ if p := w.m.pause[id]; p != nil {
+ cur = p.gen
+ }
+ switch n := w.rng.Intn(20); {
+ case n < 14:
+ return cur, "current"
+ case n < 17:
+ return cur - 1, "stale"
+ }
+ return cur + 1, "next"
+}
+
+func (w *simWorld) opDrain() string {
+ id := w.pickReady(simToDrain, JobRunning, JobDraining)
+ if id == "" {
+ return "no job to drain"
+ }
+ gen, err := w.c.Drain(w.ctx, simActor, instKey, id)
+ if err == nil {
+ w.m.pause[id] = &simPause{gen: gen, drainedAt: w.now(), open: true}
+ w.follow = "acknowledge quiescent"
+ }
+ return fmt.Sprintf("drain %s -> generation %d %s", id, gen, errText(err))
+}
+
+func (w *simWorld) opAck() string {
+ id := w.pickReady(simToAck, JobDraining)
+ if id == "" {
+ return "no job to acknowledge"
+ }
+ gen, kind := w.genChoice(id)
+ p := w.m.pause[id]
+ if kind == "current" && p != nil && w.now()-p.drainedAt > T(PauseAckTimeout) {
+ kind = "late"
+ }
+ err := w.c.Quiescent(w.ctx, simActor, instKey, id, gen)
+ if err == nil && p != nil && p.open && gen == p.gen && w.now()-p.drainedAt <= T(PauseAckTimeout) {
+ p.acked = true
+ w.follow = "suspend"
+ }
+ return fmt.Sprintf("quiescent %s generation %d (%s) -> %s", id, gen, kind, errText(err))
+}
+
+func (w *simWorld) opSuspend() string {
+ id := w.pickReady(simToSuspend, JobDraining, JobSuspending)
+ if id == "" {
+ return "no job to suspend"
+ }
+ gen, kind := w.genChoice(id)
+ fault := ""
+ if w.rng.Intn(5) == 0 {
+ w.run.queue(isolatedjob.OpSuspend, isolatedjob.FaultThrottle)
+ fault = " (throttled)"
+ }
+ w.run.mu.Lock()
+ w.run.suspendOp = &simGen{attempt: id, gen: gen}
+ w.run.mu.Unlock()
+ err := w.c.Suspend(w.ctx, simActor, instKey, id, gen)
+ w.run.mu.Lock()
+ w.run.suspendOp = nil
+ w.run.mu.Unlock()
+ if err == nil {
+ w.follow, w.short = "time advance", true
+ }
+ return fmt.Sprintf("suspend %s generation %d (%s)%s -> %s", id, gen, kind, fault, errText(err))
+}
+
+func (w *simWorld) opReopen() string {
+ id := w.pickJob(JobDraining)
+ if id == "" {
+ return "no job to reopen"
+ }
+ gen, kind := w.genChoice(id)
+ err := w.c.Reopen(w.ctx, simActor, instKey, id, gen)
+ if p := w.m.pause[id]; err == nil && p != nil && gen == p.gen {
+ p.open, p.acked = false, false
+ }
+ return fmt.Sprintf("reopen %s generation %d (%s) -> %s", id, gen, kind, errText(err))
+}
+
+func (w *simWorld) opResume() string {
+ id := w.pickReady(simToResume, JobSuspended, JobResuming)
+ if id == "" {
+ return "no job to resume"
+ }
+ op, kind := "", "new"
+ if used := w.m.ops[id]; len(used) > 0 && w.rng.Intn(5) < 2 {
+ op, kind = used[w.rng.Intn(len(used))], "repeated"
+ } else {
+ w.m.nextOp++
+ op = fmt.Sprintf("op-%d", w.m.nextOp)
+ w.m.ops[id] = append(w.m.ops[id], op)
+ }
+ lost := w.maybeLost(isolatedjob.OpResume, 3)
+ epoch, err := w.c.Resume(w.ctx, simActor, instKey, id, op)
+ if err == nil {
+ w.m.returned = append(w.m.returned, simReturned{attempt: id, op: op, epoch: epoch})
+ w.closePause(id)
+ } else {
+ w.follow, w.short = "time advance", true
+ }
+ return fmt.Sprintf("resume %s operation %s (%s)%s -> epoch %d %s", id, op, kind, lost, epoch, errText(err))
+}
+
+// closePause records that the pause of attempt ended in a committed resume.
+func (w *simWorld) closePause(id string) {
+ if p := w.m.pause[id]; p != nil {
+ p.open, p.acked = false, false
+ }
+}
+
+func (w *simWorld) opPlant() string {
+ w.m.nextOrphan++
+ ref := w.run.plant(fmt.Sprintf("orphan-%d", w.m.nextOrphan))
+ return fmt.Sprintf("planted orphan %s", ref)
+}
+
+func (w *simWorld) opStop() string {
+ id := w.pickJob()
+ if id == "" {
+ return "no job to stop"
+ }
+ lost := w.maybeLost(isolatedjob.OpStop, 5)
+ p, err := w.c.Stop(w.ctx, simActor, instKey, id, "simulation stop")
+ return fmt.Sprintf("stop %s%s -> proof %+v %s", id, lost, p, errText(err))
+}
+
+// vmsIn returns the fake's VMs whose state passes keep, in launch order.
+func (w *simWorld) vmsIn(keep func(isolatedjob.State) bool) []isolatedjob.Ref {
+ var out []isolatedjob.Ref
+ for _, vm := range w.snap.vms {
+ if keep(vm.State) {
+ out = append(out, vm.Ref)
+ }
+ }
+ return out
+}
+
+func (w *simWorld) opEnd() string {
+ refs := w.vmsIn(func(s isolatedjob.State) bool { return s.Live() && s != isolatedjob.StateStopping })
+ if len(refs) == 0 {
+ return "no live VM"
+ }
+ ref := refs[w.rng.Intn(len(refs))]
+ _ = w.fake.Stop(w.ctx, ref, "ended") // the provider's own doing: no controller call
+ return fmt.Sprintf("%s ends by itself", ref)
+}
+
+func (w *simWorld) opVanish() string {
+ refs := w.vmsIn(isolatedjob.State.Terminal)
+ if len(refs) == 0 {
+ return "no stopped VM"
+ }
+ ref := refs[w.rng.Intn(len(refs))]
+ w.fake.Vanish(ref)
+ return fmt.Sprintf("the provider forgets %s", ref)
+}
+
+func (w *simWorld) opWall() string {
+ d := time.Duration(w.rng.Int63n(int64(6*time.Hour))) - 3*time.Hour
+ w.clk.SetWall(w.clk.Wall().Add(d))
+ return fmt.Sprintf("wall clock moves %v", d)
+}
+
+func (w *simWorld) opAdvance() string {
+ var d time.Duration
+ short := w.short // waiting for the VM to settle after a suspend or resume
+ w.short = false
+ switch n := w.rng.Intn(20); {
+ case n < 10 || short:
+ d = time.Duration(1+w.rng.Intn(60)) * time.Second
+ case n < 19:
+ d = time.Duration(61+w.rng.Intn(540)) * time.Second
+ default:
+ d = time.Duration(901+w.rng.Intn(9*3600-900)) * time.Second
+ }
+ out := fmt.Sprintf("advance %v: %s", d, w.advance(d))
+ if short && w.bad == nil && w.anyJob(simToResume) {
+ w.follow = "resume"
+ }
+ return out
+}
+
+func viewText(v JobView, err error) string {
+ if err != nil {
+ return errText(err)
+ }
+ return fmt.Sprintf("%s %s", v.State, v.VMRef)
+}
+
+func faultNote(f isolatedjob.Fault) string {
+ if f == "" {
+ return ""
+ }
+ return " [" + string(f) + "]"
+}
+
+func errText(err error) string {
+ if err == nil {
+ return "ok"
+ }
+ s := strings.ReplaceAll(err.Error(), "\n", " | ")
+ if len(s) > 200 {
+ s = s[:200] + "..."
+ }
+ return "error: " + s
+}
+
+func simDur(t T) time.Duration { return time.Duration(t) }