oficina / equipo Public

Merge branch 'upgrade-thin' into main

Merge upgrade-thin: production upgrade and cutover-finish scripts

upgrade-thin.sh upgrades production between staged versions; cutover-
finish-thin.sh completed the 11-19 cutover on the kept database (run by
Paul 11-20). cutover rollback refuses after deploy. Astra: two rounds.
claude agent, operated by paul@keymail.dev b1f66f09e1f5efc081dfb9b06b1a149209ec5182 parent 07e4c8fparent 3dbfeae
8 files changed, +2,257 −13
  • internal/release/cutover_finish_test.go +444 −0
  • internal/release/cutover_test.go +64 −12
  • internal/release/upgrade_test.go +419 −0
  • scripts/cutover-finish-thin.sh +290 −0
  • scripts/cutover-thin.sh +15 −1
  • scripts/runner-config.py +117 −0
  • scripts/runner-reference-allowlist.json +574 −0
  • scripts/upgrade-thin.sh +334 −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/main: Type  Size Avail | ext4   96G   87G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   87G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.4s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.5s
ci-box: opencode: installed and verified in 2.2s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.7s
ci-box: clone deepened in 2.9s
ci-box: file times set from content: 2721 files, 174 directories
ci-box: ready in 16.4s
=== 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.8s
+ 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.523s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m18.038s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m18.04s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 39.78, cpu waiting 25.46%, memory waiting 0.00%, io waiting 0.52%
--- 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 1m22.249s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m20.635s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m20.63s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 39.78, cpu waiting 24.89%, memory waiting 0.00%, io waiting 0.50%
--- 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 1m24.041s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m21.955s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m11.63s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.67s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.66s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 37.64, cpu waiting 24.53%, memory waiting 0.00%, io waiting 0.48%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m18.886s 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.308s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.85s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 20.01s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.12s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.33s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 40.02, cpu waiting 25.99%, memory waiting 0.00%, io waiting 0.53%
--- 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 1m35.653s 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 1m34.032s amadan.net/oficina/equipo/internal/headless
receipt: slow test 59.35s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.89s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 9.63s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.47s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.7s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 33.90, cpu waiting 20.45%, memory waiting 0.00%, io waiting 0.39%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

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

receipt: test step 393ms 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 2.58, cpu waiting 0.06%, memory waiting 0.00%, io waiting 1.95%
--- 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 308ms 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 2.58, cpu waiting 0.06%, memory waiting 0.00%, io waiting 1.95%
--- 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 4m29.494s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m42.416s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 4m29.494s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.95s 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.45s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.8s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.56, cpu waiting 0.92%, memory waiting 0.00%, io waiting 0.11%
--- 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.107s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 45.967s amadan.net/oficina/equipo/internal/runner
receipt: slow test 25.94s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 34.38, cpu waiting 22.06%, memory waiting 0.00%, io waiting 0.92%
--- 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 49.296s 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 47.373s amadan.net/oficina/equipo/internal/runner
receipt: slow test 37.46s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 32.88s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.34s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.56s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 34.75, cpu waiting 24.85%, memory waiting 0.00%, io waiting 0.86%
--- 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.549s 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.645s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.12s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.3s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.12s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.96s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 21.85, cpu waiting 14.26%, memory waiting 0.00%, io waiting 1.12%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 27.6%, load 21.85
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.522s 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.645s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.96s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.92s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 24.95s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.51s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.35s amadan.net/oficina/equipo/internal/equipotest TestAuthoritySnapshotChanges
machine: 32 CPUs, load 33.90, cpu waiting 21.11%, memory waiting 0.00%, io waiting 0.41%
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 27.6%, load 21.85
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 393ms 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 21.85, cpu waiting 11.28%, memory waiting 0.00%, io waiting 1.20%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 28.0%, load 21.85
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.553s 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.528s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.59s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.86s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.87s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.81s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.79s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 31.35, cpu waiting 17.93%, memory waiting 0.00%, io waiting 0.34%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 27.6%, load 21.85
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 464ms 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 21.85, cpu waiting 11.28%, memory waiting 0.00%, io waiting 1.20%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 27.6%, load 21.85
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 569ms 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 21.85, cpu waiting 11.28%, memory waiting 0.00%, io waiting 1.20%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 27.6%, load 21.85
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/cmd/equipo-runner: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runnerproto: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget note: internal/equipo took 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/release took 22.788s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/containment took 42.551s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m17.285s against a 60s target (the gate's other steps are not in this figure)
receipt: 14 packages ran, 46 cached, 18 without tests, 0 failed
receipt: slow package 57.08s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.176s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 47.583s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 42.551s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 41.84s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 30.51s amadan.net/oficina/equipo/cmd/equipo-runner TestReleaseRunnerHasNoFakeWorker
receipt: slow test 21.71s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 16.83s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 15.95s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 10.16s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeP1OnlyOpenCodeReachable
machine: 32 CPUs, load 11.91, cpu waiting 6.20%, memory waiting 0.00%, io waiting 0.11%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m22.577s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m20.967s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.09s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.79s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.04s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.61s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.12s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 39.78, cpu waiting 24.89%, memory waiting 0.00%, io waiting 0.50%
--- 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.994s 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 1m29.395s amadan.net/oficina/equipo/internal/headless
receipt: slow test 25.97s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 22.46s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.61s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 10.06s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.86s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 35.98, cpu waiting 21.75%, memory waiting 0.00%, io waiting 0.42%
--- 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.855s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m38.182s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.92s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 12.92s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 12.68s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 10.49s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.08s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 31.35, cpu waiting 19.13%, memory waiting 0.00%, io waiting 0.37%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-20T05:36:21.800Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T05:36:21.800Z level=INFO msg="startup phase done" phase=state_lock took=132µs
time=2026-11-20T05:36:21.800Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T05:36:21.800Z level=INFO msg="startup phase done" phase=claim_roots took=124µs
time=2026-11-20T05:36:21.800Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T05:36:21.832Z level=INFO msg="startup phase done" phase=sweep took=31.65ms
time=2026-11-20T05:36:21.832Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T05:36:21.832Z level=INFO msg="startup phase done" phase=credentials took=134µs
time=2026-11-20T05:36:21.832Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T05:36:21.871Z level=INFO msg="startup phase done" phase=open_state took=38.925ms
time=2026-11-20T05:36:21.872Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T05:36:21.872Z level=INFO msg=connecting host=127.0.0.1:39523 protocol=28
time=2026-11-20T05:36:21.873Z level=INFO msg=connected host=127.0.0.1:39523 took=906µs
time=2026-11-20T05:36:21.874Z level=INFO msg="capabilities gathering"
time=2026-11-20T05:36:21.874Z level=INFO msg="capabilities gathered" took=381µs tags=linux,claude,go
time=2026-11-20T05:36:21.875Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T05:36:21.880Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T05:36:22.929Z level=INFO msg="connection checked" connection=claude-1 state=healthy
    browser_receipts_test.go:169: waiting for [...document.querySelectorAll('[equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes("I'm your coordinator")): context deadline exceeded (last evaluation: <nil>)
--- FAIL: TestBrowserEmptyExplore (5.78s)

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


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

receipt: test step 313ms 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 183ms 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 201ms 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 250ms 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 2.58, cpu waiting 1.27%, memory waiting 0.00%, io waiting 1.92%
--- 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.30s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.20s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.72s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 25.38s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless   (55s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 14.16s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 12.61s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 10.96s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 15.22s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (21s)
ok ./internal/headless TestMixedVersions 19.83s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (1s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.76s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (0s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 36.69, cpu waiting 25.52%, memory waiting 0.00%, io waiting 0.77%
--- 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.069s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 3 without tests, 0 failed
receipt: slow package 7.002s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 198ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 83ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 4.95s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.67s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 290ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 200ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 80ms 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.04s 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.735s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 170ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryReusedPID
machine: 32 CPUs, load 8.34, cpu waiting 4.13%, memory waiting 0.00%, io waiting 1.68%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 28.0%, load 21.85
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2435 text files, 2842 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.519s
machine: 32 CPUs, load 34.38, cpu waiting 22.06%, memory waiting 0.00%, io waiting 0.92%
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 27.6%, load 21.85
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 21.85, cpu waiting 12.78%, memory waiting 0.00%, io waiting 1.16%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 27.6%, load 21.85
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 27.95, cpu waiting 15.49%, memory waiting 0.00%, io waiting 1.08%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 28.0%, load 21.85
shard 28: make gitleaks
5:35AM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
5:35AM INF 1023 commits scanned.
5:35AM INF scanned ~59954680 bytes (59.95 MB) in 13.8s
5:35AM INF no leaks found
machine: 32 CPUs, load 29.80, cpu waiting 19.80%, memory waiting 0.00%, io waiting 0.98%
=== 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.061ms, worst 1.09ms, budget 150ms
perf: GET /api/runner/protocol: median 95µs, worst 121µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 617µs, worst 699µs, budget 150ms
perf: GET /api/v1/accounts: median 416µs, worst 432µs, budget 150ms
perf: GET /api/v1/auth/devices: median 457µs, worst 491µs, budget 150ms
perf: GET /api/v1/budgets: median 480µs, worst 507µs, budget 150ms
perf: GET /api/v1/capabilities: median 251µs, worst 273µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.239ms, worst 1.308ms, budget 150ms
perf: GET /api/v1/connections: median 573µs, worst 616µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 549µs, worst 567µs, budget 150ms
perf: GET /api/v1/conversation: median 938µs, worst 996µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.536ms, worst 1.562ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.771ms, worst 1.881ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 460µs, worst 485µs, budget 150ms
perf: GET /api/v1/journey: median 8.872ms, worst 9.136ms, budget 150ms
perf: GET /api/v1/me: median 457µs, worst 498µs, budget 150ms
perf: GET /api/v1/me/settings: median 575µs, worst 594µs, budget 150ms
perf: GET /api/v1/needs-you: median 8.695ms, worst 8.861ms, budget 150ms
perf: GET /api/v1/notifications: median 1.612ms, worst 1.687ms, budget 150ms
perf: GET /api/v1/onboarding: median 403µs, worst 447µs, budget 150ms
perf: GET /api/v1/people: median 434µs, worst 487µs, budget 150ms
perf: GET /api/v1/playbooks: median 574µs, worst 593µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 514µs, worst 573µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 814µs, worst 860µs, budget 150ms
perf: GET /api/v1/preferences: median 759µs, worst 784µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 462µs, worst 473µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 571µs, worst 596µs, budget 150ms
perf: GET /api/v1/roster: median 461µs, worst 504µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 415µs, worst 426µs, budget 150ms
perf: GET /api/v1/specialists: median 7.937ms, worst 8.021ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.668ms, worst 7.86ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 830µs, worst 905µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.086ms, worst 1.106ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 704µs, worst 731µs, budget 150ms
perf: GET /api/v1/teams: median 432µs, worst 447µs, budget 150ms
perf: GET /api/v1/templates: median 578µs, worst 625µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 455µs, worst 464µs, budget 150ms
perf: GET /auth/callback: median 77µs, worst 103µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.157ms, worst 3.423ms, budget 150ms
perf: GET /auth/verify: median 78µs, worst 107µs, budget 150ms
perf: GET /connections: median 3.524ms, worst 3.592ms, budget 150ms
perf: GET /conversation: median 7.533ms, worst 10.339ms, budget 150ms
perf: GET /conversation/connections: median 246µs, worst 277µs, budget 150ms
perf: GET /conversation/notebook: median 241µs, worst 265µs, budget 150ms
perf: GET /conversation/settings: median 3.879ms, worst 3.954ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.487ms, worst 3.531ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.018ms, worst 6.115ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.142ms, worst 6.268ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.46ms, worst 3.548ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 3.937ms, worst 4.065ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.354ms, worst 4.418ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.487ms, worst 6.359ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.395ms, worst 3.506ms, budget 150ms
perf: GET /conversation/settings/thinking: median 3.859ms, worst 3.902ms, budget 150ms
perf: GET /housekeeping: median 3.652ms, worst 3.703ms, budget 150ms
perf: GET /invites/new: median 583µs, worst 608µs, budget 150ms
perf: GET /invites/{id}: median 610µs, worst 656µs, budget 150ms
perf: GET /jobs: median 3.189ms, worst 3.274ms, budget 150ms
perf: GET /jobs/{id}: median 4.297ms, worst 4.379ms, budget 150ms
perf: GET /journey: median 10.075ms, worst 10.148ms, budget 150ms
perf: GET /nav/rail: median 2.86ms, worst 2.956ms, budget 150ms
perf: GET /needs-you: median 10.306ms, worst 13.393ms, budget 150ms
perf: GET /onboarding: median 3.888ms, worst 3.939ms, budget 150ms
perf: GET /people: median 3.296ms, worst 3.415ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.489ms, worst 4.534ms, budget 150ms
perf: GET /playbooks: median 3.997ms, worst 4.048ms, budget 150ms
perf: GET /playbooks/new: median 4.145ms, worst 4.207ms, budget 150ms
perf: GET /playbooks/{id}: median 4.64ms, worst 4.701ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.586ms, worst 4.698ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 3.841ms, worst 3.891ms, budget 150ms
perf: GET /preferences: median 4.018ms, worst 4.058ms, budget 150ms
perf: GET /preferences/sources/{source}: median 3.913ms, worst 4.024ms, budget 150ms
perf: GET /projects: median 5.254ms, worst 7.985ms, budget 150ms
perf: GET /projects/accounts: median 3.564ms, worst 3.767ms, budget 150ms
perf: GET /projects/new: median 3.494ms, worst 3.542ms, budget 150ms
perf: GET /projects/{id}: median 10.086ms, worst 10.198ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.584ms, worst 3.618ms, budget 150ms
perf: GET /runners/enrol: median 4.211ms, worst 4.35ms, budget 150ms
perf: GET /settings: median 3.244ms, worst 3.398ms, budget 150ms
perf: GET /settings/coordinator: median 5.214ms, worst 5.365ms, budget 150ms
perf: GET /settings/devices: median 3.186ms, worst 3.29ms, budget 150ms
perf: GET /settings/recovery: median 3.272ms, worst 3.355ms, budget 150ms
perf: GET /settings/recovery/release: median 3.432ms, worst 3.537ms, budget 150ms
perf: GET /settings/thinking: median 262µs, worst 288µs, budget 150ms
perf: GET /signin: median 353µs, worst 365µs, budget 150ms
perf: GET /specialists/new: median 3.368ms, worst 3.468ms, budget 150ms
perf: GET /specialists/{key}: median 12.657ms, worst 12.824ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.9ms, worst 4.029ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 4.037ms, worst 4.121ms, budget 150ms
perf: GET /tasks: median 5.535ms, worst 5.594ms, budget 150ms
perf: GET /tasks/new: median 3.37ms, worst 3.467ms, budget 150ms
perf: GET /tasks/{id}: median 5.973ms, worst 6.164ms, budget 150ms
perf: GET /tasks/{id}/merge: median 5.328ms, worst 5.361ms, budget 150ms
perf: GET /tasks/{id}/move: median 5.019ms, worst 5.086ms, budget 150ms
perf: GET /tasks/{id}/plan: median 5.522ms, worst 5.685ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.444ms, worst 1.529ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 4.991ms, worst 5.07ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 4.57ms, worst 4.6ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.042ms, worst 4.163ms, budget 150ms
perf: GET /tasks/{id}/thread: median 7.666ms, worst 7.77ms, budget 150ms
perf: GET /team/{specialist}: median 4.198ms, worst 4.278ms, budget 150ms
perf: GET /teams: median 11.818ms, worst 14.497ms, budget 150ms
perf: GET /templates: median 3.729ms, worst 3.918ms, budget 150ms
perf: GET /usage: median 4.407ms, worst 4.459ms, budget 150ms
perf: GET /work: median 3.187ms, worst 3.239ms, budget 150ms
perf: cold boot: median 255ms of [254.215285ms 255.138195ms 256.544385ms], budget 500ms

receipt: test step 28.893s 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.825s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-runner
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-tool-proxy
receipt: slow package 0s amadan.net/oficina/equipo/internal/advice
receipt: slow package 0s amadan.net/oficina/equipo/internal/attach
receipt: slow test 8.01s 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: 2.90 GiB in 21415 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 0.84 GiB in 27329 files
diff --git a/internal/release/cutover_finish_test.go b/internal/release/cutover_finish_test.go
new file mode 100644
index 00000000..b971d84f
--- /dev/null
+++ b/internal/release/cutover_finish_test.go
@@ -0,0 +1,444 @@
+package release
+
+import (
+ "crypto/sha256"
+ "encoding/hex"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+const (
+ finishVersion = "abc1234"
+ keptID = "KEPTINSTANCE00000000000000"
+)
+
+// finishRig is production as the 2026-11-19 cutover left it: steps 1 to 5
+// recorded, the instance serving finishVersion on the kept database, the
+// old runner stopped with its old origin and files. scripts/cutover-finish-thin.sh
+// runs against stub carlos, systemctl, journalctl and curl on a temporary
+// HOME; carlos db (the replica) fails if anything calls it.
+type finishRig struct {
+ t *testing.T
+ root, home, runner string
+ repo, log string
+ serviceEnv, unit string
+}
+
+func newFinishRig(t *testing.T) *finishRig {
+ t.Helper()
+ root := t.TempDir()
+ r := &finishRig{t: t, root: root, home: filepath.Join(root, "home"), log: filepath.Join(root, "calls.log"), repo: filepath.Join(root, "repo")}
+ r.runner = filepath.Join(r.home, ".local/share/equipo-runner")
+ for _, name := range []string{"cutover-finish-thin.sh", "cutover-thin.sh", "upgrade-thin.sh", "runner-config.py"} {
+ src, err := os.ReadFile("../../scripts/" + name)
+ r.must(err)
+ r.write(filepath.Join(r.repo, "scripts", name), string(src), 0700)
+ }
+ release := filepath.Join(r.repo, "releases", "equipo-runner-linux-amd64-"+finishVersion)
+ runner := "#!/bin/sh\nif [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> " + r.log + "; exit; fi\necho \"equipo-runner $1 $EQUIPO_INSTANCE_ID $EQUIPO_ORIGIN\" >> " + r.log + "\n[ -e " + filepath.Join(root, "enrolfail") + " ] && exit 1\n# The running runner holds the state lock enrol needs.\n[ -e " + filepath.Join(root, "active") + " ] && { echo state locked >&2; exit 1; }\necho new > \"$EQUIPO_RUNNER_STATE_DIR/credentials.json\"\n"
+ r.write(filepath.Join(release, "equipo-runner"), runner, 0700)
+ r.write(filepath.Join(release, "equipo-tool-proxy"), "proxy", 0700)
+ sum := func(s string) string { h := sha256.Sum256([]byte(s)); return hex.EncodeToString(h[:]) }
+ r.write(filepath.Join(r.repo, "releases", "staged", finishVersion+".json"), `{"staging": "PASS", "sha256": {"runner": "`+sum(runner)+`", "tool_proxy": "`+sum("proxy")+`"}}`, 0600)
+ r.serviceEnv = "EQUIPO_ORIGIN=\"https://equipo.bds.oncarlos.com\"\nEQUIPO_INSTANCE_ID=\"" + keptID + "\"\nEQUIPO_TOOL_PROXY_PATH=\"/old/equipo-tool-proxy\"\nEQUIPO_RUNNER_STATE_DIR=\"" + filepath.Join(r.runner, "state") + "\"\n"
+ r.unit = "[Service]\nEnvironmentFile=" + filepath.Join(r.runner, "service.env") + "\nExecStart=/old/equipo-runner run\nRestart=on-failure\nRestartSec=5\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"), "old", 0600)
+ backups := filepath.Join(r.home, ".local/share/equipo-cutover")
+ r.write(filepath.Join(backups, "cutover.state"), "version="+finishVersion+"\nstamp=20261119T140850Z\nprev_version=prev999\nprev_always_on=1\nprev_database=-unset-\nprev_origin=https://equipo.bds.oncarlos.com\nold_instance_id="+keptID+"\ndone_preflight=1\ndone_export=1\ndone_config=1\ndone_deploy=1\n", 0600)
+ r.write(filepath.Join(backups, "prior", "service.env"), r.serviceEnv, 0600)
+ r.write(filepath.Join(backups, "prior", "equipo-runner.service"), r.unit, 0600)
+ r.write(filepath.Join(root, "served"), finishVersion+"\n", 0600)
+ r.setInstall("https://equipo.oficina.works", finishVersion, keptID)
+ r.must(os.MkdirAll(filepath.Join(root, "proc", "4242"), 0700))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", finishVersion, "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, "curl"), "#!/bin/sh\n"+log+`case "$*" in
+*/install.sh) cat `+filepath.Join(root, "install.sh")+` ;;
+*) cat `+filepath.Join(root, "served")+` ;;
+esac
+`, 0700)
+ unitStubs(r.write, root, filepath.Join(r.runner, "equipo-runner.service"), r.log)
+ // mv and install fail once when asked to (root/failmv, root/failinstallstate):
+ // a step interrupted half way.
+ r.write(filepath.Join(bin, "mv"), "#!/bin/sh\nif [ -e "+filepath.Join(root, "failmv")+" ]; then rm "+filepath.Join(root, "failmv")+"; exit 1; fi\nexec /usr/bin/mv \"$@\"\n", 0700)
+ r.write(filepath.Join(bin, "install"), "#!/bin/sh\ncase \"$*\" in *equipo-runner/state) if [ -e "+filepath.Join(root, "failinstallstate")+" ]; then rm "+filepath.Join(root, "failinstallstate")+"; exit 1; fi ;; esac\nexec /usr/bin/install \"$@\"\n", 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\nEQUIPO_ORIGIN https://equipo.oficina.works\n' ;;
+db*) echo "the copy failed its integrity check" >&2; exit 1 ;;
+esac
+`, 0700)
+ return r
+}
+
+// setInstall is what the instance's /install.sh says.
+func (r *finishRig) setInstall(origin, version, instance string) {
+ r.write(filepath.Join(r.root, "install.sh"), "#!/bin/sh\nset -eu\ncurl --fail '"+origin+"/releases/"+version+"/install-v1.sh' | sh -s -- '"+origin+"' '"+version+"' '"+instance+"'\n", 0600)
+}
+
+func (r *finishRig) must(err error) {
+ r.t.Helper()
+ if err != nil {
+ r.t.Fatal(err)
+ }
+}
+
+func (r *finishRig) 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 *finishRig) read(path string) string {
+ raw, _ := os.ReadFile(path)
+ return string(raw)
+}
+
+func (r *finishRig) run(script string, args ...string) (string, error) {
+ cmd := exec.Command("bash", append([]string{filepath.Join(r.repo, "scripts", script)}, args...)...)
+ cmd.Env = []string{"HOME=" + r.home, "PATH=" + filepath.Join(r.root, "bin") + ":/usr/bin:/bin", "CUTOVER_YES=1", "CUTOVER_TRIES=3", "CUTOVER_WAIT=0", "CUTOVER_PROC=" + filepath.Join(r.root, "proc"), "LANG=C.UTF-8"}
+ out, err := cmd.CombinedOutput()
+ return string(out), err
+}
+
+func (r *finishRig) state() string {
+ return r.read(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"))
+}
+
+// The plan changes nothing, never reads the replica, and lists the steps.
+func TestCutoverFinishPlanChangesNothing(t *testing.T) {
+ r := newFinishRig(t)
+ state := r.state()
+ out, err := r.run("cutover-finish-thin.sh")
+ if err != nil {
+ t.Fatalf("plan: %v\n%s", err, out)
+ }
+ inOrder(t, out, "instance "+keptID, "== 6 identity", "sh -s -- 'https://equipo.oficina.works' '"+finishVersion+"' '"+keptID+"'",
+ "== 7 config", "env unset --app equipo --account oficina --console https://console.carloku.com EQUIPO_DATABASE",
+ "== 8 install", "runner-config.py render", "EQUIPO_INSTANCE_ID="+keptID, "EQUIPO_ORIGIN=https://equipo.oficina.works", "state.pre-thin-20261119T140850Z",
+ "== 9 enrol", "runner-config.py check", "verify-installed", "enrol", "== 10 start", "systemctl --user start", "== 11 verify", "_SYSTEMD_INVOCATION_ID=", "msg=welcome", "Plan only.")
+ if strings.Contains(out, "would refuse") || strings.Contains(out, "carlos db") {
+ t.Fatalf("plan refuses or reads the replica:\n%s", out)
+ }
+ if r.read(r.log) != "" || r.state() != state || r.read(filepath.Join(r.runner, "service.env")) != r.serviceEnv {
+ t.Fatalf("the plan changed something:\n%s", r.read(r.log))
+ }
+}
+
+// The finish moves the runner to the public origin with the kept instance
+// id, enrols it, verifies through the instance alone, and records the
+// steps so the upgrade accepts the cutover as finished.
+func TestCutoverFinishOnTheKeptDatabase(t *testing.T) {
+ r := newFinishRig(t)
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err != nil {
+ t.Fatalf("finish: %v\n%s", err, out)
+ }
+ calls := r.read(r.log)
+ inOrder(t, calls, "install.sh", "env unset --app equipo --account oficina --console https://console.carloku.com EQUIPO_DATABASE", "install.sh",
+ "daemon-reload", "equipo-runner verify-installed "+filepath.Join(r.runner, "releases", finishVersion, "equipo-tool-proxy"),
+ "equipo-runner enrol "+keptID+" https://equipo.oficina.works", "systemctl --user start", "install.sh", "journalctl --user -b _SYSTEMD_INVOCATION_ID=0123456789abcdef0123456789abcdef _PID=4242")
+ for _, never := range []string{"carlos db", "promote", "deploy", "env set"} {
+ if strings.Contains(calls, never) {
+ t.Fatalf("finish ran %q:\n%s", never, calls)
+ }
+ }
+ env := r.read(filepath.Join(r.runner, "service.env"))
+ if !strings.Contains(env, "EQUIPO_ORIGIN=\"https://equipo.oficina.works\"") || !strings.Contains(env, "EQUIPO_INSTANCE_ID=\""+keptID+"\"") {
+ t.Fatalf("runner config not moved:\n%s", env)
+ }
+ if r.read(filepath.Join(r.runner, "state.pre-thin-20261119T140850Z", "credentials.json")) != "old" {
+ t.Fatal("old runner state not kept aside")
+ }
+ st := r.state()
+ for _, want := range []string{"kept_database=1", "new_instance_id=" + keptID, "done_identity=1", "done_unset=1", "done_runner=1", "done_enrol=1", "done_verify=1"} {
+ if !strings.Contains(st, want) {
+ t.Fatalf("cutover.state lacks %q:\n%s", want, st)
+ }
+ }
+ if out, err = r.run("upgrade-thin.sh", "bbb2222"); err != nil || strings.Contains(out, "would refuse") {
+ t.Fatalf("upgrade does not accept the finished cutover: %v\n%s", err, out)
+ }
+ if out, err = r.run("cutover-finish-thin.sh", "--execute"); err == nil || !strings.Contains(out, "complete") {
+ t.Fatalf("second finish allowed: %v\n%s", err, out)
+ }
+}
+
+// Anything that does not show the kept database, or a cutover not at its
+// deploy, stops the finish before it changes anything.
+func TestCutoverFinishRefusesBeforeChangingAnything(t *testing.T) {
+ for name, set := range map[string]func(r *finishRig){
+ "another instance id": func(r *finishRig) {
+ r.setInstall("https://equipo.oficina.works", finishVersion, "FRESHINSTANCE0000000000000")
+ },
+ "the old origin": func(r *finishRig) { r.setInstall("https://equipo.bds.oncarlos.com", finishVersion, keptID) },
+ "another version": func(r *finishRig) { r.write(filepath.Join(r.root, "served"), "ccc3333\n", 0600) },
+ "other runner bytes": func(r *finishRig) {
+ r.write(filepath.Join(r.repo, "releases", "equipo-runner-linux-amd64-"+finishVersion, "equipo-runner"), "#!/bin/sh\n", 0700)
+ },
+ "unstaged version": func(r *finishRig) {
+ r.write(filepath.Join(r.repo, "releases", "staged", finishVersion+".json"), `{"staging": "FAIL"}`, 0600)
+ },
+ "no deploy": func(r *finishRig) {
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"), strings.Replace(r.state(), "done_deploy=1\n", "", 1), 0600)
+ },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ set(r)
+ state := r.state()
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "refused") {
+ t.Fatalf("not refused: %v\n%s", err, out)
+ }
+ for _, change := range []string{"env unset", "systemctl", "enrol"} {
+ if strings.Contains(r.read(r.log), change) {
+ t.Fatalf("changed something (%s) before refusing:\n%s", change, r.read(r.log))
+ }
+ }
+ if r.state() != state || r.read(filepath.Join(r.runner, "service.env")) != r.serviceEnv || r.read(filepath.Join(r.runner, "state", "credentials.json")) != "old" {
+ t.Fatal("state or runner changed before refusing")
+ }
+ })
+ }
+}
+
+// Verify needs the staged bytes running and the instance's welcome to that
+// process in its log; once both hold, the same run resumes and finishes.
+func TestCutoverFinishVerifiesThroughTheInstance(t *testing.T) {
+ r := newFinishRig(t)
+ r.write(filepath.Join(r.root, "journal"), "msg=\"runner stream\" err=unauthorized\n", 0600)
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err == nil || !strings.Contains(out, "not connected") {
+ t.Fatalf("verified without a welcome: %v\n%s", err, out)
+ }
+ r.write(filepath.Join(r.root, "journal"), "msg=welcome generation=2\n", 0600)
+ 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("cutover-finish-thin.sh", "--execute"); err == nil || !strings.Contains(out, "not the staged") {
+ t.Fatalf("accepted another running binary: %v\n%s", err, out)
+ }
+ if strings.Contains(r.state(), "done_verify=1") {
+ t.Fatal("verify recorded after a failed check")
+ }
+ r.must(os.Remove(exe))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", finishVersion, "equipo-runner"), exe))
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err != nil || strings.Count(r.read(r.log), "equipo-runner enrol") != 1 {
+ t.Fatalf("did not resume past finished steps: %v\n%s\n%s", err, out, r.read(r.log))
+ }
+}
+
+// Rollback puts the runner back as the cutover left it, stopped, offers
+// no earlier version, and the upgrade and the cutover's own rollback then
+// refuse.
+func TestCutoverFinishRollbackOffersNoEarlierVersion(t *testing.T) {
+ r := newFinishRig(t)
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err != nil {
+ t.Fatalf("finish: %v\n%s", err, out)
+ }
+ before := r.read(r.log)
+ out, err := r.run("cutover-finish-thin.sh", "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 || r.read(filepath.Join(r.runner, "state", "credentials.json")) != "old" {
+ t.Fatal("runner not put back exactly")
+ }
+ calls := strings.TrimPrefix(r.read(r.log), before)
+ for _, never := range []string{"promote", "deploy", "env set", "systemctl --user start"} {
+ if strings.Contains(calls, never) {
+ t.Fatalf("rollback ran %q:\n%s", never, calls)
+ }
+ }
+ if !strings.Contains(out, "prev999 is not offered") || !strings.Contains(out, "cannot read the migrated schema") {
+ t.Fatalf("rollback does not say why the earlier version is not offered:\n%s", out)
+ }
+ if out, err = r.run("upgrade-thin.sh", "bbb2222"); err != nil || !strings.Contains(out, "would refuse: the cutover has not finished") {
+ t.Fatalf("upgrade accepts a rolled-back finish: %v\n%s", err, out)
+ }
+ if out, err = r.run("cutover-thin.sh", "rollback", "--execute"); err == nil || !strings.Contains(out, "prev999 cannot read it") {
+ t.Fatalf("the cutover's rollback offers prev999: %v\n%s", err, out)
+ }
+ if out, err = r.run("cutover-finish-thin.sh", "rollback", "--execute"); err == nil {
+ t.Fatalf("second rollback allowed: %s", out)
+ }
+ if out, err = r.run("cutover-finish-thin.sh", "--execute"); err != nil {
+ t.Fatalf("finish again after rollback: %v\n%s", err, out)
+ }
+}
+
+// finished asserts the finish ended with the runner moved, the old state
+// kept aside, and the original runner files recorded.
+func (r *finishRig) finished(out string, err error) {
+ r.t.Helper()
+ if err != nil {
+ r.t.Fatalf("finish: %v\n%s", err, out)
+ }
+ if !strings.Contains(r.read(filepath.Join(r.runner, "service.env")), "EQUIPO_ORIGIN=\"https://equipo.oficina.works\"") ||
+ r.read(filepath.Join(r.runner, "state.pre-thin-20261119T140850Z", "credentials.json")) != "old" ||
+ r.read(filepath.Join(r.runner, "state", "credentials.json")) != "new\n" || !strings.Contains(r.state(), "done_verify=1") {
+ r.t.Fatalf("not finished:\n%s\n%s", out, r.state())
+ }
+ snap := filepath.Join(r.home, ".local/share/equipo-cutover/finish-20261119T140850Z")
+ if r.read(filepath.Join(snap, "service.env")) != r.serviceEnv || r.read(filepath.Join(snap, "equipo-runner.service")) != r.unit {
+ r.t.Fatal("the recorded runner files are not the originals")
+ }
+}
+
+// Step 8 interrupted anywhere resumes: after the files are written but
+// before the state moves, after the move but before the new state exists,
+// after the new state exists, and after a move nobody recorded.
+func TestCutoverFinishRunnerStepResumes(t *testing.T) {
+ for _, flag := range []string{"failmv", "failinstallstate", "failreload"} {
+ t.Run(flag, func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ r.write(filepath.Join(r.root, flag), "", 0600)
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err == nil || strings.Contains(r.state(), "done_runner=1") {
+ t.Fatalf("step 8 did not stop: %v\n%s", err, out)
+ }
+ r.finished(r.run("cutover-finish-thin.sh", "--execute"))
+ })
+ }
+ t.Run("unrecorded move", func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ r.must(os.Rename(filepath.Join(r.runner, "state"), filepath.Join(r.runner, "state.pre-thin-20261119T140850Z")))
+ r.finished(r.run("cutover-finish-thin.sh", "--execute"))
+ })
+ t.Run("both states and no record", func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ r.write(filepath.Join(r.runner, "state.pre-thin-20261119T140850Z", "credentials.json"), "older", 0600)
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "no move is recorded") || r.read(filepath.Join(r.runner, "state", "credentials.json")) != "old" {
+ t.Fatalf("went on with two runner states: %v\n%s", err, out)
+ }
+ })
+}
+
+// A record that cannot be written stops the run at once.
+func TestCutoverFinishStopsWhenItCannotRecord(t *testing.T) {
+ r := newFinishRig(t)
+ r.must(os.Chmod(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"), 0400))
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "could not record") || strings.Contains(r.read(r.log), "env unset") {
+ t.Fatalf("went on without its record: %v\n%s", err, out)
+ }
+}
+
+// The runner's files must hold each expected entry exactly once; the
+// written and the loaded configuration are checked again before enrolment.
+func TestCutoverFinishChecksTheRunnerConfig(t *testing.T) {
+ for name, set := range map[string]func(r *finishRig){
+ "origin twice": func(r *finishRig) {
+ r.serviceEnv += "EQUIPO_ORIGIN=\"https://elsewhere.example.com\"\n"
+ r.write(filepath.Join(r.runner, "service.env"), r.serviceEnv, 0600)
+ },
+ "no instance id": func(r *finishRig) {
+ r.serviceEnv = strings.Replace(r.serviceEnv, "EQUIPO_INSTANCE_ID=\""+keptID+"\"\n", "", 1)
+ r.write(filepath.Join(r.runner, "service.env"), r.serviceEnv, 0600)
+ },
+ "no RestartSec": func(r *finishRig) {
+ r.unit = strings.Replace(r.unit, "RestartSec=5\n", "", 1)
+ r.write(filepath.Join(r.runner, "equipo-runner.service"), r.unit, 0600)
+ },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ set(r)
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "not one") || strings.Contains(r.read(r.log), "equipo-runner enrol") || r.read(filepath.Join(r.runner, "state", "credentials.json")) != "old" {
+ t.Fatalf("went on with an unexpected runner config: %v\n%s", err, out)
+ }
+ })
+ }
+ t.Run("changed before enrol", func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ r.write(filepath.Join(r.root, "enrolfail"), "", 0600)
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err == nil || !strings.Contains(r.state(), "done_runner=1") {
+ t.Fatalf("enrol failure not reached: %v\n%s", err, out)
+ }
+ r.must(os.Remove(filepath.Join(r.root, "enrolfail")))
+ env := filepath.Join(r.runner, "service.env")
+ r.write(env, strings.Replace(r.read(env), "https://equipo.oficina.works", "https://equipo.bds.oncarlos.com", 1), 0600)
+ before := strings.Count(r.read(r.log), "equipo-runner enrol")
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "does not hold EQUIPO_ORIGIN") || strings.Count(r.read(r.log), "equipo-runner enrol") != before {
+ t.Fatalf("enrolled with a changed config: %v\n%s", err, out)
+ }
+ })
+ t.Run("another unit loaded", func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ r.write(filepath.Join(r.root, "loaded"), "{ path=/old/equipo-runner ; argv[]=/old/equipo-runner run }\n", 0600)
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "the loaded equipo-runner.service does not start") || strings.Contains(r.read(r.log), "equipo-runner enrol") {
+ t.Fatalf("enrolled with another unit loaded: %v\n%s", err, out)
+ }
+ })
+ t.Run("unsafe value", func(t *testing.T) {
+ cmd := exec.Command("python3", "../../scripts/runner-config.py", "check", t.TempDir(), "--exec", "/x/equipo-runner", "EQUIPO_ORIGIN=https://a|b")
+ if out, err := cmd.CombinedOutput(); err == nil || !strings.Contains(string(out), "unexpected characters") {
+ t.Fatalf("accepted a value with a replacement character: %v %s", err, out)
+ }
+ })
+}
+
+// Verified means connected now, in this invocation.
+func TestCutoverFinishVerifiesTheCurrentConnection(t *testing.T) {
+ for name, set := range map[string]func(r *finishRig){
+ "dropped since": func(r *finishRig) {
+ r.write(filepath.Join(r.root, "journal"), "msg=welcome generation=1\nmsg=\"runner stream ended\" retry_in=1s\n", 0600)
+ },
+ "another invocation each time": func(r *finishRig) { r.write(filepath.Join(r.root, "flap"), "", 0600) },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newFinishRig(t)
+ r.t = t
+ set(r)
+ out, err := r.run("cutover-finish-thin.sh", "--execute")
+ if err == nil || !strings.Contains(out, "not connected") || strings.Contains(r.state(), "done_verify=1") {
+ t.Fatalf("verified without a current connection: %v\n%s", err, out)
+ }
+ })
+ }
+}
+
+// A rollback that leaves the runner running is not recorded.
+func TestCutoverFinishRollbackChecksTheRunnerStopped(t *testing.T) {
+ r := newFinishRig(t)
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err != nil {
+ t.Fatalf("finish: %v\n%s", err, out)
+ }
+ r.write(filepath.Join(r.root, "stuck"), "", 0600)
+ if out, err := r.run("cutover-finish-thin.sh", "rollback", "--execute"); err == nil || !strings.Contains(out, "still running") || strings.Contains(r.state(), "kept_database=0") {
+ t.Fatalf("rollback recorded with the runner running: %v\n%s", err, out)
+ }
+}
+
+// A run cut off right after the unit starts resumes forward: enrolment is
+// already recorded, so enrol (which the running runner's state lock would
+// refuse) does not run again, and the unit is not started twice.
+func TestCutoverFinishResumesAfterTheStart(t *testing.T) {
+ r := newFinishRig(t)
+ r.write(filepath.Join(r.root, "killafterstart"), "", 0600)
+ if out, err := r.run("cutover-finish-thin.sh", "--execute"); err == nil {
+ t.Fatalf("the run was not interrupted:\n%s", out)
+ }
+ if !strings.Contains(r.state(), "done_enrol=1") || strings.Contains(r.state(), "done_start=1") {
+ t.Fatalf("enrol not recorded before the start:\n%s", r.state())
+ }
+ r.finished(r.run("cutover-finish-thin.sh", "--execute"))
+ if n := strings.Count(r.read(r.log), "equipo-runner enrol"); n != 1 {
+ t.Fatalf("enrol ran %d times", n)
+ }
+}
diff --git a/internal/release/cutover_test.go b/internal/release/cutover_test.go
index cba89cf0..1cda7d80 100644
--- a/internal/release/cutover_test.go
+++ b/internal/release/cutover_test.go
@@ -57,7 +57,7 @@ func newCutoverRig(t *testing.T) *cutoverRig {
"env list") [ -e `+filepath.Join(root, "envfail")+` ] && exit 1; printf 'using console\nKEY VALUE\nEQUIPO_ALWAYS_ON 1\nEQUIPO_ORIGIN https://equipo.bds.oncarlos.com\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 ('members','tasks','conversation_messages','runners')]; c.commit()" "$a" ;; esac; prev=$a; done ;;
"db query") printf 'id\n%s\n' "$(cat `+filepath.Join(root, "teamid")+`)" ;;
-deploy*) for a; do case $prev in --version) echo "$a" > `+filepath.Join(root, "served")+` ;; esac; prev=$a; done ;;
+deploy*) [ -e `+filepath.Join(root, "deployfail")+` ] && exit 1; 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)
@@ -84,6 +84,16 @@ func (r *cutoverRig) run(args ...string) (string, error) {
return string(out), err
}
+// answer runs the script without CUTOVER_YES, answering its step prompts
+// from input.
+func (r *cutoverRig) answer(input string, 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", "CUTOVER_ID_TRIES=2", "CUTOVER_ID_WAIT=0", "LANG=C.UTF-8"}
+ cmd.Stdin = strings.NewReader(input)
+ out, err := cmd.CombinedOutput()
+ return string(out), err
+}
+
func (r *cutoverRig) read(path string) string {
raw, _ := os.ReadFile(path)
return string(raw)
@@ -131,12 +141,14 @@ func TestCutoverRefusesWithoutANewInstanceID(t *testing.T) {
}
}
-// Rollback restores the complete prior configuration and keeps the new
-// runner state under a timestamped name.
-func TestCutoverRollbackRestoresEverything(t *testing.T) {
+// Before its deploy begins, rollback restores the complete prior
+// configuration. Once a deploy may have begun it is refused: on CARLOS the
+// activator passes the app an absolute --db, so a deploy migrates the old
+// database in place and the previous version cannot read it.
+func TestCutoverRollbackRestoresEverythingBeforeTheDeploy(t *testing.T) {
r := newCutoverRig(t)
- if out, err := r.run(cutoverVersion, "--execute"); err != nil {
- t.Fatalf("cutover: %v\n%s", err, out)
+ if out, err := r.answer("yes\nyes\nyes\nyes\nno\n", cutoverVersion, "--execute"); err == nil || !strings.Contains(out, "stopped before: 5") {
+ t.Fatalf("cutover did not stop before its deploy: %v\n%s", err, out)
}
out, err := r.run("rollback", "--execute")
if err != nil {
@@ -146,14 +158,10 @@ func TestCutoverRollbackRestoresEverything(t *testing.T) {
t.Fatal("runner configuration not restored exactly")
}
if r.read(filepath.Join(r.runner, "state", "credentials.json")) != "old" {
- t.Fatal("old runner state not restored")
- }
- moved, _ := filepath.Glob(filepath.Join(r.runner, "state.thin-rolled-back-*"))
- if len(moved) != 1 || r.read(filepath.Join(moved[0], "credentials.json")) != "new\n" {
- t.Fatalf("new state not kept aside: %v", moved)
+ t.Fatal("old runner state not kept")
}
calls := r.read(r.log)
- for _, want := range []string{"env unset --app equipo --account oficina --console https://console.carloku.com EQUIPO_DATABASE", "env set --app equipo --account oficina --console https://console.carloku.com --no-prompt EQUIPO_ALWAYS_ON=1", "promote --app equipo --account oficina --console https://console.carloku.com prev999 edge"} {
+ for _, want := range []string{"env unset --app equipo --account oficina --console https://console.carloku.com EQUIPO_DATABASE", "env set --app equipo --account oficina --console https://console.carloku.com --no-prompt EQUIPO_ALWAYS_ON=1", "promote --app equipo --account oficina --console https://console.carloku.com prev999 edge", "systemctl --user start"} {
if !strings.Contains(calls, want) {
t.Fatalf("missing call %q:\n%s", want, calls)
}
@@ -166,6 +174,50 @@ func TestCutoverRollbackRestoresEverything(t *testing.T) {
}
}
+func TestCutoverRollbackRefusedOnceADeployMayHaveBegun(t *testing.T) {
+ for name, set := range map[string]func(r *cutoverRig){
+ // The deploy failed or was cut off: CARLOS may have started the new version.
+ "deploy failed": func(r *cutoverRig) {
+ r.write(filepath.Join(r.root, "deployfail"), "", 0600)
+ if out, err := r.run(cutoverVersion, "--execute"); err == nil {
+ r.t.Fatalf("cutover went on after a failed deploy:\n%s", out)
+ }
+ },
+ // A record from before deploy_started existed, past step 4.
+ "older record": func(r *cutoverRig) {
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state"), "version="+cutoverVersion+"\nstamp=X\nprev_version=prev999\ndone_preflight=1\ndone_export=1\ndone_config=1\n", 0600)
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/prior/service.env"), string(r.serviceEnv), 0600)
+ r.write(filepath.Join(r.home, ".local/share/equipo-cutover/prior/equipo-runner.service"), string(r.unit), 0600)
+ },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newCutoverRig(t)
+ r.t = t
+ set(r)
+ before := r.read(r.log)
+ out, err := r.run("rollback", "--execute")
+ if err == nil || !strings.Contains(out, "prev999 cannot read it") || r.read(r.log) != before {
+ t.Fatalf("rollback offered prev999: %v\n%s", err, out)
+ }
+ })
+ }
+}
+
+func TestCutoverRollbackRefusedAfterTheDeploy(t *testing.T) {
+ r := newCutoverRig(t)
+ if out, err := r.run(cutoverVersion, "--execute"); err != nil {
+ t.Fatalf("cutover: %v\n%s", err, out)
+ }
+ before := r.read(r.log)
+ out, err := r.run("rollback", "--execute")
+ if err == nil || !strings.Contains(out, "prev999 cannot read it") || !strings.Contains(out, "cutover-finish-thin.sh") {
+ t.Fatalf("rollback to a version that cannot read the migrated database: %v\n%s", err, out)
+ }
+ if r.read(r.log) != before {
+ t.Fatalf("a refused rollback changed something:\n%s", strings.TrimPrefix(r.read(r.log), before))
+ }
+}
+
// A snapshot read that fails stops the cutover before any change, so a
// later rollback never unsets a value it could not read.
func TestCutoverStopsWhenASnapshotReadFails(t *testing.T) {
diff --git a/internal/release/upgrade_test.go b/internal/release/upgrade_test.go
new file mode 100644
index 00000000..6d0f4d80
--- /dev/null
+++ b/internal/release/upgrade_test.go
@@ -0,0 +1,419 @@
+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)
+ helper, err := os.ReadFile("../../scripts/runner-config.py")
+ r.must(err)
+ r.write(filepath.Join(repo, "scripts", "runner-config.py"), string(helper), 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\nRestartSec=5\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/0", 0600)
+ // The runner it replaces, which a rollback starts again.
+ r.write(filepath.Join(old, "equipo-runner"), "#!/bin/sh\n# old runner\n", 0700)
+ // 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)
+ unitStubs(r.write, root, filepath.Join(r.runner, "equipo-runner.service"), r.log)
+ r.write(filepath.Join(bin, "carlos"), "#!/bin/sh\n"+log+`case "$1 $2" in
+"db "*) [ -e `+filepath.Join(root, "replicabroken")+` ] && { echo "the copy failed its integrity check" >&2; exit 1; }
+ case "$2 $*" in 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 ;;
+ *integrity_check*) printf 'integrity_check\nok\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=3", "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", "runner-config.py render", "daemon-reload", "short window, not a drain", "systemctl --user restart equipo-runner.service",
+ "== 4 instance", "--swap hold --version "+upgradeTo, "== 5 verify", "_SYSTEMD_INVOCATION_ID=", "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"), "daemon-reload", "show -p ExecStart", "db query",
+ "systemctl --user restart equipo-runner.service", "carlos deploy", "--swap hold --version "+upgradeTo,
+ "journalctl --user -b _SYSTEMD_INVOCATION_ID=0123456789abcdef0123456789abcdef _PID=4242")
+ // Idle counts dispatched turns that have not ended, as well as steps and merges.
+ if !strings.Contains(calls, "(SELECT count(*) FROM chat_turns WHERE dispatched=1 AND state NOT IN ('replied','failed','cancelled'))") {
+ t.Fatalf("the idle reading does not count unfinished turns:\n%s", calls)
+ }
+ 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, "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/0", 0600) },
+ "turns in flight": func(r *upgradeRig) { r.write(filepath.Join(r.root, "inflight"), "0/0/1", 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)
+ },
+ "replica unreadable": func(r *upgradeRig) { r.write(filepath.Join(r.root, "replicabroken"), "", 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")
+ }
+ })
+ }
+ // An unreadable replica is named, with the check to run, and no way around it.
+ r := newUpgradeRig(t)
+ r.write(filepath.Join(r.root, "replicabroken"), "", 0600)
+ out, _ := r.run(upgradeTo, "--execute")
+ if !strings.Contains(out, "replica of equipo's database cannot be read") || !strings.Contains(out, "--sql 'PRAGMA integrity_check' (it must print ok)") {
+ t.Fatalf("unclear refusal for an unreadable replica:\n%s", out)
+ }
+ // 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)
+ }
+ // Until the previous runner is the one running and connected, the
+ // rollback is not recorded, and it can be run again.
+ if out, err := r.run("rollback", "--execute"); err == nil || !strings.Contains(out, "is not the previous runner") || strings.Contains(r.state(), "rolled_back=1") {
+ t.Fatalf("rollback recorded without the previous runner running: %v\n%s", err, out)
+ }
+ exe := filepath.Join(r.root, "proc", "4242", "exe")
+ r.must(os.Remove(exe))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", upgradeFrom, "equipo-runner"), exe))
+ 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
+ r.must(os.Remove(exe))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", upgradeTo, "equipo-runner"), exe))
+ 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)
+ }
+}
+
+// unitStubs writes stub systemctl and journalctl for the runner unit at
+// unit: start and restart make it active (root/active) and stop ends it
+// unless root/stuck exists; with root/killafter<verb> the script calling
+// start or restart is killed right after (an interrupted run). It has an
+// invocation id (fresh on every call while root/flap exists), main PID
+// 4242 while active, the loaded ExecStart (root/loaded, else the unit
+// file's) and the journal (root/journal, else a welcome).
+func unitStubs(write func(string, string, os.FileMode), root, unit, log string) {
+ bin := filepath.Join(root, "bin")
+ logLine := "echo \"$(basename $0) $*\" >> " + log + "\n"
+ write(filepath.Join(bin, "systemctl"), "#!/bin/sh\n"+logLine+`case "$*" in
+*FragmentPath*) cat `+filepath.Join(root, "fragment")+` 2>/dev/null || echo `+unit+` ;;
+*InvocationID*) if [ -e `+filepath.Join(root, "flap")+` ]; then od -An -tx1 -N16 /dev/urandom | tr -d ' \n'; echo; else echo 0123456789abcdef0123456789abcdef; fi ;;
+*MainPID*) if [ -e `+filepath.Join(root, "active")+` ]; then echo 4242; else echo 0; fi ;;
+*" start "*|*" restart "*) touch `+filepath.Join(root, "active")+`; v=$2; if [ -e `+filepath.Join(root, "killafter")+`$v ]; then rm `+filepath.Join(root, "killafter")+`$v; kill -TERM $PPID; fi ;;
+*" stop "*) [ -e `+filepath.Join(root, "stuck")+` ] || rm -f `+filepath.Join(root, "active")+` ;;
+*ExecStart*) cat `+filepath.Join(root, "loaded")+` 2>/dev/null || sed -n 's/^ExecStart=\(.*\) run$/{ path=\1 ; argv[]=\1 run }/p' `+unit+` ;;
+*is-active*) [ -e `+filepath.Join(root, "active")+` ] ;;
+*daemon-reload*) if [ -e `+filepath.Join(root, "failreload")+` ]; then rm `+filepath.Join(root, "failreload")+`; exit 1; fi ;;
+esac
+`, 0700)
+ write(filepath.Join(bin, "journalctl"), "#!/bin/sh\n"+logLine+"cat "+filepath.Join(root, "journal")+" 2>/dev/null || echo 'level=INFO msg=welcome protocol=28 generation=1'\n", 0700)
+}
+
+// Each key, ExecStart and RestartSec must be there exactly once: an edit
+// that would match nothing, or twice, stops before the restart.
+func TestUpgradeRefusesUnexpectedRunnerConfig(t *testing.T) {
+ for name, set := range map[string]func(r *upgradeRig){
+ "tool proxy twice": func(r *upgradeRig) {
+ r.write(filepath.Join(r.runner, "service.env"), r.serviceEnv+"EQUIPO_TOOL_PROXY_PATH=\"/elsewhere\"\n", 0600)
+ },
+ "no RestartSec": func(r *upgradeRig) {
+ r.write(filepath.Join(r.runner, "equipo-runner.service"), strings.Replace(r.unit, "RestartSec=5\n", "", 1), 0600)
+ },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newUpgradeRig(t)
+ r.t = t
+ set(r)
+ out, err := r.run(upgradeTo, "--execute")
+ if err == nil || !strings.Contains(out, "not one") || strings.Contains(r.read(r.log), "restart") || strings.Contains(r.read(r.log), "carlos deploy") {
+ t.Fatalf("went on with an unexpected runner config: %v\n%s", err, out)
+ }
+ })
+ }
+}
+
+// Connected means now, for this invocation: a welcome followed by a drop,
+// or an invocation that changes between readings, is not enough.
+func TestUpgradeVerifiesTheCurrentConnection(t *testing.T) {
+ for name, set := range map[string]func(r *upgradeRig){
+ "dropped since": func(r *upgradeRig) {
+ r.write(filepath.Join(r.root, "journal"), "level=INFO msg=welcome generation=1\nlevel=INFO msg=\"runner stream ended\" retry_in=1s\n", 0600)
+ },
+ "never welcomed": func(r *upgradeRig) {
+ r.write(filepath.Join(r.root, "journal"), "level=WARN msg=\"runner stream\" err=refused\n", 0600)
+ },
+ "another invocation each time": func(r *upgradeRig) { r.write(filepath.Join(r.root, "flap"), "", 0600) },
+ } {
+ t.Run(name, func(t *testing.T) {
+ r := newUpgradeRig(t)
+ r.t = t
+ set(r)
+ out, err := r.run(upgradeTo, "--execute")
+ if err == nil || !strings.Contains(out, "not connected") || strings.Contains(r.state(), "done_verify=1") {
+ t.Fatalf("verified without a current connection: %v\n%s", err, out)
+ }
+ })
+ }
+}
+
+// The scripts a person runs are executable.
+func TestOperatorScriptsAreExecutable(t *testing.T) {
+ for _, name := range []string{"cutover-thin.sh", "cutover-finish-thin.sh", "upgrade-thin.sh", "runner-config.py"} {
+ info, err := os.Stat("../../scripts/" + name)
+ if err != nil || info.Mode()&0111 != 0111 {
+ t.Errorf("scripts/%s is not executable: %v %v", name, info, err)
+ }
+ }
+}
+
+// A run cut off right after the restart resumes without restarting the
+// staged runner again; a rollback cut off after the previous runner
+// started does not stop it again.
+func TestUpgradeResumesAfterTheRestart(t *testing.T) {
+ r := newUpgradeRig(t)
+ r.write(filepath.Join(r.root, "killafterrestart"), "", 0600)
+ if out, err := r.run(upgradeTo, "--execute"); err == nil {
+ t.Fatalf("the run was not interrupted:\n%s", out)
+ }
+ if out, err := r.run(upgradeTo, "--execute"); err != nil || strings.Count(r.read(r.log), "systemctl --user restart") != 1 || !strings.Contains(r.state(), "done_verify=1") {
+ t.Fatalf("did not resume without a second restart: %v\n%s\n%s", err, out, r.read(r.log))
+ }
+ r.write(filepath.Join(r.root, "killafterstart"), "", 0600)
+ if out, err := r.run("rollback", "--execute"); err == nil {
+ t.Fatalf("the rollback was not interrupted:\n%s", out)
+ }
+ stops := strings.Count(r.read(r.log), "systemctl --user stop")
+ if stops != 1 {
+ t.Fatalf("the rollback stopped the staged runner %d times", stops)
+ }
+ // The previous runner is what the unit now runs.
+ exe := filepath.Join(r.root, "proc", "4242", "exe")
+ r.must(os.Remove(exe))
+ r.must(os.Symlink(filepath.Join(r.runner, "releases", upgradeFrom, "equipo-runner"), exe))
+ if out, err := r.run("rollback", "--execute"); err != nil || strings.Count(r.read(r.log), "systemctl --user stop") != stops || !strings.Contains(r.state(), "rolled_back=1") {
+ t.Fatalf("rollback retry stopped the previous runner again: %v\n%s\n%s", err, out, r.read(r.log))
+ }
+}
diff --git a/scripts/cutover-finish-thin.sh b/scripts/cutover-finish-thin.sh
new file mode 100755
index 00000000..66c1d9b5
--- /dev/null
+++ b/scripts/cutover-finish-thin.sh
@@ -0,0 +1,290 @@
+#!/usr/bin/env bash
+# Finish the thin v1 production cutover on the database production kept.
+#
+# scripts/cutover-finish-thin.sh # print the plan only (default)
+# scripts/cutover-finish-thin.sh --execute # a person runs it, step by step
+# scripts/cutover-finish-thin.sh rollback [--execute] # the runner as the cutover left it
+#
+# The 2026-11-19 cutover (scripts/cutover-thin.sh) stopped after step 5,
+# and its fresh database never happened: on CARLOS the activator passes the
+# app an absolute --db, so EQUIPO_DATABASE is ignored, and the new version
+# migrated the old database in place. That data is kept. This finishes
+# cutover steps 6 onward for it without the platform replica: every check
+# reads the instance or this machine. Agents must not run --execute. Steps
+# done are recorded in cutover.state (done_identity ... done_verify), so a
+# finished run is a finished cutover to scripts/upgrade-thin.sh. Every step
+# can be run again after a failure.
+#
+# 6 identity /install.sh, which the instance builds from its own database
+# (its team), names the recorded old instance id, the version
+# and the public origin, on both routes; staged runner bytes
+# 7 config EQUIPO_DATABASE unset, so the configuration says what runs;
+# then the instance serves that version and the same id again
+# 8 runner the runner's files recorded once; the staged runner beside
+# the old one; service.env and unit written from that record
+# (scripts/runner-config.py); the old state moved aside
+# 9 enrol the written and loaded configuration checked, then
+# verify-installed, enrol (the owner approves the link)
+# 10 start the unit starts (recorded apart from enrol: the running
+# runner holds the state lock enrol needs)
+# 11 verify version and identity again; in this boot and this unit
+# invocation, the staged runner's process was welcomed by the
+# instance and has not dropped since, on two readings
+#
+# Rollback puts the runner's state, service.env and unit back as the
+# cutover left them and leaves the runner stopped. It never offers the
+# version before the cutover: that version cannot read the migrated schema.
+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
+BACKUPS=$HOME/.local/share/equipo-cutover
+STATE=$BACKUPS/cutover.state
+REPO=$(cd "$(dirname "$0")/.." && pwd)
+RELEASES=${EQUIPO_RELEASE_REPO:-$REPO}/releases
+PROC=${CUTOVER_PROC:-/proc}
+carlos_app=(--app "$APP" --account "$ACCOUNT" --console "$CONSOLE")
+
+mode=finish
+execute=0
+case "${1:-} ${2:-}" in
+" ") ;;
+"--execute ") execute=1 ;;
+"rollback ") mode=rollback ;;
+"rollback --execute") mode=rollback execute=1 ;;
+*) sed -n '2,35p' "$0"; exit 2 ;;
+esac
+
+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)) && [[ ${CUTOVER_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; the last wins.
+get() { [[ -f $STATE ]] && sed -n "s/^$1=//p" "$STATE" | tail -1 || true; }
+put() {
+ ((execute)) || return 0
+ printf '%s=%s\n' "$1" "$2" >>"$STATE" || die "could not record $1=$2 in $STATE"
+}
+done_step() { [[ $(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"; }
+wait_serving() { run bash -c "for i in \$(seq 60); do [ \"\$(curl -fsS $ORIGIN/api/version)\" = $1 ] && exit 0; sleep 2; done; exit 1"; }
+
+version=$(get version)
+old_id=$(get old_instance_id)
+stamp=$(get stamp)
+snap=$BACKUPS/finish-$stamp
+kept=$RUNNER_ROOT/state.pre-thin-$stamp
+
+# The instance's own word, not the replica's: /install.sh ends with the
+# origin, version and instance id (its team's id, read from the database
+# it serves), on the platform route and on the public address.
+identity() {
+ local origin said
+ for origin in "$ORIGIN" "$PUBLIC_ORIGIN"; do
+ said=$(curl -fsS "$origin/install.sh") || die "could not read $origin/install.sh"
+ [[ $said == *"sh -s -- '$PUBLIC_ORIGIN' '$version' '$old_id'" ]] ||
+ die "$origin/install.sh does not name $PUBLIC_ORIGIN, $version and instance $old_id (it says: ${said##*sh -s -- })"
+ done
+}
+
+# A hash from the green staging record of $version (empty if there is none).
+staged_sha() { python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(d["sha256"][sys.argv[2]] if d.get("staging") == "PASS" else "")' "$RELEASES/staged/$version.json" "$1" 2>/dev/null || true; }
+
+# The production unit and its state directory, not some other runner's.
+production_unit() {
+ [[ $(readlink -f "$(systemctl --user show -p FragmentPath --value "$UNIT")") == "$RUNNER_ROOT/equipo-runner.service" ]] || die "$UNIT is not $RUNNER_ROOT/equipo-runner.service"
+ [[ $(file_value EQUIPO_RUNNER_STATE_DIR "$RUNNER_ROOT/service.env") == "$RUNNER_ROOT/state" ]] || die "the runner state is not $RUNNER_ROOT/state"
+}
+
+# Connected now: in this boot and the unit's current invocation, the
+# process running the binary with sha256 $1 logged the instance's welcome,
+# and no stream drop after it, on two readings in a row of the same
+# invocation and process.
+connected() {
+ local seen= inv pid last
+ for _ in $(seq "${CUTOVER_TRIES:-30}"); do
+ inv=$(systemctl --user show -p InvocationID --value "$UNIT")
+ pid=$(systemctl --user show -p MainPID --value "$UNIT")
+ last=
+ if [[ $inv =~ ^[0-9a-f]{32}$ && $pid =~ ^[1-9][0-9]*$ ]]; then
+ [[ $(sha256sum "$PROC/$pid/exe" | cut -d ' ' -f 1) == "$1" ]] || die "the running runner is not the staged $version runner"
+ last=$(journalctl --user -b _SYSTEMD_INVOCATION_ID="$inv" _PID="$pid" -o cat --no-pager | grep -E 'msg=welcome|msg="runner stream' | tail -1 || true)
+ fi
+ if [[ $last == *msg=welcome* ]]; then
+ [[ $seen == "$inv $pid" ]] && return 0
+ seen="$inv $pid"
+ else
+ seen=
+ fi
+ sleep "${CUTOVER_WAIT:-5}"
+ done
+ return 1
+}
+
+# The old state was written by the old runner for the old origin; it is
+# kept for rollback. Each part is recorded, so a retry finds where it was.
+move_state() {
+ if [[ $(get state_moved) != 1 ]]; then
+ if [[ -e $kept && -e $RUNNER_ROOT/state ]]; then
+ die "both state and state.pre-thin-$stamp exist and no move is recorded: look before going on"
+ fi
+ if [[ ! -e $kept ]]; then
+ [[ -d $RUNNER_ROOT/state ]] || die "no runner state to keep"
+ mv "$RUNNER_ROOT/state" "$kept"
+ fi
+ put state_moved 1
+ fi
+ [[ -d $kept ]] || die "state.pre-thin-$stamp is missing"
+ install -d -m 0700 "$RUNNER_ROOT/state"
+}
+
+if [[ $mode == rollback ]]; then
+ [[ $(get kept_database) == 1 ]] || die "no finish of the cutover on the kept database is recorded ($STATE)"
+ [[ -f $snap/service.env && -f $snap/equipo-runner.service ]] || die "the runner files from before the finish were not recorded"
+ step "rollback 1 stop the runner"
+ run systemctl --user stop "$UNIT"
+ step "rollback 2 the runner's state, service.env and unit as the cutover left them"
+ if [[ -e $kept ]]; then
+ if [[ -e $RUNNER_ROOT/state ]]; then
+ run mv "$RUNNER_ROOT/state" "$RUNNER_ROOT/state.finish-rolled-back-$(date -u +%Y%m%dT%H%M%SZ)"
+ fi
+ run mv "$kept" "$RUNNER_ROOT/state"
+ fi
+ 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
+ if ((execute)); then
+ systemctl --user is-active --quiet "$UNIT" && die "$UNIT is still running"
+ cmp -s "$snap/service.env" "$RUNNER_ROOT/service.env" && cmp -s "$snap/equipo-runner.service" "$RUNNER_ROOT/equipo-runner.service" || die "the runner files are not the recorded ones"
+ [[ -d $RUNNER_ROOT/state && ! -e $kept ]] || die "the old runner state is not back in place"
+ fi
+ for s in identity unset runner enrol start verify; do put "done_$s" 0; done
+ put state_moved 0
+ put kept_database 0
+ echo " The runner stays stopped and the instance stays on $version: nothing is promoted."
+ echo " $(get prev_version) is not offered: $version migrated the kept database in place, and"
+ echo " $(get prev_version) cannot read the migrated schema. EQUIPO_DATABASE is not set again: it was never used."
+ echo " To finish again: scripts/cutover-finish-thin.sh --execute"
+ ((execute)) || echo $'\nPlan only. A person runs it with --execute.'
+ exit 0
+fi
+
+[[ -f $STATE ]] || refuse "no cutover was recorded ($STATE)"
+[[ $(get rolled_back) != 1 ]] || refuse "the cutover was rolled back"
+done_step deploy || refuse "the cutover has not deployed its version yet; use scripts/cutover-thin.sh"
+if done_step verify; then die "the cutover to $version is complete"; fi
+[[ $old_id =~ ^[A-Z0-9]{26}$ ]] || refuse "cutover.state records no old instance id"
+runner_release=$RELEASES/equipo-runner-linux-amd64-$version
+new=$RUNNER_ROOT/releases/$version
+config=(--exec "$new/equipo-runner" "EQUIPO_TOOL_PROXY_PATH=$new/equipo-tool-proxy" "EQUIPO_INSTANCE_ID=$old_id" "EQUIPO_ORIGIN=$PUBLIC_ORIGIN")
+echo "Finish the cutover to ${version:--unknown-} on the kept database, instance ${old_id:--unknown-}."
+
+step "6 identity: the instance names the kept database's id (no replica)"
+run curl -fsS "$ORIGIN/api/version"
+echo " $ORIGIN/install.sh and $PUBLIC_ORIGIN/install.sh must end: sh -s -- '$PUBLIC_ORIGIN' '$version' '$old_id'"
+echo " the staged runner and tool proxy must have the hashes in $RELEASES/staged/$version.json"
+if ((execute)) && ! done_step identity; then
+ [[ $(curl -fsS "$ORIGIN/api/version") == "$version" ]] || die "production does not serve $version"
+ identity
+ [[ $(sha256sum "$runner_release/equipo-runner" | cut -d ' ' -f 1) == "$(staged_sha runner)" ]] || die "equipo-runner is not the one staging passed for $version"
+ [[ $(sha256sum "$runner_release/equipo-tool-proxy" | cut -d ' ' -f 1) == "$(staged_sha tool_proxy)" ]] || die "equipo-tool-proxy is not the one staging passed for $version"
+ put new_instance_id "$old_id"
+ put kept_database 1
+ finish identity
+fi
+
+step "7 config: unset EQUIPO_DATABASE (the activator's --db wins, so it was never used)"
+if ! done_step unset; then
+ if ((execute)); then
+ listing=$(carlos env list "${carlos_app[@]}") || die "could not read the instance configuration"
+ grep -q '^KEY' <<<"$listing" || die "unexpected configuration listing"
+ [[ $(env_value EQUIPO_DATABASE <<<"$listing") == -unset- ]] || run carlos env unset "${carlos_app[@]}" EQUIPO_DATABASE
+ else
+ run carlos env unset "${carlos_app[@]}" EQUIPO_DATABASE
+ fi
+ echo " the instance may restart for this; then it serves $version and names $old_id again"
+ wait_serving "$version"
+ if ((execute)); then identity; fi
+ finish unset
+fi
+
+step "8 install the staged runner beside the old one"
+if ! done_step runner; then
+ if ((execute)); then
+ production_unit
+ # Recorded once, before any edit: a retry never takes edited files for the originals.
+ if [[ $(get finish_snapshot) != 1 ]]; then
+ install -d -m 0700 "$snap"
+ cp -p "$RUNNER_ROOT/service.env" "$RUNNER_ROOT/equipo-runner.service" "$snap/"
+ put finish_snapshot 1
+ fi
+ fi
+ echo " $UNIT is $RUNNER_ROOT/equipo-runner.service with state $RUNNER_ROOT/state; its files recorded once in $snap"
+ run install -d -m 0700 "$new"
+ run install -m 0700 "$runner_release/equipo-runner" "$runner_release/equipo-tool-proxy" "$new/"
+ run python3 "$REPO/scripts/runner-config.py" render "$snap" "$RUNNER_ROOT" "${config[@]}"
+ if ((execute)); then move_state; else
+ run mv "$RUNNER_ROOT/state" "$kept"
+ run install -d -m 0700 "$RUNNER_ROOT/state"
+ fi
+ run systemctl --user daemon-reload
+ finish runner
+fi
+
+step "9 enrol the runner: open the printed link as the owner and approve it"
+if ! done_step enrol; then
+ run python3 "$REPO/scripts/runner-config.py" check "$RUNNER_ROOT" "${config[@]}"
+ echo " the loaded unit starts $new/equipo-runner (systemctl show -p ExecStart)"
+ if ((execute)); then
+ production_unit
+ [[ $(systemctl --user show -p ExecStart --value "$UNIT") == *"path=$new/equipo-runner ;"* ]] || die "the loaded $UNIT does not start $new/equipo-runner"
+ fi
+ run bash -c "set -a; . '$RUNNER_ROOT/service.env'; set +a; '$new/equipo-runner' verify-installed"
+ run bash -c "set -a; . '$RUNNER_ROOT/service.env'; set +a; '$new/equipo-runner' enrol"
+ # Recorded before the start: a running runner holds the state lock, so
+ # enrol must never run again once the unit is up.
+ finish enrol
+fi
+
+step "10 start the runner"
+if ! done_step start; then
+ run systemctl --user start "$UNIT"
+ finish start
+fi
+
+step "11 verify (no replica)"
+run curl -fsS "$ORIGIN/api/version"
+echo " install.sh names $old_id again; sha256 of $PROC/<MainPID>/exe is the staged runner's"
+echo " $ journalctl --user -b _SYSTEMD_INVOCATION_ID=<InvocationID> _PID=<MainPID> -o cat --no-pager"
+echo " the last stream line is msg=welcome (no later \"runner stream\" drop), on two readings of the same process"
+if ((execute)) && ! done_step verify; then
+ [[ $(curl -fsS "$ORIGIN/api/version") == "$version" ]] || die "production does not serve $version"
+ identity
+ connected "$(staged_sha runner)" || die "the runner is not connected to the instance now; see journalctl --user -u $UNIT"
+ finish verify
+fi
+echo " Then, as the owner: sign in at $PUBLIC_ORIGIN/conversation, check the offline line"
+echo " is gone, say hello and see the reply stream. If Machines lists the old runner, remove it."
+echo " To undo the runner change: scripts/cutover-finish-thin.sh rollback --execute"
+((execute)) || echo $'\nPlan only. A person runs it with --execute.'
diff --git a/scripts/cutover-thin.sh b/scripts/cutover-thin.sh
index dba4bc63..06dcc0f3 100755
--- a/scripts/cutover-thin.sh
+++ b/scripts/cutover-thin.sh
@@ -81,7 +81,10 @@ run() {
}
# Recorded facts and finished steps, one KEY=value per line.
get() { [[ -f $STATE ]] && sed -n "s/^$1=//p" "$STATE" | tail -1 || true; }
-put() { ((execute)) && printf '%s=%s\n' "$1" "$2" >>"$STATE" || true; }
+put() {
+ ((execute)) || return 0
+ printf '%s=%s\n' "$1" "$2" >>"$STATE" || die "could not record $1=$2 in $STATE"
+}
done_step() { [[ $(get "done_$1") == 1 ]]; }
finish() { put "done_$1" 1; }
# env_value reads one key from a `carlos env list` listing on stdin.
@@ -91,6 +94,14 @@ overlaps() { case "$1/" in "$2"/*) return 0 ;; esac; case "$2/" in "$1"/*) retur
if [[ $mode == rollback ]]; then
[[ -f $STATE ]] || die "no cutover was recorded ($STATE)"
[[ $(get rolled_back) != 1 ]] || die "already rolled back"
+ # On CARLOS the activator passes the app an absolute --db, so EQUIPO_DATABASE
+ # chose no fresh file: a deploy that began may have migrated the old
+ # database in place. It may have begun when the record says it started or
+ # finished, or when a record from before deploy_started existed passed
+ # step 4 without saying.
+ if [[ $(get deploy_started) == 1 ]] || done_step deploy || { done_step config && [[ -z $(get deploy_started) ]]; }; then
+ die "a deploy of $(get version) may have begun, and it migrates the production database in place (EQUIPO_DATABASE is ignored on CARLOS); $(get prev_version) cannot read it. Finish on the kept database: scripts/cutover-finish-thin.sh"
+ fi
stamp=$(get stamp)
[[ -n $stamp && -f $SNAP/service.env && -f $SNAP/equipo-runner.service ]] || die "the prior configuration was not recorded"
step "rollback 1 stop the runner"
@@ -200,11 +211,14 @@ step "4 configuration: fresh database file, no always-on"
if ! done_step config; then
run carlos env set "${carlos_app[@]}" --no-prompt "EQUIPO_DATABASE=$NEW_DB" "EQUIPO_ORIGIN=$PUBLIC_ORIGIN"
[[ $(get prev_always_on) == -unset- ]] || run carlos env unset "${carlos_app[@]}" EQUIPO_ALWAYS_ON
+ put deploy_started 0
finish config
fi
step "5 deploy the staged instance with --swap hold"
if ! done_step deploy; then
+ # Recorded before CARLOS is asked: from here rollback refuses the old version.
+ put deploy_started 1
run carlos deploy "${carlos_app[@]}" --channel edge --target linux-arm64 --swap hold --version "$version" --timeout 5m --no-prompt "$instance"
run bash -c "for i in \$(seq 60); do [ \"\$(curl -fsS $ORIGIN/api/version)\" = $version ] && exit 0; sleep 2; done; exit 1"
finish deploy
diff --git a/scripts/runner-config.py b/scripts/runner-config.py
new file mode 100755
index 00000000..efc25ded
--- /dev/null
+++ b/scripts/runner-config.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+"""Write or check the production runner's service.env and unit, for
+scripts/cutover-finish-thin.sh and scripts/upgrade-thin.sh.
+
+ runner-config.py render <snapshot-dir> <runner-root> --exec PATH KEY=VALUE...
+ runner-config.py check <runner-root> --exec PATH KEY=VALUE...
+
+render reads the recorded snapshot (service.env, equipo-runner.service),
+never the live files, so running it again gives the same result. Each KEY
+must appear exactly once in service.env; ExecStart, RestartSec and
+EnvironmentFile (naming <runner-root>/service.env) exactly once in the
+unit. Values are restricted to plain path, origin and id characters, so
+nothing needs escaping. RestartPreventExitStatus=3 follows RestartSec.
+Both files are written to a temporary file, synced and renamed into
+place, then checked. check refuses unless the live files hold exactly
+those values.
+"""
+import os
+from pathlib import Path
+import re
+import sys
+
+SAFE = re.compile(r'[A-Za-z0-9/._:-]{1,512}')
+ENV, UNIT = 'service.env', 'equipo-runner.service'
+
+
+def fail(msg):
+ print('refused: ' + msg, file=sys.stderr)
+ sys.exit(1)
+
+
+def once(lines, prefix, where):
+ hits = [i for i, line in enumerate(lines) if line.startswith(prefix)]
+ if len(hits) != 1:
+ fail(f'{where} has {len(hits)} {prefix} lines, not one')
+ return hits[0]
+
+
+def args(argv):
+ if len(argv) < 2 or argv[0] != '--exec':
+ fail('usage: --exec PATH KEY=VALUE...')
+ exe, pairs = argv[1], argv[2:]
+ values = {}
+ for pair in pairs:
+ key, _, value = pair.partition('=')
+ if not re.fullmatch(r'EQUIPO_[A-Z_]+', key) or key in values:
+ fail('bad key ' + key)
+ values[key] = value
+ for value in [exe, *values.values()]:
+ if not SAFE.fullmatch(value):
+ fail('unexpected characters in ' + repr(value))
+ if not values:
+ fail('no keys')
+ return exe, values
+
+
+def rendered(env, unit, root, exe, values):
+ env = env.splitlines()
+ for key, value in values.items():
+ env[once(env, key + '=', ENV)] = f'{key}="{value}"'
+ unit = [line for line in unit.splitlines() if not line.startswith('RestartPreventExitStatus=')]
+ if unit[once(unit, 'EnvironmentFile=', UNIT)] != f'EnvironmentFile={root}/{ENV}':
+ fail(f'{UNIT} does not read {root}/{ENV}')
+ unit[once(unit, 'ExecStart=', UNIT)] = f'ExecStart={exe} run'
+ unit.insert(once(unit, 'RestartSec=', UNIT) + 1, 'RestartPreventExitStatus=3')
+ return '\n'.join(env) + '\n', '\n'.join(unit) + '\n'
+
+
+def write(path, text):
+ tmp = path.with_name('.' + path.name + '.new')
+ fd = os.open(tmp, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
+ with os.fdopen(fd, 'w') as f:
+ f.write(text)
+ f.flush()
+ os.fsync(f.fileno())
+ os.replace(tmp, path)
+ dirfd = os.open(path.parent, os.O_RDONLY)
+ try:
+ os.fsync(dirfd)
+ finally:
+ os.close(dirfd)
+
+
+def check(root, exe, values):
+ env = (root / ENV).read_text().splitlines()
+ unit = (root / UNIT).read_text().splitlines()
+ for key, value in values.items():
+ if env[once(env, key + '=', ENV)] != f'{key}="{value}"':
+ fail(f'{ENV} does not hold {key}={value}')
+ if unit[once(unit, 'ExecStart=', UNIT)] != f'ExecStart={exe} run':
+ fail(f'{UNIT} does not start {exe}')
+ if unit[once(unit, 'RestartSec=', UNIT) + 1:][:1] != ['RestartPreventExitStatus=3']:
+ fail(f'{UNIT} lacks RestartPreventExitStatus=3 after RestartSec')
+ if unit[once(unit, 'EnvironmentFile=', UNIT)] != f'EnvironmentFile={root}/{ENV}':
+ fail(f'{UNIT} does not read {root}/{ENV}')
+
+
+def main(argv):
+ if len(argv) >= 3 and argv[0] == 'render':
+ snap, root = Path(argv[1]), Path(argv[2])
+ exe, values = args(argv[3:])
+ env, unit = rendered((snap / ENV).read_text(), (snap / UNIT).read_text(), root, exe, values)
+ write(root / ENV, env)
+ write(root / UNIT, unit)
+ check(root, exe, values)
+ return 0
+ if len(argv) >= 2 and argv[0] == 'check':
+ root = Path(argv[1])
+ exe, values = args(argv[2:])
+ check(root, exe, values)
+ return 0
+ print(__doc__, file=sys.stderr)
+ return 2
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index 4e513dd3..dada24a4 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -15846,5 +15846,579 @@
"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": "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": "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": "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": 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": "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."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "cc9a4f1d39cf13a08b04ddbe4607bfffc0d907fa96a07ded61506fc199e3a83b",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "5387904268932982e0c79cca82a7935df90015ba54ea545f95a1943589bc13d1",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "95f7dd5e6d8dccf9adce4ee99a15c5c02ab43c11a29efaa3016b30f745a079bb",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "726e45e1b3fee0327a9cae24c19ae5161a0a7431aabbc9b5f81943f2174c65ea",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "f3516baa7ba6cfe082af6c44eacc6a69cd683a370dd9f3d0a0e171396d337b9a",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "67b3316b103986ea19bd7a0c7427e4f3e75760d72711b2d623439f7554863b6d",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "ac3606fcb3f775c9331866cb07186b1d07dba5956b6536db392b27cc7330e1af",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "2e931fedc6dc8ea790e88e2017240063cb4fd702ccfa53edc0aa073566a4d59e",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "bdf6a5c5cd9cb8574f59c99e799dd44556619a7f8f85606ff41f6a5c11a4f834",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "b315acb3fe1248523bd1cba13f0e9419a3f1fed852d52a6e88bb2665c1fc50bb",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "60a3d9430038ca22f024c3a491a0021eb689ac3e1722b619a76cfe3470f8427d",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "72fb0dd00b8df6bb5ccba76d7a2fb0b41077bf7d2b655a70e6bf3a1fdf204283",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "5e560fc45e4c710658a74b3b2a6f2927aff817cd7671e3160efc271be4d89f57",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "c9c06860121022396f126390b0ca200fa1b807969febc08a6ddb5abca248e0d9",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "d27ef4c746c4edb2660ab80f5695ffc19368288b948105bccb0bc979f0fff143",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "b0bf3c7b4a5c9687d50d5ea70d17fd21ac211a2adf1e7a689b1f25d78f72bb55",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "8d36abb113f2fd8041b041b07c79a670d832081f95e8d7412bfd232471ff8829",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "6a307e61a9c219df3411456ec34eb42cb3151dfab3850e0b7aafc8af60602bdd",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "c4fb003c9d0a05da6cb58134cd2c22f532af4ecbbfb0effd2fe510a26db26431",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "9e2410bd1041e36dec92ebadf32046d0546aae50f9c74ea2bc90765eb69ff636",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "38f1162b40561ebbc3b2755a57d881df993c35d5da1e7465fb2eb50f9a986511",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "scripts/upgrade-thin.sh",
+ "line_sha256": "a4a5d63fcd0e9b704a101fa4da059852940f2a2dd16b2dfa81eada11f433b214",
+ "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": "dfb0f4574ab1336eb1ec9bb9bc572df8370ec0e6db502de6b2dcfc17d5c7d2c3",
+ "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": "83b4e47e5c15d615a54426bc51bfdbfcc010d06aa77b5793fbb931e93008d8e0",
+ "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": "f166412dde230c4cdeaf6cc24f1665aa097b39a2271f06acec510e371e36b14a",
+ "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": "ac5f1d42a46dc2a7d855705a367744f9a51c8bde7982bf2031b6c5e2ad9bc7c7",
+ "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": "2c2e12380915b2e850e19a0eb241bdd5a5f9249ae821eb0c93586ba5324b1505",
+ "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": "bee334cd0a8e2cd7a0c604bac8b35302b1b196271f3d8129eb374b6965532038",
+ "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": "25d904150adcbdceb65d39b947b733dbf6309426d9caa7ab4e145c783978ab1b",
+ "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": "a1ac21a3f394ac32d10f370efd119ffabfb5cd434b34d1f1d6d00ed135b3aff2",
+ "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": "72fe0742134d2cad6e4f73f31590b5020298aa656767e2812cd57d190e6eb086",
+ "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": "8adb8b295b76e076dc8c77118d8d2d6da779545242c87dec47ecc42a61201ee5",
+ "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": "9af63341746b59fe167f10cb4596cea300fc5e170d478879f3028d901bf15e05",
+ "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": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "7fb4566fa4fc2de31d0e2c1245476f07f24c1f24124736a943c2e97277b02a27",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "ecec89aa4795595c9dee3b63c5b61e8c1b2c98dc6e86dc0fe23e2a7666e4f442",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "de12d948ad68c53ade1b7ce7be97d9f1f371fb0450e214bf6d04ad620b4fb890",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "8a45b416e2a70a24fb9c34d1ebb0548b28a0b0d3b3e13a367b21257b6ce2d5cb",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "cbfa9bfcd83504dcd196e34c615e3d0054fb3940ad1d6bb00a4d41673f355be5",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "83b4e47e5c15d615a54426bc51bfdbfcc010d06aa77b5793fbb931e93008d8e0",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "f166412dde230c4cdeaf6cc24f1665aa097b39a2271f06acec510e371e36b14a",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "bee334cd0a8e2cd7a0c604bac8b35302b1b196271f3d8129eb374b6965532038",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "5d83ed69d02766d60da9bc60114d885f6c44e02a1e60f711f350b6ac5e50b855",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "0ebb9510ee37f057280bae82c4812d7cd9cb15e1832096b41d57c54d46c2a779",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "b608c3ed1f03ecbd49aae573f8c2eb7afd6c9f818debe3ee47c41d708b4fc814",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "3ca6246560fd41e70579a83aa36600b48aada2d6e3b87231d04458a92a2ced01",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "5c3fd49d98f2ec568387eef61ddd05b962bfeefc105110abed83d5dce136b600",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "efb0834842a0eb23630c64b46cc8ad924374943c9f95bf1a779289c1e5e9965e",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "9d834452c25980e341475a467db7ac63c96b96e793472e77b6090d2b349a49a5",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "4cfab4ec17dd6c885bfe39e78bf816ce63d18453e3a698bed21c62a9c98bc5c0",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "cfc95a445d3c5277a2e0113e8f75066930cf8610f10e202c8bf23f28cf414464",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "0185447b6313959dfe740727b0d7a824eb05c4dc06b3cfd3c9d9e7e1c62ffcfa",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_test.go",
+ "line_sha256": "163d5178d859864b484c1b9582e995f1c3ad2d162ae9adcc87ddd69fc1d1fabb",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the production cutover script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "scripts/runner-config.py",
+ "line_sha256": "e6c2e9a9db79b4caf6f0fd8d1e8dce5cffe97583e553702e9af870b155e0bee2",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Writes and checks the production runner unit file (equipo-runner.service) for the cutover finish and upgrade scripts."
+ },
+ {
+ "path": "scripts/runner-config.py",
+ "line_sha256": "2ea395d5c57dda5c0c192534b46448d17f51a1ce98aa41838ff13dc1b28fb2a9",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Writes and checks the production runner unit file (equipo-runner.service) for the cutover finish and upgrade scripts."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "ac3af06bcf42f6e0653809e9ed7edcb4ef999a46f17942de9047424321d60058",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME."
+ },
+ {
+ "path": "internal/release/cutover_finish_test.go",
+ "line_sha256": "c8162f9af9bca14c82a3a2184c4c5d0a6a3dd7cc95b6c1fb4b7d68f4aa1772d7",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Test of the cutover finish 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 100755
index 00000000..68d37823
--- /dev/null
+++ b/scripts/upgrade-thin.sh
@@ -0,0 +1,334 @@
+#!/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; the replica reads clean (PRAGMA
+# integrity_check) and nothing is in flight; records the prior
+# state (served version, runner service.env and unit)
+# 2 backup carlos db pull, integrity-checked, counted, hashed, read-only.
+# The upgrade changes no configuration: the same database.
+# 3 runner the staged runner beside the current one, checked by
+# verify-installed; service.env and unit written from the
+# preflight's record (scripts/runner-config.py); nothing in
+# flight on a reading just before the restart (a short window,
+# not a drain: Equipo has no maintenance mode); the restart
+# keeps the runner's 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; in this boot and unit invocation, the staged
+# runner's process welcomed by the instance and not dropped
+# since, on two readings
+#
+# 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'))||'/'||(SELECT count(*) FROM chat_turns WHERE dispatched=1 AND state NOT IN ('replied','failed','cancelled'))"
+
+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,42p' "$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)) || return 0
+ printf '%s=%s\n' "$1" "$2" >>"$STATE" || die "could not record $1=$2 in $STATE"
+}
+# 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; }
+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, merges among them, and dispatched turns not yet
+# ended: a runner restart fails a running step or turn, and a merge needs
+# the runner it started with. One reading of the replica: a short window,
+# not a drain.
+idle() {
+ local out
+ out=$(carlos db query "${carlos_app[@]}" --sql "$IN_FLIGHT" | tail -1) || die "could not read the work in flight. $REPLICA"
+ [[ $out =~ ^[0-9]+/[0-9]+/[0-9]+$ ]] || die "could not read the work in flight. $REPLICA"
+ [[ $out == 0/0/0 ]] || die "in flight (steps/merges/turns): $out; run again when nothing runs"
+}
+# The unit's main process runs the binary with sha256 $1.
+runs() {
+ local pid
+ pid=$(systemctl --user show -p MainPID --value "$UNIT")
+ [[ $pid =~ ^[1-9][0-9]*$ && $(sha256sum "$PROC/$pid/exe" 2>/dev/null | cut -d ' ' -f 1) == "$1" ]]
+}
+# Connected now: in this boot and the unit's current invocation, the
+# process running the binary with sha256 $1 logged the instance's welcome,
+# and no stream drop after it, on two readings in a row of the same
+# invocation and process. $2 names that binary.
+connected() {
+ local seen= inv pid last
+ for _ in $(seq "${UPGRADE_TRIES:-30}"); do
+ inv=$(systemctl --user show -p InvocationID --value "$UNIT")
+ pid=$(systemctl --user show -p MainPID --value "$UNIT")
+ last=
+ if [[ $inv =~ ^[0-9a-f]{32}$ && $pid =~ ^[1-9][0-9]*$ ]]; then
+ [[ $(sha256sum "$PROC/$pid/exe" | cut -d ' ' -f 1) == "$1" ]] || die "the running runner is not $2"
+ last=$(journalctl --user -b _SYSTEMD_INVOCATION_ID="$inv" _PID="$pid" -o cat --no-pager | grep -E 'msg=welcome|msg="runner stream' | tail -1 || true)
+ fi
+ if [[ $last == *msg=welcome* ]]; then
+ [[ $seen == "$inv $pid" ]] && return 0
+ seen="$inv $pid"
+ else
+ seen=
+ fi
+ sleep "${UPGRADE_WAIT:-5}"
+ done
+ return 1
+}
+# The in-flight check and the backup both read the platform's replica of
+# the database (carlos db restores a copy); an unreadable one stops here.
+REPLICA="Check the platform's replica with: carlos db query ${carlos_app[*]} --sql 'PRAGMA integrity_check' (it must print ok)"
+replica() {
+ local said
+ said=$(carlos db query "${carlos_app[@]}" --sql 'PRAGMA integrity_check' 2>/dev/null | tail -1) || said=
+ [[ $said == ok ]] || die "the platform's replica of $APP's database cannot be read, and the in-flight check and the backup both need it. $REPLICA"
+}
+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 the database of $HOST (the file the activator"
+ echo " passes as --db) with that file, 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"
+ prev_exec=$(sed -n 's/^ExecStart=\(.*\) run$/\1/p' "$snap/equipo-runner.service")
+ [[ -f $prev_exec ]] || die "the previous runner $prev_exec is missing"
+ prev_sha=$(sha256sum "$prev_exec" | cut -d ' ' -f 1)
+ step "rollback 1 stop the runner"
+ # A retry after the previous runner started again does not stop it a second time.
+ if ((execute)) && runs "$prev_sha"; then echo " $UNIT already runs $prev_exec"; else run systemctl --user stop "$UNIT"; fi
+ 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, and see it connected"
+ run systemctl --user start "$UNIT"
+ echo " $UNIT runs $prev_exec, welcomed by the instance in this invocation, on two readings"
+ if ((execute)); then
+ connected "$prev_sha" "the previous runner $prev_exec" || die "the previous runner is not connected; nothing recorded as rolled back"
+ fi
+ 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 " the replica reads clean (the in-flight check and the backup need it):"
+printf ' $ carlos db query %s --sql "PRAGMA integrity_check" # must be ok\n' "${carlos_app[*]}"
+echo " nothing in flight (steps/merges/turns):"
+printf ' $ carlos db query %s --sql "%s" # must be 0/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
+ replica
+ 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"
+ finish preflight
+fi
+stamp=PLAN
+((history)) || stamp=$(get stamp)
+stamp=${stamp:-PLAN}
+
+step "2 backup: the current database (the upgrade keeps it: no configuration changes)"
+if ! done_step backup; then
+ if ((execute)); then replica; fi
+ 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
+config=(--exec "$new/equipo-runner" "EQUIPO_TOOL_PROXY_PATH=$new/equipo-tool-proxy")
+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"
+ # Written from the preflight's record, never the live files, so a retry
+ # gives the same files; each key, ExecStart and RestartSec exactly once.
+ run python3 "$REPO/scripts/runner-config.py" render "$BACKUPS/upgrade-$stamp" "$RUNNER_ROOT" "${config[@]}"
+ run systemctl --user daemon-reload
+ echo " the loaded unit starts $new/equipo-runner (systemctl show -p ExecStart)"
+ if ((execute)); then
+ [[ $(systemctl --user show -p ExecStart --value "$UNIT") == *"path=$new/equipo-runner ;"* ]] || die "the loaded $UNIT does not start $new/equipo-runner"
+ fi
+ finish runner
+fi
+want=$( [[ -f $staged ]] && python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["sha256"]["runner"])' "$staged" || echo "the runner hash in $staged")
+echo " nothing in flight, read again right before the restart. This is a short window, not a drain:"
+echo " work dispatched after the reading, or not yet in the replica, can still be cut by the restart."
+if ! done_step restart; then
+ # A retry after the restart happened finds the staged runner running and
+ # does not restart it again.
+ if ((execute)) && runs "$want"; then echo " $UNIT already runs the staged runner"; else
+ if ((execute)); then idle; fi
+ run systemctl --user restart "$UNIT"
+ fi
+ finish restart
+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"
+run curl -fsS "$ORIGIN/api/version"
+echo " sha256 of $PROC/<MainPID of $UNIT>/exe must be $want"
+echo " $ journalctl --user -b _SYSTEMD_INVOCATION_ID=<InvocationID> _PID=<MainPID> -o cat --no-pager"
+echo " the last stream line is msg=welcome (no later \"runner stream\" drop), on two readings of the same process"
+if ((execute)) && ! done_step verify; then
+ [[ $(curl -fsS "$ORIGIN/api/version") == "$version" ]] || die "production does not report $version"
+ connected "$want" "the staged $version runner" || die "the runner is not connected to the instance now; 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.'