oficina / equipo Public

Add scripts/upgrade-thin.sh: staged production upgrade with rollback

Upgrades equipo production from one staged thin version to the next on
the same database, in the staging release order: preflight (staged-check,
finished cutover or upgrade, served version, production runner unit and
roots, nothing in flight), database backup, runners first, then the
instance with --swap hold, then verify (version, runner connected on the
new version, running runner hash equals the staged record).

Plan only by default; --execute asks before each step. Its own resumable
state file (upgrade.state) records the prior runner config and version
for rollback, which says plainly that the database is not rolled back.

Tests in internal/release/upgrade_test.go follow cutover_test.go: stub
carlos, systemctl, curl, git and make on a temporary HOME.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 363da8979ac1b1127a3483f3f86dcd62ef9b96a1 parent 86fcd05
3 files changed, +786 −0
  • internal/release/upgrade_test.go +284 −0
  • scripts/runner-reference-allowlist.json +224 −0
  • scripts/upgrade-thin.sh +278 −0

CI passed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/upgrade-thin: 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.6s
ci-box: claude: fetched and verified in 2.1s
ci-box: codex: fetched and verified in 4.1s
ci-box: codex-code-mode-host: fetched and verified in 1.9s
ci-box: libwrap: fetched and verified in 0.5s
ci-box: socat: fetched and verified in 0.6s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.7s
ci-box: pi: installed and verified in 7.3s
ci-box: opencode: installed and verified in 2.4s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 13.7s
ci-box: clone deepened in 2.9s
ci-box: file times set from content: 2718 files, 174 directories
ci-box: ready in 17.1s
=== 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.243s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  1.0s
+ go list -export -test -tags testbuild -f  ./...
  0.7s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  0.2s
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-11 02:51:11 +0000 UTC

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

receipt: test step 1m19.059s 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.578s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.58s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 35.29, cpu waiting 20.67%, memory waiting 0.00%, io waiting 0.62%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m20.61s 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.012s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m19.01s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 35.29, cpu waiting 20.29%, memory waiting 0.00%, io waiting 0.60%
--- shard 2 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-connections: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m21.666s 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.598s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m9.31s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.67s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.61s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 34.06, cpu waiting 20.29%, memory waiting 0.00%, io waiting 0.60%
--- 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 1m17.324s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m15.822s amadan.net/oficina/equipo/internal/headless
receipt: slow test 36.26s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.17s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.38s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 35.29, cpu waiting 20.83%, memory waiting 0.00%, io waiting 0.65%
--- 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 1m34.646s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m32.995s amadan.net/oficina/equipo/internal/headless
receipt: slow test 58.25s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.63s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 9.64s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.65s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.81s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 31.01, cpu waiting 16.59%, 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 3m6.901s 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 3m4.958s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m44.29s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 23.53s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.28s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 7.99s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.27s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 7.79, cpu waiting 3.60%, memory waiting 0.00%, io waiting 0.12%
--- 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 348ms 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 2m0.883s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 7.82s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.8s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.38s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.88s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.42s amadan.net/oficina/equipo/internal/thintest TestResearchDoneFallsBack
machine: 32 CPUs, load 6.90, cpu waiting 0.39%, memory waiting 0.00%, io waiting 2.32%
--- 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 355ms 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 1m22.798s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.09s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.23s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.41s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.37s amadan.net/oficina/equipo/internal/thintest TestContractPublishNameTaken
receipt: slow test 2.35s amadan.net/oficina/equipo/internal/thintest TestContractPreview
machine: 32 CPUs, load 6.90, cpu waiting 0.39%, memory waiting 0.00%, io waiting 2.32%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
cache miss: amadan.net/oficina/equipo/internal/runner/thin: its inputs changed
budget note: internal/runner/thin took 4m28.144s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m40.94s 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 4m28.144s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.96s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.87s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.78s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.46s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.85s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.12, cpu waiting 0.75%, memory waiting 0.00%, io waiting 0.02%
--- 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.51s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 46.369s amadan.net/oficina/equipo/internal/runner
receipt: slow test 26.34s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 36.62, cpu waiting 19.66%, memory waiting 0.00%, io waiting 1.07%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

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

receipt: test step 34.515s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 33.685s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.12s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.48s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.11s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.92s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 28.13, cpu waiting 14.26%, memory waiting 0.00%, io waiting 1.31%
--- 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 26.9%, load 23.35
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.548s 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.725s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 27.13s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 27.03s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 25.07s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.45s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.36s amadan.net/oficina/equipo/internal/equipotest TestAuthorityRejectsMismatchedTarget
machine: 32 CPUs, load 31.01, cpu waiting 16.59%, 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 26.9%, load 23.35
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 493ms 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 1m14.081s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 19.43s amadan.net/oficina/equipo/internal/equipotest TestProjectsSharedAndGrouped
receipt: slow test 19.43s amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
receipt: slow test 19.41s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 19.38s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
receipt: slow test 19.3s amadan.net/oficina/equipo/internal/equipotest TestProjectKindsAndDefaultBranch
machine: 32 CPUs, load 23.35, cpu waiting 11.53%, memory waiting 0.00%, io waiting 1.40%
--- 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 26.9%, load 23.35
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 1m14.123s 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.241s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.63s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.87s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.83s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 9.83s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 6.77s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 26.87, cpu waiting 14.56%, memory waiting 0.00%, io waiting 0.41%
--- 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 26.9%, load 23.35
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 480ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m6.433s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 25.51s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 24.68s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 24.62s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 22.72s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedOnce
receipt: slow test 22.66s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsRollbackAndUnavailable
machine: 32 CPUs, load 23.35, cpu waiting 11.53%, memory waiting 0.00%, io waiting 1.40%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 28.0%, load 23.35
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 573ms 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 47.181s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.5s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.44s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.42s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.32s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.18s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
machine: 32 CPUs, load 28.13, cpu waiting 11.53%, memory waiting 0.00%, io waiting 1.40%
--- 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 26.9%, load 23.35
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runnerproto: its inputs changed
cache miss: amadan.net/oficina/equipo/cmd/equipo-runner: 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/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: 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
--- FAIL amadan.net/oficina/equipo/internal/runner/webread TestTimeouts
=== RUN   TestTimeouts
    fetch_test.go:537: s1: {Source:s1 Origin:paul Parent: URL:https://shop.example.com/slow-body Hops:[{URL:https://shop.example.com/slow-body Address:151.101.1.1 Status:200}] Address:151.101.1.1 Status:200 Type:text/plain Bytes:5 SHA256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 Millis:300 Reason: File:s001.txt}
--- FAIL: TestTimeouts (0.61s)

--- FAIL amadan.net/oficina/equipo/internal/runner/webread (package output)
FAIL
rastrillo-budget/v1 ran 1.06s
FAIL	amadan.net/oficina/equipo/internal/runner/webread	1.069s

budget note: internal/equipo took 25.955s, 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 13.726s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 10.311s, 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 47.583s, 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.065s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m13.368s against a 60s target (the gate's other steps are not in this figure)
receipt: 13 packages ran, 46 cached, 18 without tests, 1 failed
receipt: slow package 52.645s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 52.26s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 47.583s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 39.065s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 36.407s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 21.21s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 15.95s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 15.22s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 9.11s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringMissingModuleCache
receipt: slow test 8.36s amadan.net/oficina/equipo/internal/runner/checks TestCheckNamespaceGoRootInsideModuleCache
rastrillo: budget test: go test failed
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestTimeouts$' -count=1 ./internal/runner/webread   (retry, once)
##############################################################################
FLAKE ./internal/runner/webread:TestTimeouts rest 363da8979ac1b1127a3483f3f86dcd62ef9b96a1 0.61s 11.39
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 11.39, cpu waiting 5.20%, 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 1m21.327s 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.949s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.16s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.96s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.17s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.66s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.6s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 34.06, cpu waiting 19.79%, memory waiting 0.00%, io waiting 0.58%
--- 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 1m30.082s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m28.479s amadan.net/oficina/equipo/internal/headless
receipt: slow test 25.16s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 22.03s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.87s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.95s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.85s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 31.01, cpu waiting 17.63%, memory waiting 0.00%, io waiting 0.51%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m39.153s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m37.558s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.35s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 12.94s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 12.9s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 10.22s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.15s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 28.69, cpu waiting 15.52%, memory waiting 0.00%, io waiting 0.44%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN   TestBrowserCopyContinue
time=2026-11-19T20:06:24.404Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-19T20:06:24.404Z level=INFO msg="startup phase done" phase=state_lock took=73µs
time=2026-11-19T20:06:24.404Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-19T20:06:24.404Z level=INFO msg="startup phase done" phase=claim_roots took=79µs
time=2026-11-19T20:06:24.404Z level=INFO msg="startup phase" phase=sweep
time=2026-11-19T20:06:24.439Z level=INFO msg="startup phase done" phase=sweep took=35.018ms
time=2026-11-19T20:06:24.439Z level=INFO msg="startup phase" phase=credentials
time=2026-11-19T20:06:24.439Z level=INFO msg="startup phase done" phase=credentials took=111µs
time=2026-11-19T20:06:24.439Z level=INFO msg="startup phase" phase=open_state
time=2026-11-19T20:06:24.489Z level=INFO msg="startup phase done" phase=open_state took=49.489ms
time=2026-11-19T20:06:24.490Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-19T20:06:24.491Z level=INFO msg=connecting host=127.0.0.1:40705 protocol=28
time=2026-11-19T20:06:24.494Z level=INFO msg=connected host=127.0.0.1:40705 took=1.169ms
time=2026-11-19T20:06:24.494Z level=INFO msg="capabilities gathering"
time=2026-11-19T20:06:24.494Z level=INFO msg="capabilities gathered" took=373µs tags=linux,claude,go
time=2026-11-19T20:06:24.495Z level=INFO msg="hello sent" protocol=28
time=2026-11-19T20:06:24.503Z level=INFO msg=welcome protocol=28 role=primary generation=1
    browser_copy_test.go:93: continue did not reach Checks: 0 <nil>
--- FAIL: TestBrowserCopyContinue (1.77s)

--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-19T20:06:54.796Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-19T20:06:54.796Z level=INFO msg="startup phase done" phase=state_lock took=81µs
time=2026-11-19T20:06:54.796Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-19T20:06:54.796Z level=INFO msg="startup phase done" phase=claim_roots took=79µs
time=2026-11-19T20:06:54.796Z level=INFO msg="startup phase" phase=sweep
time=2026-11-19T20:06:54.828Z level=INFO msg="startup phase done" phase=sweep took=31.458ms
time=2026-11-19T20:06:54.828Z level=INFO msg="startup phase" phase=credentials
time=2026-11-19T20:06:54.828Z level=INFO msg="startup phase done" phase=credentials took=100µs
time=2026-11-19T20:06:54.828Z level=INFO msg="startup phase" phase=open_state
time=2026-11-19T20:06:54.872Z level=INFO msg="startup phase done" phase=open_state took=44.161ms
time=2026-11-19T20:06:54.873Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-19T20:06:54.874Z level=INFO msg=connecting host=127.0.0.1:33243 protocol=28
time=2026-11-19T20:06:54.875Z level=INFO msg=connected host=127.0.0.1:33243 took=911µs
time=2026-11-19T20:06:54.875Z level=INFO msg="capabilities gathering"
time=2026-11-19T20:06:54.875Z level=INFO msg="capabilities gathered" took=376µs tags=linux,claude,go
time=2026-11-19T20:06:54.876Z level=INFO msg="hello sent" protocol=28
time=2026-11-19T20:06:54.880Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-19T20:06:55.870Z 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.80s)

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


receipt: test step 1m27.201s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m25.811s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.06s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 11.2s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.36s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 10.13s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 7.92s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$|^TestBrowserEmptyExplore$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest 363da8979ac1b1127a3483f3f86dcd62ef9b96a1 1.77s 32.06
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
##############################################################################
FLAKE ./internal/headless:TestBrowserEmptyExplore browser-headless-rest 363da8979ac1b1127a3483f3f86dcd62ef9b96a1 5.80s 32.06
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 28.69, cpu waiting 15.52%, memory waiting 0.00%, io waiting 0.44%
--- 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 284ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 701ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 700ms 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 243ms 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.631s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 1.63s 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 190ms 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.794s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 1.79s 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|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackStarCentre)$' ./internal/thintest

receipt: test step 267ms 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 3m4.809s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 17.42s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.34s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 10.61s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 9.34s amadan.net/oficina/equipo/internal/thintest TestBrowserInnerScreens
receipt: slow test 9.15s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
machine: 32 CPUs, load 6.90, cpu waiting 1.39%, memory waiting 0.00%, io waiting 2.24%
--- 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   (52s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.24s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.32s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.46s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.77s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 25.03s
+ 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   (60s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 12.70s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 21.56s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 11.15s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 13.06s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (21s)
ok ./internal/headless TestMixedVersions 20.00s
+ 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   (0s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 37.62, cpu waiting 21.04%, memory waiting 0.00%, io waiting 0.85%
--- 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.064s 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 6.974s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 205ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 115ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow test 4.93s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.69s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 200ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 3.067s 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.745s 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 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryReusedPID
machine: 32 CPUs, load 16.57, cpu waiting 4.23%, memory waiting 0.00%, io waiting 1.96%
--- 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 26.9%, load 23.35
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2432 text files, 2781 matches, 0 failures
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 87 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipo	2.487s
machine: 32 CPUs, load 33.80, cpu waiting 18.81%, memory waiting 0.00%, io waiting 1.15%
--- 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 26.9%, load 23.35
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 28.13, cpu waiting 11.53%, memory waiting 0.00%, io waiting 1.40%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 28.0%, load 23.35
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 30.12, cpu waiting 14.26%, memory waiting 0.00%, io waiting 1.31%
--- 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 26.9%, load 23.35
shard 28: make gitleaks
8:06PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
8:06PM INF 1019 commits scanned.
8:06PM INF scanned ~59863559 bytes (59.86 MB) in 12.6s
8:06PM INF no leaks found
machine: 32 CPUs, load 33.80, cpu waiting 18.81%, memory waiting 0.00%, io waiting 1.15%
=== perf ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -require TestPerfScreens,TestPerfBoot -tags perf -count=1 -p 1 -parallel 1 -run '^TestPerf' ./...
perf: GET /: median 1.012ms, worst 1.177ms, budget 150ms
perf: GET /api/runner/protocol: median 70µs, worst 112µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 582µs, worst 605µs, budget 150ms
perf: GET /api/v1/accounts: median 423µs, worst 460µs, budget 150ms
perf: GET /api/v1/auth/devices: median 440µs, worst 501µs, budget 150ms
perf: GET /api/v1/budgets: median 467µs, worst 485µs, budget 150ms
perf: GET /api/v1/capabilities: median 242µs, worst 263µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.143ms, worst 1.194ms, budget 150ms
perf: GET /api/v1/connections: median 552µs, worst 575µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 528µs, worst 615µs, budget 150ms
perf: GET /api/v1/conversation: median 860µs, worst 881µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.365ms, worst 1.401ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.681ms, worst 1.722ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 443µs, worst 470µs, budget 150ms
perf: GET /api/v1/journey: median 8.97ms, worst 9.231ms, budget 150ms
perf: GET /api/v1/me: median 480µs, worst 513µs, budget 150ms
perf: GET /api/v1/me/settings: median 546µs, worst 552µs, budget 150ms
perf: GET /api/v1/needs-you: median 9.024ms, worst 9.125ms, budget 150ms
perf: GET /api/v1/notifications: median 1.717ms, worst 1.77ms, budget 150ms
perf: GET /api/v1/onboarding: median 409µs, worst 457µs, budget 150ms
perf: GET /api/v1/people: median 446µs, worst 469µs, budget 150ms
perf: GET /api/v1/playbooks: median 588µs, worst 650µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 543µs, worst 579µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 882µs, worst 964µs, budget 150ms
perf: GET /api/v1/preferences: median 790µs, worst 836µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 474µs, worst 524µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 593µs, worst 652µs, budget 150ms
perf: GET /api/v1/roster: median 470µs, worst 533µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 441µs, worst 453µs, budget 150ms
perf: GET /api/v1/specialists: median 8.212ms, worst 9.303ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 8.085ms, worst 8.202ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 873µs, worst 915µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.116ms, worst 1.141ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 718µs, worst 770µs, budget 150ms
perf: GET /api/v1/teams: median 427µs, worst 452µs, budget 150ms
perf: GET /api/v1/templates: median 601µs, worst 645µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 433µs, worst 453µs, budget 150ms
perf: GET /auth/callback: median 78µs, worst 99µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.271ms, worst 3.423ms, budget 150ms
perf: GET /auth/verify: median 90µs, worst 110µs, budget 150ms
perf: GET /connections: median 3.567ms, worst 3.731ms, budget 150ms
perf: GET /conversation: median 7.163ms, worst 7.41ms, budget 150ms
perf: GET /conversation/connections: median 261µs, worst 302µs, budget 150ms
perf: GET /conversation/notebook: median 238µs, worst 266µs, budget 150ms
perf: GET /conversation/settings: median 3.921ms, worst 3.978ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.524ms, worst 3.683ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.045ms, worst 6.248ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.472ms, worst 9.301ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.508ms, worst 3.614ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 3.945ms, worst 4.058ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.325ms, worst 4.433ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.235ms, worst 4.357ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.215ms, worst 3.403ms, budget 150ms
perf: GET /conversation/settings/thinking: median 3.771ms, worst 3.816ms, budget 150ms
perf: GET /housekeeping: median 3.696ms, worst 3.812ms, budget 150ms
perf: GET /invites/new: median 562µs, worst 574µs, budget 150ms
perf: GET /invites/{id}: median 608µs, worst 635µs, budget 150ms
perf: GET /jobs: median 3.176ms, worst 3.327ms, budget 150ms
perf: GET /jobs/{id}: median 4.597ms, worst 7.083ms, budget 150ms
perf: GET /journey: median 10.217ms, worst 10.747ms, budget 150ms
perf: GET /nav/rail: median 2.941ms, worst 3.002ms, budget 150ms
perf: GET /needs-you: median 9.964ms, worst 10.358ms, budget 150ms
perf: GET /onboarding: median 3.949ms, worst 4.045ms, budget 150ms
perf: GET /people: median 3.289ms, worst 3.371ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.568ms, worst 4.739ms, budget 150ms
perf: GET /playbooks: median 4.045ms, worst 4.249ms, budget 150ms
perf: GET /playbooks/new: median 4.438ms, worst 7.103ms, budget 150ms
perf: GET /playbooks/{id}: median 4.839ms, worst 5.045ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.806ms, worst 5.04ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 3.883ms, worst 4.104ms, budget 150ms
perf: GET /preferences: median 4.291ms, worst 4.382ms, budget 150ms
perf: GET /preferences/sources/{source}: median 3.983ms, worst 4.147ms, budget 150ms
perf: GET /projects: median 5.131ms, worst 5.212ms, budget 150ms
perf: GET /projects/accounts: median 3.693ms, worst 3.815ms, budget 150ms
perf: GET /projects/new: median 3.568ms, worst 3.672ms, budget 150ms
perf: GET /projects/{id}: median 10.467ms, worst 10.801ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.852ms, worst 6.181ms, budget 150ms
perf: GET /runners/enrol: median 4.432ms, worst 4.511ms, budget 150ms
perf: GET /settings: median 3.388ms, worst 3.455ms, budget 150ms
perf: GET /settings/coordinator: median 5.333ms, worst 5.427ms, budget 150ms
perf: GET /settings/devices: median 3.232ms, worst 3.356ms, budget 150ms
perf: GET /settings/recovery: median 3.326ms, worst 3.458ms, budget 150ms
perf: GET /settings/recovery/release: median 3.379ms, worst 3.424ms, budget 150ms
perf: GET /settings/thinking: median 244µs, worst 255µs, budget 150ms
perf: GET /signin: median 320µs, worst 355µs, budget 150ms
perf: GET /specialists/new: median 3.279ms, worst 3.383ms, budget 150ms
perf: GET /specialists/{key}: median 10.649ms, worst 10.839ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.539ms, worst 3.711ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 3.884ms, worst 5.821ms, budget 150ms
perf: GET /tasks: median 5.317ms, worst 5.476ms, budget 150ms
perf: GET /tasks/new: median 3.194ms, worst 3.355ms, budget 150ms
perf: GET /tasks/{id}: median 5.406ms, worst 5.582ms, budget 150ms
perf: GET /tasks/{id}/merge: median 4.687ms, worst 4.904ms, budget 150ms
perf: GET /tasks/{id}/move: median 4.421ms, worst 4.496ms, budget 150ms
perf: GET /tasks/{id}/plan: median 5.549ms, worst 5.69ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.441ms, worst 1.518ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 4.961ms, worst 5.113ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 4.723ms, worst 4.899ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.187ms, worst 6.614ms, budget 150ms
perf: GET /tasks/{id}/thread: median 7.932ms, worst 8.05ms, budget 150ms
perf: GET /team/{specialist}: median 4.238ms, worst 4.301ms, budget 150ms
perf: GET /teams: median 9.784ms, worst 10.03ms, budget 150ms
perf: GET /templates: median 3.295ms, worst 3.386ms, budget 150ms
perf: GET /usage: median 4.007ms, worst 4.21ms, budget 150ms
perf: GET /work: median 2.968ms, worst 3.078ms, budget 150ms
perf: cold boot: median 255ms of [254.31635ms 254.755864ms 259.011816ms], budget 500ms

receipt: test step 29.5s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 83 without tests, 0 failed
receipt: slow package 8.797s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-runner
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-tool-proxy
receipt: slow package 0s amadan.net/oficina/equipo/internal/advice
receipt: slow package 0s amadan.net/oficina/equipo/internal/attach
receipt: slow test 7.98s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 820ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 4.24 GiB in 24863 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 0.84 GiB in 27329 files
ci-box: build cache over 4.0 GiB: dropped 1.60 GiB this job did not read, kept 2.64 GiB
diff --git a/internal/release/upgrade_test.go b/internal/release/upgrade_test.go
new file mode 100644
index 00000000..6f11c1b4
--- /dev/null
+++ b/internal/release/upgrade_test.go
@@ -0,0 +1,284 @@
+package release
+
+import (
+ "crypto/sha256"
+ "encoding/hex"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+ "time"
+)
+
+const (
+ upgradeFrom = "aaa1111"
+ upgradeTo = "bbb2222"
+)
+
+// upgradeRig runs scripts/upgrade-thin.sh against stub carlos, systemctl,
+// curl, git and make on a temporary HOME, after a finished cutover to
+// upgradeFrom. Nothing here reaches a real service.
+type upgradeRig struct {
+ t *testing.T
+ root, home, runner string
+ script, log string
+ serviceEnv, unit string
+}
+
+func newUpgradeRig(t *testing.T) *upgradeRig {
+ t.Helper()
+ root := t.TempDir()
+ r := &upgradeRig{t: t, root: root, home: filepath.Join(root, "home"), log: filepath.Join(root, "calls.log")}
+ r.runner = filepath.Join(r.home, ".local/share/equipo-runner")
+ repo := filepath.Join(root, "repo")
+ src, err := os.ReadFile("../../scripts/upgrade-thin.sh")
+ r.must(err)
+ r.script = filepath.Join(repo, "scripts", "upgrade-thin.sh")
+ r.write(r.script, string(src), 0700)
+ r.write(filepath.Join(repo, "releases", "equipo-linux-arm64-"+upgradeTo), "instance", 0600)
+ release := filepath.Join(repo, "releases", "equipo-runner-linux-amd64-"+upgradeTo)
+ runner := "#!/bin/sh\nif [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> " + r.log + "; [ ! -e " + filepath.Join(root, "verifyfail") + " ]; exit; fi\necho \"equipo-runner $1\" >> " + r.log + "\n"
+ r.write(filepath.Join(release, "equipo-runner"), runner, 0700)
+ r.write(filepath.Join(release, "equipo-tool-proxy"), "proxy", 0700)
+ sum := sha256.Sum256([]byte(runner))
+ r.write(filepath.Join(repo, "releases", "staged", upgradeTo+".json"), `{"staging": "PASS", "sha256": {"runner": "`+hex.EncodeToString(sum[:])+`"}}`, 0600)
+ old := filepath.Join(r.runner, "releases", upgradeFrom)
+ r.serviceEnv = "EQUIPO_ORIGIN=\"https://equipo.oficina.works\"\nEQUIPO_INSTANCE_ID=\"INSTANCE0000000000000000000\"\nEQUIPO_TOOL_PROXY_PATH=\"" + old + "/equipo-tool-proxy\"\nEQUIPO_RUNNER_STATE_DIR=\"" + filepath.Join(r.runner, "state") + "\"\nEQUIPO_SCRATCH_ROOT=\"/prod/scratch\"\nEQUIPO_WORKSPACE_ROOT=\"/prod/work\"\n"
+ r.unit = "[Service]\nEnvironmentFile=" + filepath.Join(r.runner, "service.env") + "\nExecStart=" + old + "/equipo-runner run\nRestart=on-failure\n"
+ r.write(filepath.Join(r.runner, "service.env"), r.serviceEnv, 0600)
+ r.write(filepath.Join(r.runner, "equipo-runner.service"), r.unit, 0600)
+ r.write(filepath.Join(r.runner, "state", "credentials.json"), "enrolled", 0600)
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"), "version="+upgradeFrom+"\ndone_preflight=1\ndone_verify=1\n", 0600)
+ r.write(filepath.Join(root, "served"), upgradeFrom+"\n", 0600)
+ r.write(filepath.Join(root, "inflight"), "0/0", 0600)
+ // The running runner's executable, as /proc shows it: the installed one.
+ r.must(os.MkdirAll(filepath.Join(root, "proc", "4242"), 0700))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", upgradeTo, "equipo-runner"), filepath.Join(root, "proc", "4242", "exe")))
+ bin := filepath.Join(root, "bin")
+ log := "echo \"$(basename $0) $*\" >> " + r.log + "\n"
+ r.write(filepath.Join(bin, "make"), "#!/bin/sh\n"+log, 0700)
+ r.write(filepath.Join(bin, "git"), "#!/bin/sh\n"+log, 0700)
+ r.write(filepath.Join(bin, "curl"), "#!/bin/sh\ncat "+filepath.Join(root, "served")+"\n", 0700)
+ r.write(filepath.Join(bin, "systemctl"), "#!/bin/sh\n"+log+`case "$*" in
+*FragmentPath*) cat `+filepath.Join(root, "fragment")+` 2>/dev/null || echo `+filepath.Join(r.runner, "equipo-runner.service")+` ;;
+*MainPID*) echo 4242 ;;
+esac
+`, 0700)
+ r.write(filepath.Join(bin, "carlos"), "#!/bin/sh\n"+log+`case "$1 $2" in
+"env list") printf 'using console\nKEY VALUE\nEQUIPO_DATABASE equipo-v1.db\n' ;;
+"db pull") for a; do case $prev in --out) python3 -c "import sqlite3,sys; c=sqlite3.connect(sys.argv[1]); [c.execute('create table '+t+'(x)') for t in ('teams','chat_tasks','chat_steps','chat_turns','runners')]; c.commit()" "$a" ;; esac; prev=$a; done ;;
+"db query") case "$*" in *runner_sessions*) printf 'n\n1\n' ;; *) printf 'x\n%s\n' "$(cat `+filepath.Join(root, "inflight")+`)" ;; esac ;;
+deploy*) for a; do case $prev in --version) echo "$a" > `+filepath.Join(root, "served")+` ;; esac; prev=$a; done ;;
+promote*) shift; for a; do last2=$last; last=$a; done; echo "$last2" > `+filepath.Join(root, "served")+` ;;
+esac
+`, 0700)
+ return r
+}
+
+func (r *upgradeRig) must(err error) {
+ r.t.Helper()
+ if err != nil {
+ r.t.Fatal(err)
+ }
+}
+
+func (r *upgradeRig) write(path, body string, mode os.FileMode) {
+ r.t.Helper()
+ r.must(os.MkdirAll(filepath.Dir(path), 0700))
+ r.must(os.WriteFile(path, []byte(body), mode))
+}
+
+func (r *upgradeRig) read(path string) string {
+ raw, _ := os.ReadFile(path)
+ return string(raw)
+}
+
+func (r *upgradeRig) run(args ...string) (string, error) {
+ cmd := exec.Command("bash", append([]string{r.script}, args...)...)
+ cmd.Env = []string{"HOME=" + r.home, "PATH=" + filepath.Join(r.root, "bin") + ":/usr/bin:/bin", "UPGRADE_YES=1", "UPGRADE_TRIES=2", "UPGRADE_WAIT=0", "UPGRADE_PROC=" + filepath.Join(r.root, "proc"), "LANG=C.UTF-8"}
+ out, err := cmd.CombinedOutput()
+ return string(out), err
+}
+
+func (r *upgradeRig) state() string {
+ return r.read(filepath.Join(r.home, ".local/share/equipo-cutover/upgrade.state"))
+}
+
+// inOrder fails unless each want appears in s after the one before it.
+func inOrder(t *testing.T, s string, want ...string) {
+ t.Helper()
+ at := 0
+ for _, w := range want {
+ i := strings.Index(s[at:], w)
+ if i < 0 {
+ t.Fatalf("%q missing or out of order in:\n%s", w, s)
+ }
+ at += i + len(w)
+ }
+}
+
+// The plan changes nothing and lists the staging release order: preflight,
+// backup, runners (after a second idle check), then the instance, then verify.
+func TestUpgradePlanChangesNothingAndRunsRunnersFirst(t *testing.T) {
+ r := newUpgradeRig(t)
+ out, err := r.run(upgradeTo)
+ if err != nil {
+ t.Fatalf("plan: %v\n%s", err, out)
+ }
+ inOrder(t, out, "from "+upgradeFrom+" to "+upgradeTo, "== 1 preflight", "staged-check RELEASE_VERSION="+upgradeTo, "must be 0/0",
+ "== 2 backup", "carlos db pull", "pragma integrity_check", "chmod 0400",
+ "== 3 runner", "verify-installed", "nothing in flight, again", "systemctl --user restart equipo-runner.service",
+ "== 4 instance", "--swap hold --version "+upgradeTo, "== 5 verify", "versions.runner')='"+upgradeTo+"'", "Plan only.")
+ if strings.Contains(out, "would refuse") || strings.Contains(out, "env set") {
+ t.Fatalf("plan refuses or changes the configuration:\n%s", out)
+ }
+ if r.read(r.log) != "" || r.state() != "" || r.read(filepath.Join(r.runner, "service.env")) != r.serviceEnv {
+ t.Fatalf("the plan changed something:\n%s", r.read(r.log))
+ }
+}
+
+// The upgrade switches the runner first, then the instance, on the same
+// database, and checks the running runner's bytes; it is not run twice.
+func TestUpgradeSwitchesRunnerThenInstanceOnTheSameDatabase(t *testing.T) {
+ r := newUpgradeRig(t)
+ out, err := r.run(upgradeTo, "--execute")
+ if err != nil {
+ t.Fatalf("upgrade: %v\n%s", err, out)
+ }
+ calls := r.read(r.log)
+ inOrder(t, calls, "make -C", "staged-check", "git -C", "merge-base --is-ancestor "+upgradeFrom+" "+upgradeTo, "db query", "db pull",
+ "equipo-runner verify-installed "+filepath.Join(r.runner, "releases", upgradeTo, "equipo-tool-proxy"), "db query",
+ "systemctl --user restart equipo-runner.service", "carlos deploy", "--swap hold --version "+upgradeTo, "runner_sessions")
+ for _, never := range []string{"env set", "env unset", "equipo-runner enrol", "promote"} {
+ if strings.Contains(calls, never) {
+ t.Fatalf("upgrade ran %q:\n%s", never, calls)
+ }
+ }
+ env, unit := r.read(filepath.Join(r.runner, "service.env")), r.read(filepath.Join(r.runner, "equipo-runner.service"))
+ if !strings.Contains(env, filepath.Join(r.runner, "releases", upgradeTo, "equipo-tool-proxy")) || !strings.Contains(env, "INSTANCE0000000000000000000") ||
+ !strings.Contains(unit, "ExecStart="+filepath.Join(r.runner, "releases", upgradeTo, "equipo-runner")+" run") {
+ t.Fatalf("runner not switched:\n%s\n%s", env, unit)
+ }
+ if r.read(filepath.Join(r.runner, "state", "credentials.json")) != "enrolled" {
+ t.Fatal("runner enrolment changed")
+ }
+ st := r.state()
+ for _, want := range []string{"prev_version=" + upgradeFrom, "database=equipo-v1.db", "backup_sha256=", "done_verify=1"} {
+ if !strings.Contains(st, want) {
+ t.Fatalf("state lacks %q:\n%s", want, st)
+ }
+ }
+ if out, err = r.run(upgradeTo, "--execute"); err == nil || !strings.Contains(out, "already on") {
+ t.Fatalf("second upgrade allowed: %v %s", err, out)
+ }
+}
+
+// Each refusal stops --execute before anything changes.
+func TestUpgradeRefusesBeforeChangingAnything(t *testing.T) {
+ for name, set := range map[string]func(r *upgradeRig){
+ "cutover unfinished": func(r *upgradeRig) {
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"), "version="+upgradeFrom+"\ndone_deploy=1\n", 0600)
+ },
+ "no cutover": func(r *upgradeRig) {
+ r.must(os.Remove(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state")))
+ },
+ "steps in flight": func(r *upgradeRig) { r.write(filepath.Join(r.root, "inflight"), "1/0", 0600) },
+ "another served": func(r *upgradeRig) { r.write(filepath.Join(r.root, "served"), "ccc3333\n", 0600) },
+ "staging unit": func(r *upgradeRig) {
+ r.write(filepath.Join(r.root, "fragment"), filepath.Join(r.home, ".config/systemd/user/equipo-runner-staging.service"), 0600)
+ },
+ "runner on the old origin": func(r *upgradeRig) {
+ r.write(filepath.Join(r.runner, "service.env"), strings.Replace(r.serviceEnv, "equipo.oficina.works", "equipo.bds.oncarlos.com", 1), 0600)
+ },
+ "another upgrade unfinished": func(r *upgradeRig) {
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/upgrade.state"), "version=ddd4444\nprev_version="+upgradeFrom+"\ndone_preflight=1\n", 0600)
+ },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newUpgradeRig(t)
+ r.t = t
+ set(r)
+ env := r.read(filepath.Join(r.runner, "service.env"))
+ out, err := r.run(upgradeTo, "--execute")
+ if err == nil || !strings.Contains(out, "refused") {
+ t.Fatalf("not refused: %v\n%s", err, out)
+ }
+ calls := r.read(r.log)
+ for _, change := range []string{"db pull", "restart", "deploy", "daemon-reload"} {
+ if strings.Contains(calls, change) {
+ t.Fatalf("changed something (%s) before refusing:\n%s", change, calls)
+ }
+ }
+ if r.read(filepath.Join(r.runner, "service.env")) != env || strings.Contains(r.state(), "done_preflight=1\ndone") {
+ t.Fatal("runner config or state changed")
+ }
+ })
+ }
+ // The plan still prints, and says what it would refuse.
+ r := newUpgradeRig(t)
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"), "version="+upgradeFrom+"\ndone_deploy=1\n", 0600)
+ if out, err := r.run(upgradeTo); err != nil || !strings.Contains(out, "would refuse: the cutover has not finished") || !strings.Contains(out, "== 5 verify") {
+ t.Fatalf("plan: %v\n%s", err, out)
+ }
+}
+
+// A running runner that is not the staged bytes, or programs that fail
+// verify-installed, stop the upgrade; once fixed, the same run resumes.
+func TestUpgradeVerifiesTheRunnerItRuns(t *testing.T) {
+ r := newUpgradeRig(t)
+ r.write(filepath.Join(r.root, "verifyfail"), "", 0600)
+ if out, err := r.run(upgradeTo, "--execute"); err == nil || strings.Contains(r.read(r.log), "restart") {
+ t.Fatalf("switched after a failed verify-installed: %v\n%s", err, out)
+ }
+ if r.read(filepath.Join(r.runner, "service.env")) != r.serviceEnv {
+ t.Fatal("runner config changed before verify-installed passed")
+ }
+ r.must(os.Remove(filepath.Join(r.root, "verifyfail")))
+ exe := filepath.Join(r.root, "proc", "4242", "exe")
+ r.must(os.Remove(exe))
+ r.must(os.Symlink("/bin/sh", exe))
+ if out, err := r.run(upgradeTo, "--execute"); err == nil || !strings.Contains(out, "not the staged") {
+ t.Fatalf("accepted another running binary: %v\n%s", err, out)
+ }
+ r.must(os.Remove(exe))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", upgradeTo, "equipo-runner"), exe))
+ out, err := r.run(upgradeTo, "--execute")
+ if err != nil || strings.Count(r.read(r.log), "db pull") != 1 || strings.Count(r.read(r.log), "carlos deploy") != 1 {
+ t.Fatalf("did not resume past finished steps: %v\n%s\n%s", err, out, r.read(r.log))
+ }
+}
+
+// Rollback restores the previous runner and version exactly, says the
+// database is not rolled back and names the backup; the next upgrade can
+// then start again from the restored version.
+func TestUpgradeRollbackRestoresRunnerAndVersion(t *testing.T) {
+ r := newUpgradeRig(t)
+ if out, err := r.run(upgradeTo, "--execute"); err != nil {
+ t.Fatalf("upgrade: %v\n%s", err, out)
+ }
+ out, err := r.run("rollback", "--execute")
+ if err != nil {
+ t.Fatalf("rollback: %v\n%s", err, out)
+ }
+ if r.read(filepath.Join(r.runner, "service.env")) != r.serviceEnv || r.read(filepath.Join(r.runner, "equipo-runner.service")) != r.unit {
+ t.Fatal("runner configuration not restored exactly")
+ }
+ if strings.TrimSpace(r.read(filepath.Join(r.root, "served"))) != upgradeFrom {
+ t.Fatal("previous version not served")
+ }
+ inOrder(t, r.read(r.log), "systemctl --user stop", "daemon-reload", "promote --app equipo --account oficina --console https://console.carloku.com "+upgradeFrom+" edge", "systemctl --user start")
+ if !strings.Contains(out, "database is not rolled back") || !strings.Contains(out, "equipo-upgrade-") {
+ t.Fatalf("rollback does not say the database stays, or where the backup is:\n%s", out)
+ }
+ if out, err = r.run("rollback", "--execute"); err == nil {
+ t.Fatalf("second rollback allowed: %s", out)
+ }
+ time.Sleep(1100 * time.Millisecond) // a new stamp, so a new backup file
+ if out, err = r.run(upgradeTo, "--execute"); err != nil {
+ t.Fatalf("upgrade after rollback: %v\n%s", err, out)
+ }
+ if kept, _ := filepath.Glob(filepath.Join(r.home, ".local/share/equipo-cutover/upgrade-"+upgradeTo+"-*.state")); len(kept) != 1 {
+ t.Fatalf("rolled-back state not kept: %v", kept)
+ }
+}
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index 4e513dd3..6be25b92 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -15846,5 +15846,229 @@
"match": "node",
"count": 1,
"reason": "Toolchains schema generated from internal/wire: the node toolchain version field in a runner's capability report."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "cc9a4f1d39cf13a08b04ddbe4607bfffc0d907fa96a07ded61506fc199e3a83b",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "5387904268932982e0c79cca82a7935df90015ba54ea545f95a1943589bc13d1",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "348e448534eb84668fdb431d7daee01da5303e78b04c3f605778aae7c7cc5458",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "5617ad9e2980bb6cf650b7101f99998f647b61a0d38ef09410b61e4dac1f8c4b",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "726e45e1b3fee0327a9cae24c19ae5161a0a7431aabbc9b5f81943f2174c65ea",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "f3516baa7ba6cfe082af6c44eacc6a69cd683a370dd9f3d0a0e171396d337b9a",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "d0136f3cf706c6eae3e431955521e424fbc60f1ee46e5aa394ec74dbe2f002fa",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "de82dc301283bf8260bc9b2eac1d4750815be32b189b1596f2cba56a086b37a8",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "d4efcf9e2390cfa3a8575775133475fb7c56466f6c4c36c980f20e71e7ee45d8",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "f79423dfae78cd691aeaabcbb880fcaa3c4b8110f7248fb736ff6596675d9b0e",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "e3200de7d13f661f86de2b26108c0f0daf9c075a18d01d4337dcd95a510e553c",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "ef6b3bdbba47a2e988d5466df7360310f01757d5b513cf4c3359745b09ab3472",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "ac3606fcb3f775c9331866cb07186b1d07dba5956b6536db392b27cc7330e1af",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "81fa203f16b85f1406e0da2d3e2b952f48768f70b7a3ba9ee488d0ac3fc0a47a",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "13cae955220577b1be76283a90edcf206a696f3017a1c4d95e13d06545256492",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "b315acb3fe1248523bd1cba13f0e9419a3f1fed852d52a6e88bb2665c1fc50bb",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "5b2124d7cb6f2d3f9a7ff72483dee757d516b481c408523cb45c3c0377fcd2a9",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "329e99fc3702f97467353f012e01fcb1b56c4ace3d1a64b3a55920f5e0f378a8",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "72fb0dd00b8df6bb5ccba76d7a2fb0b41077bf7d2b655a70e6bf3a1fdf204283",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "067df260ceff91170cc1ddbb7b8c44a7d9c09feff8f9179aeb334e7b3c00b420",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "c9c06860121022396f126390b0ca200fa1b807969febc08a6ddb5abca248e0d9",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "0caf4386bf4438b916dc914c103fa2ab2f4b41d7058d2769e45993e2aa5d97cf",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "c2789b63b564aa04c685fb40058933bf368eaf7beaff825461c72ce5489c8abc",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "5e8c262da6fa10151424e8851d3c1b1dddab6b6d8ee5e273b555626ffb28a36c",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "e1de57ba930e0e8921ddb2c1866549fc485c41ed096ffee45efc4fd16aa92b76",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "42fb097fdd65faf2c089814152fd97d30de553df75ca053d3bf6014453ad533b",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "92e0cb6e234075d9fc1a567884f5dd7ac6d1666479319376d07179e68b6a54a6",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "29c12566ed7044dd111ae72590e683f74cacbaa73127dd89d9698f8ebf527b32",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "cb687beffc044d8ac0aca04838a993f090d025bcb5d0b90023160de6780c0d7f",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "eb2b9b70ed1ed63b93a970f966a5eb264c8ec71c42d52cf0b457c08a4c855c5f",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "098e170a5bc8526e8d03a416f92e1008e8ce63cf6b5ff430f3c5fb68bea57eaf",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "b22c8ae7386d993a2634e7c184ca7a7c3ba8c4f6c492fddbe808ee0af26216e3",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME."
}
]
diff --git a/scripts/upgrade-thin.sh b/scripts/upgrade-thin.sh
new file mode 100644
index 00000000..1da9d0a6
--- /dev/null
+++ b/scripts/upgrade-thin.sh
@@ -0,0 +1,278 @@
+#!/usr/bin/env bash
+# Thin v1 production upgrade for equipo: from the staged version production
+# serves to the next staged version, on the same database, runners first
+# (the staging release order, scripts/staging-thin.py release).
+#
+# scripts/upgrade-thin.sh <version> # print the plan only (default)
+# scripts/upgrade-thin.sh <version> --execute # a person runs it, step by step
+# scripts/upgrade-thin.sh rollback [--execute] # restore the recorded prior state
+#
+# <version> is a `make release` version staging passed on exactly these
+# bytes (`make staged-check`), read from $EQUIPO_RELEASE_REPO/releases
+# (default: this checkout). Agents must not run --execute: it changes
+# production. Each step asks first and stops on the first failure. The run
+# is resumable: steps done are recorded in $BACKUPS/upgrade.state and
+# skipped. When the next upgrade starts, a finished or rolled-back one's
+# state is kept as upgrade-<version>-<stamp>.state.
+#
+# Upgrade:
+# 1 preflight staged-check, artifacts, CARLOS sign-in; the cutover (or the
+# last upgrade) finished and production serves its version,
+# which <version> descends from; the runner unit and roots are
+# production's, not staging's; nothing in flight; records the
+# prior state (served version, EQUIPO_DATABASE, runner
+# service.env and unit)
+# 2 backup carlos db pull, integrity-checked, counted, hashed, read-only.
+# The upgrade keeps EQUIPO_DATABASE: never a fresh database.
+# 3 runner the staged runner beside the current one, checked by
+# verify-installed; nothing in flight, then the unit switches
+# and restarts, keeping its state and enrolment
+# 4 instance the staged instance with --swap hold, until /api/version
+# reports it. Its migrations run when it starts.
+# 5 verify the version, the runner connected on it, and the running
+# runner's hash equal to the staged record's
+#
+# Rollback restores the previous runner (service.env and unit) and promotes
+# the previously served version. It does not roll back the database: once
+# step 4 has started, the new version's migrations may have run, and the
+# backup from step 2 is the only copy from before them.
+set -euo pipefail
+
+APP=equipo
+ACCOUNT=oficina
+CONSOLE=https://console.carloku.com
+HOST=equipo.bds.oncarlos.com
+ORIGIN=https://$HOST
+PUBLIC_ORIGIN=${EQUIPO_PUBLIC_ORIGIN:-https://equipo.oficina.works}
+UNIT=equipo-runner.service
+RUNNER_ROOT=$HOME/.local/share/equipo-runner
+STAGING_ROOT=$HOME/.local/share/equipo-runner-staging
+BACKUPS=$HOME/.local/share/equipo-cutover
+CUTOVER_STATE=$BACKUPS/cutover.state
+STATE=$BACKUPS/upgrade.state
+REPO=$(cd "$(dirname "$0")/.." && pwd)
+RELEASE_REPO=${EQUIPO_RELEASE_REPO:-$REPO}
+RELEASES=$RELEASE_REPO/releases
+PROC=${UPGRADE_PROC:-/proc}
+carlos_app=(--app "$APP" --account "$ACCOUNT" --console "$CONSOLE")
+IN_FLIGHT="SELECT (SELECT count(*) FROM chat_steps WHERE state IN ('queued','running'))||'/'||(SELECT count(*) FROM chat_steps WHERE specialist='merge' AND state IN ('queued','running'))"
+
+mode=upgrade
+version=${1:-}
+[[ $version == rollback ]] && mode=rollback
+execute=0
+[[ ${2:-} == --execute ]] && execute=1
+if [[ $mode == upgrade && ! $version =~ ^[0-9a-f]{7,12}$ ]]; then
+ sed -n '2,38p' "$0"
+ exit 2
+fi
+
+die() { echo "refused: $*" >&2; exit 1; }
+# A refusal read from the records stops --execute; the plan notes it and goes on.
+refuse() {
+ if ((execute)); then die "$*"; fi
+ echo " ! would refuse: $*"
+}
+step() {
+ printf '\n== %s\n' "$1"
+ if ((execute)) && [[ ${UPGRADE_YES:-} != 1 ]]; then
+ read -r -p "Run this step? Type yes: " answer
+ [[ $answer == yes ]] || { echo "stopped before: $1"; exit 1; }
+ fi
+}
+run() {
+ printf ' $ %s\n' "$*"
+ if ((execute)); then "$@"; fi
+}
+# Recorded facts and finished steps, one KEY=value per line.
+get_in() { [[ -f $1 ]] && sed -n "s/^$2=//p" "$1" | tail -1 || true; }
+get() { get_in "$STATE" "$1"; }
+put() { ((execute)) && printf '%s=%s\n' "$1" "$2" >>"$STATE" || true; }
+# A finished or rolled-back upgrade's record is history: its steps are not this run's.
+history=0
+done_step() { ((!history)) && [[ $(get "done_$1") == 1 ]]; }
+finish() { put "done_$1" 1; }
+env_value() { awk -v k="$1" '$1 == k { print $2; found = 1 } END { if (!found) print "-unset-" }'; }
+file_value() { sed -n "s/^$1=\"\{0,1\}\([^\"]*\)\"\{0,1\}$/\1/p" "$2"; }
+overlaps() { case "$1/" in "$2"/*) return 0 ;; esac; case "$2/" in "$1"/*) return 0 ;; esac; return 1; }
+wait_serving() { run bash -c "for i in \$(seq 60); do [ \"\$(curl -fsS $ORIGIN/api/version)\" = $1 ] && exit 0; sleep 2; done; exit 1"; }
+# Steps queued or running, and merges among them: a runner restart fails a
+# running step, and a merge needs the runner it started with.
+idle() {
+ local out
+ out=$(carlos db query "${carlos_app[@]}" --sql "$IN_FLIGHT" | tail -1) || die "could not read the steps in flight"
+ [[ $out =~ ^[0-9]+/[0-9]+$ ]] || die "could not read the steps in flight"
+ [[ $out == 0/0 ]] || die "in flight (steps/merges): $out; run again when nothing runs"
+}
+database_note() {
+ echo " The database is not rolled back. If $(get version) started, its migrations may have run,"
+ echo " and $(get prev_version) now runs on the migrated database. The copy from before the upgrade:"
+ echo " $(get backup) (sha256 $(get backup_sha256))"
+ echo " No carlos verb writes a database back to an instance (carlos db only reads a copy)."
+ echo " To restore it, a platform operator replaces $(get database) of $HOST with that file,"
+ echo " with the instance stopped. Check it first:"
+ echo " python3 -c \"import sqlite3; print(sqlite3.connect('file:$(get backup)?mode=ro', uri=True).execute('pragma integrity_check').fetchone()[0])\""
+}
+
+if [[ $mode == rollback ]]; then
+ [[ -f $STATE ]] || die "no upgrade was recorded ($STATE)"
+ [[ $(get rolled_back) != 1 ]] || die "already rolled back"
+ snap=$BACKUPS/upgrade-$(get stamp)
+ [[ -n $(get stamp) && -f $snap/service.env && -f $snap/equipo-runner.service ]] || die "the prior state was not recorded"
+ step "rollback 1 stop the runner"
+ run systemctl --user stop "$UNIT"
+ step "rollback 2 the previous runner's service.env and unit"
+ run cp -p "$snap/service.env" "$RUNNER_ROOT/service.env"
+ run cp -p "$snap/equipo-runner.service" "$RUNNER_ROOT/equipo-runner.service"
+ run systemctl --user daemon-reload
+ step "rollback 3 the previous instance version"
+ run carlos promote "${carlos_app[@]}" "$(get prev_version)" edge
+ wait_serving "$(get prev_version)"
+ step "rollback 4 start the previous runner"
+ run systemctl --user start "$UNIT"
+ put rolled_back 1
+ if ((!execute)) || [[ $(get instance_started) == 1 ]]; then database_note; fi
+ ((execute)) || echo $'\nPlan only. A person runs it with --execute.'
+ exit 0
+fi
+
+instance=$RELEASES/equipo-linux-arm64-$version
+runner_release=$RELEASES/equipo-runner-linux-amd64-$version
+staged=$RELEASES/staged/$version.json
+
+# The version production should serve: an unfinished upgrade to this
+# version resumes from its record; otherwise the last upgrade (finished, or
+# rolled back to its previous version) names it, or else the cutover.
+if [[ -f $STATE && $(get rolled_back) == 1 ]]; then
+ base=$(get prev_version) history=1
+elif [[ -f $STATE ]] && done_step verify; then
+ base=$(get version) history=1
+elif [[ -f $STATE ]]; then
+ [[ $(get version) == "$version" ]] || die "an upgrade to $(get version) is unfinished; finish it or roll it back"
+ base=$(get prev_version)
+else
+ [[ -f $CUTOVER_STATE ]] || refuse "no cutover was recorded ($CUTOVER_STATE)"
+ [[ $(get_in "$CUTOVER_STATE" done_verify) == 1 && $(get_in "$CUTOVER_STATE" rolled_back) != 1 ]] ||
+ refuse "the cutover has not finished ($CUTOVER_STATE has no done_verify)"
+ base=$(get_in "$CUTOVER_STATE" version)
+fi
+[[ $base != "$version" ]] || die "production is already on $version"
+echo "Upgrade production from ${base:--unknown-} to $version."
+
+step "1 preflight"
+run make -C "$RELEASE_REPO" staged-check RELEASE_VERSION="$version"
+run test -f "$instance"
+run test -x "$runner_release/equipo-runner"
+run test -x "$runner_release/equipo-tool-proxy"
+run test -f "$RUNNER_ROOT/equipo-runner.service"
+run test -f "$RUNNER_ROOT/service.env"
+run carlos apps list --account "$ACCOUNT" --console "$CONSOLE"
+echo " production serves ${base:--unknown-} ($ORIGIN/api/version), and $version descends from it (git merge-base)"
+echo " $UNIT is $RUNNER_ROOT/equipo-runner.service, enrolled, talking to $PUBLIC_ORIGIN, roots not shared with $STAGING_ROOT"
+echo " EQUIPO_DATABASE is set and recorded (carlos env list); nothing in flight:"
+printf ' $ carlos db query %s --sql "%s" # must be 0/0\n' "${carlos_app[*]}" "$IN_FLIGHT"
+if ((execute)) && ! done_step preflight; then
+ served=$(curl -fsS "$ORIGIN/api/version") || die "could not read the served version"
+ [[ $served == "$base" ]] || die "production serves $served, but the records say $base"
+ git -C "$RELEASE_REPO" merge-base --is-ancestor "$base" "$version" || die "$version does not descend from $base"
+ unit_file=$(systemctl --user show -p FragmentPath --value "$UNIT") || die "could not read $UNIT"
+ [[ $(readlink -f "$unit_file") == "$RUNNER_ROOT/equipo-runner.service" ]] || die "$UNIT is not the production runner unit"
+ grep -qx "EnvironmentFile=$RUNNER_ROOT/service.env" "$RUNNER_ROOT/equipo-runner.service" || die "$UNIT does not read $RUNNER_ROOT/service.env"
+ [[ $(file_value EQUIPO_RUNNER_STATE_DIR "$RUNNER_ROOT/service.env") == "$RUNNER_ROOT/state" ]] || die "the runner state is not $RUNNER_ROOT/state"
+ [[ -f $RUNNER_ROOT/state/credentials.json ]] || die "the runner is not enrolled"
+ [[ $(file_value EQUIPO_ORIGIN "$RUNNER_ROOT/service.env") == "$PUBLIC_ORIGIN" ]] || die "the runner does not talk to $PUBLIC_ORIGIN: finish the cutover first"
+ if [[ -f $STAGING_ROOT/service.env ]]; then
+ for key in EQUIPO_RUNNER_STATE_DIR EQUIPO_WORKSPACE_ROOT EQUIPO_SCRATCH_ROOT; do
+ mine=$(file_value "$key" "$RUNNER_ROOT/service.env")
+ theirs=$(file_value "$key" "$STAGING_ROOT/service.env")
+ if [[ -n $mine && -n $theirs ]] && overlaps "$mine" "$theirs"; then
+ die "$key is shared with the staging runner"
+ fi
+ done
+ fi
+ listing=$(carlos env list "${carlos_app[@]}") || die "could not read the instance configuration"
+ grep -q '^KEY' <<<"$listing" || die "unexpected configuration listing"
+ database=$(env_value EQUIPO_DATABASE <<<"$listing")
+ [[ $database =~ ^[A-Za-z0-9._-]{1,128}$ && $database != -unset- ]] || die "EQUIPO_DATABASE is not set"
+ idle
+ install -d -m 0700 "$BACKUPS"
+ if ((history)); then mv "$STATE" "$BACKUPS/upgrade-$(get version)-$(get stamp).state"; history=0; fi
+ stamp=$(date -u +%Y%m%dT%H%M%SZ)
+ install -d -m 0700 "$BACKUPS/upgrade-$stamp"
+ cp -p "$RUNNER_ROOT/service.env" "$RUNNER_ROOT/equipo-runner.service" "$BACKUPS/upgrade-$stamp/"
+ put version "$version"
+ put stamp "$stamp"
+ put prev_version "$served"
+ put database "$database"
+ finish preflight
+fi
+stamp=PLAN
+((history)) || stamp=$(get stamp)
+stamp=${stamp:-PLAN}
+
+step "2 backup: the current database (the upgrade keeps EQUIPO_DATABASE)"
+if ! done_step backup; then
+ backup=$BACKUPS/equipo-upgrade-$stamp.db
+ run carlos db pull "${carlos_app[@]}" --out "$backup"
+ run python3 -c "import sqlite3,sys; c=sqlite3.connect('file:$backup?mode=ro', uri=True); r=c.execute('pragma integrity_check').fetchone()[0]; print('integrity', r); [print(t, c.execute('select count(*) from '+t).fetchone()[0]) for t in ('teams','chat_tasks','chat_steps','chat_turns','runners')]; sys.exit(r!='ok')"
+ run sha256sum "$backup"
+ run chmod 0400 "$backup"
+ if ((execute)); then
+ put backup "$backup"
+ put backup_sha256 "$(sha256sum "$backup" | cut -d ' ' -f 1)"
+ fi
+ finish backup
+fi
+
+step "3 runner: the staged runner beside the current one, then the unit switches"
+new=$RUNNER_ROOT/releases/$version
+if ! done_step runner; then
+ run install -d -m 0700 "$new"
+ run install -m 0700 "$runner_release/equipo-runner" "$runner_release/equipo-tool-proxy" "$new/"
+ # The staged runner holds every program its configuration names, and
+ # its own tool proxy, to its release's digests before anything switches.
+ run bash -c "set -a; . '$RUNNER_ROOT/service.env'; set +a; EQUIPO_TOOL_PROXY_PATH='$new/equipo-tool-proxy' '$new/equipo-runner' verify-installed"
+ echo " nothing in flight, again, just before the restart (a restart fails a running step)"
+ if ((execute)); then idle; fi
+ run sed -i -e "s|^EQUIPO_TOOL_PROXY_PATH=.*|EQUIPO_TOOL_PROXY_PATH=\"$new/equipo-tool-proxy\"|" "$RUNNER_ROOT/service.env"
+ run sed -i -e "s|^ExecStart=.*|ExecStart=$new/equipo-runner run|" "$RUNNER_ROOT/equipo-runner.service"
+ run systemctl --user daemon-reload
+ run systemctl --user restart "$UNIT"
+ finish runner
+fi
+
+step "4 instance: the staged instance with --swap hold; its migrations run on start"
+echo " From here a rollback restores the previous version but not the database: that needs the step 2 backup."
+if ! done_step instance; then
+ put instance_started 1
+ run carlos deploy "${carlos_app[@]}" --channel edge --target linux-arm64 --swap hold --version "$version" --timeout 5m --no-prompt "$instance"
+ wait_serving "$version"
+ finish instance
+fi
+
+step "5 verify"
+want=$( [[ -f $staged ]] && python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["sha256"]["runner"])' "$staged" || echo "the runner hash in $staged")
+connected="SELECT count(*) FROM runner_sessions WHERE connected=1 AND json_extract(hello,'\$.versions.runner')='$version'"
+run curl -fsS "$ORIGIN/api/version"
+run systemctl --user is-active "$UNIT"
+echo " sha256 of $PROC/<MainPID of $UNIT>/exe must be $want"
+printf ' $ carlos db query %s --sql "%s" # at least 1\n' "${carlos_app[*]}" "$connected"
+if ((execute)) && ! done_step verify; then
+ [[ $(curl -fsS "$ORIGIN/api/version") == "$version" ]] || die "production does not report $version"
+ pid=$(systemctl --user show -p MainPID --value "$UNIT")
+ [[ $pid =~ ^[1-9][0-9]*$ ]] || die "$UNIT is not running"
+ [[ $(sha256sum "$PROC/$pid/exe" | cut -d ' ' -f 1) == "$want" ]] || die "the running runner is not the staged $version runner"
+ n=
+ for _ in $(seq "${UPGRADE_TRIES:-30}"); do
+ n=$(carlos db query "${carlos_app[@]}" --sql "$connected" 2>/dev/null | tail -1 || true)
+ [[ $n =~ ^[1-9][0-9]*$ ]] && break
+ n=
+ sleep "${UPGRADE_WAIT:-5}"
+ done
+ [[ -n $n ]] || die "no runner on $version is connected; to undo: scripts/upgrade-thin.sh rollback --execute"
+ finish verify
+fi
+echo " Then, as the owner: sign in at $PUBLIC_ORIGIN/conversation, check the offline line is"
+echo " gone, say hello and see the reply stream."
+echo " To undo: scripts/upgrade-thin.sh rollback --execute"
+((execute)) || echo $'\nPlan only. A person runs it with --execute.'