oficina / equipo Public

hostedctl: recheck gates before dispatch, keep provider text out

Review r1. Launch and Replay create VMs through one dispatch that
re-reads the intent and re-checks the stop request, stop time, flag,
image and audit freshness right before the provider call, so an audit
that went stale while a launch queued for transaction 1 leaves the
intent waiting. Provider errors keep their isolatedjob sentinel and
lose their text, which could echo the instance code. The launch ID and
spec are built in transaction 1, only for a new attempt. The store
probe now detects a held transaction by itself; the concurrent launch
test holds the first provider call. Input limits documented as
controller policy (R16).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev f506a22aed8b98b4553f6bdf8e60918f5d621614 parent e4b0713
3 files changed, +509 −153
  • docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md +24 −0
  • internal/hostedctl/launch.go +205 −120
  • internal/hostedctl/launch_test.go +280 −33

CI cancelled — superseded by a newer push — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/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 2.0s
ci-box: codex: fetched and verified in 3.5s
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.9s
ci-box: pi: installed and verified in 7.3s
ci-box: opencode: installed and verified in 2.2s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.6s
ci-box: clone deepened in 3.6s
ci-box: file times set from content: 2872 files, 192 directories
ci-box: ready in 17.0s
=== 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.248s
=== 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  ./...
  0.8s
+ 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.2s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m19.542s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m19.54s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 36.25, cpu waiting 21.00%, memory waiting 0.00%, io waiting 0.63%
--- 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.32s 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.638s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m21.64s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 36.25, cpu waiting 20.51%, memory waiting 0.00%, io waiting 0.61%
--- 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.267s 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.055s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m12.58s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.72s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.75s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 36.25, cpu waiting 20.13%, memory waiting 0.00%, io waiting 0.59%
--- 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 1m18.946s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.226s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 20.24s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.51s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.48s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 37.84, cpu waiting 21.17%, memory waiting 0.00%, io waiting 0.66%
--- 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 1m36.761s 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 1m35.062s amadan.net/oficina/equipo/internal/headless
receipt: slow test 59.19s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.04s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 10.13s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.77s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.94s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 31.22, cpu waiting 16.90%, memory waiting 0.00%, io waiting 0.48%
--- 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 3m8.201s 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 3m6.081s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m43.67s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 24.2s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.56s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 8.14s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.37s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 8.67, cpu waiting 3.68%, memory waiting 0.00%, io waiting 0.10%
--- 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.139s 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.70, cpu waiting 0.03%, memory waiting 0.00%, io waiting 2.40%
--- 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.054s 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.70, cpu waiting 0.03%, memory waiting 0.00%, io waiting 2.40%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
cache miss: amadan.net/oficina/equipo/internal/runner/thin: its inputs changed

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

receipt: test step 47.149s 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.989s amadan.net/oficina/equipo/internal/runner
receipt: slow test 25.96s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 40.40, cpu waiting 20.98%, memory waiting 0.00%, io waiting 1.09%
--- 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.482s 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.543s amadan.net/oficina/equipo/internal/runner
receipt: slow test 35.55s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 31.52s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.38s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.6s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 40.40, cpu waiting 20.98%, memory waiting 0.00%, io waiting 1.09%
--- 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 35.03s 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 34.056s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.14s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.34s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.11s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.28s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 35.09, cpu waiting 14.26%, memory waiting 0.00%, io waiting 1.38%
--- 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 27.3%, load 29.61
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.297s 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.128s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.67s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.61s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 24.72s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.17s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.08s amadan.net/oficina/equipo/internal/equipotest TestAuthorityReadsOneSnapshot
machine: 32 CPUs, load 31.22, cpu waiting 16.90%, memory waiting 0.00%, io waiting 0.48%
--- 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 27.3%, load 29.61
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.412s 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 29.61, cpu waiting 12.55%, memory waiting 0.00%, io waiting 1.43%
--- 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 27.3%, load 26.71
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.102s 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.346s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.63s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.63s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.59s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.55s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.49s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 26.81, cpu waiting 14.79%, memory waiting 0.00%, io waiting 0.42%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 27.3%, load 29.61
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 567ms 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 29.61, cpu waiting 12.55%, memory waiting 0.00%, io waiting 1.43%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 27.3%, load 29.61
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 598ms 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 29.61, cpu waiting 11.25%, memory waiting 0.00%, io waiting 1.47%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 27.3%, load 26.71
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/isolatedjob: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: 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/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget note: internal/equipo took 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/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.291s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m16.144s 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 52.206s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.272s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 45.275s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 39.84s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 39.291s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 21.02s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 15.06s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 10.89s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 10.82s amadan.net/oficina/equipo/internal/equipo TestAgentReadRechecksIdentity
receipt: slow test 9.34s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringMissingModuleCache
machine: 32 CPUs, load 11.81, cpu waiting 5.31%, memory waiting 0.00%, io waiting 0.14%
--- 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.44s 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.025s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.43s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 15.24s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.51s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.75s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.79s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 36.25, cpu waiting 20.13%, memory waiting 0.00%, io waiting 0.59%
--- 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 1m32.183s 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 1m30.565s amadan.net/oficina/equipo/internal/headless
receipt: slow test 26.13s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 22.36s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 14.22s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 10.24s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.73s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 33.15, cpu waiting 17.44%, memory waiting 0.00%, io waiting 0.50%
--- 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 1m40.676s 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 1m38.925s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.09s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.36s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 13.02s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 10.25s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.13s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 28.88, cpu waiting 15.81%, memory waiting 0.00%, io waiting 0.45%
--- 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 TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-22T17:29:30.080Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-22T17:29:30.080Z level=INFO msg="startup phase done" phase=state_lock took=63µs
time=2026-11-22T17:29:30.080Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-22T17:29:30.081Z level=INFO msg="startup phase done" phase=claim_roots took=87µs
time=2026-11-22T17:29:30.081Z level=INFO msg="startup phase" phase=sweep
time=2026-11-22T17:29:30.110Z level=INFO msg="startup phase done" phase=sweep took=29.796ms
time=2026-11-22T17:29:30.110Z level=INFO msg="startup phase" phase=credentials
time=2026-11-22T17:29:30.111Z level=INFO msg="startup phase done" phase=credentials took=110µs
time=2026-11-22T17:29:30.111Z level=INFO msg="startup phase" phase=open_state
time=2026-11-22T17:29:30.155Z level=INFO msg="startup phase done" phase=open_state took=44.587ms
time=2026-11-22T17:29:30.155Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-22T17:29:30.156Z level=INFO msg=connecting host=127.0.0.1:41221 protocol=28
time=2026-11-22T17:29:30.159Z level=INFO msg=connected host=127.0.0.1:41221 took=2.253ms
time=2026-11-22T17:29:30.159Z level=INFO msg="capabilities gathering"
time=2026-11-22T17:29:30.160Z level=INFO msg="capabilities gathered" took=668µs tags=linux,claude,go
time=2026-11-22T17:29:30.161Z level=INFO msg="hello sent" protocol=28
time=2026-11-22T17:29:30.167Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-22T17:29:31.122Z level=INFO msg="connection checked" connection=claude-1 state=healthy
    browser_receipts_test.go:169: waiting for [...document.querySelectorAll('[equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes("I'm your coordinator")): context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserEmptyExplore (5.82s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m26.962s
FAIL	amadan.net/oficina/equipo/internal/headless	87.252s


receipt: test step 1m28.306s 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 1m26.962s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.08s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 11.29s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.53s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 10.37s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 8.03s 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 '^TestBrowserEmptyExplore$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserEmptyExplore browser-headless-rest f506a22aed8b98b4553f6bdf8e60918f5d621614 5.82s 34.47
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 31.22, cpu waiting 16.35%, memory waiting 0.00%, io waiting 0.47%
--- 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 995ms 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 819ms 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 283ms 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.05s 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.70, cpu waiting 1.72%, memory waiting 0.00%, io waiting 2.28%
--- 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.44s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.32s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.74s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.99s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.96s
+ 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   (55s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 14.72s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 13.07s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 11.49s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 13.95s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (22s)
ok ./internal/headless TestMixedVersions 20.37s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.78s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (1s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 41.04, cpu waiting 21.97%, memory waiting 0.00%, io waiting 0.95%
--- 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.348s 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.118s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 153ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 60ms 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.11s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.64s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 150ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 70ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
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 2.966s 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.658s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 270ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 170ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
machine: 32 CPUs, load 11.51, cpu waiting 4.68%, memory waiting 0.00%, io waiting 1.99%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 27.3%, load 29.61
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2585 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.534s
machine: 32 CPUs, load 38.61, cpu waiting 19.95%, memory waiting 0.00%, io waiting 1.17%
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 27.3%, load 29.61
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 29.61, cpu waiting 12.55%, memory waiting 0.00%, io waiting 1.43%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 27.3%, load 26.71
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 35.09, cpu waiting 15.56%, memory waiting 0.00%, io waiting 1.33%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 27.3%, load 26.71
shard 28: make gitleaks
5:28PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
5:29PM INF 1118 commits scanned.
5:29PM INF scanned ~61628177 bytes (61.63 MB) in 13.6s
5:29PM INF no leaks found
machine: 32 CPUs, load 38.61, cpu waiting 19.95%, memory waiting 0.00%, io waiting 1.17%
diff --git a/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
index fc402db0..be232543 100644
--- a/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
+++ b/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
@@ -335,3 +335,27 @@ Launch intents and replay: `internal/hostedctl/{launch.go,audit.go,states.go,lau
| X2 replay sends a changed spec (bootstrap plus one byte) | `^TestCrashBetweenLaunchAndSave$` | `launch_test.go:401: Replay = hostedctl: launch att-1: isolatedjob: conflict: attempt att-1 was launched with a different spec` | yes, passes |
| X3 a throttle returned as an error | `^TestThrottleWaitsThenReplays$` | `launch_test.go:522: throttled Launch = (zero view, hostedctl: launch att-1: isolatedjob: throttled: fake launch), want a waiting view with a launch ID and no error` | yes, passes |
| X4 request hash ignores the key | `^TestLaunchConflictOnChangedRequest$` | `launch_test.go:312: changed Launch = ({... State:starting ...}, <nil>), want (zero view, ErrConflict)` | yes, passes |
+
+### Task 10 fix round 1
+
+Review r1 findings 1, 2, 4 and 5 fixed; finding 3 settled by ruling R16 (limits kept, documented in `checkRequest` as controller policy).
+- Provider errors are classified (`providerError`): the matching isolatedjob sentinel (or context error) is kept for `errors.Is`, otherwise `ErrProviderLaunch`; the provider's text is dropped from returned errors on both paths, the throttle branch included.
+- One `dispatch` serves Launch and Replay: it re-reads the intent in its own transaction (stop asked for, `stop_t`), then checks flag, image and audit freshness immediately before the provider call. A transient failure after transaction 1 leaves the intent waiting; Launch returns the waiting view, nil, and a `launch_deferred` audit row.
+- The launch ID, bootstrap and spec are built inside transaction 1, only for a new attempt; validation uses a placeholder ID of the real length.
+- The probe in `TestLaunchSavesIntentBeforeProvider` reads the store from a helper goroutine, marks the call blocked after 2 s and returns so the caller unwinds, then joins the helper. `TestConcurrentLaunchSameAttempt` now holds the first provider call until the other 19 calls have returned.
+- New tests: `TestLaunchRechecksGatesBeforeDispatch` (transaction admission held, the audit goes stale while the launch waits; zero provider calls, intent waiting), `TestLaunchProviderTextNeverReturned` (invalid, conflict, unclassified, throttle; Launch and Replay).
+- GREEN: the brief's command ok 1.1 s; `go test ./internal/hostedctl -count=1` ok 3.5 s (with Task 11's work in progress in the tree) and 2.6 s over HEAD; the new tests under `-race` ok.
+- Mutations ran with `-overlay` mapping Task 11's in-flight files to HEAD and hiding its new files, so they test this code alone. Every row below was restored and passed again. Round 0 rows were re-run on the new code: all fail as before except X2, which no longer applies because Launch now also sends the decoded saved spec, so a decode change alters both calls alike; X2b replaces it.
+
+| Mutation | Test | Observed failure | Restored |
+| --- | --- | --- | --- |
+| F1 provider text kept in the returned error | `^TestLaunchProviderTextNeverReturned$` | `launch_test.go:658: Launch error "hostedctl: launch att-1: ValidationException: RunHookPayload {...\"instance_code\":\"code-SECRET-4f2a9c\"} rejected: isolatedjob: invalid request" carries the provider's text and the instance code` (also conflict, unclassified) | yes, passes |
+| F2 no gate recheck before a Launch dispatch (`replay && gate != nil`) | `^TestLaunchRechecksGatesBeforeDispatch$` | `launch_test.go:576: provider launches = 1, want 0: the audit went stale before dispatch` | yes, passes |
+| F4 provider call inside the intent transaction | `^TestLaunchSavesIntentBeforeProvider$` | `launch_test.go:264: provider call 0: a store read waited 2 s; a transaction is held across the provider call` | yes, passes |
+| F4b provider call inside the dispatch transaction | `^TestLaunchSavesIntentBeforeProvider$` | same line | yes, passes |
+| M1 provider called before the intent is saved | `^TestLaunchSavesIntentBeforeProvider$` | `launch_test.go:270: provider call 0: the provider was called before the launch intent was saved` | yes, passes |
+| M4 replay without re-checking the gates (`!replay &&` on both checks) | `^TestThrottleThenRefusal$` | `launch_test.go:837: provider launches = 2, want 1: a failed gate calls nothing` | yes, passes |
+| L4 audit age not checked | `^(TestLaunchRefusals\|TestThrottleThenRefusal\|TestLaunchRechecksGatesBeforeDispatch)$` | `launch_test.go:576: provider launches = 1, want 0` plus `:745` and `:837` | yes, passes |
+| X1 a repeat of a saved intent dispatches | `^TestConcurrentLaunchSameAttempt$` | `launch_test.go:471: view 0, returned while the provider call was held = {... State:starting VMRef:vm-0001 ...}, want waiting with no ref` | yes, passes |
+| X2b replay alone sends changed bytes | `^TestCrashBetweenLaunchAndSave$` | `launch_test.go:514: Replay = hostedctl: launch att-1: provider refused: isolatedjob: conflict` | yes, passes |
+| M2, M3, L1-L3, L4b, L5-L8, R1-R5b, R6c, X3, X4 | as in round 0 | each fails as before (now `launch_test.go:745`, `:740`, `:837`, `:851`, `:769`, `:379`); M2, L1 and L3 now end with the intent deferred as `waiting` by the dispatch gates, L8 as `abandoned` | yes, passes |
diff --git a/internal/hostedctl/launch.go b/internal/hostedctl/launch.go
index 4e4e1009..2719c2f0 100644
--- a/internal/hostedctl/launch.go
+++ b/internal/hostedctl/launch.go
@@ -11,6 +11,7 @@ import (
"errors"
"fmt"
"math"
+ "strings"
"time"
"amadan.net/oficina/equipo/internal/hostedwire"
@@ -27,6 +28,10 @@ var (
// ErrReplacementLive: the attempt named in Replaces is unknown, belongs
// to another key, or has no stop proof yet.
ErrReplacementLive = errors.New("hostedctl: replaced attempt is not proven stopped")
+ // ErrProviderLaunch: the provider's launch call failed in a way none of
+ // the isolatedjob sentinels names. The provider's own text is dropped,
+ // as it might echo the request and with it the instance code.
+ ErrProviderLaunch = errors.New("hostedctl: provider launch failed")
)
// DrainBefore and StopBefore place a job's drain and stop times before its
@@ -37,25 +42,34 @@ const (
StopBefore = 10 * time.Minute
)
-// maxNameLen bounds TaskID and Account.
+// maxNameLen bounds TaskID and Account. Controller policy (ruling R16): the
+// two IDs are written into audit rows and alerts, so they are kept short and
+// printable.
const maxNameLen = 128
+// launchIDLen is the length of a launch ID: 128 random bits in hex.
+const launchIDLen = 32
+
// purposeTask is jobs.purpose for a launch that runs a task attempt.
const purposeTask = "task"
// Audit actions written by Launch and Replay.
const (
- actionLaunchRefused = "launch_refused"
- actionLaunchIntent = "launch_intent"
- actionLaunchRepeated = "launch_repeated"
- actionLaunchStarted = "launch_started"
- actionLaunchThrottled = "launch_throttled"
- actionLaunchFailed = "launch_failed"
- actionReplayStarted = "replay_started"
- actionReplayThrottled = "replay_throttled"
- actionReplayFailed = "replay_failed"
- actionReplayAbandoned = "replay_abandoned"
- actionVMAfterAbandon = "vm_after_abandon"
+ actionLaunchRefused = "launch_refused"
+ actionLaunchIntent = "launch_intent"
+ actionLaunchRepeated = "launch_repeated"
+ actionLaunchDeferred = "launch_deferred"
+ actionLaunchStarted = "launch_started"
+ actionLaunchThrottled = "launch_throttled"
+ actionLaunchFailed = "launch_failed"
+ actionLaunchAbandoned = "launch_abandoned"
+ actionReplayStarted = "replay_started"
+ actionReplayThrottled = "replay_throttled"
+ actionReplayFailed = "replay_failed"
+ actionReplayAbandoned = "replay_abandoned"
+ actionVMAfterAbandon = "vm_after_abandon"
+ providerFailureReason = "provider error; intent kept for replay"
+ providerThrottleReason = "provider throttled; intent kept for replay"
)
// LaunchRequest asks for one VM for one task attempt. InstanceCode is a
@@ -98,25 +112,34 @@ func Deadlines(launched T, lifetime time.Duration) (deadline, drain, stop T) {
//
// In order it refuses: launches switched off (ErrDisabled); a key without
// RoleInstance (ErrForbidden); a malformed request (isolatedjob.ErrInvalid,
-// or ErrBootstrapTooLarge; a lifetime of StopBefore or less is malformed); an image outside Config.Images
-// (ErrImageNotAllowed); no passing network audit begun within AuditMaxAge
-// (ErrNetworkAudit). Each refusal is audited and creates nothing.
+// or ErrBootstrapTooLarge; see checkRequest for the controller's own
+// limits); an image outside Config.Images (ErrImageNotAllowed); no passing
+// network audit begun within AuditMaxAge (ErrNetworkAudit). Each refusal is
+// audited and creates nothing.
//
// Transaction 1 then looks up q.AttemptID. A job saved for the same request
// by the same key is returned as it stands, with no provider call; a
// different request, or another key, gives isolatedjob.ErrConflict. A new
// attempt naming Replaces needs that attempt to exist, belong to by and
-// carry stop proof (ErrReplacementLive). Otherwise the intent is saved as
-// JobWaiting with the exact LaunchSpec, a fresh launch ID and deadlines from
-// the current controller time.
+// carry stop proof (ErrReplacementLive). Otherwise transaction 1 draws a
+// fresh launch ID, builds the exact LaunchSpec and saves it as a JobWaiting
+// intent with deadlines from the current controller time.
+//
+// After that commit, dispatch re-reads the intent and re-checks every gate
+// that guards VM creation, as Replay does, immediately before the provider
+// call: a stop asked for or the stop time reached abandons the intent
+// (JobAbandoned); launches off, the image dropped or no fresh passing audit
+// leaves it JobWaiting, and Launch returns that view with a nil error. Time
+// spent queueing for transaction 1 can let the audit go stale, so the check
+// before it is not enough.
//
// The provider call runs outside any transaction, with the attempt ID as
// its client token. On success transaction 2 saves the Ref and JobStarting.
-// A throttle returns the JobWaiting view and a nil error: the intent is
-// saved and Replay launches it once the provider allows. Any other provider
-// error, a lost reply included, returns the error with a zero view; the
-// intent stays JobWaiting for Replay, which re-sends the same spec, so a VM
-// the lost call created is found again rather than doubled.
+// A throttle returns the JobWaiting view and a nil error: Replay launches it
+// once the provider allows. Any other provider error, a lost reply included,
+// returns a zero view and a fixed error (see providerError); the intent
+// stays JobWaiting for Replay, which re-sends the same spec, so a VM the lost
+// call created is found again rather than doubled.
func (c *Controller) Launch(ctx context.Context, by hostedwire.KeyID, key hostedwire.VerifyKey, q LaunchRequest) (JobView, error) {
if !c.cfg.Enabled {
return c.refuse(ctx, by, q, ErrDisabled)
@@ -124,8 +147,7 @@ func (c *Controller) Launch(ctx context.Context, by hostedwire.KeyID, key hosted
if by == "" || key.Role != hostedwire.RoleInstance {
return c.refuse(ctx, by, q, fmt.Errorf("%w: launch needs an instance key", ErrForbidden))
}
- spec, launchID, err := c.newSpec(q)
- if err != nil {
+ if err := c.checkRequest(q); err != nil {
return c.refuse(ctx, by, q, err)
}
if !c.cfg.Images[q.Image] {
@@ -135,13 +157,21 @@ func (c *Controller) Launch(ctx context.Context, by hostedwire.KeyID, key hosted
return c.refuse(ctx, by, q, err)
}
- view, created, err := c.saveIntent(ctx, by, q, spec, launchID)
+ view, created, err := c.saveIntent(ctx, by, q)
if err != nil || !created {
return view, err
}
- ref, perr := c.runner.Launch(ctx, spec)
- // Record the answer even if the caller has gone: a VM may now exist.
- return c.settle(context.WithoutCancel(ctx), by, q.AttemptID, ref, perr, false)
+ view, gate, err := c.dispatch(ctx, by, q.AttemptID, false)
+ if gate != nil {
+ aerr := c.store.Tx(ctx, func(tx *sql.Tx) error {
+ return appendAudit(tx, Audit{Actor: by, Account: q.Account, Task: q.TaskID, Attempt: q.AttemptID,
+ Action: actionLaunchDeferred, Reason: "intent kept for replay: " + gate.Error(), At: c.store.Clock().Now()})
+ })
+ if aerr != nil {
+ return JobView{}, aerr
+ }
+ }
+ return view, err
}
// refuse audits a refusal that came before any transaction, in a short
@@ -158,38 +188,44 @@ func (c *Controller) refuse(ctx context.Context, by hostedwire.KeyID, q LaunchRe
return JobView{}, err
}
-// newSpec checks q's fields and builds the LaunchSpec the provider will get,
-// with a fresh launch ID in its bootstrap. The spec is validated against the
-// runner's limits.
-func (c *Controller) newSpec(q LaunchRequest) (isolatedjob.LaunchSpec, string, error) {
+// checkRequest checks q's fields, then validates the spec q would give
+// against the runner's limits. That spec carries a placeholder launch ID of
+// the real length, so the bootstrap size checked is the size sent; the real
+// ID is drawn only in transaction 1, for a new intent.
+//
+// Two limits are controller policy (ruling R16), beyond what the provider
+// needs: TaskID and Account must be 1 to maxNameLen printable ASCII
+// characters, as they appear in audit rows and alerts; and MaxLifetime must
+// be more than StopBefore, since a shorter one has its stop time at launch
+// and the reaper would stop it, or Replay abandon it, at once.
+func (c *Controller) checkRequest(q LaunchRequest) error {
switch {
case !printableASCII(q.TaskID, maxNameLen):
- return isolatedjob.LaunchSpec{}, "", fmt.Errorf("%w: task id must be 1 to %d printable ASCII characters", isolatedjob.ErrInvalid, maxNameLen)
+ return fmt.Errorf("%w: task id must be 1 to %d printable ASCII characters", isolatedjob.ErrInvalid, maxNameLen)
case !printableASCII(q.Account, maxNameLen):
- return isolatedjob.LaunchSpec{}, "", fmt.Errorf("%w: account must be 1 to %d printable ASCII characters", isolatedjob.ErrInvalid, maxNameLen)
+ return fmt.Errorf("%w: account must be 1 to %d printable ASCII characters", isolatedjob.ErrInvalid, maxNameLen)
case q.Replaces != "" && !printableASCII(q.Replaces, maxNameLen):
- return isolatedjob.LaunchSpec{}, "", fmt.Errorf("%w: replaced attempt id must be printable ASCII", isolatedjob.ErrInvalid)
+ return fmt.Errorf("%w: replaced attempt id must be printable ASCII", isolatedjob.ErrInvalid)
case q.MaxLifetime <= StopBefore:
- // Its stop time would be reached at launch, so any Replay would
- // abandon it while the provider call is in flight.
- return isolatedjob.LaunchSpec{}, "", fmt.Errorf("%w: lifetime %v must be more than %v", isolatedjob.ErrInvalid, q.MaxLifetime, StopBefore)
+ return fmt.Errorf("%w: lifetime %v must be more than %v", isolatedjob.ErrInvalid, q.MaxLifetime, StopBefore)
case !printableASCII(q.InstanceCode, math.MaxInt):
// The text never repeats the code.
- return isolatedjob.LaunchSpec{}, "", fmt.Errorf("%w: instance code must be one or more printable ASCII characters", isolatedjob.ErrInvalid)
+ return fmt.Errorf("%w: instance code must be one or more printable ASCII characters", isolatedjob.ErrInvalid)
}
- launchID, err := newLaunchID()
+ spec, err := buildSpec(q, strings.Repeat("0", launchIDLen))
if err != nil {
- return isolatedjob.LaunchSpec{}, "", err
+ return err
}
+ return spec.Validate(c.runner.Limits())
+}
+
+// buildSpec is the LaunchSpec for q with launchID in its bootstrap.
+func buildSpec(q LaunchRequest, launchID string) (isolatedjob.LaunchSpec, error) {
boot, err := json.Marshal(hostedwire.Bootstrap{Version: hostedwire.BootstrapVersion, LaunchID: launchID, InstanceCode: q.InstanceCode})
if err != nil {
- return isolatedjob.LaunchSpec{}, "", fmt.Errorf("hostedctl: encode bootstrap: %w", err)
+ return isolatedjob.LaunchSpec{}, fmt.Errorf("hostedctl: encode bootstrap: %w", err)
}
- spec := isolatedjob.LaunchSpec{AttemptID: q.AttemptID, Image: q.Image, Size: q.Size, MaxLifetime: q.MaxLifetime, Bootstrap: boot}
- if err := spec.Validate(c.runner.Limits()); err != nil {
- return isolatedjob.LaunchSpec{}, "", err
- }
- return spec, launchID, nil
+ return isolatedjob.LaunchSpec{AttemptID: q.AttemptID, Image: q.Image, Size: q.Size, MaxLifetime: q.MaxLifetime, Bootstrap: boot}, nil
}
// printableASCII reports whether s is 1 to n bytes, each from ' ' to '~'.
@@ -206,9 +242,9 @@ func printableASCII(s string, n int) bool {
return true
}
-// newLaunchID returns 128 random bits as 32 lower-case hex digits.
+// newLaunchID returns 128 random bits as launchIDLen lower-case hex digits.
func newLaunchID() (string, error) {
- var b [16]byte
+ var b [launchIDLen / 2]byte
if _, err := rand.Read(b[:]); err != nil {
return "", fmt.Errorf("hostedctl: launch id: %w", err)
}
@@ -260,7 +296,7 @@ func encodeSpec(s isolatedjob.LaunchSpec) (string, error) {
func decodeSpec(text, attempt string) (isolatedjob.LaunchSpec, error) {
var s storedSpec
if err := json.Unmarshal([]byte(text), &s); err != nil {
- return isolatedjob.LaunchSpec{}, fmt.Errorf("hostedctl: saved spec for %s is unreadable: %w", attempt, err)
+ return isolatedjob.LaunchSpec{}, fmt.Errorf("hostedctl: saved spec for %s is unreadable", attempt)
}
if s.AttemptID != attempt {
return isolatedjob.LaunchSpec{}, fmt.Errorf("hostedctl: saved spec for %s names attempt %s", attempt, s.AttemptID)
@@ -270,19 +306,16 @@ func decodeSpec(text, attempt string) (isolatedjob.LaunchSpec, error) {
}
// saveIntent is transaction 1. It returns the existing job's view when the
-// same request was saved before (created false), or saves a new intent and
-// returns its view (created true). A conflict or a live replaced attempt is
-// audited, committed, and returned as the error.
-func (c *Controller) saveIntent(ctx context.Context, by hostedwire.KeyID, q LaunchRequest, spec isolatedjob.LaunchSpec, launchID string) (JobView, bool, error) {
- specJSON, err := encodeSpec(spec)
- if err != nil {
- return JobView{}, false, err
- }
+// same request was saved before (created false), or draws a launch ID,
+// builds the spec, saves the new intent and returns its view (created
+// true). A conflict or a live replaced attempt is audited, committed, and
+// returned as the error.
+func (c *Controller) saveIntent(ctx context.Context, by hostedwire.KeyID, q LaunchRequest) (JobView, bool, error) {
hash := requestHash(by, q)
var view JobView
var created bool
var refusal error
- err = c.store.Tx(ctx, func(tx *sql.Tx) error {
+ err := c.store.Tx(ctx, func(tx *sql.Tx) error {
view, created, refusal = JobView{}, false, nil
now := c.store.Clock().Now()
a := Audit{Actor: by, Account: q.Account, Task: q.TaskID, Attempt: q.AttemptID, At: now}
@@ -310,6 +343,18 @@ func (c *Controller) saveIntent(ctx context.Context, by hostedwire.KeyID, q Laun
return appendAudit(tx, a)
}
}
+ launchID, err := newLaunchID()
+ if err != nil {
+ return err
+ }
+ spec, err := buildSpec(q, launchID)
+ if err != nil {
+ return err
+ }
+ specJSON, err := encodeSpec(spec)
+ if err != nil {
+ return err
+ }
deadline, drain, stop := Deadlines(now, spec.MaxLifetime)
replaces := sql.NullString{String: q.Replaces, Valid: q.Replaces != ""}
if _, err := tx.ExecContext(ctx, `INSERT INTO jobs (attempt_id, launch_id, task_id, account_id, actor_key,
@@ -356,25 +401,112 @@ func checkReplaces(ctx context.Context, tx *sql.Tx, by hostedwire.KeyID, attempt
return nil
}
+// dispatch sends attempt's saved spec to the provider if, read again just
+// now, it is still a waiting intent with no Ref and every creation gate
+// passes. Launch (actor by, replay false) and Replay (actor empty, replay
+// true) both create VMs only through it.
+//
+// In its own transaction it re-reads the row. An intent no longer waiting,
+// or holding a Ref, is returned as it stands. A stop asked for, or the stop
+// time reached, marks it JobAbandoned with an audit row. Then, outside the
+// transaction and just before the call, it checks the transient gates
+// (creatable); a failure is returned as gate with the waiting view and no
+// provider call. Otherwise it calls the provider and settles the answer.
+func (c *Controller) dispatch(ctx context.Context, actor hostedwire.KeyID, attempt string, replay bool) (view JobView, gate, err error) {
+ var spec isolatedjob.LaunchSpec
+ ready := false
+ err = c.store.Tx(ctx, func(tx *sql.Tx) error {
+ ready = false
+ j, found, err := loadJob(ctx, tx, attempt)
+ if err != nil {
+ return err
+ }
+ if !found {
+ return fmt.Errorf("hostedctl: launch intent %s is missing", attempt)
+ }
+ now := c.store.Clock().Now()
+ if j.state != JobWaiting || j.ref.Valid {
+ view = j.view(now)
+ return nil
+ }
+ if reason := abandonReason(j, now); reason != "" {
+ res, err := tx.ExecContext(ctx, `UPDATE jobs SET state = ?, revision = revision + 1
+ WHERE attempt_id = ? AND state = ? AND vm_ref IS NULL`, JobAbandoned, attempt, JobWaiting)
+ if err != nil {
+ return fmt.Errorf("hostedctl: abandon %s: %w", attempt, err)
+ }
+ if n, err := res.RowsAffected(); err != nil || n != 1 {
+ return fmt.Errorf("hostedctl: abandon %s: %d rows (%v)", attempt, n, err)
+ }
+ action := actionLaunchAbandoned
+ if replay {
+ action = actionReplayAbandoned
+ }
+ j.state = JobAbandoned
+ view = j.view(now)
+ return appendAudit(tx, Audit{Actor: actor, Account: j.account, Task: j.task, Attempt: attempt,
+ Action: action, Reason: reason, At: now})
+ }
+ if spec, err = decodeSpec(j.specJSON, attempt); err != nil {
+ return err
+ }
+ view = j.view(now)
+ ready = true
+ return nil
+ })
+ if err != nil {
+ return JobView{}, nil, err
+ }
+ if !ready {
+ return view, nil, nil
+ }
+ if gate := c.creatable(spec.Image, c.store.Clock().Now()); gate != nil {
+ return view, gate, nil
+ }
+ ref, perr := c.runner.Launch(ctx, spec)
+ // Record the answer even if the caller has gone: a VM may now exist.
+ view, err = c.settle(context.WithoutCancel(ctx), actor, attempt, ref, perr, replay)
+ return view, nil, err
+}
+
+// providerError turns a provider launch error into a fixed error for
+// attempt. It keeps the isolatedjob sentinel the error matches, so
+// errors.Is still works, and drops the provider's own text, which might
+// echo the request and with it the instance code. An error matching none
+// becomes ErrProviderLaunch.
+func providerError(attempt string, err error) error {
+ for _, s := range []error{
+ isolatedjob.ErrThrottled, isolatedjob.ErrConflict, isolatedjob.ErrInvalid,
+ isolatedjob.ErrBootstrapTooLarge, isolatedjob.ErrNotFound, isolatedjob.ErrIncomplete,
+ context.Canceled, context.DeadlineExceeded,
+ } {
+ if errors.Is(err, s) {
+ return fmt.Errorf("hostedctl: launch %s: provider refused: %w", attempt, s)
+ }
+ }
+ return fmt.Errorf("hostedctl: launch %s: %w", attempt, ErrProviderLaunch)
+}
+
// settle records what the provider said about a launch of attempt. actor is
// the key that asked, or empty for Replay. A Ref is saved by transaction 2
// (saveRef). A throttle is audited and returns the waiting view with a nil
-// error. Any other error is audited, with a fixed reason since provider
-// text might echo the request, and returned.
+// error. Any other error is audited with a fixed reason and returned as
+// providerError gives it.
func (c *Controller) settle(ctx context.Context, actor hostedwire.KeyID, attempt string, ref isolatedjob.Ref, perr error, replay bool) (JobView, error) {
if perr == nil && ref == "" {
- perr = errors.New("hostedctl: provider returned no VM ref")
+ perr = errors.New("provider returned no VM ref")
}
if perr == nil {
return c.saveRef(ctx, actor, attempt, ref, replay)
}
throttled := errors.Is(perr, isolatedjob.ErrThrottled)
- action, reason := actionLaunchFailed, "provider error; intent kept for replay"
+ fixed := providerError(attempt, perr)
+ action, reason := actionLaunchFailed, providerFailureReason
switch {
case throttled && replay:
- action, reason = actionReplayThrottled, "provider throttled; intent kept for replay"
+ action, reason = actionReplayThrottled, providerThrottleReason
case throttled:
- action, reason = actionLaunchThrottled, "provider throttled; intent kept for replay"
+ action, reason = actionLaunchThrottled, providerThrottleReason
case replay:
action = actionReplayFailed
}
@@ -392,13 +524,10 @@ func (c *Controller) settle(ctx context.Context, actor hostedwire.KeyID, attempt
return appendAudit(tx, Audit{Actor: actor, Account: j.account, Task: j.task, Attempt: attempt,
Action: action, Reason: reason, At: now})
})
- if throttled {
- if err != nil {
- return JobView{}, errors.Join(perr, err)
- }
+ if throttled && err == nil {
return view, nil
}
- return JobView{}, errors.Join(fmt.Errorf("hostedctl: launch %s: %w", attempt, perr), err)
+ return JobView{}, errors.Join(fixed, err)
}
// saveRef is transaction 2: it saves ref for a waiting intent and moves it
@@ -458,7 +587,8 @@ func (c *Controller) saveRef(ctx context.Context, actor hostedwire.KeyID, attemp
}
// Replay launches every intent that has no Ref yet, in launch order, each
-// with its saved spec. Before each provider call it re-checks the gates:
+// with its saved spec, through dispatch. Before each provider call the
+// gates are re-checked:
//
// - a stop asked for, or the intent's stop time reached: the intent is
// marked JobAbandoned and audited, and never replayed again;
@@ -497,58 +627,13 @@ func (c *Controller) Replay(ctx context.Context) error {
errs = append(errs, err)
break
}
- if err := c.replayOne(ctx, id); err != nil {
+ if _, _, err := c.dispatch(ctx, "", id, true); err != nil {
errs = append(errs, err)
}
}
return errors.Join(errs...)
}
-// replayOne re-checks attempt's gates and, when every one passes, launches
-// its saved spec. The row is re-read in its own transaction, so an intent
-// settled since Replay listed it is skipped.
-func (c *Controller) replayOne(ctx context.Context, attempt string) error {
- var spec isolatedjob.LaunchSpec
- ready := false
- err := c.store.Tx(ctx, func(tx *sql.Tx) error {
- ready = false
- j, found, err := loadJob(ctx, tx, attempt)
- if err != nil {
- return err
- }
- if !found || j.state != JobWaiting || j.ref.Valid {
- return nil
- }
- now := c.store.Clock().Now()
- if reason := abandonReason(j, now); reason != "" {
- res, err := tx.ExecContext(ctx, `UPDATE jobs SET state = ?, revision = revision + 1
- WHERE attempt_id = ? AND state = ? AND vm_ref IS NULL`, JobAbandoned, attempt, JobWaiting)
- if err != nil {
- return fmt.Errorf("hostedctl: abandon %s: %w", attempt, err)
- }
- if n, err := res.RowsAffected(); err != nil || n != 1 {
- return fmt.Errorf("hostedctl: abandon %s: %d rows (%v)", attempt, n, err)
- }
- return appendAudit(tx, Audit{Account: j.account, Task: j.task, Attempt: attempt,
- Action: actionReplayAbandoned, Reason: reason, At: now})
- }
- if spec, err = decodeSpec(j.specJSON, attempt); err != nil {
- return err
- }
- ready = true
- return nil
- })
- if err != nil || !ready {
- return err
- }
- if c.creatable(spec.Image, c.store.Clock().Now()) != nil {
- return nil // transient: the intent waits for a later pass
- }
- ref, perr := c.runner.Launch(ctx, spec)
- _, err = c.settle(context.WithoutCancel(ctx), "", attempt, ref, perr, true)
- return err
-}
-
// abandonReason returns why a waiting intent must never be launched, or ""
// when nothing stops it: a stop was asked for, or its stop time has come.
func abandonReason(j jobRow, now T) string {
@@ -561,8 +646,8 @@ func abandonReason(j jobRow, now T) string {
return ""
}
-// creatable checks the gates Replay shares with Launch: launches on, the
-// image still allowed, and a passing audit begun within AuditMaxAge.
+// creatable checks the transient creation gates: launches on, the image
+// still allowed, and a passing audit begun within AuditMaxAge.
func (c *Controller) creatable(img isolatedjob.ImageDigest, now T) error {
if !c.cfg.Enabled {
return ErrDisabled
diff --git a/internal/hostedctl/launch_test.go b/internal/hostedctl/launch_test.go
index 1761226c..05dd1e76 100644
--- a/internal/hostedctl/launch_test.go
+++ b/internal/hostedctl/launch_test.go
@@ -6,6 +6,7 @@ import (
"database/sql"
"encoding/json"
"errors"
+ "fmt"
"path/filepath"
"strings"
"sync"
@@ -39,6 +40,7 @@ type launchEnv struct {
ctx context.Context
path string
clk *isolatedjobtest.FakeClock
+ gc *gateClock // the store's clock: clk, with a signal a test can arm
fake *isolatedjob.Fake
run isolatedjob.Runner // what the controller calls; the fake unless a test wraps it
cfg Config
@@ -52,15 +54,42 @@ func newLaunchEnv(t *testing.T) *launchEnv {
fake := isolatedjob.NewFake(clk, isolatedjob.SpikeLimits())
e := &launchEnv{
t: t, ctx: context.Background(), path: filepath.Join(t.TempDir(), "hosted.db"),
- clk: clk, fake: fake, run: fake,
+ clk: clk, gc: &gateClock{FakeClock: clk}, fake: fake, run: fake,
cfg: Config{Enabled: true, Images: map[isolatedjob.ImageDigest]bool{imgA: true, imgB: true}},
}
- e.store = openStore(t, e.path, clk)
+ e.store = openStore(t, e.path, e.gc)
e.newController()
e.audit()
return e
}
+// gateClock is the test clock with one extra: after arm, the next Mono call
+// reads the time and then closes the returned channel, so a test learns that
+// a goroutine has just read the clock.
+type gateClock struct {
+ *isolatedjobtest.FakeClock
+ mu sync.Mutex
+ armed chan struct{}
+}
+
+func (g *gateClock) arm() <-chan struct{} {
+ g.mu.Lock()
+ defer g.mu.Unlock()
+ g.armed = make(chan struct{})
+ return g.armed
+}
+
+func (g *gateClock) Mono() time.Duration {
+ d := g.FakeClock.Mono()
+ g.mu.Lock()
+ defer g.mu.Unlock()
+ if g.armed != nil {
+ close(g.armed)
+ g.armed = nil
+ }
+ return d
+}
+
// newController builds a controller over e.store with e.cfg and e.run. It
// has no network audit until e.audit runs.
func (e *launchEnv) newController() {
@@ -87,7 +116,7 @@ func (e *launchEnv) reopen() {
if err := e.store.Close(); err != nil {
e.t.Fatalf("Close = %v", err)
}
- e.store = openStore(e.t, e.path, e.clk)
+ e.store = openStore(e.t, e.path, e.gc)
e.newController()
}
@@ -156,36 +185,68 @@ func request(attempt string) LaunchRequest {
}
// intentProbe wraps the fake provider. At each Launch it reads the job row
-// for the attempt from the store, as the provider is called, and records it.
-// Its read waits at most 2 s for the store's one connection, so a
-// transaction held across the provider call shows as an error, not a hang.
+// for the attempt from the store in a helper goroutine, as the provider is
+// called. If the read has not finished after 2 s, something holds the store
+// across the provider call: the probe marks the call blocked and returns an
+// error at once, so the caller can unwind and release the store. join then
+// waits for every helper.
type intentProbe struct {
*isolatedjob.Fake
store *Store
- seen []probeSeen
+ mu sync.Mutex
+ seen []*probeSeen
}
type probeSeen struct {
- spec isolatedjob.LaunchSpec
- row jobRow
- found bool
- err error
+ spec isolatedjob.LaunchSpec
+ row jobRow
+ found bool
+ err error
+ blocked bool
+ done chan struct{}
}
+var errProbeBlocked = errors.New("probe: the store was held across the provider call")
+
func (p *intentProbe) Launch(ctx context.Context, s isolatedjob.LaunchSpec) (isolatedjob.Ref, error) {
- rctx, cancel := context.WithTimeout(ctx, 2*time.Second)
- defer cancel()
- var got probeSeen
- got.spec = s
- got.err = p.store.Tx(rctx, func(tx *sql.Tx) error {
- var err error
- got.row, got.found, err = loadJob(rctx, tx, s.AttemptID)
- return err
- })
+ got := &probeSeen{spec: s, done: make(chan struct{})}
+ p.mu.Lock()
p.seen = append(p.seen, got)
+ p.mu.Unlock()
+ go func() {
+ defer close(got.done)
+ got.err = p.store.Tx(context.Background(), func(tx *sql.Tx) error {
+ var err error
+ got.row, got.found, err = loadJob(context.Background(), tx, s.AttemptID)
+ return err
+ })
+ }()
+ select {
+ case <-got.done:
+ case <-time.After(2 * time.Second):
+ got.blocked = true
+ return "", errProbeBlocked
+ }
return p.Fake.Launch(ctx, s)
}
+// join waits for every read the probe started and returns what each saw.
+// Call it after the probed call has returned; nothing then holds the store.
+func (p *intentProbe) join(t *testing.T) []*probeSeen {
+ t.Helper()
+ p.mu.Lock()
+ seen := append([]*probeSeen(nil), p.seen...)
+ p.mu.Unlock()
+ for _, g := range seen {
+ select {
+ case <-g.done:
+ case <-time.After(5 * time.Second):
+ t.Fatal("a probe read of the store is still blocked after the launch returned")
+ }
+ }
+ return seen
+}
+
func TestLaunchSavesIntentBeforeProvider(t *testing.T) {
e := newLaunchEnv(t)
probe := &intentProbe{Fake: e.fake, store: e.store}
@@ -197,19 +258,25 @@ func TestLaunchSavesIntentBeforeProvider(t *testing.T) {
q := request("att-1")
v, err := e.c.Launch(e.ctx, "inst-1", instKey, q)
+ all := probe.join(t)
+ for i, g := range all {
+ if g.blocked {
+ t.Fatalf("provider call %d: a store read waited 2 s; a transaction is held across the provider call", i)
+ }
+ if g.err != nil {
+ t.Fatalf("provider call %d: reading the store = %v", i, g.err)
+ }
+ if !g.found {
+ t.Fatalf("provider call %d: the provider was called before the launch intent was saved", i)
+ }
+ }
if err != nil {
t.Fatalf("Launch = %v", err)
}
- if len(probe.seen) != 1 {
- t.Fatalf("provider launches = %d, want 1", len(probe.seen))
- }
- seen := probe.seen[0]
- if seen.err != nil {
- t.Fatalf("reading the store during the provider call = %v; a transaction is held across it", seen.err)
- }
- if !seen.found {
- t.Fatal("the provider was called before the launch intent was saved")
+ if len(all) != 1 {
+ t.Fatalf("provider launches = %d, want 1", len(all))
}
+ seen := all[0]
r := seen.row
if r.state != JobWaiting || r.ref.Valid || r.actor != "inst-1" || r.task != "task-1" || r.account != "acct-1" {
t.Fatalf("intent during the provider call = state %q ref %v actor %q task %q account %q, want waiting, no ref, inst-1, task-1, acct-1",
@@ -329,11 +396,35 @@ func TestLaunchConflictOnChangedRequest(t *testing.T) {
}
}
+// holdRunner wraps the fake provider and holds the first Launch call until
+// release is closed; later calls go straight through.
+type holdRunner struct {
+ *isolatedjob.Fake
+ once sync.Once
+ entered chan struct{}
+ release chan struct{}
+}
+
+func (h *holdRunner) Launch(ctx context.Context, s isolatedjob.LaunchSpec) (isolatedjob.Ref, error) {
+ first := false
+ h.once.Do(func() { first = true; close(h.entered) })
+ if first {
+ <-h.release
+ }
+ return h.Fake.Launch(ctx, s)
+}
+
func TestConcurrentLaunchSameAttempt(t *testing.T) {
e := newLaunchEnv(t)
+ hold := &holdRunner{Fake: e.fake, entered: make(chan struct{}), release: make(chan struct{})}
+ e.run = hold
+ e.newController()
+ e.audit()
+
const n = 20
views := make([]JobView, n)
errs := make([]error, n)
+ finished := make(chan int, n)
start := make(chan struct{})
var wg sync.WaitGroup
for i := range n {
@@ -342,9 +433,28 @@ func TestConcurrentLaunchSameAttempt(t *testing.T) {
defer wg.Done()
<-start
views[i], errs[i] = e.c.Launch(e.ctx, "inst-1", instKey, request("att-1"))
+ finished <- i
}()
}
close(start)
+ // The first provider call is held. Every other caller must answer from
+ // the saved intent meanwhile, without reaching the provider.
+ select {
+ case <-hold.entered:
+ case <-time.After(5 * time.Second):
+ t.Fatal("no provider call within 5 s")
+ }
+ early := map[int]bool{}
+ for range n - 1 {
+ select {
+ case i := <-finished:
+ early[i] = true
+ case <-time.After(5 * time.Second):
+ close(hold.release)
+ t.Fatalf("only %d of %d other launches returned while the first provider call was held", len(early), n-1)
+ }
+ }
+ close(hold.release)
wg.Wait()
for i, err := range errs {
@@ -357,8 +467,11 @@ func TestConcurrentLaunchSameAttempt(t *testing.T) {
if v.LaunchID != j.launchID {
t.Fatalf("view %d launch ID %q, want the one intent's %q", i, v.LaunchID, j.launchID)
}
- if v.VMRef != "" && string(v.VMRef) != j.ref.String {
- t.Fatalf("view %d ref %q, want the saved %q", i, v.VMRef, j.ref.String)
+ if early[i] && (v.State != JobWaiting || v.VMRef != "") {
+ t.Fatalf("view %d, returned while the provider call was held = %+v, want waiting with no ref", i, v)
+ }
+ if !early[i] && (v.State != JobStarting || string(v.VMRef) != j.ref.String) {
+ t.Fatalf("view %d, the launching call = %+v, want starting with the saved ref %q", i, v, j.ref.String)
}
}
if j.state != JobStarting || !j.ref.Valid {
@@ -379,8 +492,8 @@ func TestCrashBetweenLaunchAndSave(t *testing.T) {
e := newLaunchEnv(t)
e.fake.Inject(isolatedjob.OpLaunch, isolatedjob.FaultLostReply)
v, err := e.c.Launch(e.ctx, "inst-1", instKey, request("att-1"))
- if !errors.Is(err, isolatedjob.ErrLostReply) {
- t.Fatalf("Launch with a lost reply = (%+v, %v), want ErrLostReply", v, err)
+ if !errors.Is(err, ErrProviderLaunch) || errors.Is(err, isolatedjob.ErrLostReply) || v != (JobView{}) {
+ t.Fatalf("Launch with a lost reply = (%+v, %v), want (zero view, ErrProviderLaunch) with the provider's error dropped", v, err)
}
if live := e.fake.LiveByAttempt(); live["att-1"] != 1 {
t.Fatalf("live VMs after the lost reply = %v, want one for att-1", live)
@@ -420,6 +533,140 @@ func TestCrashBetweenLaunchAndSave(t *testing.T) {
e.noCodeInAudit()
}
+// TestLaunchRechecksGatesBeforeDispatch: a launch passes its gates, then
+// queues for transaction 1 while the audit goes stale. Once the intent is
+// saved it must not reach the provider.
+func TestLaunchRechecksGatesBeforeDispatch(t *testing.T) {
+ e := newLaunchEnv(t)
+
+ // Hold transaction admission.
+ entered, release := make(chan struct{}), make(chan struct{})
+ blocker := make(chan error, 1)
+ go func() {
+ blocker <- e.store.Tx(e.ctx, func(*sql.Tx) error { close(entered); <-release; return nil })
+ }()
+ <-entered
+
+ // The launch's gate check is its first clock read; once it has read
+ // the clock it can only go on to queue behind the held transaction.
+ read := e.gc.arm()
+ type result struct {
+ v JobView
+ err error
+ }
+ done := make(chan result, 1)
+ go func() {
+ v, err := e.c.Launch(e.ctx, "inst-1", instKey, request("att-1"))
+ done <- result{v, err}
+ }()
+ select {
+ case <-read:
+ case <-time.After(5 * time.Second):
+ close(release)
+ t.Fatal("the launch did not read the clock within 5 s")
+ }
+ e.clk.AdvanceMono(AuditMaxAge + time.Nanosecond) // the audit goes stale while it waits
+ close(release)
+ if err := <-blocker; err != nil {
+ t.Fatalf("holding transaction = %v", err)
+ }
+ r := <-done
+
+ if n := e.fake.Calls(isolatedjob.OpLaunch); n != 0 {
+ t.Fatalf("provider launches = %d, want 0: the audit went stale before dispatch", n)
+ }
+ if r.err != nil || r.v.State != JobWaiting || r.v.VMRef != "" || r.v.LaunchID == "" {
+ t.Fatalf("Launch = (%+v, %v), want a waiting view with a launch ID and no error", r.v, r.err)
+ }
+ if j, ok := e.job("att-1"); !ok || j.state != JobWaiting || j.ref.Valid {
+ t.Fatalf("job = %+v (found %v), want the intent kept, waiting, with no ref", j, ok)
+ }
+ if got := e.lastAudit(); got.Action != actionLaunchDeferred || got.Actor != "inst-1" || !strings.Contains(got.Reason, "network audit") {
+ t.Fatalf("last audit = %+v, want %s for inst-1 naming the audit", got, actionLaunchDeferred)
+ }
+
+ // The kept intent launches once a fresh audit passes.
+ e.audit()
+ if err := e.c.Replay(e.ctx); err != nil {
+ t.Fatalf("Replay = %v", err)
+ }
+ if j, _ := e.job("att-1"); j.state != JobStarting || !j.ref.Valid {
+ t.Fatalf("job after Replay = state %q ref %v, want starting with a ref", j.state, j.ref)
+ }
+}
+
+// leakRunner wraps the fake provider. While fail is set, Launch returns the
+// error fail builds from the spec instead of launching.
+type leakRunner struct {
+ *isolatedjob.Fake
+ fail func(isolatedjob.LaunchSpec) error
+}
+
+func (l *leakRunner) Launch(ctx context.Context, s isolatedjob.LaunchSpec) (isolatedjob.Ref, error) {
+ if l.fail != nil {
+ return "", l.fail(s)
+ }
+ return l.Fake.Launch(ctx, s)
+}
+
+// TestLaunchProviderTextNeverReturned: a provider error whose text quotes
+// the bootstrap must not carry the instance code into a returned error or an
+// audit row, from Launch or from Replay. The isolatedjob sentinel it wraps
+// still matches.
+func TestLaunchProviderTextNeverReturned(t *testing.T) {
+ cases := []struct {
+ name string
+ fail func(isolatedjob.LaunchSpec) error
+ want error // nil: a throttle, which Launch and Replay do not return
+ }{
+ {"invalid", func(s isolatedjob.LaunchSpec) error {
+ return fmt.Errorf("ValidationException: RunHookPayload %s rejected: %w", s.Bootstrap, isolatedjob.ErrInvalid)
+ }, isolatedjob.ErrInvalid},
+ {"conflict", func(s isolatedjob.LaunchSpec) error {
+ return fmt.Errorf("IdempotentParameterMismatch for %s: %w", s.Bootstrap, isolatedjob.ErrConflict)
+ }, isolatedjob.ErrConflict},
+ {"unclassified", func(s isolatedjob.LaunchSpec) error {
+ return fmt.Errorf("InternalFailure echoing %s", s.Bootstrap)
+ }, ErrProviderLaunch},
+ {"throttle", func(s isolatedjob.LaunchSpec) error {
+ return fmt.Errorf("TooManyRequests for %s: %w", s.Bootstrap, isolatedjob.ErrThrottled)
+ }, nil},
+ }
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+ e := newLaunchEnv(t)
+ leak := &leakRunner{Fake: e.fake, fail: tc.fail}
+ e.run = leak
+ e.newController()
+ e.audit()
+ check := func(path string, err error) {
+ t.Helper()
+ if tc.want == nil {
+ if err != nil {
+ t.Fatalf("%s with a throttle = %v, want nil", path, err)
+ }
+ } else if !errors.Is(err, tc.want) {
+ t.Fatalf("%s = %v, want it to match %v", path, err, tc.want)
+ }
+ if err != nil && (strings.Contains(err.Error(), testCode) || strings.Contains(err.Error(), "launch_id")) {
+ t.Fatalf("%s error %q carries the provider's text and the instance code", path, err)
+ }
+ e.noCodeInAudit()
+ }
+ v, err := e.c.Launch(e.ctx, "inst-1", instKey, request("att-1"))
+ check("Launch", err)
+ if tc.want != nil && v != (JobView{}) {
+ t.Fatalf("Launch view = %+v, want zero with an error", v)
+ }
+ check("Replay", e.c.Replay(e.ctx))
+ if j, _ := e.job("att-1"); j.state != JobWaiting || j.ref.Valid {
+ t.Fatalf("job = state %q ref %v, want waiting with no ref", j.state, j.ref)
+ }
+ })
+ }
+}
+
func TestLaunchRefusals(t *testing.T) {
// launchOld launches att-old for by and returns its ref.
launchOld := func(e *launchEnv, by hostedwire.KeyID) {