oficina / equipo Public

Harden cutover finish and upgrade after review round 1

- cutover-thin.sh records deploy_started=1 before carlos deploy (and 0
  after step 4); rollback refuses the old version once a deploy may have
  begun, including older records past step 4 with no deploy_started.
- Records fail loudly in all three scripts.
- Finish step 8 resumes: the runner's files are recorded once, the state
  move is recorded and reconciled, and service.env and unit are written
  from the record by scripts/runner-config.py, which requires each key,
  ExecStart, RestartSec and EnvironmentFile exactly once, allows only
  plain path, origin and id characters, writes atomically and checks the
  result. The written and the loaded unit are checked before enrolment.
- Verification reads the journal of this boot and unit invocation: the
  staged runner's last stream line is the instance's welcome, on two
  readings of the same invocation and process. Upgrade rollback checks
  the previous runner is running and connected before recording; finish
  rollback checks the runner stopped and its files back.
- Upgrade idle counts unfinished dispatched turns too, and is read just
  before the restart; the plan says it is a short window, not a drain.
- The operator scripts are executable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev c149a3ea8d35d6e01346f3ba660ac40088681366 parent 093ca59
8 files changed, +849 −169
  • internal/release/cutover_finish_test.go +164 −10
  • internal/release/cutover_test.go +45 −7
  • internal/release/upgrade_test.go +107 −14
  • scripts/cutover-finish-thin.sh +100 −34
  • scripts/cutover-thin.sh +13 −4
  • scripts/runner-config.py +117 −0
  • scripts/runner-reference-allowlist.json +235 −67
  • scripts/upgrade-thin.sh +68 −33

CI passed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/upgrade-thin: Type  Size Avail | ext4   96G   86G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   86G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 4.2s
ci-box: codex: fetched and verified in 3.5s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.4s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 7.3s
ci-box: opencode: installed and verified in 2.2s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 3.0s
ci-box: file times set from content: 2721 files, 174 directories
ci-box: ready in 17.1s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipotest	0.241s
=== 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 1m18.907s 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.418s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.42s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 40.16, cpu waiting 21.32%, memory waiting 0.00%, io waiting 0.57%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m20.907s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m19.328s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m19.33s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 40.16, cpu waiting 20.68%, memory waiting 0.00%, io waiting 0.53%
--- 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 1m22.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 1m20.09s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m9.8s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.66s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.62s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 39.35, cpu waiting 20.20%, memory waiting 0.00%, io waiting 0.52%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m17.775s 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 1m16.295s amadan.net/oficina/equipo/internal/headless
receipt: slow test 36.73s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.13s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.41s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 40.16, cpu waiting 21.32%, memory waiting 0.00%, io waiting 0.57%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m34.598s 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 1m33.043s amadan.net/oficina/equipo/internal/headless
receipt: slow test 58.62s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.61s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 9.57s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.54s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.7s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 35.30, cpu waiting 17.41%, memory waiting 0.00%, io waiting 0.43%
--- 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 3m4.022s 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 3m2.071s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m42.2s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 23.46s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.27s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 7.97s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.25s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 9.69, cpu waiting 3.91%, memory waiting 0.00%, io waiting 0.09%
--- 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 299ms 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 1.26, cpu waiting 0.00%, 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 398ms 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 1.26, cpu waiting 0.00%, 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 4m27.237s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m39.981s 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 4m27.237s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.89s 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.73s 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.87s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.56, cpu waiting 0.78%, memory waiting 0.00%, io waiting 0.01%
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

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

receipt: test step 46.279s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 44.351s amadan.net/oficina/equipo/internal/runner
receipt: slow test 34.43s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 30.51s 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.84, cpu waiting 20.00%, memory waiting 0.00%, io waiting 0.98%
--- 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.388s 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.543s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.12s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.26s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.13s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.91s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 25.98, cpu waiting 13.28%, memory waiting 0.00%, io waiting 1.20%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 27.3%, load 18.58
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m3.896s 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.032s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.44s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.37s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 24.42s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 21.96s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 21.78s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelDuplicates
machine: 32 CPUs, load 35.30, cpu waiting 17.41%, memory waiting 0.00%, io waiting 0.43%
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 27.3%, load 18.58
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 401ms 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 18.58, cpu waiting 10.75%, memory waiting 0.00%, io waiting 1.28%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 27.3%, load 18.58
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m13.679s 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.391s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 13.94s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.83s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.8s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.77s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.7s amadan.net/oficina/equipo/internal/equipotest TestRosterProtectsLastOwner
machine: 32 CPUs, load 31.33, cpu waiting 14.77%, memory waiting 0.00%, io waiting 0.37%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 27.3%, load 18.58
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 520ms 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 18.58, cpu waiting 11.80%, memory waiting 0.00%, io waiting 1.24%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 27.3%, load 18.58
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 611ms 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 18.58, cpu waiting 11.80%, memory waiting 0.00%, io waiting 1.24%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 27.3%, load 18.58
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/cmd/equipo-runner: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runnerproto: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
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 17.498s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/containment took 39.138s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m13.986s 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 54.466s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.903s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 47.583s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 39.138s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 36.92s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 21.88s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 15.95s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 15.29s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 9.57s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringMissingModuleCache
receipt: slow test 8.4s amadan.net/oficina/equipo/internal/runner/checks TestCheckNamespaceGoRootInsideModuleCache
machine: 32 CPUs, load 13.12, cpu waiting 5.46%, memory waiting 0.00%, io waiting 0.13%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m21.52s 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.101s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.31s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 15.01s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 9.93s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.58s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.9s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 39.35, cpu waiting 20.68%, memory waiting 0.00%, io waiting 0.53%
--- 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.062s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m28.471s amadan.net/oficina/equipo/internal/headless
receipt: slow test 25.32s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 22.06s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.79s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.96s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.84s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 37.16, cpu waiting 17.96%, memory waiting 0.00%, io waiting 0.45%
--- 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.281s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m37.772s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.91s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 12.92s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 12.86s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 10.2s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.09s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 33.36, cpu waiting 15.75%, memory waiting 0.00%, io waiting 0.39%
--- 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-19T21:55:09.319Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-19T21:55:09.319Z level=INFO msg="startup phase done" phase=state_lock took=69µs
time=2026-11-19T21:55:09.319Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-19T21:55:09.319Z level=INFO msg="startup phase done" phase=claim_roots took=97µs
time=2026-11-19T21:55:09.319Z level=INFO msg="startup phase" phase=sweep
time=2026-11-19T21:55:09.349Z level=INFO msg="startup phase done" phase=sweep took=29.977ms
time=2026-11-19T21:55:09.349Z level=INFO msg="startup phase" phase=credentials
time=2026-11-19T21:55:09.349Z level=INFO msg="startup phase done" phase=credentials took=132µs
time=2026-11-19T21:55:09.349Z level=INFO msg="startup phase" phase=open_state
time=2026-11-19T21:55:09.390Z level=INFO msg="startup phase done" phase=open_state took=40.102ms
time=2026-11-19T21:55:09.390Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-19T21:55:09.391Z level=INFO msg=connecting host=127.0.0.1:40269 protocol=28
time=2026-11-19T21:55:09.392Z level=INFO msg=connected host=127.0.0.1:40269 took=1.007ms
time=2026-11-19T21:55:09.392Z level=INFO msg="capabilities gathering"
time=2026-11-19T21:55:09.393Z level=INFO msg="capabilities gathered" took=399µs tags=linux,claude,go
time=2026-11-19T21:55:09.393Z level=INFO msg="hello sent" protocol=28
time=2026-11-19T21:55:09.397Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-19T21:55:10.399Z level=INFO msg="connection checked" connection=claude-1 state=healthy
    browser_receipts_test.go:169: waiting for [...document.querySelectorAll('[equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes("I'm your coordinator")): context deadline exceeded (last evaluation: <nil>)
--- FAIL: TestBrowserEmptyExplore (5.82s)

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


receipt: test step 1m26.79s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m25.511s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.95s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 11.1s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.29s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 10.24s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.75s 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 c149a3ea8d35d6e01346f3ba660ac40088681366 5.82s 37.16
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 33.36, cpu waiting 16.29%, memory waiting 0.00%, io waiting 0.41%
--- 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 287ms 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 209ms 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 226ms 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 322ms 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 5.32, cpu waiting 1.38%, memory waiting 0.00%, io waiting 1.98%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless   (51s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.17s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.26s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.09s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.60s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.80s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless   (61s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 12.53s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 13.85s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 20.17s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 12.87s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (21s)
ok ./internal/headless TestMixedVersions 19.57s
+ 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 38.52, cpu waiting 21.66%, memory waiting 0.00%, io waiting 0.75%
--- 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 8s 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.1s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 173ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 66ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 5.11s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.63s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 170ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 70ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 3.103s 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.747s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 180ms 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 TestNamespaceRecoveryReusedPID
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
machine: 32 CPUs, load 11.50, cpu waiting 4.16%, memory waiting 0.00%, io waiting 1.73%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 27.3%, load 18.58
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, 2840 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.503s
machine: 32 CPUs, load 34.82, cpu waiting 19.45%, memory waiting 0.00%, io waiting 1.01%
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 27.3%, load 18.58
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 25.98, cpu waiting 11.80%, memory waiting 0.00%, io waiting 1.24%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 27.3%, load 18.58
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 25.98, cpu waiting 14.68%, memory waiting 0.00%, io waiting 1.16%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 27.3%, load 18.58
shard 28: make gitleaks
9:54PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
9:54PM INF 1021 commits scanned.
9:54PM INF scanned ~59947732 bytes (59.95 MB) in 13.2s
9:54PM INF no leaks found
machine: 32 CPUs, load 34.82, cpu waiting 19.45%, memory waiting 0.00%, io waiting 1.01%
=== 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.015ms, worst 1.098ms, budget 150ms
perf: GET /api/runner/protocol: median 83µs, worst 132µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 603µs, worst 694µs, budget 150ms
perf: GET /api/v1/accounts: median 430µs, worst 446µs, budget 150ms
perf: GET /api/v1/auth/devices: median 451µs, worst 459µs, budget 150ms
perf: GET /api/v1/budgets: median 474µs, worst 540µs, budget 150ms
perf: GET /api/v1/capabilities: median 271µs, worst 349µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.232ms, worst 1.281ms, budget 150ms
perf: GET /api/v1/connections: median 565µs, worst 613µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 532µs, worst 573µs, budget 150ms
perf: GET /api/v1/conversation: median 915µs, worst 970µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.662ms, worst 4.495ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.792ms, worst 1.88ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 461µs, worst 486µs, budget 150ms
perf: GET /api/v1/journey: median 9.03ms, worst 9.406ms, budget 150ms
perf: GET /api/v1/me: median 489µs, worst 520µs, budget 150ms
perf: GET /api/v1/me/settings: median 573µs, worst 586µs, budget 150ms
perf: GET /api/v1/needs-you: median 8.651ms, worst 8.895ms, budget 150ms
perf: GET /api/v1/notifications: median 1.617ms, worst 1.709ms, budget 150ms
perf: GET /api/v1/onboarding: median 390µs, worst 450µs, budget 150ms
perf: GET /api/v1/people: median 424µs, worst 447µs, budget 150ms
perf: GET /api/v1/playbooks: median 558µs, worst 601µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 514µs, worst 569µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 810µs, worst 867µs, budget 150ms
perf: GET /api/v1/preferences: median 756µs, worst 818µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 448µs, worst 478µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 586µs, worst 613µs, budget 150ms
perf: GET /api/v1/roster: median 447µs, worst 501µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 400µs, worst 443µs, budget 150ms
perf: GET /api/v1/specialists: median 7.986ms, worst 8.065ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.888ms, worst 8.005ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 830µs, worst 874µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.093ms, worst 1.135ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 707µs, worst 749µs, budget 150ms
perf: GET /api/v1/teams: median 412µs, worst 431µs, budget 150ms
perf: GET /api/v1/templates: median 580µs, worst 615µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 411µs, worst 483µs, budget 150ms
perf: GET /auth/callback: median 87µs, worst 118µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.233ms, worst 3.35ms, budget 150ms
perf: GET /auth/verify: median 72µs, worst 95µs, budget 150ms
perf: GET /connections: median 3.604ms, worst 3.753ms, budget 150ms
perf: GET /conversation: median 7.876ms, worst 10.454ms, budget 150ms
perf: GET /conversation/connections: median 236µs, worst 262µs, budget 150ms
perf: GET /conversation/notebook: median 238µs, worst 266µs, budget 150ms
perf: GET /conversation/settings: median 3.917ms, worst 4.007ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.487ms, worst 3.542ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.189ms, worst 6.255ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.288ms, worst 6.524ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.435ms, worst 3.603ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 4ms, worst 4.261ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.365ms, worst 4.626ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.591ms, worst 6.374ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.385ms, worst 3.594ms, budget 150ms
perf: GET /conversation/settings/thinking: median 3.857ms, worst 3.941ms, budget 150ms
perf: GET /housekeeping: median 3.648ms, worst 3.75ms, budget 150ms
perf: GET /invites/new: median 587µs, worst 632µs, budget 150ms
perf: GET /invites/{id}: median 592µs, worst 631µs, budget 150ms
perf: GET /jobs: median 3.21ms, worst 3.38ms, budget 150ms
perf: GET /jobs/{id}: median 4.404ms, worst 4.544ms, budget 150ms
perf: GET /journey: median 10.02ms, worst 10.262ms, budget 150ms
perf: GET /nav/rail: median 2.818ms, worst 2.932ms, budget 150ms
perf: GET /needs-you: median 10.256ms, worst 13.134ms, budget 150ms
perf: GET /onboarding: median 3.831ms, worst 3.873ms, budget 150ms
perf: GET /people: median 3.214ms, worst 3.353ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.46ms, worst 4.656ms, budget 150ms
perf: GET /playbooks: median 3.962ms, worst 4.088ms, budget 150ms
perf: GET /playbooks/new: median 4.041ms, worst 4.253ms, budget 150ms
perf: GET /playbooks/{id}: median 4.582ms, worst 4.654ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.58ms, worst 4.752ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 3.79ms, worst 3.847ms, budget 150ms
perf: GET /preferences: median 4.01ms, worst 4.247ms, budget 150ms
perf: GET /preferences/sources/{source}: median 4.139ms, worst 7.518ms, budget 150ms
perf: GET /projects: median 5.275ms, worst 5.432ms, budget 150ms
perf: GET /projects/accounts: median 3.556ms, worst 3.597ms, budget 150ms
perf: GET /projects/new: median 3.531ms, worst 3.582ms, budget 150ms
perf: GET /projects/{id}: median 10.202ms, worst 10.279ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.654ms, worst 3.731ms, budget 150ms
perf: GET /runners/enrol: median 4.276ms, worst 4.375ms, budget 150ms
perf: GET /settings: median 3.315ms, worst 3.376ms, budget 150ms
perf: GET /settings/coordinator: median 5.342ms, worst 5.489ms, budget 150ms
perf: GET /settings/devices: median 3.192ms, worst 3.372ms, budget 150ms
perf: GET /settings/recovery: median 3.369ms, worst 4.94ms, budget 150ms
perf: GET /settings/recovery/release: median 3.389ms, worst 3.546ms, budget 150ms
perf: GET /settings/thinking: median 246µs, worst 291µs, budget 150ms
perf: GET /signin: median 312µs, worst 335µs, budget 150ms
perf: GET /specialists/new: median 3.196ms, worst 3.272ms, budget 150ms
perf: GET /specialists/{key}: median 12.492ms, worst 12.649ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.881ms, worst 3.946ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 3.986ms, worst 4.052ms, budget 150ms
perf: GET /tasks: median 5.468ms, worst 5.568ms, budget 150ms
perf: GET /tasks/new: median 3.335ms, worst 3.367ms, budget 150ms
perf: GET /tasks/{id}: median 5.892ms, worst 5.989ms, budget 150ms
perf: GET /tasks/{id}/merge: median 5.509ms, worst 7.039ms, budget 150ms
perf: GET /tasks/{id}/move: median 5.068ms, worst 5.335ms, budget 150ms
perf: GET /tasks/{id}/plan: median 5.572ms, worst 5.782ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.509ms, worst 1.57ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 4.994ms, worst 5.146ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 4.546ms, worst 4.648ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.106ms, worst 4.342ms, budget 150ms
perf: GET /tasks/{id}/thread: median 7.755ms, worst 7.837ms, budget 150ms
perf: GET /team/{specialist}: median 4.205ms, worst 4.376ms, budget 150ms
perf: GET /teams: median 11.968ms, worst 14.029ms, budget 150ms
perf: GET /templates: median 3.796ms, worst 3.863ms, budget 150ms
perf: GET /usage: median 4.433ms, worst 4.566ms, budget 150ms
perf: GET /work: median 3.288ms, worst 3.401ms, budget 150ms
perf: cold boot: median 254ms of [253.447365ms 254.368477ms 254.59153ms], budget 500ms

receipt: test step 29.256s 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.846s 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.03s 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: 3.15 GiB in 21618 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
index c7e3c1dc..b2babbde 100644
--- a/internal/release/cutover_finish_test.go
+++ b/internal/release/cutover_finish_test.go
@@ -32,13 +32,13 @@ func newFinishRig(t *testing.T) *finishRig {
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"} {
+ 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 + "\necho new > \"$EQUIPO_RUNNER_STATE_DIR/credentials.json\"\n"
+ 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\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[:]) }
@@ -56,7 +56,6 @@ func newFinishRig(t *testing.T) *finishRig {
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")))
- r.write(filepath.Join(root, "journal"), "msg=welcome protocol=28 role=primary generation=1\n", 0600)
bin := filepath.Join(root, "bin")
log := "echo \"$(basename $0) $*\" >> " + r.log + "\n"
r.write(filepath.Join(bin, "curl"), "#!/bin/sh\n"+log+`case "$*" in
@@ -64,8 +63,11 @@ func newFinishRig(t *testing.T) *finishRig {
*) cat `+filepath.Join(root, "served")+` ;;
esac
`, 0700)
- r.write(filepath.Join(bin, "systemctl"), "#!/bin/sh\n"+log+"case \"$*\" in *MainPID*) echo 4242 ;; esac\n", 0700)
- r.write(filepath.Join(bin, "journalctl"), "#!/bin/sh\n"+log+"cat "+filepath.Join(root, "journal")+"\n", 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 ;;
@@ -99,7 +101,7 @@ func (r *finishRig) read(path string) string {
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=2", "CUTOVER_WAIT=0", "CUTOVER_PROC=" + filepath.Join(r.root, "proc"), "LANG=C.UTF-8"}
+ 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
}
@@ -118,8 +120,8 @@ func TestCutoverFinishPlanChangesNothing(t *testing.T) {
}
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", "EQUIPO_INSTANCE_ID=\""+keptID+"\"", "EQUIPO_ORIGIN=\"https://equipo.oficina.works\"", "state.pre-thin-20261119T140850Z",
- "== 9 enrol", "verify-installed", "enrol", "systemctl --user start", "== 10 verify", "msg=welcome", "Plan only.")
+ "== 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", "systemctl --user start", "== 10 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)
}
@@ -140,7 +142,7 @@ func TestCutoverFinishOnTheKeptDatabase(t *testing.T) {
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 _PID=4242")
+ "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)
@@ -212,7 +214,7 @@ func TestCutoverFinishRefusesBeforeChangingAnything(t *testing.T) {
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, "no welcome") {
+ 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)
@@ -270,3 +272,155 @@ func TestCutoverFinishRollbackOffersNoEarlierVersion(t *testing.T) {
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, "active"), "", 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)
+ }
+}
diff --git a/internal/release/cutover_test.go b/internal/release/cutover_test.go
index bcc80ed6..1cda7d80 100644
--- a/internal/release/cutover_test.go
+++ b/internal/release/cutover_test.go
@@ -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,15 +141,14 @@ func TestCutoverRefusesWithoutANewInstanceID(t *testing.T) {
}
}
-// Before its deploy, rollback restores the complete prior configuration.
-// After it, rollback is refused: on CARLOS the activator passes the app an
-// absolute --db, so the deployed version migrated the old database in
-// place and the previous version cannot read it.
+// 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)
- r.write(filepath.Join(r.root, "deployfail"), "", 0600)
- if out, err := r.run(cutoverVersion, "--execute"); err == nil {
- t.Fatalf("cutover went on after a failed deploy:\n%s", 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 {
@@ -165,6 +174,35 @@ func TestCutoverRollbackRestoresEverythingBeforeTheDeploy(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 {
diff --git a/internal/release/upgrade_test.go b/internal/release/upgrade_test.go
index 6cbea943..a2eda700 100644
--- a/internal/release/upgrade_test.go
+++ b/internal/release/upgrade_test.go
@@ -36,6 +36,9 @@ func newUpgradeRig(t *testing.T) *upgradeRig {
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"
@@ -45,13 +48,15 @@ func newUpgradeRig(t *testing.T) *upgradeRig {
r.write(filepath.Join(repo, "releases", "staged", upgradeTo+".json"), `{"staging": "PASS", "sha256": {"runner": "`+hex.EncodeToString(sum[:])+`"}}`, 0600)
old := filepath.Join(r.runner, "releases", upgradeFrom)
r.serviceEnv = "EQUIPO_ORIGIN=\"https://equipo.oficina.works\"\nEQUIPO_INSTANCE_ID=\"INSTANCE0000000000000000000\"\nEQUIPO_TOOL_PROXY_PATH=\"" + old + "/equipo-tool-proxy\"\nEQUIPO_RUNNER_STATE_DIR=\"" + filepath.Join(r.runner, "state") + "\"\nEQUIPO_SCRATCH_ROOT=\"/prod/scratch\"\nEQUIPO_WORKSPACE_ROOT=\"/prod/work\"\n"
- r.unit = "[Service]\nEnvironmentFile=" + filepath.Join(r.runner, "service.env") + "\nExecStart=" + old + "/equipo-runner run\nRestart=on-failure\n"
+ r.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", 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")))
@@ -60,15 +65,11 @@ func newUpgradeRig(t *testing.T) *upgradeRig {
r.write(filepath.Join(bin, "make"), "#!/bin/sh\n"+log, 0700)
r.write(filepath.Join(bin, "git"), "#!/bin/sh\n"+log, 0700)
r.write(filepath.Join(bin, "curl"), "#!/bin/sh\ncat "+filepath.Join(root, "served")+"\n", 0700)
- r.write(filepath.Join(bin, "systemctl"), "#!/bin/sh\n"+log+`case "$*" in
-*FragmentPath*) cat `+filepath.Join(root, "fragment")+` 2>/dev/null || echo `+filepath.Join(r.runner, "equipo-runner.service")+` ;;
-*MainPID*) echo 4242 ;;
-esac
-`, 0700)
+ 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' ;; *runner_sessions*) printf 'n\n1\n' ;; *) printf 'x\n%s\n' "$(cat `+filepath.Join(root, "inflight")+`)" ;; esac ;;
+ *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
@@ -96,7 +97,7 @@ func (r *upgradeRig) read(path string) string {
func (r *upgradeRig) run(args ...string) (string, error) {
cmd := exec.Command("bash", append([]string{r.script}, args...)...)
- cmd.Env = []string{"HOME=" + r.home, "PATH=" + filepath.Join(r.root, "bin") + ":/usr/bin:/bin", "UPGRADE_YES=1", "UPGRADE_TRIES=2", "UPGRADE_WAIT=0", "UPGRADE_PROC=" + filepath.Join(r.root, "proc"), "LANG=C.UTF-8"}
+ 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
}
@@ -128,8 +129,8 @@ func TestUpgradePlanChangesNothingAndRunsRunnersFirst(t *testing.T) {
}
inOrder(t, out, "from "+upgradeFrom+" to "+upgradeTo, "== 1 preflight", "staged-check RELEASE_VERSION="+upgradeTo, "must be 0/0",
"== 2 backup", "carlos db pull", "pragma integrity_check", "chmod 0400",
- "== 3 runner", "verify-installed", "nothing in flight, again", "systemctl --user restart equipo-runner.service",
- "== 4 instance", "--swap hold --version "+upgradeTo, "== 5 verify", "versions.runner')='"+upgradeTo+"'", "Plan only.")
+ "== 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)
}
@@ -148,8 +149,13 @@ func TestUpgradeSwitchesRunnerThenInstanceOnTheSameDatabase(t *testing.T) {
}
calls := r.read(r.log)
inOrder(t, calls, "make -C", "staged-check", "git -C", "merge-base --is-ancestor "+upgradeFrom+" "+upgradeTo, "db query", "db pull",
- "equipo-runner verify-installed "+filepath.Join(r.runner, "releases", upgradeTo, "equipo-tool-proxy"), "db query",
- "systemctl --user restart equipo-runner.service", "carlos deploy", "--swap hold --version "+upgradeTo, "runner_sessions")
+ "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)
@@ -183,7 +189,8 @@ func TestUpgradeRefusesBeforeChangingAnything(t *testing.T) {
"no cutover": func(r *upgradeRig) {
r.must(os.Remove(filepath.Join(r.home, ".local/share/equipo-cutover/cutover.state")))
},
- "steps in flight": func(r *upgradeRig) { r.write(filepath.Join(r.root, "inflight"), "1/0", 0600) },
+ "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)
@@ -265,6 +272,14 @@ func TestUpgradeRollbackRestoresRunnerAndVersion(t *testing.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)
@@ -283,6 +298,8 @@ func TestUpgradeRollbackRestoresRunnerAndVersion(t *testing.T) {
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)
}
@@ -290,3 +307,79 @@ func TestUpgradeRollbackRestoresRunnerAndVersion(t *testing.T) {
t.Fatalf("rolled-back state not kept: %v", kept)
}
}
+
+// unitStubs writes stub systemctl and journalctl for the runner unit at
+// unit: an invocation id (fresh on every call while root/flap exists),
+// main PID 4242, the loaded ExecStart (root/loaded, else the unit file's),
+// is-active (root/active) 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*) echo 4242 ;;
+*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)
+ }
+ }
+}
diff --git a/scripts/cutover-finish-thin.sh b/scripts/cutover-finish-thin.sh
old mode 100644
new mode 100755
index 5636097d..fe219ec5
--- a/scripts/cutover-finish-thin.sh
+++ b/scripts/cutover-finish-thin.sh
@@ -10,21 +10,24 @@
# 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 itself. 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. It is resumable.
+# 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
-# cutover.state records and the public origin, on both routes
+# 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 staged runner of that version beside the old one (bytes
-# checked against releases/staged), public origin, same
-# instance id; the old runner's state moved aside
-# 9 enrol verify-installed, enrol (the owner approves the link), start
-# 10 verify version and identity again; the unit runs the staged runner;
-# its log shows the instance's welcome to that process
+# 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), start
+# 10 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
@@ -53,7 +56,7 @@ case "${1:-} ${2:-}" in
"--execute ") execute=1 ;;
"rollback ") mode=rollback ;;
"rollback --execute") mode=rollback execute=1 ;;
-*) sed -n '2,31p' "$0"; exit 2 ;;
+*) sed -n '2,33p' "$0"; exit 2 ;;
esac
die() { echo "refused: $*" >&2; exit 1; }
@@ -75,16 +78,21 @@ run() {
}
# 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)) && 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() { 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
@@ -101,22 +109,76 @@ identity() {
# 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 $RUNNER_ROOT/state.pre-thin-$stamp ]]; then
+ 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 "$RUNNER_ROOT/state.pre-thin-$stamp" "$RUNNER_ROOT/state"
+ 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 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"
@@ -132,6 +194,8 @@ done_step deploy || refuse "the cutover has not deployed its version yet; use sc
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)"
@@ -164,26 +228,36 @@ if ! done_step unset; then
fi
step "8 install the staged runner beside the old one"
-new=$RUNNER_ROOT/releases/$version
if ! done_step runner; then
if ((execute)); then
- [[ -e $RUNNER_ROOT/state.pre-thin-$stamp ]] && die "state.pre-thin-$stamp already exists"
- install -d -m 0700 "$snap"
- cp -p "$RUNNER_ROOT/service.env" "$RUNNER_ROOT/equipo-runner.service" "$snap/"
+ 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 sed -i -e "s|^EQUIPO_TOOL_PROXY_PATH=.*|EQUIPO_TOOL_PROXY_PATH=\"$new/equipo-tool-proxy\"|" -e "s|^EQUIPO_INSTANCE_ID=.*|EQUIPO_INSTANCE_ID=\"$old_id\"|" -e "s|^EQUIPO_ORIGIN=.*|EQUIPO_ORIGIN=\"$PUBLIC_ORIGIN\"|" "$RUNNER_ROOT/service.env"
- run sed -i -e "s|^ExecStart=.*|ExecStart=$new/equipo-runner run|" -e '/^RestartPreventExitStatus=/d' -e '/^RestartSec=/a RestartPreventExitStatus=3' "$RUNNER_ROOT/equipo-runner.service"
- # The old state was written by the old runner for the old origin; kept for rollback.
- run mv "$RUNNER_ROOT/state" "$RUNNER_ROOT/state.pre-thin-$stamp"
- run install -d -m 0700 "$RUNNER_ROOT/state"
+ 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"
run systemctl --user start "$UNIT"
@@ -192,21 +266,13 @@ fi
step "10 verify (no replica)"
run curl -fsS "$ORIGIN/api/version"
-run systemctl --user is-active "$UNIT"
echo " install.sh names $old_id again; sha256 of $PROC/<MainPID>/exe is the staged runner's"
-echo " $ journalctl --user _PID=<MainPID> -o cat --no-pager # a msg=welcome line: the instance took the connection"
+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
- pid=$(systemctl --user show -p MainPID --value "$UNIT")
- [[ $pid =~ ^[1-9][0-9]*$ ]] || die "$UNIT is not running"
- [[ $(sha256sum "$PROC/$pid/exe" | cut -d ' ' -f 1) == "$(staged_sha runner)" ]] || die "the running runner is not the staged $version runner"
- welcomed=0
- for _ in $(seq "${CUTOVER_TRIES:-30}"); do
- if journalctl --user _PID="$pid" -o cat --no-pager | grep -q 'msg=welcome'; then welcomed=1; break; fi
- sleep "${CUTOVER_WAIT:-5}"
- done
- ((welcomed)) || die "the runner has no welcome from the instance; see journalctl --user -u $UNIT"
+ 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"
diff --git a/scripts/cutover-thin.sh b/scripts/cutover-thin.sh
index 23328ac9..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.
@@ -92,9 +95,12 @@ 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: the deployed version migrated the old database in place.
- if done_step deploy; then
- die "$(get version) migrated the production database in place (EQUIPO_DATABASE is ignored on CARLOS), and $(get prev_version) cannot read it. Finish on the kept database: scripts/cutover-finish-thin.sh"
+ # 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"
@@ -205,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 d6e149e3..26735b8b 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -15945,13 +15945,6 @@
"count": 1,
"reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
},
- {
- "path": "scripts/upgrade-thin.sh",
- "line_sha256": "13cae955220577b1be76283a90edcf206a696f3017a1c4d95e13d06545256492",
- "match": "equipo-runner",
- "count": 2,
- "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back."
- },
{
"path": "internal/release/upgrade_test.go",
"line_sha256": "b315acb3fe1248523bd1cba13f0e9419a3f1fed852d52a6e88bb2665c1fc50bb",
@@ -15982,268 +15975,443 @@
},
{
"path": "internal/release/upgrade_test.go",
- "line_sha256": "067df260ceff91170cc1ddbb7b8c44a7d9c09feff8f9179aeb334e7b3c00b420",
+ "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": "c9c06860121022396f126390b0ca200fa1b807969febc08a6ddb5abca248e0d9",
+ "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": "0caf4386bf4438b916dc914c103fa2ab2f4b41d7058d2769e45993e2aa5d97cf",
+ "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": "c2789b63b564aa04c685fb40058933bf368eaf7beaff825461c72ce5489c8abc",
+ "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": "5e8c262da6fa10151424e8851d3c1b1dddab6b6d8ee5e273b555626ffb28a36c",
+ "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": "e1de57ba930e0e8921ddb2c1866549fc485c41ed096ffee45efc4fd16aa92b76",
+ "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": "42fb097fdd65faf2c089814152fd97d30de553df75ca053d3bf6014453ad533b",
+ "line_sha256": "098e170a5bc8526e8d03a416f92e1008e8ce63cf6b5ff430f3c5fb68bea57eaf",
"match": "equipo-runner",
- "count": 1,
+ "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": "92e0cb6e234075d9fc1a567884f5dd7ac6d1666479319376d07179e68b6a54a6",
+ "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": "internal/release/upgrade_test.go",
- "line_sha256": "29c12566ed7044dd111ae72590e683f74cacbaa73127dd89d9698f8ebf527b32",
+ "path": "scripts/cutover-finish-thin.sh",
+ "line_sha256": "cc9a4f1d39cf13a08b04ddbe4607bfffc0d907fa96a07ded61506fc199e3a83b",
"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."
+ "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": "cb687beffc044d8ac0aca04838a993f090d025bcb5d0b90023160de6780c0d7f",
+ "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": "eb2b9b70ed1ed63b93a970f966a5eb264c8ec71c42d52cf0b457c08a4c855c5f",
+ "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": "098e170a5bc8526e8d03a416f92e1008e8ce63cf6b5ff430f3c5fb68bea57eaf",
+ "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": "b22c8ae7386d993a2634e7c184ca7a7c3ba8c4f6c492fddbe808ee0af26216e3",
+ "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": "scripts/cutover-finish-thin.sh",
- "line_sha256": "cc9a4f1d39cf13a08b04ddbe4607bfffc0d907fa96a07ded61506fc199e3a83b",
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "a1ac21a3f394ac32d10f370efd119ffabfb5cd434b34d1f1d6d00ed135b3aff2",
"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."
+ "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": "5387904268932982e0c79cca82a7935df90015ba54ea545f95a1943589bc13d1",
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "72fe0742134d2cad6e4f73f31590b5020298aa656767e2812cd57d190e6eb086",
"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."
+ "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": "95f7dd5e6d8dccf9adce4ee99a15c5c02ab43c11a29efaa3016b30f745a079bb",
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "8adb8b295b76e076dc8c77118d8d2d6da779545242c87dec47ecc42a61201ee5",
"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."
+ "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": "726e45e1b3fee0327a9cae24c19ae5161a0a7431aabbc9b5f81943f2174c65ea",
+ "path": "internal/release/upgrade_test.go",
+ "line_sha256": "9af63341746b59fe167f10cb4596cea300fc5e170d478879f3028d901bf15e05",
"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."
+ "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": "f3516baa7ba6cfe082af6c44eacc6a69cd683a370dd9f3d0a0e171396d337b9a",
+ "line_sha256": "7fb4566fa4fc2de31d0e2c1245476f07f24c1f24124736a943c2e97277b02a27",
"match": "equipo-runner",
- "count": 1,
+ "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": "67b3316b103986ea19bd7a0c7427e4f3e75760d72711b2d623439f7554863b6d",
+ "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": "8849d248c7527e322c2d8fe7300fda47e2c659e887e771a057ec80dabb8b3862",
+ "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": "ac3606fcb3f775c9331866cb07186b1d07dba5956b6536db392b27cc7330e1af",
+ "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": "7d5294cc821bb98fdf681b63042326ef90ccb5deefee5bc9eb497052023d1335",
+ "line_sha256": "cbfa9bfcd83504dcd196e34c615e3d0054fb3940ad1d6bb00a4d41673f355be5",
"match": "equipo-runner",
- "count": 2,
+ "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",
+ "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": "bdf6a5c5cd9cb8574f59c99e799dd44556619a7f8f85606ff41f6a5c11a4f834",
+ "line_sha256": "f166412dde230c4cdeaf6cc24f1665aa097b39a2271f06acec510e371e36b14a",
"match": "equipo-runner",
- "count": 1,
+ "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": "b315acb3fe1248523bd1cba13f0e9419a3f1fed852d52a6e88bb2665c1fc50bb",
+ "line_sha256": "ec77b37d0194b8a707ac59961d6796d83c2a99e22e1f2057d7cf9a509bf597da",
"match": "equipo-runner",
- "count": 1,
+ "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": "60a3d9430038ca22f024c3a491a0021eb689ac3e1722b619a76cfe3470f8427d",
+ "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": "707b5aaedf104217e953b4083e18b6627436993960a9bad37df7c799c70aa4c2",
+ "line_sha256": "5d83ed69d02766d60da9bc60114d885f6c44e02a1e60f711f350b6ac5e50b855",
"match": "equipo-runner",
- "count": 2,
+ "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",
+ "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": "5e560fc45e4c710658a74b3b2a6f2927aff817cd7671e3160efc271be4d89f57",
+ "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": "c9c06860121022396f126390b0ca200fa1b807969febc08a6ddb5abca248e0d9",
+ "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": "d27ef4c746c4edb2660ab80f5695ffc19368288b948105bccb0bc979f0fff143",
+ "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": "b0bf3c7b4a5c9687d50d5ea70d17fd21ac211a2adf1e7a689b1f25d78f72bb55",
+ "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": "8d36abb113f2fd8041b041b07c79a670d832081f95e8d7412bfd232471ff8829",
+ "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": "eca17b6c8ebf4a8082f6bbafa25957672a57bb3b00a99d2d7732f7ba8d0e60dd",
+ "line_sha256": "4cfab4ec17dd6c885bfe39e78bf816ce63d18453e3a698bed21c62a9c98bc5c0",
"match": "equipo-runner",
- "count": 1,
+ "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": "6a307e61a9c219df3411456ec34eb42cb3151dfab3850e0b7aafc8af60602bdd",
+ "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": "c4fb003c9d0a05da6cb58134cd2c22f532af4ecbbfb0effd2fe510a26db26431",
+ "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_finish_test.go",
- "line_sha256": "9e2410bd1041e36dec92ebadf32046d0546aae50f9c74ea2bc90765eb69ff636",
+ "path": "internal/release/cutover_test.go",
+ "line_sha256": "163d5178d859864b484c1b9582e995f1c3ad2d162ae9adcc87ddd69fc1d1fabb",
"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."
+ "reason": "Test of the production cutover script: a stub runner release, runner unit and runner paths under a temporary HOME."
},
{
- "path": "internal/release/cutover_finish_test.go",
- "line_sha256": "38f1162b40561ebbc3b2755a57d881df993c35d5da1e7465fb2eb50f9a986511",
+ "path": "scripts/runner-config.py",
+ "line_sha256": "e6c2e9a9db79b4caf6f0fd8d1e8dce5cffe97583e553702e9af870b155e0bee2",
"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."
+ "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."
}
]
diff --git a/scripts/upgrade-thin.sh b/scripts/upgrade-thin.sh
old mode 100644
new mode 100755
index c62d725e..1a84926e
--- a/scripts/upgrade-thin.sh
+++ b/scripts/upgrade-thin.sh
@@ -25,12 +25,16 @@
# 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; nothing in flight, then the unit switches
-# and restarts, keeping its state and enrolment
+# 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, the runner connected on it, and the running
-# runner's hash equal to the staged record's
+# 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
@@ -55,7 +59,7 @@ 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'))"
+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:-}
@@ -63,7 +67,7 @@ version=${1:-}
execute=0
[[ ${2:-} == --execute ]] && execute=1
if [[ $mode == upgrade && ! $version =~ ^[0-9a-f]{7,12}$ ]]; then
- sed -n '2,38p' "$0"
+ sed -n '2,42p' "$0"
exit 2
fi
@@ -87,7 +91,10 @@ run() {
# Recorded facts and finished steps, one KEY=value per line.
get_in() { [[ -f $1 ]] && sed -n "s/^$2=//p" "$1" | tail -1 || true; }
get() { get_in "$STATE" "$1"; }
-put() { ((execute)) && printf '%s=%s\n' "$1" "$2" >>"$STATE" || true; }
+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 ]]; }
@@ -95,13 +102,39 @@ 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, and merges among them: a runner restart fails a
-# running step, and a merge needs the runner it started with.
+# 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 steps in flight. $REPLICA"
- [[ $out =~ ^[0-9]+/[0-9]+$ ]] || die "could not read the steps in flight. $REPLICA"
- [[ $out == 0/0 ]] || die "in flight (steps/merges): $out; run again when nothing runs"
+ 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"
+}
+# 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.
@@ -135,8 +168,14 @@ if [[ $mode == rollback ]]; then
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"
+ step "rollback 4 start the previous runner, and see it connected"
run systemctl --user start "$UNIT"
+ prev_exec=$(sed -n 's/^ExecStart=\(.*\) run$/\1/p' "$snap/equipo-runner.service")
+ echo " $UNIT runs $prev_exec, welcomed by the instance in this invocation, on two readings"
+ if ((execute)); then
+ [[ -f $prev_exec ]] || die "the previous runner $prev_exec is missing"
+ connected "$(sha256sum "$prev_exec" | cut -d ' ' -f 1)" "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.'
@@ -178,8 +217,8 @@ echo " production serves ${base:--unknown-} ($ORIGIN/api/version), and $version
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:"
-printf ' $ carlos db query %s --sql "%s" # must be 0/0\n' "${carlos_app[*]}" "$IN_FLIGHT"
+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"
@@ -232,17 +271,24 @@ 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"
- echo " nothing in flight, again, just before the restart (a restart fails a running step)"
- if ((execute)); then idle; fi
- run sed -i -e "s|^EQUIPO_TOOL_PROXY_PATH=.*|EQUIPO_TOOL_PROXY_PATH=\"$new/equipo-tool-proxy\"|" "$RUNNER_ROOT/service.env"
- run sed -i -e "s|^ExecStart=.*|ExecStart=$new/equipo-runner run|" "$RUNNER_ROOT/equipo-runner.service"
+ # 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
+ 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 ((execute)); then idle; fi
run systemctl --user restart "$UNIT"
finish runner
fi
@@ -258,24 +304,13 @@ fi
step "5 verify"
want=$( [[ -f $staged ]] && python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["sha256"]["runner"])' "$staged" || echo "the runner hash in $staged")
-connected="SELECT count(*) FROM runner_sessions WHERE connected=1 AND json_extract(hello,'\$.versions.runner')='$version'"
run curl -fsS "$ORIGIN/api/version"
-run systemctl --user is-active "$UNIT"
echo " sha256 of $PROC/<MainPID of $UNIT>/exe must be $want"
-printf ' $ carlos db query %s --sql "%s" # at least 1\n' "${carlos_app[*]}" "$connected"
+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"
- pid=$(systemctl --user show -p MainPID --value "$UNIT")
- [[ $pid =~ ^[1-9][0-9]*$ ]] || die "$UNIT is not running"
- [[ $(sha256sum "$PROC/$pid/exe" | cut -d ' ' -f 1) == "$want" ]] || die "the running runner is not the staged $version runner"
- n=
- for _ in $(seq "${UPGRADE_TRIES:-30}"); do
- n=$(carlos db query "${carlos_app[@]}" --sql "$connected" 2>/dev/null | tail -1 || true)
- [[ $n =~ ^[1-9][0-9]*$ ]] && break
- n=
- sleep "${UPGRADE_WAIT:-5}"
- done
- [[ -n $n ]] || die "no runner on $version is connected; to undo: scripts/upgrade-thin.sh rollback --execute"
+ 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"