oficina / equipo Public

awsjob/livectl: hostedlive SDK tool for the Task 17 live calls

Ruling R40: every Lambda MicroVMs and Lambda core call of the live run
goes through the pinned Go SDK, not the CLI. livectl (package main,
hostedlive only, inside the adapter subtree) has one subcommand per
operation for connectors, images and VMs, plus caller. Each prints the
SDK's whole output as JSON, with the response's server time and request
ID. Failures are one JSON line on stderr with distinct exit codes.

It refuses any account but 640012953448 and any region but eu-west-1
(build constants, checked via STS first), creates outside the run
prefix, and deletes or changes of anything outside the run, read first.
Offline tests use stub APIs and a fake clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a36861a0441d3b97da46ac78023207b15c3152b2 parent abc4db4
7 files changed, +1,873 −0
  • docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md +31 −0
  • internal/isolatedjob/awsjob/livectl/connector.go +184 −0
  • internal/isolatedjob/awsjob/livectl/image.go +319 −0
  • internal/isolatedjob/awsjob/livectl/main.go +415 −0
  • internal/isolatedjob/awsjob/livectl/main_test.go +653 −0
  • internal/isolatedjob/awsjob/livectl/vm.go +192 −0
  • internal/isolatedjob/awsjob/livectl/wait.go +79 −0

CI passed — run details

CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/hosted-runners-1a: Type  Size Avail | ext4   96G   85G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   85G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.7s
ci-box: codex: fetched and verified in 7.3s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
ci-box: image pulled in 9.7s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: pi: installed and verified in 7.2s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 9.3s
ci-box: clone deepened in 3.4s
ci-box: file times set from content: 2915 files, 195 directories
ci-box: ready in 20.5s
=== 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.244s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  1.2s
+ go list -export -test -tags testbuild -f  ./...
  0.6s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  0.3s
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-24 15:56:00 +0000 UTC

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

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

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

receipt: test step 1m24.508s 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 1m22.331s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m11.87s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.69s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.78s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 35.50, cpu waiting 20.07%, memory waiting 0.00%, io waiting 0.56%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

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

receipt: test step 1m37.418s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m35.681s amadan.net/oficina/equipo/internal/headless
receipt: slow test 59.79s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.13s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 10.06s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.84s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.86s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 29.56, cpu waiting 16.85%, memory waiting 0.00%, io waiting 0.46%
--- 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 3m18.707s 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 3m16.637s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m45.31s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 24.09s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 20.56s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 8.11s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.35s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 6.83, cpu waiting 3.10%, 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 1.117s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 2m1.624s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 7.84s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.74s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.31s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
receipt: slow test 3.81s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.52s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
machine: 32 CPUs, load 2.15, cpu waiting 0.39%, memory waiting 0.00%, io waiting 2.31%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 1.045s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m26.784s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.08s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.03s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.41s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.4s amadan.net/oficina/equipo/internal/thintest TestContractPreview
receipt: slow test 2.34s amadan.net/oficina/equipo/internal/thintest TestContractPublishNameTaken
machine: 32 CPUs, load 2.15, cpu waiting 0.39%, memory waiting 0.00%, io waiting 2.31%
--- 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.99s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m40.966s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 4m27.99s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.94s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.88s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.78s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.47s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.72s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.23, 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.036s 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.026s amadan.net/oficina/equipo/internal/runner
receipt: slow test 25.99s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 36.74, cpu waiting 20.38%, memory waiting 0.00%, io waiting 1.07%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 46.248s 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.347s amadan.net/oficina/equipo/internal/runner
receipt: slow test 34.38s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 30.36s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.39s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.56s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 36.74, cpu waiting 20.38%, memory waiting 0.00%, io waiting 1.07%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 35.133s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 34.31s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.13s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.64s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.12s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.23s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 28.14, cpu waiting 14.69%, memory waiting 0.00%, io waiting 1.31%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 25.8%, load 19.97
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m4.525s 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.661s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.83s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.76s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 24.88s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.26s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.03s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfiguration
machine: 32 CPUs, load 31.87, cpu waiting 17.39%, memory waiting 0.00%, io waiting 0.47%
--- 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 25.8%, load 19.97
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest

receipt: test step 1.209s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m12.399s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 19.2s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 19.12s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
receipt: slow test 19.11s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 19.11s amadan.net/oficina/equipo/internal/equipotest TestProjectRetryAndRevision
receipt: slow test 19.08s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
machine: 32 CPUs, load 19.97, cpu waiting 11.46%, memory waiting 0.00%, io waiting 1.40%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 25.8%, load 19.97
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m15.31s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m3.358s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.64s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.72s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.68s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.65s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.6s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 27.99, cpu waiting 14.78%, memory waiting 0.00%, io waiting 0.40%
--- 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 25.8%, load 19.97
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 441ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m4.903s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 24.52s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 23.66s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.64s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 22.02s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsRollbackAndUnavailable
receipt: slow test 21.99s amadan.net/oficina/equipo/internal/equipotest TestSigninBackgroundSweep
machine: 32 CPUs, load 19.97, cpu waiting 11.46%, memory waiting 0.00%, io waiting 1.40%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 25.8%, load 19.97
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 564ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 48.756s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.61s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.41s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.5s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.47s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.21s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
machine: 32 CPUs, load 19.97, cpu waiting 11.46%, memory waiting 0.00%, io waiting 1.40%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 25.8%, load 19.97
test lane rest: ./cmd/equipo ./cmd/equipo-hosted-controller ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/hostedclient ./internal/hostedctl ./internal/hostedwire ./internal/idtest ./internal/isolatedjob ./internal/isolatedjob/awsjob ./internal/isolatedjob/guardfixture ./internal/isolatedjob/isolatedjobtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-hosted-controller ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/hostedclient ./internal/hostedctl ./internal/hostedwire ./internal/idtest ./internal/isolatedjob ./internal/isolatedjob/awsjob ./internal/isolatedjob/guardfixture ./internal/isolatedjob/isolatedjobtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/isolatedjob: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget note: internal/equipo took 45.275s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/chat took 12.529s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/hostedctl took 15.452s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/idtest took 39.84s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/release took 34.981s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/runner/containment took 39.476s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m15.386s against a 60s target (the gate's other steps are not in this figure)
receipt: 12 packages ran, 55 cached, 20 without tests, 0 failed
receipt: slow package 52.471s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.036s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 45.275s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 39.84s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 39.476s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 32.06s amadan.net/oficina/equipo/cmd/equipo-runner TestReleaseRunnerHasNoFakeWorker
receipt: slow test 21.47s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 14.86s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 13.95s amadan.net/oficina/equipo/internal/hostedctl TestLifecycleSimulation
receipt: slow test 10.89s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
machine: 32 CPUs, load 11.54, cpu waiting 5.46%, memory waiting 0.00%, io waiting 0.17%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m22.102s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m20.649s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.29s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 15.11s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.49s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.63s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.81s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 35.50, cpu waiting 20.61%, memory waiting 0.00%, io waiting 0.58%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m32.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 1m31.077s amadan.net/oficina/equipo/internal/headless
receipt: slow test 26.24s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 22.54s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 14.17s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 10.22s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 8.06s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 31.87, cpu waiting 17.39%, memory waiting 0.00%, io waiting 0.47%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m40.19s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m38.556s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.67s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.15s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 13.12s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 10.23s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.23s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 29.56, cpu waiting 15.77%, memory waiting 0.00%, io waiting 0.43%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-28T15:15:48.523Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-28T15:15:48.523Z level=INFO msg="startup phase done" phase=state_lock took=62µs
time=2026-11-28T15:15:48.523Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-28T15:15:48.523Z level=INFO msg="startup phase done" phase=claim_roots took=83µs
time=2026-11-28T15:15:48.523Z level=INFO msg="startup phase" phase=sweep
time=2026-11-28T15:15:48.556Z level=INFO msg="startup phase done" phase=sweep took=32.855ms
time=2026-11-28T15:15:48.556Z level=INFO msg="startup phase" phase=credentials
time=2026-11-28T15:15:48.556Z level=INFO msg="startup phase done" phase=credentials took=153µs
time=2026-11-28T15:15:48.557Z level=INFO msg="startup phase" phase=open_state
time=2026-11-28T15:15:48.597Z level=INFO msg="startup phase done" phase=open_state took=40.625ms
time=2026-11-28T15:15:48.598Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-28T15:15:48.599Z level=INFO msg=connecting host=127.0.0.1:36685 protocol=28
time=2026-11-28T15:15:48.601Z level=INFO msg=connected host=127.0.0.1:36685 took=1.942ms
time=2026-11-28T15:15:48.601Z level=INFO msg="capabilities gathering"
time=2026-11-28T15:15:48.601Z level=INFO msg="capabilities gathered" took=355µs tags=linux,claude,go
time=2026-11-28T15:15:48.602Z level=INFO msg="hello sent" protocol=28
time=2026-11-28T15:15:48.606Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-28T15:15:49.602Z 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.80s)

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


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

receipt: test step 972ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 573ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 570ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor)$' ./internal/idtest

receipt: test step 807ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1.673s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 1.67s amadan.net/oficina/equipo/internal/idtest TestBrowserOficinaIDDoor
browser lane browser-rest: ./internal/plan3test
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestTeamsHierarchyBrowser)$' ./internal/plan3test

receipt: test step 281ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1.856s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 1.86s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest

receipt: test step 1.136s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 3m20.199s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 17.52s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.35s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.02s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.55s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 7.93s amadan.net/oficina/equipo/internal/thintest TestBrowserInnerScreens
machine: 32 CPUs, load 5.66, cpu waiting 2.09%, memory waiting 0.00%, io waiting 2.16%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless   (52s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.30s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.35s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.34s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.56s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.77s
+ 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   (63s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 12.83s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 13.96s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 20.49s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 13.17s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (22s)
ok ./internal/headless TestMixedVersions 20.00s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.78s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (0s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 36.87, cpu waiting 21.54%, memory waiting 0.00%, io waiting 0.82%
--- shard 24 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 24: make runner-host
python3 scripts/runner-prerequisites.py
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks

receipt: test step 8.346s 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.064s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 156ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 74ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 2ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 5.05s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.64s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 290ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 160ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 70ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
CGO_ENABLED=0 EQUIPO_REQUIRE_USER_SESSION=1 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 3.141s 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.845s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 260ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
machine: 32 CPUs, load 13.04, cpu waiting 4.29%, memory waiting 0.00%, io waiting 1.96%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 25.8%, load 19.97
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2628 text files, 2854 matches, 0 failures
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 97 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipo	2.479s
machine: 32 CPUs, load 36.74, cpu waiting 19.27%, memory waiting 0.00%, io waiting 1.14%
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 28.4%, load 19.97
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 28.14, cpu waiting 12.95%, memory waiting 0.00%, io waiting 1.35%
--- 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 25.8%, load 19.97
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 33.41, cpu waiting 15.91%, memory waiting 0.00%, io waiting 1.27%
--- 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 25.8%, load 19.97
shard 28: make gitleaks
3:15PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
3:15PM INF 1165 commits scanned.
3:15PM INF scanned ~62632056 bytes (62.63 MB) in 13.4s
3:15PM INF no leaks found
machine: 32 CPUs, load 36.74, cpu waiting 19.27%, memory waiting 0.00%, io waiting 1.14%
=== 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.018ms, worst 1.097ms, budget 150ms
perf: GET /api/runner/protocol: median 74µs, worst 99µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 562µs, worst 603µs, budget 150ms
perf: GET /api/v1/accounts: median 402µs, worst 430µs, budget 150ms
perf: GET /api/v1/auth/devices: median 428µs, worst 453µs, budget 150ms
perf: GET /api/v1/budgets: median 488µs, worst 522µs, budget 150ms
perf: GET /api/v1/capabilities: median 250µs, worst 263µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.26ms, worst 1.307ms, budget 150ms
perf: GET /api/v1/connections: median 593µs, worst 607µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 522µs, worst 602µs, budget 150ms
perf: GET /api/v1/conversation: median 897µs, worst 969µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.4ms, worst 1.454ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.693ms, worst 1.809ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 458µs, worst 481µs, budget 150ms
perf: GET /api/v1/journey: median 7.326ms, worst 7.564ms, budget 150ms
perf: GET /api/v1/me: median 413µs, worst 455µs, budget 150ms
perf: GET /api/v1/me/settings: median 490µs, worst 540µs, budget 150ms
perf: GET /api/v1/needs-you: median 7.124ms, worst 7.246ms, budget 150ms
perf: GET /api/v1/notifications: median 1.653ms, worst 1.684ms, budget 150ms
perf: GET /api/v1/onboarding: median 400µs, worst 418µs, budget 150ms
perf: GET /api/v1/people: median 449µs, worst 496µs, budget 150ms
perf: GET /api/v1/playbooks: median 605µs, worst 653µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 544µs, worst 566µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 865µs, worst 893µs, budget 150ms
perf: GET /api/v1/preferences: median 810µs, worst 857µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 468µs, worst 504µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 619µs, worst 674µs, budget 150ms
perf: GET /api/v1/roster: median 466µs, worst 527µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 436µs, worst 480µs, budget 150ms
perf: GET /api/v1/specialists: median 8.038ms, worst 8.118ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.899ms, worst 8.027ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 862µs, worst 912µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.224ms, worst 3.934ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 740µs, worst 849µs, budget 150ms
perf: GET /api/v1/teams: median 420µs, worst 450µs, budget 150ms
perf: GET /api/v1/templates: median 584µs, worst 621µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 445µs, worst 486µs, budget 150ms
perf: GET /auth/callback: median 82µs, worst 121µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.276ms, worst 3.454ms, budget 150ms
perf: GET /auth/verify: median 89µs, worst 110µs, budget 150ms
perf: GET /connections: median 3.504ms, worst 3.605ms, budget 150ms
perf: GET /conversation: median 7.169ms, worst 7.444ms, budget 150ms
perf: GET /conversation/connections: median 243µs, worst 276µs, budget 150ms
perf: GET /conversation/notebook: median 236µs, worst 290µs, budget 150ms
perf: GET /conversation/settings: median 3.789ms, worst 3.838ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.439ms, worst 3.55ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.025ms, worst 6.218ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.275ms, worst 9.139ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.553ms, worst 3.623ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 3.981ms, worst 4.089ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.283ms, worst 4.388ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.239ms, worst 4.312ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.295ms, worst 3.346ms, budget 150ms
perf: GET /conversation/settings/thinking: median 3.786ms, worst 3.869ms, budget 150ms
perf: GET /housekeeping: median 3.641ms, worst 3.733ms, budget 150ms
perf: GET /invites/new: median 579µs, worst 656µs, budget 150ms
perf: GET /invites/{id}: median 590µs, worst 641µs, budget 150ms
perf: GET /jobs: median 3.193ms, worst 3.303ms, budget 150ms
perf: GET /jobs/{id}: median 4.378ms, worst 4.626ms, budget 150ms
perf: GET /journey: median 10.077ms, worst 10.563ms, budget 150ms
perf: GET /nav/rail: median 2.838ms, worst 2.905ms, budget 150ms
perf: GET /needs-you: median 9.633ms, worst 9.677ms, budget 150ms
perf: GET /onboarding: median 3.755ms, worst 3.786ms, budget 150ms
perf: GET /people: median 3.175ms, worst 3.228ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.926ms, worst 5.021ms, budget 150ms
perf: GET /playbooks: median 4.526ms, worst 4.705ms, budget 150ms
perf: GET /playbooks/new: median 4.621ms, worst 4.682ms, budget 150ms
perf: GET /playbooks/{id}: median 4.5ms, worst 5.866ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.472ms, worst 4.566ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 3.61ms, worst 3.682ms, budget 150ms
perf: GET /preferences: median 4.105ms, worst 4.143ms, budget 150ms
perf: GET /preferences/sources/{source}: median 3.857ms, worst 3.964ms, budget 150ms
perf: GET /projects: median 4.962ms, worst 5.085ms, budget 150ms
perf: GET /projects/accounts: median 3.42ms, worst 3.489ms, budget 150ms
perf: GET /projects/new: median 3.469ms, worst 3.503ms, budget 150ms
perf: GET /projects/{id}: median 10.024ms, worst 10.185ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.583ms, worst 3.662ms, budget 150ms
perf: GET /runners/enrol: median 4.355ms, worst 6.951ms, budget 150ms
perf: GET /settings: median 3.389ms, worst 3.495ms, budget 150ms
perf: GET /settings/coordinator: median 5.363ms, worst 5.476ms, budget 150ms
perf: GET /settings/devices: median 3.165ms, worst 3.212ms, budget 150ms
perf: GET /settings/recovery: median 3.299ms, worst 3.417ms, budget 150ms
perf: GET /settings/recovery/release: median 3.326ms, worst 3.426ms, budget 150ms
perf: GET /settings/thinking: median 248µs, worst 268µs, budget 150ms
perf: GET /signin: median 316µs, worst 344µs, budget 150ms
perf: GET /specialists/new: median 3.265ms, worst 3.316ms, budget 150ms
perf: GET /specialists/{key}: median 10.525ms, worst 10.546ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.518ms, worst 3.566ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 3.636ms, worst 3.665ms, budget 150ms
perf: GET /tasks: median 5.134ms, worst 6.984ms, budget 150ms
perf: GET /tasks/new: median 3.125ms, worst 3.235ms, budget 150ms
perf: GET /tasks/{id}: median 5.275ms, worst 5.427ms, budget 150ms
perf: GET /tasks/{id}/merge: median 4.61ms, worst 4.71ms, budget 150ms
perf: GET /tasks/{id}/move: median 4.361ms, worst 4.459ms, budget 150ms
perf: GET /tasks/{id}/plan: median 5.441ms, worst 5.496ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.444ms, worst 1.529ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 4.925ms, worst 5.003ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 4.514ms, worst 4.602ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.089ms, worst 4.211ms, budget 150ms
perf: GET /tasks/{id}/thread: median 7.762ms, worst 10.193ms, budget 150ms
perf: GET /team/{specialist}: median 4.282ms, worst 4.47ms, budget 150ms
perf: GET /teams: median 9.842ms, worst 10.069ms, budget 150ms
perf: GET /templates: median 3.313ms, worst 3.357ms, budget 150ms
perf: GET /usage: median 4.06ms, worst 4.098ms, budget 150ms
perf: GET /work: median 2.956ms, worst 3.001ms, budget 150ms
perf: cold boot: median 263ms of [259.702454ms 263.450365ms 264.526345ms], budget 500ms

receipt: test step 31.178s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 92 without tests, 0 failed
receipt: slow package 8.734s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-hosted-controller
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 test 7.89s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 840ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 3.96 GiB in 24482 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 0.91 GiB in 33199 files
diff --git a/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
index 4d77b0ea..5f8ac4be 100644
--- a/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
+++ b/docs/superpowers/plans/HOSTED-SLICE1-PROGRESS.md
@@ -1431,3 +1431,34 @@ SKIP TOPIC_ARN none
```
VM ledger (`vms.tsv`): empty, no VM was launched.
+
+### Revision 5 pre-flight: `livectl` (ruling R40)
+
+- `internal/isolatedjob/awsjob/livectl` (package main, `hostedlive` on every file) makes each Lambda
+ MicroVMs and Lambda core call of the live run through the pinned SDK. It has one subcommand per
+ operation:
+ - `connector` create, get, list-versions, wait-active, delete and wait-gone;
+ - `image` base-versions, create, update, get, get-version, list, wait-version and delete;
+ - `vm` run, get, list, suspend, resume, terminate and wait-state;
+ - `caller`.
+- Each subcommand prints the SDK's whole output struct as JSON (every field, null when absent).
+ `ResultMetadata` shows the response's `ServerTime` and `RequestID`.
+- Failures are one JSON line on stderr. Exit codes: 2 API, 3 usage, 4 guard, 5 wait timeout,
+ 6 failed state, 1 other.
+- Guards:
+ - account `640012953448` and region `eu-west-1` are build constants, checked through STS before
+ any other call;
+ - creates need a name (VM runs: the image's name and the client token) inside
+ `equipo-hosted-dev-t17-RUN`;
+ - deletes, updates and VM state changes read their target first.
+- It sits inside the adapter subtree, so the provider guard needs no change.
+- Runs:
+ - `go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -count=1` ok;
+ - `go vet -tags hostedlive ./internal/isolatedjob/...`, `make build vet` and `make budget`;
+ - the Task 7 guard passes unchanged.
+- No AWS call was made.
+
+| Mutation | Command | Observed failure | Restored |
+| --- | --- | --- | --- |
+| Account and region guard skipped (`checkCaller` returns nil at once) | `go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -run TestAccountRegionGuard -count=1` | `main_test.go:469: livectl ["connector" "get" "-id" "nc-1"] = exit 0, want 4` | yes, passes |
+| Run-prefix guard skipped (`inRun` returns nil at once) | `go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -run TestRunPrefixGuard -count=1` | `main_test.go:500: livectl ["connector" "create" "-name" "equipo-hosted-dev-t17-1128-abc123-conn" ...] = exit 0, want 4` | yes, passes |
diff --git a/internal/isolatedjob/awsjob/livectl/connector.go b/internal/isolatedjob/awsjob/livectl/connector.go
new file mode 100644
index 00000000..99b4d1ce
--- /dev/null
+++ b/internal/isolatedjob/awsjob/livectl/connector.go
@@ -0,0 +1,184 @@
+//go:build hostedlive
+
+package main
+
+import (
+ "flag"
+ "time"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/service/lambdacore"
+ coretypes "github.com/aws/aws-sdk-go-v2/service/lambdacore/types"
+)
+
+// connectorCreateInput is the VPC_EGRESS connector the hosted VMs use: one
+// subnet, one security group, IPv4, MicroVMs only, no Elastic IP setting.
+func connectorCreateInput(name, role, subnet, sg, token string, tags map[string]string) *lambdacore.CreateNetworkConnectorInput {
+ return &lambdacore.CreateNetworkConnectorInput{
+ Name: aws.String(name),
+ Configuration: &coretypes.NetworkConnectorConfigurationMemberVpcEgressConfiguration{
+ Value: coretypes.NetworkConnectorVpcEgressConfiguration{
+ SubnetIds: []string{subnet},
+ SecurityGroupIds: []string{sg},
+ NetworkProtocol: coretypes.NetworkProtocolIPv4,
+ AssociatedComputeResourceTypes: []coretypes.ComputeResourceType{coretypes.ComputeResourceTypeMicroVm},
+ },
+ },
+ OperatorRole: aws.String(role),
+ ClientToken: aws.String(token),
+ Tags: tags,
+ }
+}
+
+func cmdConnectorCreate(fs *flag.FlagSet) func(*env) (any, error) {
+ name := fs.String("name", "", "connector name (must start with the run prefix)")
+ role := fs.String("role", "", "operator role ARN")
+ subnet := fs.String("subnet", "", "the VM subnet ID")
+ sg := fs.String("sg", "", "the VM security group ID")
+ token := fs.String("client-token", "", "client token")
+ tags := tagsFlag{}
+ fs.Var(tags, "tag", "key=value tag (repeatable)")
+ return func(e *env) (any, error) {
+ if err := need("name", *name, "role", *role, "subnet", *subnet, "sg", *sg, "client-token", *token); err != nil {
+ return nil, err
+ }
+ if err := e.inRun("connector name", *name); err != nil {
+ return nil, err
+ }
+ out, err := e.core.CreateNetworkConnector(e.ctx, connectorCreateInput(*name, *role, *subnet, *sg, *token, tags))
+ if err != nil {
+ return nil, apiFailure("CreateNetworkConnector", err)
+ }
+ return out, nil
+ }
+}
+
+func (e *env) getConnector(id string) (*lambdacore.GetNetworkConnectorOutput, error) {
+ out, err := e.core.GetNetworkConnector(e.ctx, &lambdacore.GetNetworkConnectorInput{Identifier: aws.String(id)})
+ if err != nil {
+ return nil, apiFailure("GetNetworkConnector", err)
+ }
+ return out, nil
+}
+
+func cmdConnectorGet(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "connector ID, name or ARN; a version-qualified ARN reads that version")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ return e.getConnector(*id)
+ }
+}
+
+// listPage is what every list subcommand prints: each item of every page,
+// as the SDK gives it, and the number of pages read.
+type listPage[T any] struct {
+ Items []T
+ Pages int
+}
+
+func cmdConnectorListVersions(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "connector ID, name or unqualified ARN")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ var all listPage[coretypes.NetworkConnectorVersionSummary]
+ var marker *string
+ for {
+ out, err := e.core.ListNetworkConnectorVersions(e.ctx, &lambdacore.ListNetworkConnectorVersionsInput{
+ Identifier: aws.String(*id), Marker: marker})
+ if err != nil {
+ return nil, apiFailure("ListNetworkConnectorVersions", err)
+ }
+ all.Pages++
+ all.Items = append(all.Items, out.NetworkConnectorVersions...)
+ if aws.ToString(out.NextMarker) == "" {
+ return all, nil
+ }
+ if all.Pages >= maxPages {
+ return all, tooManyPages()
+ }
+ marker = out.NextMarker
+ }
+ }
+}
+
+func cmdConnectorWaitActive(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "connector ID, name or ARN")
+ w := waitFlags(fs, 10*time.Minute)
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ var last *lambdacore.GetNetworkConnectorOutput
+ err := w.poll(e, "connector ACTIVE", func() (bool, error) {
+ out, err := e.getConnector(*id)
+ if err != nil {
+ return false, err
+ }
+ last = out
+ switch out.State {
+ case coretypes.NetworkConnectorStateActive:
+ return true, nil
+ case coretypes.NetworkConnectorStateFailed, coretypes.NetworkConnectorStateDeleteFailed,
+ coretypes.NetworkConnectorStateDeleting, coretypes.NetworkConnectorStateInactive:
+ return false, failedState("connector", string(out.State))
+ }
+ return false, nil
+ })
+ return last, err
+ }
+}
+
+func cmdConnectorDelete(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "connector ID, name or unqualified ARN")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ cur, err := e.getConnector(*id)
+ if err != nil {
+ return nil, err
+ }
+ if err := e.inRun("connector name", aws.ToString(cur.Name)); err != nil {
+ return nil, err
+ }
+ out, err := e.core.DeleteNetworkConnector(e.ctx, &lambdacore.DeleteNetworkConnectorInput{Identifier: aws.String(*id)})
+ if err != nil {
+ return nil, apiFailure("DeleteNetworkConnector", err)
+ }
+ return out, nil
+ }
+}
+
+// cmdConnectorWaitGone waits until the connector reads as not found. A
+// connector in DELETE_FAILED ends the wait at once with exit 6 and code
+// DELETE_FAILED; its last read (StateReason included) is printed.
+func cmdConnectorWaitGone(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "connector ID, name or ARN")
+ w := waitFlags(fs, 40*time.Minute)
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ var last any
+ err := w.poll(e, "connector gone", func() (bool, error) {
+ out, err := e.core.GetNetworkConnector(e.ctx, &lambdacore.GetNetworkConnectorInput{Identifier: aws.String(*id)})
+ if isCode(err, "ResourceNotFoundException") {
+ last = map[string]any{"Gone": true, "Identifier": *id}
+ return true, nil
+ }
+ if err != nil {
+ return false, apiFailure("GetNetworkConnector", err)
+ }
+ last = out
+ if out.State == coretypes.NetworkConnectorStateDeleteFailed {
+ return false, failedState("connector", string(out.State))
+ }
+ return false, nil
+ })
+ return last, err
+ }
+}
diff --git a/internal/isolatedjob/awsjob/livectl/image.go b/internal/isolatedjob/awsjob/livectl/image.go
new file mode 100644
index 00000000..c3d24f85
--- /dev/null
+++ b/internal/isolatedjob/awsjob/livectl/image.go
@@ -0,0 +1,319 @@
+//go:build hostedlive
+
+package main
+
+import (
+ "flag"
+ "slices"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ vms "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms"
+ "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms/types"
+)
+
+// defaultBase is the managed base image Task 17 builds on.
+const defaultBase = "arn:aws:lambda:" + wantRegion + ":aws:microvm-image:al2023-1"
+
+// baseVersions is what image base-versions prints: the base image and all
+// its versions, newest first.
+type baseVersions struct {
+ BaseImage string
+ Items []types.ManagedMicrovmImageVersion
+ Pages int
+}
+
+func cmdImageBaseVersions(fs *flag.FlagSet) func(*env) (any, error) {
+ base := fs.String("base", defaultBase, "managed base image ARN")
+ return func(e *env) (any, error) {
+ all := baseVersions{BaseImage: *base}
+ var token *string
+ for {
+ out, err := e.vms.ListManagedMicrovmImageVersions(e.ctx, &vms.ListManagedMicrovmImageVersionsInput{
+ ImageIdentifier: aws.String(*base), NextToken: token})
+ if err != nil {
+ return nil, apiFailure("ListManagedMicrovmImageVersions", err)
+ }
+ all.Pages++
+ all.Items = append(all.Items, out.Items...)
+ if aws.ToString(out.NextToken) == "" {
+ break
+ }
+ if all.Pages >= maxPages {
+ return all, tooManyPages()
+ }
+ token = out.NextToken
+ }
+ slices.SortStableFunc(all.Items, func(a, b types.ManagedMicrovmImageVersion) int {
+ return compareVersions(aws.ToString(b.ImageVersion), aws.ToString(a.ImageVersion))
+ })
+ return all, nil
+ }
+}
+
+// compareVersions orders dotted versions by number, part by part ("10" after
+// "9", "3.1" after "3"); a part that is not a number compares as text.
+func compareVersions(a, b string) int {
+ pa, pb := strings.Split(a, "."), strings.Split(b, ".")
+ for i := range max(len(pa), len(pb)) {
+ if i >= len(pa) {
+ return -1
+ }
+ if i >= len(pb) {
+ return 1
+ }
+ na, ea := strconv.Atoi(pa[i])
+ nb, eb := strconv.Atoi(pb[i])
+ var c int
+ if ea == nil && eb == nil {
+ c = na - nb
+ } else {
+ c = strings.Compare(pa[i], pb[i])
+ }
+ if c != 0 {
+ return c
+ }
+ }
+ return 0
+}
+
+// imageBuild is one image version's build settings, shared by create and
+// update. The CPU is always x86_64 and the OS capabilities always ALL, as
+// the adapter's image check requires.
+type imageBuild struct {
+ description, artifact, base, baseVersion, buildRole, hooks, logGroup, token *string
+ memory *int
+}
+
+func imageBuildFlags(fs *flag.FlagSet) imageBuild {
+ return imageBuild{
+ description: fs.String("description", "", "version description"),
+ artifact: fs.String("artifact", "", "S3 URI of the code zip"),
+ base: fs.String("base", defaultBase, "managed base image ARN"),
+ baseVersion: fs.String("base-version", "", "managed base image version"),
+ buildRole: fs.String("build-role", "", "build role ARN"),
+ hooks: fs.String("hooks", "", "hooks JSON file (the API's Hooks shape: port, microvmHooks, microvmImageHooks)"),
+ logGroup: fs.String("log-group", "", "CloudWatch log group for the build and VMs"),
+ token: fs.String("client-token", "", "client token"),
+ memory: fs.Int("memory", 0, "minimum memory in MiB (2048 Small, 4096 Large)"),
+ }
+}
+
+// imageParts are the API values built from b.
+type imageParts struct {
+ hooks *types.Hooks
+ code types.CodeArtifact
+ logging types.Logging
+ cpu []types.CpuConfiguration
+ res []types.Resources
+ caps []types.Capability
+}
+
+func (b imageBuild) parts() (imageParts, error) {
+ if err := need("artifact", *b.artifact, "base", *b.base, "base-version", *b.baseVersion, "build-role", *b.buildRole,
+ "hooks", *b.hooks, "log-group", *b.logGroup, "client-token", *b.token); err != nil {
+ return imageParts{}, err
+ }
+ if *b.memory <= 0 {
+ return imageParts{}, usage("-memory is required")
+ }
+ var hooks types.Hooks
+ if err := readJSONFile(*b.hooks, &hooks); err != nil {
+ return imageParts{}, err
+ }
+ return imageParts{
+ hooks: &hooks,
+ code: &types.CodeArtifactMemberUri{Value: *b.artifact},
+ logging: &types.LoggingMemberCloudWatch{Value: types.CloudWatchLogging{LogGroup: aws.String(*b.logGroup)}},
+ cpu: []types.CpuConfiguration{{Architecture: types.ArchitectureX8664}},
+ res: []types.Resources{{MinimumMemoryInMiB: aws.Int32(int32(*b.memory))}},
+ caps: []types.Capability{types.CapabilityAll},
+ }, nil
+}
+
+func imageCreateInput(name string, b imageBuild, p imageParts, tags map[string]string) *vms.CreateMicrovmImageInput {
+ return &vms.CreateMicrovmImageInput{
+ Name: aws.String(name), Description: aws.String(*b.description), CodeArtifact: p.code,
+ BaseImageArn: aws.String(*b.base), BaseImageVersion: aws.String(*b.baseVersion), BuildRoleArn: aws.String(*b.buildRole),
+ CpuConfigurations: p.cpu, Resources: p.res, AdditionalOsCapabilities: p.caps, Hooks: p.hooks, Logging: p.logging,
+ Tags: tags, ClientToken: aws.String(*b.token),
+ }
+}
+
+func imageUpdateInput(id string, b imageBuild, p imageParts) *vms.UpdateMicrovmImageInput {
+ return &vms.UpdateMicrovmImageInput{
+ ImageIdentifier: aws.String(id), Description: aws.String(*b.description), CodeArtifact: p.code,
+ BaseImageArn: aws.String(*b.base), BaseImageVersion: aws.String(*b.baseVersion), BuildRoleArn: aws.String(*b.buildRole),
+ CpuConfigurations: p.cpu, Resources: p.res, AdditionalOsCapabilities: p.caps, Hooks: p.hooks, Logging: p.logging,
+ ClientToken: aws.String(*b.token),
+ }
+}
+
+func cmdImageCreate(fs *flag.FlagSet) func(*env) (any, error) {
+ name := fs.String("name", "", "image name (must start with the run prefix)")
+ tags := tagsFlag{}
+ fs.Var(tags, "tag", "key=value tag (repeatable)")
+ b := imageBuildFlags(fs)
+ return func(e *env) (any, error) {
+ if err := need("name", *name); err != nil {
+ return nil, err
+ }
+ if err := e.inRun("image name", *name); err != nil {
+ return nil, err
+ }
+ p, err := b.parts()
+ if err != nil {
+ return nil, err
+ }
+ out, err := e.vms.CreateMicrovmImage(e.ctx, imageCreateInput(*name, b, p, tags))
+ if err != nil {
+ return nil, apiFailure("CreateMicrovmImage", err)
+ }
+ return out, nil
+ }
+}
+
+func (e *env) getImage(id string) (*vms.GetMicrovmImageOutput, error) {
+ out, err := e.vms.GetMicrovmImage(e.ctx, &vms.GetMicrovmImageInput{ImageIdentifier: aws.String(id)})
+ if err != nil {
+ return nil, apiFailure("GetMicrovmImage", err)
+ }
+ return out, nil
+}
+
+// imageInRun reads image id and refuses it unless its name is in the run.
+func (e *env) imageInRun(id string) error {
+ cur, err := e.getImage(id)
+ if err != nil {
+ return err
+ }
+ return e.inRun("image name", aws.ToString(cur.Name))
+}
+
+func cmdImageUpdate(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "image ARN or name")
+ b := imageBuildFlags(fs)
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ p, err := b.parts()
+ if err != nil {
+ return nil, err
+ }
+ if err := e.imageInRun(*id); err != nil {
+ return nil, err
+ }
+ out, err := e.vms.UpdateMicrovmImage(e.ctx, imageUpdateInput(*id, b, p))
+ if err != nil {
+ return nil, apiFailure("UpdateMicrovmImage", err)
+ }
+ return out, nil
+ }
+}
+
+func cmdImageGet(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "image ARN or name")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ return e.getImage(*id)
+ }
+}
+
+func (e *env) getImageVersion(id, version string) (*vms.GetMicrovmImageVersionOutput, error) {
+ out, err := e.vms.GetMicrovmImageVersion(e.ctx, &vms.GetMicrovmImageVersionInput{
+ ImageIdentifier: aws.String(id), ImageVersion: aws.String(version)})
+ if err != nil {
+ return nil, apiFailure("GetMicrovmImageVersion", err)
+ }
+ return out, nil
+}
+
+func cmdImageGetVersion(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "image ARN or name")
+ version := fs.String("version", "", "image version")
+ return func(e *env) (any, error) {
+ if err := need("id", *id, "version", *version); err != nil {
+ return nil, err
+ }
+ return e.getImageVersion(*id, *version)
+ }
+}
+
+func cmdImageList(fs *flag.FlagSet) func(*env) (any, error) {
+ nameFilter := fs.String("name", "", "the API's name filter (empty lists every image)")
+ return func(e *env) (any, error) {
+ var all listPage[types.MicrovmImageSummary]
+ var token *string
+ var filter *string
+ if *nameFilter != "" {
+ filter = nameFilter
+ }
+ for {
+ out, err := e.vms.ListMicrovmImages(e.ctx, &vms.ListMicrovmImagesInput{NameFilter: filter, NextToken: token})
+ if err != nil {
+ return nil, apiFailure("ListMicrovmImages", err)
+ }
+ all.Pages++
+ all.Items = append(all.Items, out.Items...)
+ if aws.ToString(out.NextToken) == "" {
+ return all, nil
+ }
+ if all.Pages >= maxPages {
+ return all, tooManyPages()
+ }
+ token = out.NextToken
+ }
+ }
+}
+
+// cmdImageWaitVersion waits for a version to be SUCCESSFUL and ACTIVE. A
+// FAILED, DELETING, DELETED or DELETE_FAILED version ends the wait (exit 6).
+func cmdImageWaitVersion(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "image ARN or name")
+ version := fs.String("version", "", "image version")
+ w := waitFlags(fs, 20*time.Minute)
+ return func(e *env) (any, error) {
+ if err := need("id", *id, "version", *version); err != nil {
+ return nil, err
+ }
+ var last *vms.GetMicrovmImageVersionOutput
+ err := w.poll(e, "image version built", func() (bool, error) {
+ out, err := e.getImageVersion(*id, *version)
+ if err != nil {
+ return false, err
+ }
+ last = out
+ switch out.State {
+ case types.MicrovmImageVersionStateSuccessful:
+ return out.Status == types.MicrovmImageVersionStatusActive, nil
+ case types.MicrovmImageVersionStateFailed, types.MicrovmImageVersionStateDeleting,
+ types.MicrovmImageVersionStateDeleted, types.MicrovmImageVersionStateDeleteFailed:
+ return false, failedState("image version", string(out.State))
+ }
+ return false, nil
+ })
+ return last, err
+ }
+}
+
+func cmdImageDelete(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "image ARN or name")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ if err := e.imageInRun(*id); err != nil {
+ return nil, err
+ }
+ out, err := e.vms.DeleteMicrovmImage(e.ctx, &vms.DeleteMicrovmImageInput{ImageIdentifier: aws.String(*id)})
+ if err != nil {
+ return nil, apiFailure("DeleteMicrovmImage", err)
+ }
+ return out, nil
+ }
+}
diff --git a/internal/isolatedjob/awsjob/livectl/main.go b/internal/isolatedjob/awsjob/livectl/main.go
new file mode 100644
index 00000000..645d2f58
--- /dev/null
+++ b/internal/isolatedjob/awsjob/livectl/main.go
@@ -0,0 +1,415 @@
+//go:build hostedlive
+
+// Command livectl makes the Lambda MicroVMs and Lambda core calls of the
+// Task 17 live check through the pinned Go SDK (controller ruling R40), so
+// the run uses the client production uses rather than the CLI's model. The
+// plan's bash blocks call it, one subcommand per operation:
+//
+// livectl [-run RUN] GROUP VERB [flags]
+//
+// Each success prints the SDK's complete output as one JSON object on
+// stdout. Each failure prints one JSON line on stderr and exits with:
+//
+// 2 an SDK call failed (code and HTTP status in the line)
+// 3 usage
+// 4 a guard refused (wrong account or region, or a name outside the run)
+// 5 a bounded wait ran out
+// 6 a wait reached a failed state (DELETE_FAILED, FAILED, TERMINATED)
+// 1 anything else (config load, encoding)
+//
+// Guards, before any other call: the caller's account must be
+// wantAccount and the region wantRegion (build-time constants, no flag);
+// every create needs a name starting with the run prefix
+// equipo-hosted-dev-t17-RUN; every delete, update and VM state change
+// reads its target first and refuses one outside the run.
+//
+// It is built only with -tags hostedlive and never runs in CI.
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "os"
+ "reflect"
+ "regexp"
+ "strings"
+ "time"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
+ "github.com/aws/aws-sdk-go-v2/config"
+ "github.com/aws/aws-sdk-go-v2/service/lambdacore"
+ vms "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms"
+ "github.com/aws/aws-sdk-go-v2/service/sts"
+ "github.com/aws/smithy-go"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// The one account and region this tool works in. Changing them is a code
+// change, reviewed like any other.
+const (
+ wantAccount = "640012953448"
+ wantRegion = "eu-west-1"
+ prefixBase = "equipo-hosted-dev-t17-"
+)
+
+const (
+ exitOK = 0
+ exitOther = 1
+ exitAPI = 2
+ exitUsage = 3
+ exitGuard = 4
+ exitTimeout = 5
+ exitFailed = 6
+)
+
+// Waits are bounded: -timeout is capped at maxWait.
+const (
+ maxWait = 60 * time.Minute
+ defaultInterval = 15 * time.Second
+)
+
+type coreAPI interface {
+ CreateNetworkConnector(context.Context, *lambdacore.CreateNetworkConnectorInput, ...func(*lambdacore.Options)) (*lambdacore.CreateNetworkConnectorOutput, error)
+ GetNetworkConnector(context.Context, *lambdacore.GetNetworkConnectorInput, ...func(*lambdacore.Options)) (*lambdacore.GetNetworkConnectorOutput, error)
+ ListNetworkConnectorVersions(context.Context, *lambdacore.ListNetworkConnectorVersionsInput, ...func(*lambdacore.Options)) (*lambdacore.ListNetworkConnectorVersionsOutput, error)
+ DeleteNetworkConnector(context.Context, *lambdacore.DeleteNetworkConnectorInput, ...func(*lambdacore.Options)) (*lambdacore.DeleteNetworkConnectorOutput, error)
+}
+
+type vmAPI interface {
+ ListManagedMicrovmImageVersions(context.Context, *vms.ListManagedMicrovmImageVersionsInput, ...func(*vms.Options)) (*vms.ListManagedMicrovmImageVersionsOutput, error)
+ CreateMicrovmImage(context.Context, *vms.CreateMicrovmImageInput, ...func(*vms.Options)) (*vms.CreateMicrovmImageOutput, error)
+ UpdateMicrovmImage(context.Context, *vms.UpdateMicrovmImageInput, ...func(*vms.Options)) (*vms.UpdateMicrovmImageOutput, error)
+ GetMicrovmImage(context.Context, *vms.GetMicrovmImageInput, ...func(*vms.Options)) (*vms.GetMicrovmImageOutput, error)
+ GetMicrovmImageVersion(context.Context, *vms.GetMicrovmImageVersionInput, ...func(*vms.Options)) (*vms.GetMicrovmImageVersionOutput, error)
+ ListMicrovmImages(context.Context, *vms.ListMicrovmImagesInput, ...func(*vms.Options)) (*vms.ListMicrovmImagesOutput, error)
+ DeleteMicrovmImage(context.Context, *vms.DeleteMicrovmImageInput, ...func(*vms.Options)) (*vms.DeleteMicrovmImageOutput, error)
+ RunMicrovm(context.Context, *vms.RunMicrovmInput, ...func(*vms.Options)) (*vms.RunMicrovmOutput, error)
+ GetMicrovm(context.Context, *vms.GetMicrovmInput, ...func(*vms.Options)) (*vms.GetMicrovmOutput, error)
+ ListMicrovms(context.Context, *vms.ListMicrovmsInput, ...func(*vms.Options)) (*vms.ListMicrovmsOutput, error)
+ SuspendMicrovm(context.Context, *vms.SuspendMicrovmInput, ...func(*vms.Options)) (*vms.SuspendMicrovmOutput, error)
+ ResumeMicrovm(context.Context, *vms.ResumeMicrovmInput, ...func(*vms.Options)) (*vms.ResumeMicrovmOutput, error)
+ TerminateMicrovm(context.Context, *vms.TerminateMicrovmInput, ...func(*vms.Options)) (*vms.TerminateMicrovmOutput, error)
+}
+
+type stsAPI interface {
+ GetCallerIdentity(context.Context, *sts.GetCallerIdentityInput, ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)
+}
+
+// clock is time for the waits; tests use a fake one.
+type clock interface {
+ Now() time.Time
+ Sleep(time.Duration)
+}
+
+type realClock struct{}
+
+func (realClock) Now() time.Time { return time.Now() }
+func (realClock) Sleep(d time.Duration) { time.Sleep(d) }
+
+// env is everything a subcommand uses.
+type env struct {
+ ctx context.Context
+ core coreAPI
+ vms vmAPI
+ sts stsAPI
+ region string // the SDK config's region
+ clock clock
+ out io.Writer
+ errw io.Writer
+ prefix string // equipo-hosted-dev-t17-RUN, or "" without -run
+}
+
+// failure is a command's end other than success.
+type failure struct {
+ exit int
+ Kind string `json:"error"` // api, usage, guard, timeout, failed_state, other
+ Op string `json:"op,omitempty"`
+ Code string `json:"code,omitempty"` // smithy ErrorCode, or the failed state
+ Status int `json:"http_status,omitempty"` // HTTP status of a failed call
+ Message string `json:"message"` // fixed text
+ // AWSMessage is the service's own message for a failed call, kept
+ // apart from Message for the operator (the plan matches refusals on
+ // it). It is never parsed by this tool.
+ AWSMessage string `json:"aws_message,omitempty"`
+ RequestID string `json:"request_id,omitempty"`
+}
+
+func (f *failure) Error() string { return f.Kind + ": " + f.Message }
+
+func usage(format string, args ...any) *failure {
+ return &failure{exit: exitUsage, Kind: "usage", Message: fmt.Sprintf(format, args...)}
+}
+
+func guard(format string, args ...any) *failure {
+ return &failure{exit: exitGuard, Kind: "guard", Message: fmt.Sprintf(format, args...)}
+}
+
+// apiFailure describes a failed SDK call op: its error code, HTTP status
+// and request ID when the SDK has them.
+func apiFailure(op string, err error) *failure {
+ f := &failure{exit: exitAPI, Kind: "api", Op: op, Message: op + " failed"}
+ var ae smithy.APIError
+ if errors.As(err, &ae) {
+ f.Code, f.AWSMessage = ae.ErrorCode(), ae.ErrorMessage()
+ } else {
+ f.Kind, f.Message = "transport", op+" failed before an answer came back"
+ }
+ var he *smithyhttp.ResponseError
+ if errors.As(err, &he) && he.Response != nil {
+ f.Status = he.HTTPStatusCode()
+ }
+ var re *awshttp.ResponseError
+ if errors.As(err, &re) {
+ f.RequestID = re.ServiceRequestID()
+ }
+ return f
+}
+
+// isCode reports whether err is an SDK error with code.
+func isCode(err error, code string) bool {
+ var ae smithy.APIError
+ return errors.As(err, &ae) && ae.ErrorCode() == code
+}
+
+func main() {
+ ctx := context.Background()
+ cfg, err := config.LoadDefaultConfig(ctx)
+ e := &env{ctx: ctx, clock: realClock{}, out: os.Stdout, errw: os.Stderr}
+ if err != nil {
+ os.Exit(report(e, &failure{exit: exitOther, Kind: "other", Message: "AWS config did not load"}))
+ }
+ if cfg.Region == "" {
+ cfg.Region = wantRegion
+ }
+ e.region = cfg.Region
+ e.core, e.vms, e.sts = lambdacore.NewFromConfig(cfg), vms.NewFromConfig(cfg), sts.NewFromConfig(cfg)
+ os.Exit(run(e, os.Args[1:]))
+}
+
+// run parses args, checks the account and region, and runs one
+// subcommand. It returns the exit code.
+func run(e *env, args []string) int {
+ top := flag.NewFlagSet("livectl", flag.ContinueOnError)
+ top.SetOutput(io.Discard)
+ runID := top.String("run", "", "run ID; names must start with "+prefixBase+"RUN")
+ if err := top.Parse(args); err != nil {
+ return report(e, usage("%v", err))
+ }
+ rest := top.Args()
+ if len(rest) == 0 {
+ return report(e, usage("want GROUP VERB: connector, image, vm or caller"))
+ }
+ if *runID != "" {
+ if !runPattern.MatchString(*runID) {
+ return report(e, usage("-run %q must be 1 to 32 lower-case letters, digits and '-'", *runID))
+ }
+ e.prefix = prefixBase + *runID
+ }
+ cmd, ok := lookup(rest)
+ if !ok {
+ return report(e, usage("unknown command %q", strings.Join(rest[:min(2, len(rest))], " ")))
+ }
+ n := 2
+ if rest[0] == "caller" {
+ n = 1
+ }
+ fs := flag.NewFlagSet(strings.Join(rest[:n], " "), flag.ContinueOnError)
+ fs.SetOutput(io.Discard)
+ exec := cmd(fs)
+ if err := fs.Parse(rest[n:]); err != nil {
+ return report(e, usage("%v", err))
+ }
+ if fs.NArg() != 0 {
+ return report(e, usage("unexpected arguments %q", fs.Args()))
+ }
+ if f := checkCaller(e); f != nil {
+ return report(e, f)
+ }
+ out, err := exec(e)
+ if rv := reflect.ValueOf(out); out != nil && !(rv.Kind() == reflect.Pointer && rv.IsNil()) {
+ if perr := printJSON(e.out, out); perr != nil {
+ return report(e, &failure{exit: exitOther, Kind: "other", Message: "output did not encode"})
+ }
+ }
+ if err != nil {
+ var f *failure
+ if !errors.As(err, &f) {
+ f = &failure{exit: exitOther, Kind: "other", Message: err.Error()}
+ }
+ return report(e, f)
+ }
+ return exitOK
+}
+
+var runPattern = regexp.MustCompile(`^[0-9a-z-]{1,32}$`)
+
+// command declares its flags on fs and returns the step to run after the
+// guards. A step returns what to print (even on failure, such as the
+// last state a failed wait read) and its error.
+type command func(fs *flag.FlagSet) func(*env) (any, error)
+
+func lookup(args []string) (command, bool) {
+ if args[0] == "caller" {
+ return cmdCaller, true
+ }
+ if len(args) < 2 {
+ return nil, false
+ }
+ c, ok := commands[args[0]+" "+args[1]]
+ return c, ok
+}
+
+var commands = map[string]command{}
+
+func init() {
+ for name, c := range map[string]command{
+ "connector create": cmdConnectorCreate, "connector get": cmdConnectorGet,
+ "connector list-versions": cmdConnectorListVersions, "connector wait-active": cmdConnectorWaitActive,
+ "connector delete": cmdConnectorDelete, "connector wait-gone": cmdConnectorWaitGone,
+ "image base-versions": cmdImageBaseVersions, "image create": cmdImageCreate, "image update": cmdImageUpdate,
+ "image get": cmdImageGet, "image get-version": cmdImageGetVersion, "image list": cmdImageList,
+ "image wait-version": cmdImageWaitVersion, "image delete": cmdImageDelete,
+ "vm run": cmdVMRun, "vm get": cmdVMGet, "vm list": cmdVMList, "vm suspend": cmdVMSuspend,
+ "vm resume": cmdVMResume, "vm terminate": cmdVMTerminate, "vm wait-state": cmdVMWaitState,
+ } {
+ commands[name] = c
+ }
+}
+
+// checkCaller is the account and region guard every subcommand passes
+// first.
+func checkCaller(e *env) *failure {
+ if e.region != wantRegion {
+ return guard("region is %q, want %s", e.region, wantRegion)
+ }
+ out, err := e.sts.GetCallerIdentity(e.ctx, &sts.GetCallerIdentityInput{})
+ if err != nil {
+ return apiFailure("GetCallerIdentity", err)
+ }
+ if a := aws.ToString(out.Account); a != wantAccount {
+ return guard("caller account is %q, want %s", a, wantAccount)
+ }
+ return nil
+}
+
+func cmdCaller(*flag.FlagSet) func(*env) (any, error) {
+ return func(e *env) (any, error) {
+ out, err := e.sts.GetCallerIdentity(e.ctx, &sts.GetCallerIdentityInput{})
+ if err != nil {
+ return nil, apiFailure("GetCallerIdentity", err)
+ }
+ return map[string]any{"Account": aws.ToString(out.Account), "Arn": aws.ToString(out.Arn),
+ "UserId": aws.ToString(out.UserId), "Region": e.region}, nil
+ }
+}
+
+// inRun refuses name unless it is the run prefix or starts with it and a
+// '-'. Without -run every name is refused.
+func (e *env) inRun(what, name string) error {
+ if e.prefix == "" {
+ return guard("%s needs -run", what)
+ }
+ if name != e.prefix && !strings.HasPrefix(name, e.prefix+"-") {
+ return guard("%s %q is outside run %s", what, name, e.prefix)
+ }
+ return nil
+}
+
+// report writes f as one JSON line on stderr and returns its exit code.
+func report(e *env, f *failure) int {
+ b, err := json.Marshal(f)
+ if err != nil {
+ b = []byte(`{"error":"other","message":"error did not encode"}`)
+ }
+ fmt.Fprintf(e.errw, "%s\n", b)
+ return f.exit
+}
+
+// printJSON writes v as one JSON object. Every SDK output struct is
+// marshalled whole, so each field is present (null when the service left
+// it out); ResultMetadata is replaced by the response's server time and
+// request ID.
+func printJSON(w io.Writer, v any) error {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return err
+ }
+ var m map[string]json.RawMessage
+ if json.Unmarshal(b, &m) == nil {
+ if meta, ok := resultMetadata(v); ok {
+ mb, err := json.Marshal(meta)
+ if err != nil {
+ return err
+ }
+ m["ResultMetadata"] = mb
+ if b, err = json.Marshal(m); err != nil {
+ return err
+ }
+ }
+ }
+ _, err = fmt.Fprintf(w, "%s\n", b)
+ return err
+}
+
+// metaView is what ResultMetadata shows.
+type metaView struct {
+ ServerTime *time.Time `json:"ServerTime"` // the response's Date header
+ RequestID string `json:"RequestID"`
+}
+
+func resultMetadata(v any) (metaView, bool) {
+ md, ok := metadataOf(v)
+ if !ok {
+ return metaView{}, false
+ }
+ var mv metaView
+ if t, ok := awsmiddleware.GetServerTime(md); ok {
+ mv.ServerTime = &t
+ }
+ mv.RequestID, _ = awsmiddleware.GetRequestIDMetadata(md)
+ return mv, true
+}
+
+// readJSONFile decodes path into v, refusing unknown fields.
+func readJSONFile(path string, v any) error {
+ f, err := os.Open(path)
+ if err != nil {
+ return usage("cannot read %s", path)
+ }
+ defer f.Close()
+ dec := json.NewDecoder(f)
+ dec.DisallowUnknownFields()
+ if err := dec.Decode(v); err != nil {
+ return usage("%s is not the expected JSON: %v", path, err)
+ }
+ return nil
+}
+
+// tagsFlag collects repeated -tag k=v flags.
+type tagsFlag map[string]string
+
+func (t tagsFlag) String() string { return fmt.Sprint(map[string]string(t)) }
+func (t tagsFlag) Set(s string) error {
+ k, v, ok := strings.Cut(s, "=")
+ if !ok || k == "" {
+ return fmt.Errorf("tag %q is not key=value", s)
+ }
+ t[k] = v
+ return nil
+}
+
+// need refuses empty required flags.
+func need(pairs ...string) error {
+ for i := 0; i+1 < len(pairs); i += 2 {
+ if pairs[i+1] == "" {
+ return usage("-%s is required", pairs[i])
+ }
+ }
+ return nil
+}
diff --git a/internal/isolatedjob/awsjob/livectl/main_test.go b/internal/isolatedjob/awsjob/livectl/main_test.go
new file mode 100644
index 00000000..9c720b50
--- /dev/null
+++ b/internal/isolatedjob/awsjob/livectl/main_test.go
@@ -0,0 +1,653 @@
+//go:build hostedlive
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "net/http"
+ "os"
+ "path/filepath"
+ "reflect"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/rastrillo/rastrillo/budget"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
+ "github.com/aws/aws-sdk-go-v2/service/lambdacore"
+ coretypes "github.com/aws/aws-sdk-go-v2/service/lambdacore/types"
+ vms "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms"
+ "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms/types"
+ "github.com/aws/aws-sdk-go-v2/service/sts"
+ "github.com/aws/smithy-go"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+func TestMain(m *testing.M) { os.Exit(budget.Main(m)) }
+
+const (
+ runID = "1128-abc123"
+ prefix = prefixBase + runID
+)
+
+// stub answers every SDK call from its fields and records the calls.
+type stub struct {
+ calls []string
+ account string
+
+ create func(*lambdacore.CreateNetworkConnectorInput) (*lambdacore.CreateNetworkConnectorOutput, error)
+ getConn func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error)
+ listVers func(*lambdacore.ListNetworkConnectorVersionsInput) (*lambdacore.ListNetworkConnectorVersionsOutput, error)
+ deleteConn func(*lambdacore.DeleteNetworkConnectorInput) (*lambdacore.DeleteNetworkConnectorOutput, error)
+
+ baseVers func(*vms.ListManagedMicrovmImageVersionsInput) (*vms.ListManagedMicrovmImageVersionsOutput, error)
+ createImg func(*vms.CreateMicrovmImageInput) (*vms.CreateMicrovmImageOutput, error)
+ updateImg func(*vms.UpdateMicrovmImageInput) (*vms.UpdateMicrovmImageOutput, error)
+ getImg func(*vms.GetMicrovmImageInput) (*vms.GetMicrovmImageOutput, error)
+ getImgVer func(*vms.GetMicrovmImageVersionInput) (*vms.GetMicrovmImageVersionOutput, error)
+ runVM func(*vms.RunMicrovmInput) (*vms.RunMicrovmOutput, error)
+ getVM func(*vms.GetMicrovmInput) (*vms.GetMicrovmOutput, error)
+ listVMs func(*vms.ListMicrovmsInput) (*vms.ListMicrovmsOutput, error)
+ inputs []any
+ terminated []string
+}
+
+func (s *stub) note(op string, in any) {
+ s.calls = append(s.calls, op)
+ s.inputs = append(s.inputs, in)
+}
+
+func (s *stub) count(op string) int {
+ n := 0
+ for _, c := range s.calls {
+ if c == op {
+ n++
+ }
+ }
+ return n
+}
+
+func (s *stub) CreateNetworkConnector(_ context.Context, in *lambdacore.CreateNetworkConnectorInput, _ ...func(*lambdacore.Options)) (*lambdacore.CreateNetworkConnectorOutput, error) {
+ s.note("CreateNetworkConnector", in)
+ if s.create != nil {
+ return s.create(in)
+ }
+ return &lambdacore.CreateNetworkConnectorOutput{Name: in.Name, State: coretypes.NetworkConnectorStatePending}, nil
+}
+
+func (s *stub) GetNetworkConnector(_ context.Context, in *lambdacore.GetNetworkConnectorInput, _ ...func(*lambdacore.Options)) (*lambdacore.GetNetworkConnectorOutput, error) {
+ s.note("GetNetworkConnector", in)
+ if s.getConn != nil {
+ return s.getConn(in)
+ }
+ return &lambdacore.GetNetworkConnectorOutput{Name: aws.String(prefix + "-conn"), State: coretypes.NetworkConnectorStateActive}, nil
+}
+
+func (s *stub) ListNetworkConnectorVersions(_ context.Context, in *lambdacore.ListNetworkConnectorVersionsInput, _ ...func(*lambdacore.Options)) (*lambdacore.ListNetworkConnectorVersionsOutput, error) {
+ s.note("ListNetworkConnectorVersions", in)
+ if s.listVers != nil {
+ return s.listVers(in)
+ }
+ return &lambdacore.ListNetworkConnectorVersionsOutput{}, nil
+}
+
+func (s *stub) DeleteNetworkConnector(_ context.Context, in *lambdacore.DeleteNetworkConnectorInput, _ ...func(*lambdacore.Options)) (*lambdacore.DeleteNetworkConnectorOutput, error) {
+ s.note("DeleteNetworkConnector", in)
+ if s.deleteConn != nil {
+ return s.deleteConn(in)
+ }
+ return &lambdacore.DeleteNetworkConnectorOutput{State: coretypes.NetworkConnectorStateDeleting}, nil
+}
+
+func (s *stub) ListManagedMicrovmImageVersions(_ context.Context, in *vms.ListManagedMicrovmImageVersionsInput, _ ...func(*vms.Options)) (*vms.ListManagedMicrovmImageVersionsOutput, error) {
+ s.note("ListManagedMicrovmImageVersions", in)
+ return s.baseVers(in)
+}
+
+func (s *stub) CreateMicrovmImage(_ context.Context, in *vms.CreateMicrovmImageInput, _ ...func(*vms.Options)) (*vms.CreateMicrovmImageOutput, error) {
+ s.note("CreateMicrovmImage", in)
+ if s.createImg != nil {
+ return s.createImg(in)
+ }
+ return &vms.CreateMicrovmImageOutput{}, nil
+}
+
+func (s *stub) UpdateMicrovmImage(_ context.Context, in *vms.UpdateMicrovmImageInput, _ ...func(*vms.Options)) (*vms.UpdateMicrovmImageOutput, error) {
+ s.note("UpdateMicrovmImage", in)
+ if s.updateImg != nil {
+ return s.updateImg(in)
+ }
+ return &vms.UpdateMicrovmImageOutput{}, nil
+}
+
+func (s *stub) GetMicrovmImage(_ context.Context, in *vms.GetMicrovmImageInput, _ ...func(*vms.Options)) (*vms.GetMicrovmImageOutput, error) {
+ s.note("GetMicrovmImage", in)
+ if s.getImg != nil {
+ return s.getImg(in)
+ }
+ return &vms.GetMicrovmImageOutput{Name: aws.String(prefix + "-image")}, nil
+}
+
+func (s *stub) GetMicrovmImageVersion(_ context.Context, in *vms.GetMicrovmImageVersionInput, _ ...func(*vms.Options)) (*vms.GetMicrovmImageVersionOutput, error) {
+ s.note("GetMicrovmImageVersion", in)
+ return s.getImgVer(in)
+}
+
+func (s *stub) ListMicrovmImages(_ context.Context, in *vms.ListMicrovmImagesInput, _ ...func(*vms.Options)) (*vms.ListMicrovmImagesOutput, error) {
+ s.note("ListMicrovmImages", in)
+ return &vms.ListMicrovmImagesOutput{}, nil
+}
+
+func (s *stub) DeleteMicrovmImage(_ context.Context, in *vms.DeleteMicrovmImageInput, _ ...func(*vms.Options)) (*vms.DeleteMicrovmImageOutput, error) {
+ s.note("DeleteMicrovmImage", in)
+ return &vms.DeleteMicrovmImageOutput{}, nil
+}
+
+func (s *stub) RunMicrovm(_ context.Context, in *vms.RunMicrovmInput, _ ...func(*vms.Options)) (*vms.RunMicrovmOutput, error) {
+ s.note("RunMicrovm", in)
+ if s.runVM != nil {
+ return s.runVM(in)
+ }
+ return &vms.RunMicrovmOutput{MicrovmId: aws.String("vm-1")}, nil
+}
+
+func (s *stub) GetMicrovm(_ context.Context, in *vms.GetMicrovmInput, _ ...func(*vms.Options)) (*vms.GetMicrovmOutput, error) {
+ s.note("GetMicrovm", in)
+ if s.getVM != nil {
+ return s.getVM(in)
+ }
+ return &vms.GetMicrovmOutput{MicrovmId: in.MicrovmIdentifier, State: types.MicrovmStateRunning,
+ ImageArn: aws.String("arn:aws:lambda:eu-west-1:640012953448:microvm-image:" + prefix + "-image")}, nil
+}
+
+func (s *stub) ListMicrovms(_ context.Context, in *vms.ListMicrovmsInput, _ ...func(*vms.Options)) (*vms.ListMicrovmsOutput, error) {
+ s.note("ListMicrovms", in)
+ if s.listVMs != nil {
+ return s.listVMs(in)
+ }
+ return &vms.ListMicrovmsOutput{}, nil
+}
+
+func (s *stub) SuspendMicrovm(_ context.Context, in *vms.SuspendMicrovmInput, _ ...func(*vms.Options)) (*vms.SuspendMicrovmOutput, error) {
+ s.note("SuspendMicrovm", in)
+ return &vms.SuspendMicrovmOutput{}, nil
+}
+
+func (s *stub) ResumeMicrovm(_ context.Context, in *vms.ResumeMicrovmInput, _ ...func(*vms.Options)) (*vms.ResumeMicrovmOutput, error) {
+ s.note("ResumeMicrovm", in)
+ return &vms.ResumeMicrovmOutput{}, nil
+}
+
+func (s *stub) TerminateMicrovm(_ context.Context, in *vms.TerminateMicrovmInput, _ ...func(*vms.Options)) (*vms.TerminateMicrovmOutput, error) {
+ s.note("TerminateMicrovm", in)
+ s.terminated = append(s.terminated, aws.ToString(in.MicrovmIdentifier))
+ return &vms.TerminateMicrovmOutput{}, nil
+}
+
+func (s *stub) GetCallerIdentity(_ context.Context, in *sts.GetCallerIdentityInput, _ ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error) {
+ s.note("GetCallerIdentity", in)
+ return &sts.GetCallerIdentityOutput{Account: aws.String(s.account), Arn: aws.String("arn:aws:iam::" + s.account + ":user/agent")}, nil
+}
+
+// fakeClock moves only when the code sleeps.
+type fakeClock struct {
+ now time.Time
+ sleeps int
+}
+
+func (c *fakeClock) Now() time.Time { return c.now }
+func (c *fakeClock) Sleep(d time.Duration) { c.now = c.now.Add(d); c.sleeps++ }
+
+type harness struct {
+ s *stub
+ clk *fakeClock
+ e *env
+ stdout *bytes.Buffer
+ stderr *bytes.Buffer
+}
+
+func newHarness() *harness {
+ s := &stub{account: wantAccount}
+ h := &harness{s: s, clk: &fakeClock{now: time.Date(2026, 11, 28, 12, 0, 0, 0, time.UTC)},
+ stdout: &bytes.Buffer{}, stderr: &bytes.Buffer{}}
+ h.e = &env{ctx: context.Background(), core: s, vms: s, sts: s, region: wantRegion, clock: h.clk, out: h.stdout, errw: h.stderr}
+ return h
+}
+
+// do runs livectl with args and returns its exit code.
+func (h *harness) do(args ...string) int {
+ h.stdout.Reset()
+ h.stderr.Reset()
+ h.e.prefix = ""
+ return run(h.e, args)
+}
+
+// errLine decodes the one stderr line.
+func (h *harness) errLine(t *testing.T) map[string]any {
+ t.Helper()
+ var m map[string]any
+ if err := json.Unmarshal(h.stderr.Bytes(), &m); err != nil || strings.Count(h.stderr.String(), "\n") != 1 {
+ t.Fatalf("stderr %q is not one JSON line", h.stderr)
+ }
+ return m
+}
+
+func (h *harness) want(t *testing.T, code int, args ...string) {
+ t.Helper()
+ if got := h.do(args...); got != code {
+ t.Fatalf("livectl %q = exit %d, want %d; stderr %s", args, got, code, h.stderr)
+ }
+}
+
+func TestConnectorCreateInput(t *testing.T) {
+ h := newHarness()
+ h.want(t, exitOK, "-run", runID, "connector", "create", "-name", prefix+"-conn", "-role", "arn:aws:iam::640012953448:role/op",
+ "-subnet", "subnet-1", "-sg", "sg-1", "-client-token", prefix+"-conn-1", "-tag", "purpose=equipo-hosted-dev", "-tag", "run="+runID)
+ got := h.s.inputs[len(h.s.inputs)-1].(*lambdacore.CreateNetworkConnectorInput)
+ want := connectorCreateInput(prefix+"-conn", "arn:aws:iam::640012953448:role/op", "subnet-1", "sg-1", prefix+"-conn-1",
+ map[string]string{"purpose": "equipo-hosted-dev", "run": runID})
+ if !reflect.DeepEqual(got, want) {
+ t.Fatalf("CreateNetworkConnector input = %+v, want %+v", got, want)
+ }
+ cfg := got.Configuration.(*coretypes.NetworkConnectorConfigurationMemberVpcEgressConfiguration).Value
+ if cfg.NetworkProtocol != "IPv4" || !reflect.DeepEqual(cfg.AssociatedComputeResourceTypes, []coretypes.ComputeResourceType{"MicroVm"}) ||
+ cfg.ElasticIpConfiguration != nil || !reflect.DeepEqual(cfg.SubnetIds, []string{"subnet-1"}) || !reflect.DeepEqual(cfg.SecurityGroupIds, []string{"sg-1"}) {
+ t.Fatalf("connector configuration = %+v", cfg)
+ }
+ if h.s.calls[0] != "GetCallerIdentity" {
+ t.Fatalf("first call %s, want the caller check", h.s.calls[0])
+ }
+}
+
+func hooksFile(t *testing.T) string {
+ t.Helper()
+ p := filepath.Join(t.TempDir(), "hooks.json")
+ body := `{"port":9000,
+ "microvmHooks":{"run":"ENABLED","runTimeoutInSeconds":10,"resume":"ENABLED","resumeTimeoutInSeconds":10,
+ "suspend":"ENABLED","suspendTimeoutInSeconds":10,"terminate":"ENABLED","terminateTimeoutInSeconds":10},
+ "microvmImageHooks":{"ready":"ENABLED","readyTimeoutInSeconds":120,"validate":"DISABLED"}}`
+ if err := os.WriteFile(p, []byte(body), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ return p
+}
+
+func imageArgs(t *testing.T, memory string) []string {
+ return []string{"-description", "small", "-artifact", "s3://bucket/app.zip", "-base-version", "3",
+ "-build-role", "arn:aws:iam::640012953448:role/build", "-hooks", hooksFile(t), "-log-group", "/t17/lg",
+ "-client-token", prefix + "-image-create-1", "-memory", memory}
+}
+
+func TestImageCreateAndUpdateInput(t *testing.T) {
+ h := newHarness()
+ h.want(t, exitOK, append([]string{"-run", runID, "image", "create", "-name", prefix + "-image", "-tag", "run=" + runID},
+ imageArgs(t, "2048")...)...)
+ in := h.s.inputs[len(h.s.inputs)-1].(*vms.CreateMicrovmImageInput)
+ if aws.ToString(in.Name) != prefix+"-image" || aws.ToString(in.BaseImageArn) != defaultBase || aws.ToString(in.BaseImageVersion) != "3" ||
+ aws.ToString(in.BuildRoleArn) != "arn:aws:iam::640012953448:role/build" || aws.ToString(in.ClientToken) != prefix+"-image-create-1" ||
+ in.Tags["run"] != runID {
+ t.Fatalf("CreateMicrovmImage names = %+v", in)
+ }
+ if !reflect.DeepEqual(in.CpuConfigurations, []types.CpuConfiguration{{Architecture: "X86_64"}}) ||
+ !reflect.DeepEqual(in.AdditionalOsCapabilities, []types.Capability{"ALL"}) ||
+ aws.ToInt32(in.Resources[0].MinimumMemoryInMiB) != 2048 || len(in.Resources) != 1 {
+ t.Fatalf("CreateMicrovmImage shape = cpu %+v caps %+v res %+v", in.CpuConfigurations, in.AdditionalOsCapabilities, in.Resources)
+ }
+ if in.Hooks == nil || aws.ToInt32(in.Hooks.Port) != 9000 || in.Hooks.MicrovmHooks.Run != "ENABLED" ||
+ aws.ToInt32(in.Hooks.MicrovmImageHooks.ReadyTimeoutInSeconds) != 120 || in.Hooks.MicrovmImageHooks.Validate != "DISABLED" {
+ t.Fatalf("hooks = %+v", in.Hooks)
+ }
+ if u, ok := in.CodeArtifact.(*types.CodeArtifactMemberUri); !ok || u.Value != "s3://bucket/app.zip" {
+ t.Fatalf("code artifact = %#v", in.CodeArtifact)
+ }
+ if l, ok := in.Logging.(*types.LoggingMemberCloudWatch); !ok || aws.ToString(l.Value.LogGroup) != "/t17/lg" {
+ t.Fatalf("logging = %#v", in.Logging)
+ }
+
+ h.want(t, exitOK, append([]string{"-run", runID, "image", "update", "-id", "arn:img"}, imageArgs(t, "4096")...)...)
+ up := h.s.inputs[len(h.s.inputs)-1].(*vms.UpdateMicrovmImageInput)
+ if aws.ToString(up.ImageIdentifier) != "arn:img" || aws.ToInt32(up.Resources[0].MinimumMemoryInMiB) != 4096 ||
+ !reflect.DeepEqual(up.CpuConfigurations, in.CpuConfigurations) {
+ t.Fatalf("UpdateMicrovmImage = %+v", up)
+ }
+ if h.s.count("GetMicrovmImage") != 1 {
+ t.Fatal("update did not read the image first")
+ }
+
+ // A hooks file with an unknown key is a usage error, before any create.
+ bad := filepath.Join(t.TempDir(), "bad.json")
+ _ = os.WriteFile(bad, []byte(`{"port":9000,"prot":1}`), 0o600)
+ args := append([]string{"-run", runID, "image", "create", "-name", prefix + "-image"}, imageArgs(t, "2048")...)
+ for i := range args {
+ if args[i] == "-hooks" {
+ args[i+1] = bad
+ }
+ }
+ before := h.s.count("CreateMicrovmImage")
+ h.want(t, exitUsage, args...)
+ if h.s.count("CreateMicrovmImage") != before {
+ t.Fatal("a bad hooks file still reached CreateMicrovmImage")
+ }
+}
+
+func TestVMRunInput(t *testing.T) {
+ h := newHarness()
+ payload := filepath.Join(t.TempDir(), "payload")
+ _ = os.WriteFile(payload, []byte(`{"code":"x"}`+"\n"), 0o600)
+ image := "arn:aws:lambda:eu-west-1:640012953448:microvm-image:" + prefix + "-image"
+ h.want(t, exitOK, "-run", runID, "vm", "run", "-image", image, "-version", "1",
+ "-connector", "arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1:1", "-max-seconds", "900",
+ "-client-token", prefix+"-launch-1", "-payload-file", payload)
+ in := h.s.inputs[len(h.s.inputs)-1].(*vms.RunMicrovmInput)
+ want := &vms.RunMicrovmInput{ImageIdentifier: aws.String(image), ImageVersion: aws.String("1"),
+ EgressNetworkConnectors: []string{"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1:1"},
+ IngressNetworkConnectors: []string{"arn:aws:lambda:eu-west-1:aws:network-connector:aws-network-connector:NO_INGRESS"},
+ MaximumDurationInSeconds: aws.Int32(900), ClientToken: aws.String(prefix + "-launch-1"), RunHookPayload: aws.String(`{"code":"x"}` + "\n")}
+ if !reflect.DeepEqual(in, want) {
+ t.Fatalf("RunMicrovm input = %+v, want %+v (no role, no idle policy)", in, want)
+ }
+}
+
+// TestOutputKeepsAllFields: every exported field of each output the tool
+// prints is a key, null or empty when unset, and ResultMetadata shows the
+// server time and request ID.
+func TestOutputKeepsAllFields(t *testing.T) {
+ for _, v := range []any{
+ &lambdacore.CreateNetworkConnectorOutput{}, &lambdacore.GetNetworkConnectorOutput{}, &lambdacore.DeleteNetworkConnectorOutput{},
+ &vms.CreateMicrovmImageOutput{}, &vms.UpdateMicrovmImageOutput{}, &vms.GetMicrovmImageOutput{}, &vms.GetMicrovmImageVersionOutput{},
+ &vms.DeleteMicrovmImageOutput{}, &vms.RunMicrovmOutput{}, &vms.GetMicrovmOutput{}, &vms.SuspendMicrovmOutput{},
+ &vms.ResumeMicrovmOutput{}, &vms.TerminateMicrovmOutput{},
+ } {
+ var buf bytes.Buffer
+ if err := printJSON(&buf, v); err != nil {
+ t.Fatal(err)
+ }
+ var m map[string]json.RawMessage
+ if err := json.Unmarshal(buf.Bytes(), &m); err != nil {
+ t.Fatalf("%T printed %s", v, buf.String())
+ }
+ rt := reflect.TypeOf(v).Elem()
+ for i := range rt.NumField() {
+ if f := rt.Field(i); f.IsExported() {
+ if _, ok := m[f.Name]; !ok {
+ t.Errorf("%T output lacks %s: %s", v, f.Name, buf.String())
+ }
+ }
+ }
+ if string(m["ResultMetadata"]) != `{"ServerTime":null,"RequestID":""}` {
+ t.Errorf("%T ResultMetadata = %s", v, m["ResultMetadata"])
+ }
+ }
+}
+
+func TestConnectorGetGolden(t *testing.T) {
+ at := time.Date(2026, 11, 26, 11, 31, 23, 0, time.UTC)
+ out := &lambdacore.GetNetworkConnectorOutput{
+ Arn: aws.String("arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1"), Id: aws.String("nc-1"), Name: aws.String(prefix + "-conn"),
+ Configuration: &coretypes.NetworkConnectorConfigurationMemberVpcEgressConfiguration{Value: coretypes.NetworkConnectorVpcEgressConfiguration{
+ AssociatedComputeResourceTypes: []coretypes.ComputeResourceType{"MicroVm"},
+ ElasticIpConfiguration: &coretypes.ElasticIpConfiguration{Type: "None"},
+ NetworkProtocol: "IPv4", SecurityGroupIds: []string{"sg-1"}, SubnetIds: []string{"subnet-1"}}},
+ LastModified: &at, LastUpdateStatus: "Successful", LastUpdateStatusReason: aws.String("done"), LastUpdateStatusReasonCode: "Ok",
+ LatestVersion: aws.Int64(1), LatestVersionArn: aws.String("arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1:1"),
+ OperatorRole: aws.String("arn:aws:iam::640012953448:role/op"), State: "ACTIVE", StateReason: aws.String("Initial creation"),
+ StateReasonCode: "Creating", Version: aws.Int64(1), VersionArn: aws.String("arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1:1"),
+ }
+ awsmiddleware.SetRequestIDMetadata(&out.ResultMetadata, "req-7")
+ var buf bytes.Buffer
+ if err := printJSON(&buf, out); err != nil {
+ t.Fatal(err)
+ }
+ const golden = `{"Arn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1",` +
+ `"Configuration":{"Value":{"AssociatedComputeResourceTypes":["MicroVm"],"ElasticIpConfiguration":{"Type":"None"},"NetworkProtocol":"IPv4","SecurityGroupIds":["sg-1"],"SubnetIds":["subnet-1"]}},` +
+ `"Id":"nc-1","LastModified":"2026-11-26T11:31:23Z","LastUpdateStatus":"Successful","LastUpdateStatusReason":"done","LastUpdateStatusReasonCode":"Ok",` +
+ `"LatestVersion":1,"LatestVersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1:1",` +
+ `"Name":"equipo-hosted-dev-t17-1128-abc123-conn","OperatorRole":"arn:aws:iam::640012953448:role/op",` +
+ `"ResultMetadata":{"ServerTime":null,"RequestID":"req-7"},"State":"ACTIVE","StateReason":"Initial creation","StateReasonCode":"Creating",` +
+ `"Version":1,"VersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-1:1"}` + "\n"
+ if buf.String() != golden {
+ t.Fatalf("printed\n%s\nwant\n%s", buf.String(), golden)
+ }
+}
+
+// apiErr is an SDK-shaped error: an API error inside the HTTP response
+// error the SDK wraps it in.
+func apiErr(code string, status int) error {
+ return &smithy.OperationError{ServiceID: "Lambda", OperationName: "Op", Err: &awshttp.ResponseError{
+ ResponseError: &smithyhttp.ResponseError{Response: &smithyhttp.Response{Response: &http.Response{StatusCode: status}},
+ Err: &smithy.GenericAPIError{Code: code, Message: "service text"}},
+ RequestID: "req-1"}}
+}
+
+func TestErrorShapeAndExitCodes(t *testing.T) {
+ h := newHarness()
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ return nil, apiErr("ResourceNotFoundException", 404)
+ }
+ h.want(t, exitAPI, "connector", "get", "-id", "nc-1")
+ got := h.errLine(t)
+ want := map[string]any{"error": "api", "op": "GetNetworkConnector", "code": "ResourceNotFoundException", "http_status": 404.0,
+ "message": "GetNetworkConnector failed", "aws_message": "service text", "request_id": "req-1"}
+ if !reflect.DeepEqual(got, want) {
+ t.Fatalf("error line = %v, want %v", got, want)
+ }
+ if h.stdout.Len() != 0 {
+ t.Fatalf("stdout %q on an API error, want nothing", h.stdout)
+ }
+
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ return nil, errors.New("dial tcp: connection refused")
+ }
+ h.want(t, exitAPI, "connector", "get", "-id", "nc-1")
+ if l := h.errLine(t); l["error"] != "transport" || l["code"] != nil {
+ t.Fatalf("transport error line = %v", l)
+ }
+
+ for _, args := range [][]string{{}, {"connector"}, {"connector", "nope"}, {"connector", "get"}, {"connector", "get", "-id"},
+ {"-run", "UPPER", "caller"}, {"vm", "wait-state", "-id", "vm-1", "-state", "PENDING"}, {"caller", "extra"}} {
+ if got := h.do(args...); got != exitUsage || h.errLine(t)["error"] != "usage" {
+ t.Errorf("livectl %q = exit %d %s, want usage exit %d", args, got, h.stderr, exitUsage)
+ }
+ }
+ h.want(t, exitOK, "caller")
+ if !strings.Contains(h.stdout.String(), `"Account":"640012953448"`) || !strings.Contains(h.stdout.String(), `"Region":"eu-west-1"`) {
+ t.Fatalf("caller printed %s", h.stdout)
+ }
+}
+
+// TestAccountRegionGuard: another account or region is refused (exit 4)
+// before any Lambda call.
+func TestAccountRegionGuard(t *testing.T) {
+ h := newHarness()
+ h.s.account = "149757027610"
+ h.want(t, exitGuard, "connector", "get", "-id", "nc-1")
+ if l := h.errLine(t); l["error"] != "guard" || !strings.Contains(l["message"].(string), "149757027610") {
+ t.Fatalf("guard line = %v", l)
+ }
+ h.s.account = wantAccount
+ h.e.region = "us-east-1"
+ h.want(t, exitGuard, "-run", runID, "vm", "terminate", "-id", "vm-1")
+ for _, c := range h.s.calls {
+ if c != "GetCallerIdentity" {
+ t.Fatalf("call %s made by a refused command; calls %v", c, h.s.calls)
+ }
+ }
+}
+
+// TestRunPrefixGuard: creates need a name in the run, and deletes, updates
+// and VM changes read their target first and refuse one outside the run.
+func TestRunPrefixGuard(t *testing.T) {
+ h := newHarness()
+ create := func(run, name string) []string {
+ args := []string{"connector", "create", "-name", name, "-role", "r", "-subnet", "s", "-sg", "g", "-client-token", name + "-1"}
+ if run != "" {
+ args = append([]string{"-run", run}, args...)
+ }
+ return args
+ }
+ for _, c := range []struct{ run, name string }{
+ {"", prefix + "-conn"}, // no -run
+ {runID, "equipo-hosted-dev-t17-other-conn"}, // another run
+ {runID, prefix + "x-conn"}, // the prefix without its boundary
+ {"other", prefix + "-conn"},
+ } {
+ h.want(t, exitGuard, create(c.run, c.name)...)
+ }
+ h.want(t, exitGuard, append([]string{"-run", runID, "image", "create", "-name", "someone-else"}, imageArgs(t, "2048")...)...)
+ if n := h.s.count("CreateNetworkConnector") + h.s.count("CreateMicrovmImage"); n != 0 {
+ t.Fatalf("%d creates reached the SDK outside the run", n)
+ }
+ h.want(t, exitOK, create(runID, prefix+"-conn")...)
+
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ return &lambdacore.GetNetworkConnectorOutput{Name: aws.String("production-egress")}, nil
+ }
+ h.want(t, exitGuard, "-run", runID, "connector", "delete", "-id", "nc-prod")
+ h.s.getImg = func(*vms.GetMicrovmImageInput) (*vms.GetMicrovmImageOutput, error) {
+ return &vms.GetMicrovmImageOutput{Name: aws.String("runner")}, nil
+ }
+ h.want(t, exitGuard, "-run", runID, "image", "delete", "-id", "arn:runner")
+ h.want(t, exitGuard, append([]string{"-run", runID, "image", "update", "-id", "arn:runner"}, imageArgs(t, "4096")...)...)
+ h.s.getVM = func(in *vms.GetMicrovmInput) (*vms.GetMicrovmOutput, error) {
+ return &vms.GetMicrovmOutput{MicrovmId: in.MicrovmIdentifier, ImageArn: aws.String("arn:aws:lambda:eu-west-1:640012953448:microvm-image:runner")}, nil
+ }
+ for _, verb := range []string{"terminate", "suspend", "resume"} {
+ h.want(t, exitGuard, "-run", runID, "vm", verb, "-id", "vm-other")
+ }
+ h.want(t, exitGuard, "-run", runID, "vm", "run", "-image", "arn:aws:lambda:eu-west-1:640012953448:microvm-image:runner",
+ "-version", "1", "-connector", "c", "-max-seconds", "60", "-client-token", prefix+"-l", "-payload-file", "x")
+ for _, op := range []string{"DeleteNetworkConnector", "DeleteMicrovmImage", "UpdateMicrovmImage", "TerminateMicrovm",
+ "SuspendMicrovm", "ResumeMicrovm", "RunMicrovm"} {
+ if n := h.s.count(op); n != 0 {
+ t.Errorf("%s reached the SDK %d times for a resource outside the run", op, n)
+ }
+ }
+ h.s.getVM = nil
+ h.want(t, exitOK, "-run", runID, "vm", "terminate", "-id", "vm-1")
+ if !reflect.DeepEqual(h.s.terminated, []string{"vm-1"}) {
+ t.Fatalf("terminated %v, want the run's VM", h.s.terminated)
+ }
+}
+
+// TestBoundedWaits: waits read at once, then every interval, and stop at
+// the timeout with exit 5; the fake clock moves only when they sleep.
+func TestBoundedWaits(t *testing.T) {
+ h := newHarness()
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ return &lambdacore.GetNetworkConnectorOutput{State: coretypes.NetworkConnectorStatePending}, nil
+ }
+ h.want(t, exitTimeout, "connector", "wait-active", "-id", "nc-1", "-timeout", "1m", "-interval", "15s")
+ if n := h.s.count("GetNetworkConnector"); n != 5 {
+ t.Fatalf("reads in a 1m wait every 15s = %d, want 5", n)
+ }
+ if !strings.Contains(h.stdout.String(), `"State":"PENDING"`) || h.errLine(t)["error"] != "timeout" {
+ t.Fatalf("timed-out wait printed %s / %s", h.stdout, h.stderr)
+ }
+ h.want(t, exitUsage, "connector", "wait-active", "-id", "nc-1", "-timeout", "61m")
+ h.want(t, exitUsage, "connector", "wait-active", "-id", "nc-1", "-interval", "10ms")
+
+ reads := 0
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ reads++
+ if reads < 3 {
+ return &lambdacore.GetNetworkConnectorOutput{State: coretypes.NetworkConnectorStatePending}, nil
+ }
+ return &lambdacore.GetNetworkConnectorOutput{State: coretypes.NetworkConnectorStateActive, Version: aws.Int64(1)}, nil
+ }
+ start := h.clk.now
+ h.want(t, exitOK, "connector", "wait-active", "-id", "nc-1", "-interval", "15s")
+ if d := h.clk.now.Sub(start); d != 30*time.Second {
+ t.Fatalf("wait took %v of fake time, want 30s", d)
+ }
+
+ h.s.getImgVer = func(*vms.GetMicrovmImageVersionInput) (*vms.GetMicrovmImageVersionOutput, error) {
+ return &vms.GetMicrovmImageVersionOutput{State: types.MicrovmImageVersionStateFailed}, nil
+ }
+ h.want(t, exitFailed, "image", "wait-version", "-id", "arn:img", "-version", "1")
+ h.s.getImgVer = func(*vms.GetMicrovmImageVersionInput) (*vms.GetMicrovmImageVersionOutput, error) {
+ return &vms.GetMicrovmImageVersionOutput{State: types.MicrovmImageVersionStateSuccessful, Status: types.MicrovmImageVersionStatusActive}, nil
+ }
+ h.want(t, exitOK, "image", "wait-version", "-id", "arn:img", "-version", "1")
+
+ h.s.getVM = func(in *vms.GetMicrovmInput) (*vms.GetMicrovmOutput, error) {
+ return &vms.GetMicrovmOutput{MicrovmId: in.MicrovmIdentifier, State: types.MicrovmStateTerminated}, nil
+ }
+ h.want(t, exitFailed, "vm", "wait-state", "-id", "vm-1", "-state", "RUNNING")
+ h.want(t, exitOK, "vm", "wait-state", "-id", "vm-1", "-state", "TERMINATED")
+}
+
+// TestWaitGoneReportsDeleteFailed: not found ends wait-gone well; a
+// DELETE_FAILED connector ends it at once with exit 6, code DELETE_FAILED,
+// and its last read on stdout.
+func TestWaitGoneReportsDeleteFailed(t *testing.T) {
+ h := newHarness()
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ return &lambdacore.GetNetworkConnectorOutput{State: coretypes.NetworkConnectorStateDeleteFailed, StateReason: aws.String("ENI in use")}, nil
+ }
+ h.want(t, exitFailed, "connector", "wait-gone", "-id", "nc-1")
+ if l := h.errLine(t); l["error"] != "failed_state" || l["code"] != "DELETE_FAILED" {
+ t.Fatalf("DELETE_FAILED line = %v", l)
+ }
+ if !strings.Contains(h.stdout.String(), `"StateReason":"ENI in use"`) || h.s.count("GetNetworkConnector") != 1 {
+ t.Fatalf("DELETE_FAILED stdout %s after %d reads", h.stdout, h.s.count("GetNetworkConnector"))
+ }
+ reads := 0
+ h.s.getConn = func(*lambdacore.GetNetworkConnectorInput) (*lambdacore.GetNetworkConnectorOutput, error) {
+ if reads++; reads == 1 {
+ return &lambdacore.GetNetworkConnectorOutput{State: coretypes.NetworkConnectorStateDeleting}, nil
+ }
+ return nil, apiErr("ResourceNotFoundException", 404)
+ }
+ h.want(t, exitOK, "connector", "wait-gone", "-id", "nc-1")
+ if !strings.Contains(h.stdout.String(), `"Gone":true`) {
+ t.Fatalf("wait-gone printed %s", h.stdout)
+ }
+}
+
+func TestBaseVersionsSortedAllPages(t *testing.T) {
+ h := newHarness()
+ v := func(s string, st types.ManagedMicrovmImageVersionStatus) types.ManagedMicrovmImageVersion {
+ return types.ManagedMicrovmImageVersion{ImageVersion: aws.String(s), Status: st}
+ }
+ h.s.baseVers = func(in *vms.ListManagedMicrovmImageVersionsInput) (*vms.ListManagedMicrovmImageVersionsOutput, error) {
+ if aws.ToString(in.ImageIdentifier) != defaultBase {
+ t.Errorf("base = %s", aws.ToString(in.ImageIdentifier))
+ }
+ if in.NextToken == nil {
+ return &vms.ListManagedMicrovmImageVersionsOutput{Items: []types.ManagedMicrovmImageVersion{v("3", "AVAILABLE"), v("10", "DEPRECATED")},
+ NextToken: aws.String("p2")}, nil
+ }
+ return &vms.ListManagedMicrovmImageVersionsOutput{Items: []types.ManagedMicrovmImageVersion{v("9", "AVAILABLE"), v("3.1", "AVAILABLE")}}, nil
+ }
+ h.want(t, exitOK, "image", "base-versions")
+ var got baseVersions
+ if err := json.Unmarshal(h.stdout.Bytes(), &got); err != nil {
+ t.Fatal(err)
+ }
+ var order []string
+ for _, it := range got.Items {
+ order = append(order, aws.ToString(it.ImageVersion)+"/"+string(it.Status))
+ }
+ if want := []string{"10/DEPRECATED", "9/AVAILABLE", "3.1/AVAILABLE", "3/AVAILABLE"}; !reflect.DeepEqual(order, want) || got.Pages != 2 {
+ t.Fatalf("base versions = %v over %d pages, want %v over 2", order, got.Pages, want)
+ }
+}
+
+// metadataOf must find the field the SDK outputs carry.
+func TestMetadataOf(t *testing.T) {
+ out := &vms.GetMicrovmOutput{}
+ awsmiddleware.SetRequestIDMetadata(&out.ResultMetadata, "r")
+ if md, ok := metadataOf(out); !ok || md.Has(struct{}{}) {
+ t.Fatalf("metadataOf = %v, %v", md, ok)
+ }
+ if _, ok := metadataOf(map[string]any{}); ok {
+ t.Fatal("metadataOf found metadata in a map")
+ }
+ var _ middleware.Metadata
+}
diff --git a/internal/isolatedjob/awsjob/livectl/vm.go b/internal/isolatedjob/awsjob/livectl/vm.go
new file mode 100644
index 00000000..72e92880
--- /dev/null
+++ b/internal/isolatedjob/awsjob/livectl/vm.go
@@ -0,0 +1,192 @@
+//go:build hostedlive
+
+package main
+
+import (
+ "flag"
+ "os"
+ "strings"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/isolatedjob/awsjob"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ vms "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms"
+ "github.com/aws/aws-sdk-go-v2/service/lambdamicrovms/types"
+)
+
+// imageName is the name in an image ARN
+// (arn:aws:lambda:REGION:ACCOUNT:microvm-image:NAME), or "".
+func imageName(arn string) string {
+ _, name, ok := strings.Cut(arn, ":microvm-image:")
+ if !ok {
+ return ""
+ }
+ return name
+}
+
+// vmRunInput is a launch as the adapter makes it (spec §3): the image
+// version, the egress connector only, NO_INGRESS, no role, no idle
+// policy, a maximum duration, the client token and the payload.
+func vmRunInput(region, image, version, connector, token string, seconds int, payload string) *vms.RunMicrovmInput {
+ return &vms.RunMicrovmInput{
+ ImageIdentifier: aws.String(image), ImageVersion: aws.String(version),
+ EgressNetworkConnectors: []string{connector},
+ IngressNetworkConnectors: []string{awsjob.NoIngressConnectorARN(region)},
+ MaximumDurationInSeconds: aws.Int32(int32(seconds)),
+ ClientToken: aws.String(token), RunHookPayload: aws.String(payload),
+ }
+}
+
+func cmdVMRun(fs *flag.FlagSet) func(*env) (any, error) {
+ image := fs.String("image", "", "image ARN (its name must start with the run prefix)")
+ version := fs.String("version", "", "image version")
+ connector := fs.String("connector", "", "egress connector ARN (version-qualified)")
+ seconds := fs.Int("max-seconds", 0, "maximum duration in seconds (1 to 28800)")
+ token := fs.String("client-token", "", "client token (must start with the run prefix)")
+ payloadFile := fs.String("payload-file", "", "file whose bytes are the run hook payload")
+ return func(e *env) (any, error) {
+ if err := need("image", *image, "version", *version, "connector", *connector, "client-token", *token,
+ "payload-file", *payloadFile); err != nil {
+ return nil, err
+ }
+ if *seconds < 1 || *seconds > 28800 {
+ return nil, usage("-max-seconds must be 1 to 28800")
+ }
+ if err := e.inRun("image name", imageName(*image)); err != nil {
+ return nil, err
+ }
+ if err := e.inRun("client token", *token); err != nil {
+ return nil, err
+ }
+ payload, err := os.ReadFile(*payloadFile)
+ if err != nil {
+ return nil, usage("cannot read %s", *payloadFile)
+ }
+ out, err := e.vms.RunMicrovm(e.ctx, vmRunInput(e.region, *image, *version, *connector, *token, *seconds, string(payload)))
+ if err != nil {
+ return nil, apiFailure("RunMicrovm", err)
+ }
+ return out, nil
+ }
+}
+
+func (e *env) getVM(id string) (*vms.GetMicrovmOutput, error) {
+ out, err := e.vms.GetMicrovm(e.ctx, &vms.GetMicrovmInput{MicrovmIdentifier: aws.String(id)})
+ if err != nil {
+ return nil, apiFailure("GetMicrovm", err)
+ }
+ return out, nil
+}
+
+// cmdVMGet prints GetMicrovm whole; ResultMetadata.ServerTime is the
+// response's Date header, beside StartedAt.
+func cmdVMGet(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "MicroVM ID")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ return e.getVM(*id)
+ }
+}
+
+func cmdVMList(fs *flag.FlagSet) func(*env) (any, error) {
+ image := fs.String("image", "", "image ARN to list by")
+ return func(e *env) (any, error) {
+ if err := need("image", *image); err != nil {
+ return nil, err
+ }
+ var all listPage[types.MicrovmItem]
+ var token *string
+ for {
+ out, err := e.vms.ListMicrovms(e.ctx, &vms.ListMicrovmsInput{ImageIdentifier: aws.String(*image), NextToken: token})
+ if err != nil {
+ return nil, apiFailure("ListMicrovms", err)
+ }
+ all.Pages++
+ all.Items = append(all.Items, out.Items...)
+ if aws.ToString(out.NextToken) == "" {
+ return all, nil
+ }
+ if all.Pages >= maxPages {
+ return all, tooManyPages()
+ }
+ token = out.NextToken
+ }
+ }
+}
+
+// vmInRun reads VM id and refuses it unless it runs an image of the run.
+func (e *env) vmInRun(id string) error {
+ cur, err := e.getVM(id)
+ if err != nil {
+ return err
+ }
+ return e.inRun("the VM's image name", imageName(aws.ToString(cur.ImageArn)))
+}
+
+func vmChange(op string, call func(e *env, id string) (any, error)) command {
+ return func(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "MicroVM ID")
+ return func(e *env) (any, error) {
+ if err := need("id", *id); err != nil {
+ return nil, err
+ }
+ if err := e.vmInRun(*id); err != nil {
+ return nil, err
+ }
+ out, err := call(e, *id)
+ if err != nil {
+ return nil, apiFailure(op, err)
+ }
+ return out, nil
+ }
+ }
+}
+
+var (
+ cmdVMSuspend = vmChange("SuspendMicrovm", func(e *env, id string) (any, error) {
+ return e.vms.SuspendMicrovm(e.ctx, &vms.SuspendMicrovmInput{MicrovmIdentifier: aws.String(id)})
+ })
+ cmdVMResume = vmChange("ResumeMicrovm", func(e *env, id string) (any, error) {
+ return e.vms.ResumeMicrovm(e.ctx, &vms.ResumeMicrovmInput{MicrovmIdentifier: aws.String(id)})
+ })
+ cmdVMTerminate = vmChange("TerminateMicrovm", func(e *env, id string) (any, error) {
+ return e.vms.TerminateMicrovm(e.ctx, &vms.TerminateMicrovmInput{MicrovmIdentifier: aws.String(id)})
+ })
+)
+
+// cmdVMWaitState waits for -state. TERMINATED while waiting for another
+// state ends the wait (exit 6).
+func cmdVMWaitState(fs *flag.FlagSet) func(*env) (any, error) {
+ id := fs.String("id", "", "MicroVM ID")
+ state := fs.String("state", "", "RUNNING, SUSPENDED or TERMINATED")
+ w := waitFlags(fs, 5*time.Minute)
+ return func(e *env) (any, error) {
+ if err := need("id", *id, "state", *state); err != nil {
+ return nil, err
+ }
+ want := types.MicrovmState(*state)
+ switch want {
+ case types.MicrovmStateRunning, types.MicrovmStateSuspended, types.MicrovmStateTerminated:
+ default:
+ return nil, usage("-state must be RUNNING, SUSPENDED or TERMINATED")
+ }
+ var last *vms.GetMicrovmOutput
+ err := w.poll(e, "VM "+*state, func() (bool, error) {
+ out, err := e.getVM(*id)
+ if err != nil {
+ return false, err
+ }
+ last = out
+ if out.State == want {
+ return true, nil
+ }
+ if out.State == types.MicrovmStateTerminated {
+ return false, failedState("VM", string(out.State))
+ }
+ return false, nil
+ })
+ return last, err
+ }
+}
diff --git a/internal/isolatedjob/awsjob/livectl/wait.go b/internal/isolatedjob/awsjob/livectl/wait.go
new file mode 100644
index 00000000..01daf8db
--- /dev/null
+++ b/internal/isolatedjob/awsjob/livectl/wait.go
@@ -0,0 +1,79 @@
+//go:build hostedlive
+
+package main
+
+import (
+ "flag"
+ "reflect"
+ "time"
+
+ "github.com/aws/smithy-go/middleware"
+)
+
+// maxPages bounds every paged list.
+const maxPages = 100
+
+func tooManyPages() *failure {
+ return &failure{exit: exitOther, Kind: "other", Message: "more than 100 pages; stopped reading"}
+}
+
+// failedState is a wait that reached a state it cannot leave for the one
+// it waits for (exit 6, the state as the code).
+func failedState(what, state string) *failure {
+ return &failure{exit: exitFailed, Kind: "failed_state", Code: state, Message: what + " reached a failed state"}
+}
+
+// wait holds a wait's -timeout and -interval.
+type wait struct{ timeout, interval *time.Duration }
+
+func waitFlags(fs *flag.FlagSet, def time.Duration) wait {
+ return wait{
+ timeout: fs.Duration("timeout", def, "give up after this long (at most 60m)"),
+ interval: fs.Duration("interval", defaultInterval, "time between reads (at least 1s)"),
+ }
+}
+
+// poll calls check until it reports done, returns an error, or the
+// timeout passes (exit 5). The first read is at once; reads are spaced
+// by the interval.
+func (w wait) poll(e *env, what string, check func() (bool, error)) error {
+ timeout, interval := *w.timeout, *w.interval
+ if timeout <= 0 || timeout > maxWait {
+ return usage("-timeout must be above 0 and at most %v", maxWait)
+ }
+ if interval < time.Second {
+ return usage("-interval must be at least 1s")
+ }
+ deadline := e.clock.Now().Add(timeout)
+ for {
+ done, err := check()
+ if done || err != nil {
+ return err
+ }
+ if !e.clock.Now().Before(deadline) {
+ return &failure{exit: exitTimeout, Kind: "timeout", Message: "wait for " + what + " ran out after " + timeout.String()}
+ }
+ e.clock.Sleep(min(interval, deadline.Sub(e.clock.Now())))
+ }
+}
+
+var metadataType = reflect.TypeOf(middleware.Metadata{})
+
+// metadataOf returns the ResultMetadata field of an SDK output struct.
+func metadataOf(v any) (middleware.Metadata, bool) {
+ rv := reflect.ValueOf(v)
+ if rv.Kind() == reflect.Pointer {
+ if rv.IsNil() {
+ return middleware.Metadata{}, false
+ }
+ rv = rv.Elem()
+ }
+ if rv.Kind() != reflect.Struct {
+ return middleware.Metadata{}, false
+ }
+ f := rv.FieldByName("ResultMetadata")
+ if !f.IsValid() || f.Type() != metadataType {
+ return middleware.Metadata{}, false
+ }
+ return f.Interface().(middleware.Metadata), true
+}