oficina / equipo Public

Merge task 5 (darwin Claude Code pin) into mac-slice-f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev e67a8903e473edf72d3db9ca367dfce910236d94 parent ba31a7eparent 491b09c
14 files changed, +1,611 −13
  • .rastrillo/budgets.txt +1 −1
  • internal/runner/mac/caps.go +6 −2
  • internal/runner/mac/caps_test.go +2 −3
  • internal/runner/mac/claude.go +528 −0
  • internal/runner/mac/claude_chain_test.go +290 −0
  • internal/runner/mac/claude_release.go +9 −0
  • internal/runner/mac/claude_stat_darwin.go +25 −0
  • internal/runner/mac/claude_stat_linux.go +25 −0
  • internal/runner/mac/claude_test.go +612 −0
  • internal/runner/mac/claude_testbuild.go +23 −0
  • internal/runner/provider/claude/pins.go +28 −4
  • internal/runner/thin/mac.go +16 −2
  • internal/runner/thin/mac_claude_test.go +42 −0
  • internal/runner/thin/startup_logs_test.go +4 −1

CI failed — 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/mac-slice-f: Type  Size Avail | ext4   96G   84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.7s
ci-box: codex: fetched and verified in 4.5s
ci-box: codex-code-mode-host: fetched and verified in 1.5s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 7.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 8.6s
ci-box: clone deepened in 5.1s
ci-box: file times set from content: 3316 files, 213 directories
ci-box: ready in 19.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.150s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  4.4s
+ go list -export -test -tags testbuild -f  ./...
  5.1s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/equipotest ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  3.7s
rastrillo: budget size: 1 problem(s)
exit status 1
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

receipt: test step 1m19.16s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m16.946s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m16.95s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 70.86, cpu waiting 39.00%, memory waiting 0.00%, io waiting 0.49%
--- 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

receipt: test step 1m18.294s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m16.34s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m16.34s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 70.86, cpu waiting 39.00%, memory waiting 0.00%, io waiting 0.49%
--- 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

receipt: test step 1m20.322s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m18.136s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m8.57s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.07s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.49s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 67.75, cpu waiting 38.77%, memory waiting 0.00%, io waiting 0.47%
--- 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

receipt: test step 1m18.045s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m15.798s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.66s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 18.86s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.15s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.13s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 70.86, cpu waiting 39.00%, memory waiting 0.00%, io waiting 0.49%
--- 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_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless

receipt: test step 1m35.519s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m33.389s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m2.92s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.74s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8.49s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 7.38s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.86s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 64.28, cpu waiting 38.24%, memory waiting 0.00%, io waiting 0.37%
--- 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_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless

receipt: test step 2m57.917s 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 2m55.759s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m38.81s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 19.89s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.08s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 8.2s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistantAttachments
receipt: slow test 6.77s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 23.26, cpu waiting 10.37%, memory waiting 0.00%, io waiting 0.08%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest

receipt: test step 2m15.118s 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 2m13.326s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 10.04s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.74s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.15s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 4.02s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.7s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
machine: 32 CPUs, load 39.67, cpu waiting 20.83%, memory waiting 0.00%, io waiting 0.18%
--- 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 2m7.436s 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 2m5.039s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.46s amadan.net/oficina/equipo/internal/thintest TestContractRetryPreviewUnverifiedMerge
receipt: slow test 8.99s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 4.89s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 2.96s amadan.net/oficina/equipo/internal/thintest TestContractPausedJob
machine: 32 CPUs, load 43.44, cpu waiting 24.42%, memory waiting 0.00%, io waiting 0.21%
--- 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
budget note: internal/runner/thin took 5m12.858s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 5m18.496s 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 5m12.858s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37.01s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.9s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.82s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.49s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 9.94s amadan.net/oficina/equipo/internal/runner/thin TestTimeoutKeepsNothingForAnOlderInstance
machine: 32 CPUs, load 2.86, cpu waiting 1.00%, memory waiting 0.00%, io waiting 0.05%
--- 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

receipt: test step 52.276s 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 51.297s amadan.net/oficina/equipo/internal/runner
receipt: slow test 31.26s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 68.91, cpu waiting 34.58%, memory waiting 0.00%, io waiting 0.76%
--- 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

receipt: test step 1m0.257s 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 59.107s amadan.net/oficina/equipo/internal/runner
receipt: slow test 49.14s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 45.91s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.42s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.53s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 68.36, cpu waiting 38.06%, memory waiting 0.00%, io waiting 0.66%
--- 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

receipt: test step 36.461s 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 35.662s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.14s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.31s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.27s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 3.14s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 47.80, cpu waiting 22.42%, memory waiting 0.00%, io waiting 0.99%
--- 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 41.2%, load 33.99
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
--- FAIL amadan.net/oficina/equipo/internal/equipotest TestDirectDeadReferencesRepository
=== RUN   TestDirectDeadReferencesRepository
    direct_cutover_test.go:221: repository reference inventory: exit status 1
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:161:3: unclassified equipo-runner
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:455:17: unclassified equipo-runner
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:476:37: unclassified equipo-runner
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:481:29: unclassified equipo-runner
        docs/superpowers/plans/CONTROLLER-BRIEF-mac-slice-f.md:23:18: unclassified paseo
rastrillo: budget test: go test failed
exit status 1
        docs/superpowers/plans/CONTROLLER-BRIEF-mac-slice-f.md:128:25: unclassified Paseo
        docs/superpowers/plans/MAC-SLICE-F-PROGRESS.md:36:67: unclassified npm
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:84:40: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:56: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:70: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:125: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:281:1: unclassified npm
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:324:32: unclassified node
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:389:17: unclassified NoDe
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:454:44: unclassified NPM
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:455:3: unclassified NPM
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:472:59: unclassified NPM
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:615:13: unclassified npm
        docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:695:62: unclassified Node
        docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:696:30: unclassified npm
        docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:702:24: unclassified equipo-runner
        internal/runner/mac/caps.go:20:28: unclassified Node
        internal/runner/mac/caps_test.go:43:123: unclassified Node
        internal/runner/mac/caps_test.go:43:130: unclassified node
        internal/runner/mac/caps_test.go:47:114: unclassified Node
        internal/runner/mac/claude.go:44:65: unclassified Node
        internal/runner/mac/claude.go:106:18: unclassified equipo-runner
        internal/runner/mac/claude.go:154:55: unclassified node
        internal/runner/mac/claude.go:157:5: unclassified node
        internal/runner/mac/claude_chain_test.go:19:46: unclassified equipo-runner
        internal/runner/mac/claude_chain_test.go:275:19: unclassified node
        internal/runner/mac/claude_stat_darwin.go:8:57: unclassified node
        internal/runner/mac/claude_stat_linux.go:8:57: unclassified node
        internal/runner/mac/claude_test.go:139:58: unclassified equipo-runner
        internal/runner/mac/claude_test.go:139:159: unclassified equipo-runner
        internal/runner/mac/claude_test.go:499:75: unclassified Node
        internal/runner/mac/claude_test.go:499:82: unclassified node
        internal/runner/thin/mac.go:514:40: unclassified Node
        internal/runner/thin/mac.go:514:59: unclassified NODE
        internal/runner/thin/mac.go:514:72: unclassified node
        internal/runner/thin/mac_claude_test.go:17:94: unclassified equipo-runner
        internal/wire/wiretest/testdata/frames/hello-worker-conns.json:1:750: unclassified node
        internal/wire/wiretest/testdata/frames/hello-worker-conns.json:1:1439: unclassified node
        stale allowance: ('internal/runner/mac/caps.go', '5abbc8a613a7361123b31ce476f23dcd343b0268b89ded2135d55116e7af739f', 'Node')
        stale allowance: ('internal/runner/mac/caps_test.go', 'aa868b41d078f76e1bbc236a9b9d3b402e64af694ad21cd90be31639d3dfa50f', 'Node')
        stale allowance: ('internal/runner/mac/caps_test.go', 'aa868b41d078f76e1bbc236a9b9d3b402e64af694ad21cd90be31639d3dfa50f', 'node')
        stale allowance: ('internal/runner/mac/caps_test.go', 'd44406bca55c20fbbbe9fb866fe391d10a99ad9177fd633ae97df98afe50ffb2', 'Node')
        stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'NODE')
        stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'Node')
        stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'node')
        reference scan: 3028 text files, 3265 matches, 50 failures
--- FAIL: TestDirectDeadReferencesRepository (2.41s)

--- FAIL amadan.net/oficina/equipo/internal/equipotest (package output)
FAIL
rastrillo-budget/v1 ran 1m9.329s
FAIL	amadan.net/oficina/equipo/internal/equipotest	69.668s


receipt: test step 1m11.464s 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 1m9.329s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 30.34s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 30.3s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 28s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 24.92s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 24.89s amadan.net/oficina/equipo/internal/equipotest TestAuthorityReadsOneSnapshot
+ go test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' -v -run '^TestDirectDeadReferencesRepository$' -count=1 ./internal/equipotest   (retry, once)
FAILED TWICE ./internal/equipotest:TestDirectDeadReferencesRepository equipotest-a
=== RUN   TestDirectDeadReferencesRepository
    direct_cutover_test.go:221: repository reference inventory: exit status 1
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:161:3: unclassified equipo-runner
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:455:17: unclassified equipo-runner
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:476:37: unclassified equipo-runner
        docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:481:29: unclassified equipo-runner
        docs/superpowers/plans/CONTROLLER-BRIEF-mac-slice-f.md:23:18: unclassified paseo
        docs/superpowers/plans/CONTROLLER-BRIEF-mac-slice-f.md:128:25: unclassified Paseo
        docs/superpowers/plans/MAC-SLICE-F-PROGRESS.md:36:67: unclassified npm
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:84:40: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:56: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:70: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:125: unclassified equipo-runner
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:281:1: unclassified npm
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:324:32: unclassified node
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:389:17: unclassified NoDe
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:454:44: unclassified NPM
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:455:3: unclassified NPM
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:472:59: unclassified NPM
        docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:615:13: unclassified npm
        docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:695:62: unclassified Node
        docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:696:30: unclassified npm
        docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:702:24: unclassified equipo-runner
        internal/runner/mac/caps.go:20:28: unclassified Node
        internal/runner/mac/caps_test.go:43:123: unclassified Node
        internal/runner/mac/caps_test.go:43:130: unclassified node
        internal/runner/mac/caps_test.go:47:114: unclassified Node
        internal/runner/mac/claude.go:44:65: unclassified Node
        internal/runner/mac/claude.go:106:18: unclassified equipo-runner
        internal/runner/mac/claude.go:154:55: unclassified node
        internal/runner/mac/claude.go:157:5: unclassified node
        internal/runner/mac/claude_chain_test.go:19:46: unclassified equipo-runner
        internal/runner/mac/claude_chain_test.go:275:19: unclassified node
        internal/runner/mac/claude_stat_darwin.go:8:57: unclassified node
        internal/runner/mac/claude_stat_linux.go:8:57: unclassified node
        internal/runner/mac/claude_test.go:139:58: unclassified equipo-runner
        internal/runner/mac/claude_test.go:139:159: unclassified equipo-runner
        internal/runner/mac/claude_test.go:499:75: unclassified Node
        internal/runner/mac/claude_test.go:499:82: unclassified node
        internal/runner/thin/mac.go:514:40: unclassified Node
        internal/runner/thin/mac.go:514:59: unclassified NODE
        internal/runner/thin/mac.go:514:72: unclassified node
        internal/runner/thin/mac_claude_test.go:17:94: unclassified equipo-runner
        internal/wire/wiretest/testdata/frames/hello-worker-conns.json:1:750: unclassified node
        internal/wire/wiretest/testdata/frames/hello-worker-conns.json:1:1439: unclassified node
        stale allowance: ('internal/runner/mac/caps.go', '5abbc8a613a7361123b31ce476f23dcd343b0268b89ded2135d55116e7af739f', 'Node')
        stale allowance: ('internal/runner/mac/caps_test.go', 'aa868b41d078f76e1bbc236a9b9d3b402e64af694ad21cd90be31639d3dfa50f', 'Node')
        stale allowance: ('internal/runner/mac/caps_test.go', 'aa868b41d078f76e1bbc236a9b9d3b402e64af694ad21cd90be31639d3dfa50f', 'node')
        stale allowance: ('internal/runner/mac/caps_test.go', 'd44406bca55c20fbbbe9fb866fe391d10a99ad9177fd633ae97df98afe50ffb2', 'Node')
        stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'NODE')
        stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'Node')
        stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'node')
        reference scan: 3028 text files, 3265 matches, 50 failures
--- FAIL: TestDirectDeadReferencesRepository (2.26s)
FAIL
rastrillo-budget/v1 ran 2.259s
FAIL	amadan.net/oficina/equipo/internal/equipotest	2.430s
FAIL
machine: 32 CPUs, load 59.50, cpu waiting 34.39%, memory waiting 0.00%, io waiting 0.31%
make: *** [Makefile:113: ci-shard] Error 1

amadan: step check shard 12 of 29 failed: exit status 2
--- 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 40.6%, load 33.99
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 2m16.562s 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 2m14.414s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 21.29s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 21.26s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 21.24s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 21.22s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
receipt: slow test 21.21s amadan.net/oficina/equipo/internal/equipotest TestProjectConcurrentRetry
machine: 32 CPUs, load 26.94, cpu waiting 12.66%, memory waiting 0.00%, io waiting 0.10%
--- 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 41.2%, load 33.99
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

receipt: test step 1m18.247s 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 1m12.464s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 16.08s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 14.08s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 11.12s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 10.97s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 8.01s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 56.50, cpu waiting 32.31%, memory waiting 0.00%, io waiting 0.29%
--- 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 41.2%, load 33.99
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 1m10.969s 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 1m8.884s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 28.08s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 27.17s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 27.1s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 25.19s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsConcurrentRevision
receipt: slow test 25.12s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedAuditRollback
machine: 32 CPUs, load 59.50, cpu waiting 36.45%, memory waiting 0.00%, io waiting 0.33%
--- 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 40.6%, load 33.99
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
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/plan3test TestPlan3ReleaseBoundaries
=== RUN   TestPlan3ReleaseBoundaries
--- FAIL: TestPlan3ReleaseBoundaries (0.34s)

--- FAIL amadan.net/oficina/equipo/internal/plan3test TestPlan3ReleaseBoundaries/inventory
=== RUN   TestPlan3ReleaseBoundaries/inventory
    plan3_release_test.go:22: entry has no copy review status or applicable acceptance work.needs.mac_runner
--- FAIL: TestPlan3ReleaseBoundaries/inventory (0.04s)

--- FAIL amadan.net/oficina/equipo/internal/plan3test (package output)
FAIL
rastrillo-budget/v1 ran 54.397s
FAIL	amadan.net/oficina/equipo/internal/plan3test	54.674s


receipt: test step 56.406s 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 54.397s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 4.07s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.47s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.84s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.53s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.38s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestPlan3ReleaseBoundaries$/^inventory$' -count=1 ./internal/plan3test   (retry, once)
FAILED TWICE ./internal/plan3test:TestPlan3ReleaseBoundaries/inventory plan3test
=== RUN   TestPlan3ReleaseBoundaries
=== RUN   TestPlan3ReleaseBoundaries/inventory
    plan3_release_test.go:22: entry has no copy review status or applicable acceptance work.needs.mac_runner
--- FAIL: TestPlan3ReleaseBoundaries (0.02s)
    --- FAIL: TestPlan3ReleaseBoundaries/inventory (0.02s)
FAIL
rastrillo-budget/v1 ran 17ms
FAIL	amadan.net/oficina/equipo/internal/plan3test	0.227s
FAIL
machine: 32 CPUs, load 65.53, cpu waiting 38.65%, memory waiting 0.00%, io waiting 0.42%
make: *** [Makefile:113: ci-shard] Error 1

amadan: step check shard 16 of 29 failed: exit status 2
--- 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 41.2%, load 33.99
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./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/pause ./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/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./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/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./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/pause ./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/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./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/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/chatmarkdown: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude/realcli: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runnerproto: its inputs changed
--- FAIL amadan.net/oficina/equipo/internal/testci TestBudgetRecordsAreShort
=== RUN   TestBudgetRecordsAreShort
    budgets_file_test.go:37: .rastrillo/budgets.txt:41: reason is 220 bytes, over 200
--- FAIL: TestBudgetRecordsAreShort (0.00s)

--- FAIL amadan.net/oficina/equipo/internal/testci (package output)
FAIL
rastrillo-budget/v1 ran 1.838s
FAIL	amadan.net/oficina/equipo/internal/testci	1.847s

budget note: internal/equipo took 2m31.167s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 24.825s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/github took 40.581s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 10.713s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 1m57.152s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 26.018s, 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 53.06s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 23.573s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 13.5s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/provider/pi took 1m20.162s, over the 1m0s its record on line 27 allows; reported only, timing fails on CI
budget note: internal/runner/workspace took 10.484s, over the 10s the default allows; reported only, timing fails on CI

receipt: test step 2m37.215s against a 60s target (the gate's other steps are not in this figure)
receipt: 37 packages ran, 31 cached, 16 without tests, 1 failed
receipt: slow package 2m31.167s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 1m57.152s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m20.162s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1m7.79s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 55.16s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 58.82s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 50.48s amadan.net/oficina/equipo/internal/idtest TestDoorNeverJudgesANativeSession
receipt: slow test 50.39s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
receipt: slow test 50.24s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 49.18s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
rastrillo: budget test: go test failed
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestBudgetRecordsAreShort$' -count=1 ./internal/testci   (retry, once)
FAILED TWICE ./internal/testci:TestBudgetRecordsAreShort rest
=== RUN   TestBudgetRecordsAreShort
    budgets_file_test.go:37: .rastrillo/budgets.txt:41: reason is 220 bytes, over 200
--- FAIL: TestBudgetRecordsAreShort (0.00s)
FAIL
rastrillo-budget/v1 ran 0s
FAIL	amadan.net/oficina/equipo/internal/testci	0.004s
FAIL
machine: 32 CPUs, load 19.99, cpu waiting 8.78%, memory waiting 0.00%, io waiting 0.07%
make: *** [Makefile:113: ci-shard] Error 1

amadan: step check shard 17 of 29 failed: exit status 2
--- 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

receipt: test step 1m25.71s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m23.721s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.93s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.92s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.32s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.6s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.41s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 65.53, cpu waiting 38.65%, memory waiting 0.00%, io waiting 0.42%
--- 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

receipt: test step 1m32.233s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m30.384s amadan.net/oficina/equipo/internal/headless
receipt: slow test 29.3s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 21.22s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.29s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.59s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 8.31s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 64.28, cpu waiting 38.35%, memory waiting 0.00%, io waiting 0.38%
--- 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

receipt: test step 1m53.925s 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 1m52.017s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.53s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.42s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 12.78s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.33s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 11.29s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsSignInEmail
machine: 32 CPUs, load 53.09, cpu waiting 29.50%, memory waiting 0.00%, io waiting 0.26%
--- 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|TestBrowserCardAnswerSettlesAtBottom|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN   TestBrowserCopyContinue
time=2026-11-28T19:59:56.185Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-28T19:59:56.185Z level=INFO msg="startup phase done" phase=state_lock took=219µs
time=2026-11-28T19:59:56.185Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-28T19:59:56.186Z level=INFO msg="startup phase done" phase=claim_roots took=220µs
time=2026-11-28T19:59:56.186Z level=INFO msg="startup phase" phase=sweep
time=2026-11-28T19:59:56.239Z level=INFO msg="startup phase done" phase=sweep took=52.8ms
time=2026-11-28T19:59:56.239Z level=INFO msg="startup phase" phase=credentials
time=2026-11-28T19:59:56.239Z level=INFO msg="startup phase done" phase=credentials took=158µs
time=2026-11-28T19:59:56.239Z level=INFO msg="startup phase" phase=open_state
time=2026-11-28T19:59:56.291Z level=INFO msg="startup phase done" phase=open_state took=52.47ms
time=2026-11-28T19:59:56.292Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-28T19:59:56.293Z level=INFO msg=connecting host=127.0.0.1:46849 protocol=37
time=2026-11-28T19:59:56.294Z level=INFO msg=connected host=127.0.0.1:46849 took=1.368ms
time=2026-11-28T19:59:56.294Z level=INFO msg="capabilities gathering"
time=2026-11-28T19:59:56.296Z level=INFO msg="capabilities gathered" took=1.868ms tags=linux,claude,go
time=2026-11-28T19:59:56.301Z level=INFO msg="hello sent" protocol=37
time=2026-11-28T19:59:56.302Z level=INFO msg=welcome protocol=37 role=primary generation=1
    browser_copy_test.go:90: waiting for !document.querySelector('[data-copy-continue]'): context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserCopyContinue (6.89s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m40.759s
FAIL	amadan.net/oficina/equipo/internal/headless	100.951s


receipt: test step 1m42.423s 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 1m40.759s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.1s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 13.25s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.25s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 9.44s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.51s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserCardAnswerSettlesAtBottom|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest e67a8903e473edf72d3db9ca367dfce910236d94 6.89s 59.50
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 56.50, cpu waiting 32.31%, memory waiting 0.00%, io waiting 0.29%
--- 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|TestBrowserPreviewPassExchange)$' ./internal/equipo

receipt: test step 4.543s 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.644s amadan.net/oficina/equipo/internal/equipo
receipt: slow test 1.97s amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewPassExchange
receipt: slow test 670ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/equipotest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserGitHubManifestCSP)$' ./internal/equipotest

receipt: test step 8.253s 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 6.542s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 6.54s amadan.net/oficina/equipo/internal/equipotest TestBrowserGitHubManifestCSP
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor|TestBrowserSmartDoor)$' ./internal/idtest
budget note: internal/idtest took 11.205s, over the 10s the default allows; reported only, timing fails on CI

receipt: test step 12.973s 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 11.205s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 9.05s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.15s 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 4.177s 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.382s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.38s 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|TestBrowserPausedWork|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRhythm|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 3m34.465s 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 3m31.669s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 25.32s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.4s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.08s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.61s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 8.94s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 7.91, cpu waiting 3.34%, memory waiting 0.00%, io waiting 0.20%
--- 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   (54s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.70s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.25s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.00s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.58s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 27.12s
+ 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   (58s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 14.68s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 12.19s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 10.53s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 18.11s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (22s)
ok ./internal/headless TestMixedVersions 19.51s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.81s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (2s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 68.36, cpu waiting 37.56%, memory waiting 0.00%, io waiting 0.68%
--- 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 13.603s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 4 without tests, 0 failed
receipt: slow package 7.91s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 188ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 100ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/claude/realcli
receipt: slow test 5.6s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.74s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 440ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment

receipt: test step 4.139s 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 3.027s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 270ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 200ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 130ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryReusedPID
machine: 32 CPUs, load 26.72, cpu waiting 11.57%, memory waiting 0.00%, io waiting 1.34%
--- 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 41.2%, load 33.99
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:161:3: unclassified equipo-runner
reference scan: 3028 text files, 3265 matches, 50 failures
docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:455:17: unclassified equipo-runner
docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:476:37: unclassified equipo-runner
docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md:481:29: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-mac-slice-f.md:23:18: unclassified paseo
docs/superpowers/plans/CONTROLLER-BRIEF-mac-slice-f.md:128:25: unclassified Paseo
docs/superpowers/plans/MAC-SLICE-F-PROGRESS.md:36:67: unclassified npm
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:84:40: unclassified equipo-runner
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:56: unclassified equipo-runner
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:70: unclassified equipo-runner
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:86:125: unclassified equipo-runner
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:281:1: unclassified npm
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:324:32: unclassified node
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:389:17: unclassified NoDe
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:454:44: unclassified NPM
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:455:3: unclassified NPM
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:472:59: unclassified NPM
docs/superpowers/plans/MAC-SLICE-F-TASK1-FINDINGS.md:615:13: unclassified npm
docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:695:62: unclassified Node
docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:696:30: unclassified npm
docs/superpowers/specs/2026-11-07-equipo-mac-runners.md:702:24: unclassified equipo-runner
internal/runner/mac/caps.go:20:28: unclassified Node
internal/runner/mac/caps_test.go:43:123: unclassified Node
internal/runner/mac/caps_test.go:43:130: unclassified node
internal/runner/mac/caps_test.go:47:114: unclassified Node
internal/runner/mac/claude.go:44:65: unclassified Node
internal/runner/mac/claude.go:106:18: unclassified equipo-runner
internal/runner/mac/claude.go:154:55: unclassified node
internal/runner/mac/claude.go:157:5: unclassified node
internal/runner/mac/claude_chain_test.go:19:46: unclassified equipo-runner
internal/runner/mac/claude_chain_test.go:275:19: unclassified node
internal/runner/mac/claude_stat_darwin.go:8:57: unclassified node
internal/runner/mac/claude_stat_linux.go:8:57: unclassified node
internal/runner/mac/claude_test.go:139:58: unclassified equipo-runner
internal/runner/mac/claude_test.go:139:159: unclassified equipo-runner
internal/runner/mac/claude_test.go:499:75: unclassified Node
internal/runner/mac/claude_test.go:499:82: unclassified node
internal/runner/thin/mac.go:514:40: unclassified Node
internal/runner/thin/mac.go:514:59: unclassified NODE
internal/runner/thin/mac.go:514:72: unclassified node
internal/runner/thin/mac_claude_test.go:17:94: unclassified equipo-runner
internal/wire/wiretest/testdata/frames/hello-worker-conns.json:1:750: unclassified node
internal/wire/wiretest/testdata/frames/hello-worker-conns.json:1:1439: unclassified node
stale allowance: ('internal/runner/mac/caps.go', '5abbc8a613a7361123b31ce476f23dcd343b0268b89ded2135d55116e7af739f', 'Node')
stale allowance: ('internal/runner/mac/caps_test.go', 'aa868b41d078f76e1bbc236a9b9d3b402e64af694ad21cd90be31639d3dfa50f', 'Node')
stale allowance: ('internal/runner/mac/caps_test.go', 'aa868b41d078f76e1bbc236a9b9d3b402e64af694ad21cd90be31639d3dfa50f', 'node')
stale allowance: ('internal/runner/mac/caps_test.go', 'd44406bca55c20fbbbe9fb866fe391d10a99ad9177fd633ae97df98afe50ffb2', 'Node')
stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'NODE')
stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'Node')
stale allowance: ('internal/runner/thin/mac.go', '806354b64fb925c4a4bde41b3b1405640cbd068ced590cb136fae6e290a2db83', 'node')
make[1]: *** [Makefile:238: runner-dead-references] Error 1
machine: 32 CPUs, load 38.47, cpu waiting 18.77%, memory waiting 0.00%, io waiting 1.06%
make: *** [Makefile:113: ci-shard] Error 2

amadan: step check shard 25 of 29 failed: exit status 2
--- 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 41.2%, load 33.99
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 68.91, cpu waiting 35.84%, memory waiting 0.00%, io waiting 0.73%
--- 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 41.2%, load 33.99
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 1 vulnerability in packages you import and 10
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 68.91, cpu waiting 34.58%, memory waiting 0.00%, io waiting 0.76%
--- 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 40.6%, load 33.99
shard 28: make gitleaks
7:59PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
8:00PM INF 1280 commits scanned.
8:00PM INF scanned ~69215552 bytes (69.22 MB) in 25.4s
8:00PM WRN leaks found: 2
exit status 1
make[1]: *** [Makefile:214: gitleaks] Error 1
machine: 32 CPUs, load 68.91, cpu waiting 35.84%, memory waiting 0.00%, io waiting 0.73%
make: *** [Makefile:113: ci-shard] Error 2

amadan: step check shard 28 of 29 failed: exit status 2

amadan: job failed at step check shards 12, 16, 17, 25, 28 of 29 — its output is above, not at the tail of this log
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index bd5305da..d5286bdf 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -38,7 +38,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full
perf GET /releases/* skip Verified runner release file downloads, not browser GET screens.
perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen.
time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s;
-size internal/runner/thin 30330 25215 Protocol 31 facts, 35 diffs, merge credential, publication guards, kept work, CI units, 34 places publish, GitHub token scans, waiting cards in the Assistant opening; measured 30330/25215.
+size internal/runner/thin 30344 25260 Protocol 31 facts, 35 diffs, merge credential, publication guards, kept work, CI units, 34 places publish, GitHub token scans, waiting cards in the Assistant opening, Mac slice F pinned Claude Code; measured 30344/25260.
time internal/thintest 240s Thin contract and page tests, the Assistant's and the models' included, share one harness. Measured 202s on a shared 16 CPU box (2026-11-13); CI runs two lanes.
time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing.
time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s).
diff --git a/internal/runner/mac/caps.go b/internal/runner/mac/caps.go
index 8e589263..eec9551c 100644
--- a/internal/runner/mac/caps.go
+++ b/internal/runner/mac/caps.go
@@ -15,8 +15,10 @@ import (
type Exec func(ctx context.Context, name string, args ...string) (string, error)
// Tools are the executables the capability report asks; "" is absent.
+// Claude is the pinned CLI, which nothing looks up (ClaudeCLI).
type Tools struct {
- Xcodebuild, Xcrun, Swift, Node, SRT, RG, Claude, Codex, Git string
+ Xcodebuild, Xcrun, Swift, Node, SRT, RG, Codex, Git string
+ Claude ClaudeCLI
}
// Capabilities is a Mac's capability report (spec §1.3): Xcode, the
@@ -52,7 +54,9 @@ func Capabilities(ctx context.Context, x Exec, t Tools) wire.Capabilities {
}
c.Toolchains.Node = word(nodeVersion, ask(t.Node, "--version"))
c.Harness.SRT = word(plainVersion, ask(t.SRT, "--version"))
- c.Harness.Claude = word(plainVersion, ask(t.Claude, "--version"))
+ // Claude Code is never run to ask: the pinned version, only while the
+ // pinned file verifies (spec §8.2).
+ c.Harness.Claude = t.Claude.Version()
c.Harness.Codex = word(plainVersion, ask(t.Codex, "--version"))
// No claude or codex tag: a Mac worker runs checks only until slice
// F, so nothing that needs a harness is placed on it.
diff --git a/internal/runner/mac/caps_test.go b/internal/runner/mac/caps_test.go
index 5b80c8f1..d11d7d60 100644
--- a/internal/runner/mac/caps_test.go
+++ b/internal/runner/mac/caps_test.go
@@ -18,7 +18,6 @@ var recorded = map[string]string{
"swift --version": "swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)\nTarget: arm64-apple-macosx15.0\n",
"node --version": "v22.12.0\n",
"srt --version": "0.0.81\n",
- "claude --version": "2.1.312 (Claude Code)\n",
"xcrun simctl list -j devices available": "",
}
@@ -41,11 +40,11 @@ func recordedExec(t *testing.T) Exec {
}
func TestCapabilitiesFromRecordedTools(t *testing.T) {
- c := Capabilities(context.Background(), recordedExec(t), Tools{Xcodebuild: "xcodebuild", Xcrun: "xcrun", Swift: "swift", Node: "node", SRT: "srt", Claude: "claude"})
+ c := Capabilities(context.Background(), recordedExec(t), Tools{Xcodebuild: "xcodebuild", Xcrun: "xcrun", Swift: "swift", Node: "node", SRT: "srt"})
if err := wire.ValidCapabilities(c); err != nil {
t.Fatalf("%v: %+v", err, c)
}
- if c.Xcode != (wire.Xcode{Version: "16.2", Build: "16C5032a"}) || c.Toolchains.Swift != "6.0.3" || c.Toolchains.Node != "v22.12.0" || c.Harness.SRT != "0.0.81" || c.Harness.Claude != "2.1.312" {
+ if c.Xcode != (wire.Xcode{Version: "16.2", Build: "16C5032a"}) || c.Toolchains.Swift != "6.0.3" || c.Toolchains.Node != "v22.12.0" || c.Harness.SRT != "0.0.81" || c.Harness.Claude != "" {
t.Fatalf("versions %+v", c)
}
if !slices.Equal(c.Tags, []string{wire.TagMacOS, wire.TagXcode, wire.TagIOSSimulator}) {
diff --git a/internal/runner/mac/claude.go b/internal/runner/mac/claude.go
new file mode 100644
index 00000000..670d0de1
--- /dev/null
+++ b/internal/runner/mac/claude.go
@@ -0,0 +1,528 @@
+package mac
+
+import (
+ "context"
+ "crypto/rand"
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "io/fs"
+ "net/http"
+ "os"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/runner/provider"
+ "amadan.net/oficina/equipo/internal/runner/provider/claude"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// The Claude Code a Mac worker runs (Mac runners spec §8.2): the official
+// 2.1.312 darwin-arm64 binary, which the worker fetches itself and checks
+// against claude.ExecutableSHA256DarwinArm64, compiled in. It never runs
+// a claude it finds on PATH or is pointed at, not even for --version.
+//
+// The URL is built from these constants and provider.ClaudeVersion, as
+// the official installer builds it (task 1, S1). The release manifest
+// beside it is not read: the pin is the only trust.
+const (
+ ClaudeReleaseBase = "https://downloads.claude.ai/claude-code-releases"
+ ClaudePlatform = "darwin-arm64"
+ // MaxClaudeBinary bounds the download (2.1.312's is 275988512 bytes).
+ MaxClaudeBinary = 512 << 20
+)
+
+// ClaudeURL is the pinned release's official download.
+func ClaudeURL() string {
+ return ClaudeReleaseBase + "/" + provider.ClaudeVersion + "/" + ClaudePlatform + "/claude"
+}
+
+// claudeRel is where the CLI lives under the install dir, as path
+// components: tools/claude-<version>/claude, beside the pinned Node and
+// ripgrep. Checks may not write the install dir (ChecksSettings).
+var claudeRel = []string{"tools", "claude-" + provider.ClaudeVersion}
+
+const claudeName = "claude"
+
+// downloadPrefix names a download being written beside the CLI; one a
+// crash left behind is removed by the next Provision.
+const downloadPrefix = ".claude-download-"
+
+// ClaudeDir is the pinned CLI's directory under installDir.
+func ClaudeDir(installDir string) string {
+ return filepath.Join(append([]string{installDir}, claudeRel...)...)
+}
+
+// ClaudePath is the pinned CLI under installDir. Never run it by this
+// path: Argv and Launch verify it first.
+func ClaudePath(installDir string) string {
+ return filepath.Join(ClaudeDir(installDir), claudeName)
+}
+
+var (
+ // ErrClaudeUnpinned: no pinned CLI at its place, or what is there is
+ // not a plain 0700 file, reached through no link, that matches the pin.
+ ErrClaudeUnpinned = errors.New("mac: the pinned Claude Code is not in place")
+ // ErrClaudeRefused: a download that does not match the pin, or is
+ // over MaxClaudeBinary.
+ ErrClaudeRefused = errors.New("mac: Claude Code download refused")
+)
+
+// ClaudeUnavailable stops a launch of the CLI before anything starts:
+// the step ends wire.ReasonEngineeringUnavailable.
+type ClaudeUnavailable struct{ Err error }
+
+func (e *ClaudeUnavailable) Error() string {
+ return "engineering unavailable: " + e.Err.Error()
+}
+
+func (e *ClaudeUnavailable) Unwrap() error { return e.Err }
+
+// Reason is the step reason a launch stopped by e reports.
+func (e *ClaudeUnavailable) Reason() string { return wire.ReasonEngineeringUnavailable }
+
+// ClaudeFetch opens url's body. Provision only ever asks for ClaudeURL.
+type ClaudeFetch func(ctx context.Context, url string) (io.ReadCloser, error)
+
+// ClaudeCLI is the pinned CLI under a runner's install dir. Nothing can
+// start it but Launch, which hashes the file and checks that the path
+// still names exactly what it hashed, immediately before start. The zero
+// value has no CLI: it verifies nothing and launches nothing.
+type ClaudeCLI struct {
+ // home is the trusted ancestor: the runner user's home. installDir
+ // must lie inside it; every directory from home down to the binary
+ // is checked (openClaudeDir).
+ home, installDir string
+ // pin is the digest the file must have (a test pins its own bytes).
+ pin string
+ // limit bounds a download; 0 is MaxClaudeBinary.
+ limit int64
+}
+
+// NewClaudeCLI is the pinned darwin-arm64 CLI under installDir
+// (~/.local/lib/equipo-runner on a Mac), which lies in home.
+func NewClaudeCLI(home, installDir string) ClaudeCLI {
+ return ClaudeCLI{home: home, installDir: installDir, pin: claude.ExecutableSHA256DarwinArm64}
+}
+
+// Seams. ownerOf is the uid owning a file; runnerUID the uid that must
+// own every directory and the binary. claudeDuringHash runs once in the
+// middle of a launch's hash, claudeBeforeStart after the hash and before
+// the final check (tests race a swap there; nil in a release).
+var (
+ ownerOf = fileOwner
+ runnerUID = os.Getuid()
+ claudeDuringHash, claudeBeforeStart func()
+)
+
+func (c ClaudeCLI) bound() int64 {
+ if c.limit > 0 {
+ return c.limit
+ }
+ return MaxClaudeBinary
+}
+
+// Verify hashes the CLI at its place, once, and returns its path when it
+// matches the pin: a plain 0700 file of the runner user, reached through
+// private directories and no symbolic link from the home. The path is
+// for reports and policy records only; start the CLI with Launch.
+func (c ClaudeCLI) Verify() (string, error) {
+ v, err := c.open()
+ if err != nil {
+ return "", err
+ }
+ v.close()
+ return v.path, nil
+}
+
+// Version is the pinned version while the CLI verifies, else "". It
+// runs nothing: what the capability report states about Claude Code.
+func (c ClaudeCLI) Version() string {
+ if _, err := c.Verify(); err != nil {
+ return ""
+ }
+ return provider.ClaudeVersion
+}
+
+// Launch starts the pinned CLI through start with argv [path, args...].
+// Every start of the CLI (an Engineering attempt, an ask, a token check,
+// a sign-in, a probe launch) goes through here. It opens the file and
+// hashes the open descriptor, then, immediately before start, checks
+// that the path still names that same file (device, inode, size,
+// modification and change times) and that it did not change while it
+// was hashed. The descriptor stays open until start returns, so the
+// inode cannot be reused by another file meanwhile; start should have
+// started the process when it returns. Nothing starts when any check
+// fails: *ClaudeUnavailable, engineering_unavailable.
+//
+// The honest limit: macOS cannot exec a descriptor, so the kernel looks
+// the path up again after the last check. Only the runner user can
+// rename inside the private chain, sandboxed commands cannot write the
+// install dir, and the runner user is dedicated to the runner.
+func (c ClaudeCLI) Launch(ctx context.Context, start func(ctx context.Context, argv []string) error, args ...string) error {
+ v, err := c.open()
+ if err != nil {
+ return &ClaudeUnavailable{Err: err}
+ }
+ defer v.close()
+ if claudeBeforeStart != nil {
+ claudeBeforeStart()
+ }
+ if err := v.still(); err != nil {
+ return &ClaudeUnavailable{Err: err}
+ }
+ return start(ctx, append([]string{v.path}, args...))
+}
+
+// verified is an open, hashed CLI: its descriptor and the state it had.
+type verified struct {
+ f *os.File
+ path string
+ key statKey
+}
+
+type statKey struct {
+ dev, ino uint64
+ size int64
+ mtime, ctime int64
+}
+
+func (v *verified) close() { v.f.Close() }
+
+// still: the path names the hashed file, unchanged.
+func (v *verified) still() error {
+ named, err := os.Lstat(v.path)
+ if err != nil {
+ return ErrClaudeUnpinned
+ }
+ held, err := v.f.Stat()
+ if err != nil || !named.Mode().IsRegular() || !os.SameFile(named, held) {
+ return fmt.Errorf("%w: replaced after it was hashed", ErrClaudeUnpinned)
+ }
+ nk, ok1 := fileKey(named)
+ hk, ok2 := fileKey(held)
+ if !ok1 || !ok2 || nk != v.key || hk != v.key {
+ return fmt.Errorf("%w: changed after it was hashed", ErrClaudeUnpinned)
+ }
+ return nil
+}
+
+// open validates the chain, opens the CLI and hashes the descriptor,
+// once: a regular file, not a link, mode 0700, the runner user's, the
+// file opened the one examined, unchanged from before the hash to after.
+func (c ClaudeCLI) open() (*verified, error) {
+ if c.installDir == "" || c.pin == "" {
+ return nil, ErrClaudeUnpinned
+ }
+ d, err := c.openDir(false)
+ if err != nil {
+ return nil, ErrClaudeUnpinned
+ }
+ defer d.Close()
+ f, err := c.hashIn(d, claudeDuringHash)
+ if err != nil {
+ return nil, err
+ }
+ return f, nil
+}
+
+func (c ClaudeCLI) hashIn(d *os.Root, during func()) (*verified, error) {
+ info, err := d.Lstat(claudeName)
+ if err != nil || !info.Mode().IsRegular() || info.Mode().Perm() != 0700 || ownerOf(info) != runnerUID || info.Size() > c.bound() {
+ return nil, ErrClaudeUnpinned
+ }
+ f, err := d.OpenFile(claudeName, os.O_RDONLY, 0)
+ if err != nil {
+ return nil, ErrClaudeUnpinned
+ }
+ before, err := f.Stat()
+ key, ok := fileKey(before)
+ if err != nil || !ok || !os.SameFile(info, before) {
+ f.Close()
+ return nil, ErrClaudeUnpinned
+ }
+ h := sha256.New()
+ var r io.Reader = io.LimitReader(f, c.bound()+1)
+ if during != nil {
+ r = &midway{r: r, at: during}
+ }
+ if _, err := io.Copy(h, r); err != nil || hex.EncodeToString(h.Sum(nil)) != c.pin {
+ f.Close()
+ return nil, ErrClaudeUnpinned
+ }
+ after, err := f.Stat()
+ if k, ok := fileKey(after); err != nil || !ok || k != key {
+ f.Close()
+ return nil, fmt.Errorf("%w: changed while it was hashed", ErrClaudeUnpinned)
+ }
+ return &verified{f: f, path: ClaudePath(c.installDir), key: key}, nil
+}
+
+// midway calls at once, after the first read.
+type midway struct {
+ r io.Reader
+ at func()
+}
+
+func (m *midway) Read(p []byte) (int, error) {
+ n, err := m.r.Read(p)
+ if m.at != nil && n > 0 {
+ m.at()
+ m.at = nil
+ }
+ return n, err
+}
+
+// Provision puts the pinned CLI in place unless it already verifies:
+// fetch(ClaudeURL()) is streamed into a new file beside it, mode 0600,
+// bounded by MaxClaudeBinary and hashed as it is written; only a match
+// is made 0700 and renamed into place, replacing whatever was there. A
+// refused download is removed. Every write goes through an os.Root on
+// the checked chain (openClaudeDir), whose tool directories it makes or
+// tightens to 0700.
+func (c ClaudeCLI) Provision(ctx context.Context, fetch ClaudeFetch) error {
+ if c.installDir == "" || c.pin == "" {
+ return ErrClaudeUnpinned
+ }
+ d, err := c.openDir(true)
+ if err != nil {
+ return err
+ }
+ defer d.Close()
+ removeDownloads(d)
+ if v, err := c.hashIn(d, nil); err == nil {
+ v.close()
+ return nil
+ }
+ body, err := fetch(ctx, ClaudeURL())
+ if err != nil {
+ return err
+ }
+ defer body.Close()
+ name, err := downloadName()
+ if err != nil {
+ return err
+ }
+ f, err := d.OpenFile(name, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0600)
+ if err != nil {
+ return err
+ }
+ placed := false
+ defer func() {
+ // A second Close of a closed file is harmless.
+ if !placed {
+ _ = f.Close()
+ _ = d.Remove(name)
+ }
+ }()
+ h := sha256.New()
+ n, err := io.Copy(io.MultiWriter(f, h), io.LimitReader(body, c.bound()+1))
+ if err != nil {
+ return err
+ }
+ if n > c.bound() || hex.EncodeToString(h.Sum(nil)) != c.pin {
+ return ErrClaudeRefused
+ }
+ // Executable only now, by its descriptor.
+ if err := f.Chmod(0700); err != nil {
+ return err
+ }
+ if err := f.Sync(); err != nil {
+ return err
+ }
+ if err := f.Close(); err != nil {
+ return err
+ }
+ if err := d.Rename(name, claudeName); err != nil {
+ return err
+ }
+ placed = true
+ v, err := c.hashIn(d, nil)
+ if err != nil {
+ return err
+ }
+ v.close()
+ return nil
+}
+
+// openDir opens ClaudeDir(installDir) as an os.Root, walking from the
+// home one component at a time: each a real directory (Lstat, never a
+// symbolic link), owned by the runner user, that no group or other user
+// may write, and the one opened the one examined. The tool directories
+// (tools, claude-<version>) must be exactly 0700: create makes a missing
+// one 0700 and tightens a looser one of ours; without create a looser
+// one is refused. The install dir itself is never created.
+func (c ClaudeCLI) openDir(create bool) (*os.Root, error) {
+ rel, err := filepath.Rel(c.home, c.installDir)
+ if c.home == "" || !filepath.IsAbs(c.home) || !filepath.IsAbs(c.installDir) || err != nil || rel == "." || rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator)) {
+ return nil, fmt.Errorf("%w: the install dir is not inside the home", ErrClaudeUnpinned)
+ }
+ info, err := os.Lstat(c.home)
+ if err != nil {
+ return nil, err
+ }
+ if err := private(info, "the home"); err != nil {
+ return nil, err
+ }
+ r, err := os.OpenRoot(c.home)
+ if err != nil {
+ return nil, err
+ }
+ if opened, err := r.Stat("."); err != nil || !os.SameFile(info, opened) {
+ r.Close()
+ return nil, fmt.Errorf("%w: the home moved while it was opened", ErrClaudeUnpinned)
+ }
+ install := strings.Split(rel, string(filepath.Separator))
+ for i, name := range append(install, claudeRel...) {
+ next, err := openSubdir(r, name, i >= len(install), create)
+ r.Close()
+ if err != nil {
+ return nil, err
+ }
+ r = next
+ }
+ return r, nil
+}
+
+// private: a real directory of the runner user that no group or other
+// user may write.
+func private(info fs.FileInfo, name string) error {
+ if !info.IsDir() || info.Mode()&fs.ModeSymlink != 0 || ownerOf(info) != runnerUID || info.Mode().Perm()&0022 != 0 {
+ return fmt.Errorf("%w: %s is not a private directory of this user", ErrClaudeUnpinned, name)
+ }
+ return nil
+}
+
+func openSubdir(parent *os.Root, name string, tool, create bool) (*os.Root, error) {
+ if create && tool {
+ if err := parent.Mkdir(name, 0700); err != nil && !errors.Is(err, fs.ErrExist) {
+ return nil, err
+ }
+ }
+ info, err := parent.Lstat(name)
+ if err != nil {
+ return nil, err
+ }
+ if err := private(info, name); err != nil {
+ return nil, err
+ }
+ sub, err := parent.OpenRoot(name)
+ if err != nil {
+ return nil, err
+ }
+ if opened, err := sub.Stat("."); err != nil || !os.SameFile(info, opened) {
+ sub.Close()
+ return nil, fmt.Errorf("%w: %s moved while it was opened", ErrClaudeUnpinned, name)
+ }
+ if tool && info.Mode().Perm() != 0700 {
+ if !create {
+ sub.Close()
+ return nil, fmt.Errorf("%w: %s is not 0700", ErrClaudeUnpinned, name)
+ }
+ if err := sub.Chmod(".", 0700); err != nil {
+ sub.Close()
+ return nil, err
+ }
+ }
+ return sub, nil
+}
+
+// removeDownloads removes what an interrupted download left in d.
+func removeDownloads(d *os.Root) {
+ dir, err := d.Open(".")
+ if err != nil {
+ return
+ }
+ names, _ := dir.Readdirnames(-1)
+ dir.Close()
+ for _, n := range names {
+ if strings.HasPrefix(n, downloadPrefix) {
+ _ = d.Remove(n)
+ }
+ }
+}
+
+func downloadName() (string, error) {
+ var b [8]byte
+ if _, err := rand.Read(b[:]); err != nil {
+ return "", err
+ }
+ return downloadPrefix + hex.EncodeToString(b[:]), nil
+}
+
+// ClaudeStandInEnv names a local file that stands in for the official
+// download, in a test build only (claude_testbuild.go). A release build
+// ignores it.
+const ClaudeStandInEnv = "EQUIPO_FAKE_CLAUDE_DARWIN"
+
+// claudeTransport carries the official download (tests stand in for the
+// network with their own).
+var claudeTransport http.RoundTripper = http.DefaultTransport
+
+// claudeDownloadLimit bounds the whole download, body included.
+const claudeDownloadLimit = 30 * time.Minute
+
+// OfficialClaude is the worker's ClaudeFetch: an HTTPS GET that follows
+// no redirect and takes only 200. In a test build, ClaudeStandInEnv may
+// name a local file to serve instead; the pin still decides.
+func OfficialClaude(getenv func(string) string) ClaudeFetch {
+ if f := claudeStandIn(getenv); f != nil {
+ return f
+ }
+ return fetchOfficialClaude
+}
+
+func fetchOfficialClaude(ctx context.Context, url string) (io.ReadCloser, error) {
+ c := http.Client{Transport: claudeTransport, Timeout: claudeDownloadLimit, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := c.Do(req)
+ if err != nil {
+ return nil, err
+ }
+ if resp.StatusCode != http.StatusOK {
+ resp.Body.Close()
+ return nil, errors.New("claude download: " + resp.Status)
+ }
+ return resp.Body, nil
+}
+
+// ClaudeRetry is the first wait after a failed provisioning, doubling to
+// ClaudeRecheck, how often a verified CLI is checked again.
+var ClaudeRetry, ClaudeRecheck = time.Minute, time.Hour
+
+// KeepClaude keeps the pinned CLI in place (spec §8.2), so the person
+// installs nothing: Provision at start, again after a failure, and every
+// ClaudeRecheck, fetching anew when it is missing or no longer matches.
+// It never runs it. refresh is called whenever it starts or stops
+// verifying, so the capability report follows. It returns with ctx.
+func KeepClaude(ctx context.Context, c ClaudeCLI, fetch ClaudeFetch, refresh func(), warn func(string, ...any)) {
+ wait, verified := ClaudeRetry, false
+ for {
+ err := c.Provision(ctx, fetch)
+ if ctx.Err() != nil {
+ return
+ }
+ next := ClaudeRecheck
+ if err != nil {
+ warn("claude code not provisioned", "version", provider.ClaudeVersion, "err", err)
+ next, wait = wait, min(wait*2, ClaudeRecheck)
+ } else {
+ wait = ClaudeRetry
+ }
+ if (err == nil) != verified {
+ verified = err == nil
+ refresh()
+ }
+ select {
+ case <-ctx.Done():
+ return
+ case <-time.After(next):
+ }
+ }
+}
diff --git a/internal/runner/mac/claude_chain_test.go b/internal/runner/mac/claude_chain_test.go
new file mode 100644
index 00000000..c8304e82
--- /dev/null
+++ b/internal/runner/mac/claude_chain_test.go
@@ -0,0 +1,290 @@
+package mac
+
+import (
+ "context"
+ "errors"
+ "io/fs"
+ "os"
+ "path/filepath"
+ "slices"
+ "testing"
+ "time"
+)
+
+// install makes a runner's home and install dir as the installer does
+// (0700 each) and returns both.
+func install(t *testing.T) (home, dir string) {
+ t.Helper()
+ home = t.TempDir()
+ dir = filepath.Join(home, ".local", "lib", "equipo-runner")
+ // A umask of 002 leaves t.TempDir's group-writable.
+ if err := os.Chmod(home, 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.MkdirAll(dir, 0700); err != nil {
+ t.Fatal(err)
+ }
+ return home, dir
+}
+
+func homeCLI(home, dir string, body []byte) ClaudeCLI {
+ c := NewClaudeCLI(home, dir)
+ c.pin = digest(body)
+ return c
+}
+
+// Every directory from the home down to the binary is a real directory
+// (never a link), the runner user's, written by no one else; the tool
+// directories are exactly 0700 (a looser one of ours is tightened by
+// Provision and refused by Verify).
+func TestClaudeChainIsPrivate(t *testing.T) {
+ ctx := context.Background()
+ body := fakeClaude()
+ refused := func(t *testing.T, cli ClaudeCLI, why string) {
+ t.Helper()
+ if err := cli.Provision(ctx, serve(body, nil)); err == nil {
+ t.Fatalf("provisioned %s", why)
+ }
+ if _, err := cli.Verify(); err == nil {
+ t.Fatalf("verified %s", why)
+ }
+ }
+
+ t.Run("install dir outside the home", func(t *testing.T) {
+ home, _ := install(t)
+ other := t.TempDir()
+ refused(t, homeCLI(home, other, body), "outside the home")
+ })
+
+ t.Run("the home is a symlink", func(t *testing.T) {
+ home, dir := install(t)
+ link := filepath.Join(t.TempDir(), "home")
+ if err := os.Symlink(home, link); err != nil {
+ t.Fatal(err)
+ }
+ rel, _ := filepath.Rel(home, dir)
+ refused(t, homeCLI(link, filepath.Join(link, rel), body), "under a symlinked home")
+ })
+
+ t.Run("symlinked install dir", func(t *testing.T) {
+ home, dir := install(t)
+ // A sibling inside lib: os.Root alone would follow it.
+ elsewhere := filepath.Join(filepath.Dir(dir), "elsewhere")
+ if err := os.Mkdir(elsewhere, 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Remove(dir); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink("elsewhere", dir); err != nil {
+ t.Fatal(err)
+ }
+ refused(t, homeCLI(home, dir, body), "through a symlinked install dir")
+ if left := entries(t, elsewhere); len(left) != 0 {
+ t.Fatalf("wrote through the link: %v", left)
+ }
+ })
+
+ t.Run("group-writable ancestor", func(t *testing.T) {
+ home, dir := install(t)
+ lib := filepath.Join(home, ".local")
+ if err := os.Chmod(lib, 0770); err != nil {
+ t.Fatal(err)
+ }
+ refused(t, homeCLI(home, dir, body), "under a group-writable .local")
+ if left := entries(t, dir); len(left) != 0 {
+ t.Fatalf("wrote %v", left)
+ }
+ if err := os.Chmod(lib, 0702); err != nil {
+ t.Fatal(err)
+ }
+ refused(t, homeCLI(home, dir, body), "under an other-writable .local")
+ })
+
+ t.Run("a group-writable home", func(t *testing.T) {
+ home, dir := install(t)
+ if err := os.Chmod(home, 0770); err != nil {
+ t.Fatal(err)
+ }
+ defer os.Chmod(home, 0700)
+ refused(t, homeCLI(home, dir, body), "in a group-writable home")
+ })
+
+ t.Run("a 0755 tool directory", func(t *testing.T) {
+ home, dir := install(t)
+ tools := filepath.Join(dir, "tools")
+ if err := os.Mkdir(tools, 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Chmod(tools, 0755); err != nil {
+ t.Fatal(err)
+ }
+ cli := homeCLI(home, dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatalf("a 0755 tools directory of ours: %v", err)
+ }
+ if info, _ := os.Lstat(tools); info.Mode().Perm() != 0700 {
+ t.Fatalf("tools left %v", info.Mode())
+ }
+ // Loosened after provisioning: no launch until Provision tightens it.
+ if err := os.Chmod(ClaudeDir(dir), 0755); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := cli.Verify(); err == nil {
+ t.Fatal("verified under a 0755 version directory")
+ }
+ if err := cli.Launch(ctx, func(context.Context, []string) error { t.Fatal("started"); return nil }); !isUnavailable(err) {
+ t.Fatalf("launch under a 0755 version directory: %v", err)
+ }
+ if err := cli.Provision(ctx, noFetch(t)); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := cli.Verify(); err != nil {
+ t.Fatalf("after tightening: %v", err)
+ }
+ })
+
+ t.Run("a foreign-owned directory", func(t *testing.T) {
+ home, dir := install(t)
+ defer func(was func(fs.FileInfo) int) { ownerOf = was }(ownerOf)
+ real := ownerOf
+ for _, name := range []string{filepath.Base(home), "lib", "tools", "claude-2.1.312", "claude"} {
+ cli := homeCLI(home, dir, body)
+ ownerOf = real
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ ownerOf = func(fi fs.FileInfo) int {
+ if fi.Name() == name || name == filepath.Base(home) && fi.Name() == "." {
+ return 4242
+ }
+ return real(fi)
+ }
+ if _, err := cli.Verify(); err == nil {
+ t.Fatalf("verified with %s owned by another user", name)
+ }
+ if err := cli.Provision(ctx, serve(body, nil)); err == nil && name != "claude" {
+ t.Fatalf("provisioned with %s owned by another user", name)
+ }
+ }
+ })
+}
+
+func isUnavailable(err error) bool {
+ var u *ClaudeUnavailable
+ return errors.As(err, &u) && u.Reason() == "engineering_unavailable"
+}
+
+// swapIn renames a changed CLI over the verified one, as a writer racing
+// the launch would.
+func swapIn(t *testing.T, dir string, body []byte) {
+ t.Helper()
+ b := slices.Clone(body)
+ b[0] ^= 1
+ next := ClaudePath(dir) + ".next"
+ if err := os.WriteFile(next, b, 0700); err != nil {
+ t.Error(err)
+ }
+ if err := os.Rename(next, ClaudePath(dir)); err != nil {
+ t.Error(err)
+ }
+}
+
+// A file swapped while it is being hashed, or after the hash and before
+// start, stops the launch: what the hash read is not what the path names.
+func TestLaunchRefusesARacingSwap(t *testing.T) {
+ ctx := context.Background()
+ body := fakeClaude()
+ start := func(t *testing.T) func(context.Context, []string) error {
+ return func(context.Context, []string) error {
+ t.Fatal("started a CLI swapped during its launch")
+ return nil
+ }
+ }
+ for _, at := range []struct {
+ name string
+ hook *func()
+ }{{"during hashing", &claudeDuringHash}, {"before start", &claudeBeforeStart}} {
+ t.Run(at.name+": renamed over", func(t *testing.T) {
+ home, dir := install(t)
+ cli := homeCLI(home, dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ defer func() { *at.hook = nil }()
+ *at.hook = func() { swapIn(t, dir, body) }
+ if err := cli.Launch(ctx, start(t)); !isUnavailable(err) {
+ t.Fatalf("a swap %s: %v", at.name, err)
+ }
+ })
+ }
+ // Written in place during hashing (a part already hashed), the
+ // modification time put back: the change time still moves.
+ t.Run("during hashing: written in place", func(t *testing.T) {
+ home, dir := install(t)
+ cli := homeCLI(home, dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ info, err := os.Lstat(ClaudePath(dir))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer func() { claudeDuringHash = nil }()
+ claudeDuringHash = func() {
+ time.Sleep(10 * time.Millisecond)
+ f, err := os.OpenFile(ClaudePath(dir), os.O_WRONLY, 0)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ _, err = f.WriteAt([]byte{body[0] ^ 1}, 0)
+ f.Close()
+ if err == nil {
+ err = os.Chtimes(ClaudePath(dir), info.ModTime(), info.ModTime())
+ }
+ if err != nil {
+ t.Error(err)
+ }
+ }
+ if err := cli.Launch(ctx, start(t)); !isUnavailable(err) {
+ t.Fatalf("written in place during hashing: %v", err)
+ }
+ })
+ // The capability report too: a file written while Verify hashes it
+ // does not verify.
+ t.Run("Verify: written in place during hashing", func(t *testing.T) {
+ home, dir := install(t)
+ cli := homeCLI(home, dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ defer func() { claudeDuringHash = nil }()
+ claudeDuringHash = func() {
+ time.Sleep(10 * time.Millisecond)
+ if f, err := os.OpenFile(ClaudePath(dir), os.O_WRONLY, 0); err == nil {
+ _, _ = f.WriteAt(body[:1], 0)
+ f.Close()
+ }
+ }
+ if _, err := cli.Verify(); err == nil {
+ t.Fatal("verified a file written while it was hashed")
+ }
+ })
+ // Untouched: it starts, and the CLI's file stays open until start
+ // returns (its inode cannot be reused for another file meanwhile).
+ t.Run("untouched", func(t *testing.T) {
+ home, dir := install(t)
+ cli := homeCLI(home, dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ ran := false
+ if err := cli.Launch(ctx, func(_ context.Context, argv []string) error {
+ ran = argv[0] == ClaudePath(dir)
+ return nil
+ }); err != nil || !ran {
+ t.Fatalf("untouched: %v %v", err, ran)
+ }
+ })
+}
diff --git a/internal/runner/mac/claude_release.go b/internal/runner/mac/claude_release.go
new file mode 100644
index 00000000..57bb46d2
--- /dev/null
+++ b/internal/runner/mac/claude_release.go
@@ -0,0 +1,9 @@
+//go:build !testbuild
+
+package mac
+
+// A release build has no stand-in: the pinned CLI comes only from its
+// official URL.
+const claudeStandInBuild = false
+
+func claudeStandIn(func(string) string) ClaudeFetch { return nil }
diff --git a/internal/runner/mac/claude_stat_darwin.go b/internal/runner/mac/claude_stat_darwin.go
new file mode 100644
index 00000000..61100712
--- /dev/null
+++ b/internal/runner/mac/claude_stat_darwin.go
@@ -0,0 +1,25 @@
+package mac
+
+import (
+ "io/fs"
+ "syscall"
+)
+
+// fileKey names one state of one file: its device and inode, size,
+// modification and change times. The change time moves on any write,
+// chmod or rename, and no process can set it back.
+func fileKey(fi fs.FileInfo) (statKey, bool) {
+ st, ok := fi.Sys().(*syscall.Stat_t)
+ if !ok {
+ return statKey{}, false
+ }
+ return statKey{dev: uint64(st.Dev), ino: uint64(st.Ino), size: st.Size, mtime: st.Mtimespec.Nano(), ctime: st.Ctimespec.Nano()}, true
+}
+
+// fileOwner is the uid that owns fi (-1 when unknown).
+func fileOwner(fi fs.FileInfo) int {
+ if st, ok := fi.Sys().(*syscall.Stat_t); ok {
+ return int(st.Uid)
+ }
+ return -1
+}
diff --git a/internal/runner/mac/claude_stat_linux.go b/internal/runner/mac/claude_stat_linux.go
new file mode 100644
index 00000000..a0148b98
--- /dev/null
+++ b/internal/runner/mac/claude_stat_linux.go
@@ -0,0 +1,25 @@
+package mac
+
+import (
+ "io/fs"
+ "syscall"
+)
+
+// fileKey names one state of one file: its device and inode, size,
+// modification and change times. The change time moves on any write,
+// chmod or rename, and no process can set it back.
+func fileKey(fi fs.FileInfo) (statKey, bool) {
+ st, ok := fi.Sys().(*syscall.Stat_t)
+ if !ok {
+ return statKey{}, false
+ }
+ return statKey{dev: uint64(st.Dev), ino: uint64(st.Ino), size: st.Size, mtime: st.Mtim.Nano(), ctime: st.Ctim.Nano()}, true
+}
+
+// fileOwner is the uid that owns fi (-1 when unknown).
+func fileOwner(fi fs.FileInfo) int {
+ if st, ok := fi.Sys().(*syscall.Stat_t); ok {
+ return int(st.Uid)
+ }
+ return -1
+}
diff --git a/internal/runner/mac/claude_test.go b/internal/runner/mac/claude_test.go
new file mode 100644
index 00000000..1c5a14a7
--- /dev/null
+++ b/internal/runner/mac/claude_test.go
@@ -0,0 +1,612 @@
+package mac
+
+import (
+ "bytes"
+ "context"
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "io"
+ "io/fs"
+ "net/http"
+ "os"
+ "path/filepath"
+ "slices"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/runner/provider"
+ "amadan.net/oficina/equipo/internal/runner/provider/claude"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// fakeClaude stands in for the 276 MB darwin binary: the tests check the
+// pin's handling, so a test CLI carries its own digest (claudeFor).
+func fakeClaude() []byte {
+ return bytes.Repeat([]byte("#!/bin/sh\necho fake claude 2.1.312\n"), 1024)
+}
+
+func digest(b []byte) string {
+ s := sha256.Sum256(b)
+ return hex.EncodeToString(s[:])
+}
+
+// claudeFor is the pinned CLI under installDir, pinned to body's digest.
+// Its home is installDir's parent (a test's own temporary directory);
+// both are made 0700, as a umask of 002 leaves t.TempDir's group-writable.
+func claudeFor(installDir string, body []byte) ClaudeCLI {
+ for _, d := range []string{filepath.Dir(installDir), installDir} {
+ if err := os.Chmod(d, 0700); err != nil {
+ panic(err)
+ }
+ }
+ c := NewClaudeCLI(filepath.Dir(installDir), installDir)
+ c.pin = digest(body)
+ return c
+}
+
+// serve answers every fetch with body and records the URLs asked.
+func serve(body []byte, urls *[]string) ClaudeFetch {
+ return func(_ context.Context, url string) (io.ReadCloser, error) {
+ if urls != nil {
+ *urls = append(*urls, url)
+ }
+ return io.NopCloser(bytes.NewReader(body)), nil
+ }
+}
+
+func noFetch(t *testing.T) ClaudeFetch {
+ return func(context.Context, string) (io.ReadCloser, error) {
+ t.Fatal("fetched although the pinned CLI is in place")
+ return nil, errors.New("no")
+ }
+}
+
+// watched calls atEOF once, when the download has been read to its end:
+// what is on disk then is what the provisioner wrote before it decided.
+type watched struct {
+ r io.Reader
+ atEOF func()
+ n int64
+}
+
+func (w *watched) Read(p []byte) (int, error) {
+ n, err := w.r.Read(p)
+ w.n += int64(n)
+ if err == io.EOF && w.atEOF != nil {
+ w.atEOF()
+ w.atEOF = nil
+ }
+ return n, err
+}
+
+func (w *watched) Close() error { return nil }
+
+// entries are the names under dir and their modes ("" for dir itself); a
+// missing dir has none.
+func entries(t *testing.T, dir string) map[string]fs.FileMode {
+ t.Helper()
+ out := map[string]fs.FileMode{}
+ err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
+ if errors.Is(err, fs.ErrNotExist) && path == dir {
+ return fs.SkipDir
+ }
+ if err != nil {
+ return err
+ }
+ if path == dir {
+ return nil
+ }
+ info, err := os.Lstat(path)
+ if err != nil {
+ return err
+ }
+ rel, _ := filepath.Rel(dir, path)
+ out[filepath.ToSlash(rel)] = info.Mode()
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ return out
+}
+
+// The Mac's pin is the official 2.1.312 darwin-arm64 binary (task 1, S1):
+// nothing else on darwin has one, and the Linux pins did not move.
+func TestClaudePinDarwin(t *testing.T) {
+ const want = "6b5ec691195e551b02c41df9f7d723f4ea61eaa03c2df90acefe3736f1aeb620"
+ if claude.ExecutableSHA256DarwinArm64 != want {
+ t.Fatalf("darwin pin %q", claude.ExecutableSHA256DarwinArm64)
+ }
+ if pin, ok := claude.ReleasePinFor("darwin", "arm64"); !ok || pin != want {
+ t.Fatalf("darwin/arm64: %q %v", pin, ok)
+ }
+ for _, arch := range []string{"amd64", "386", "riscv64", ""} {
+ if pin, ok := claude.ReleasePinFor("darwin", arch); ok || pin != "" {
+ t.Fatalf("darwin/%s has a pin %q", arch, pin)
+ }
+ }
+ for _, p := range []struct{ goos, goarch, pin string }{{"linux", "amd64", claude.ExecutableSHA256}, {"linux", "arm64", claude.ExecutableSHA256Arm64}} {
+ if pin, ok := claude.ReleasePinFor(p.goos, p.goarch); !ok || pin != p.pin {
+ t.Fatalf("%s/%s: %q %v", p.goos, p.goarch, pin, ok)
+ }
+ }
+ if _, ok := claude.ReleasePinFor("windows", "amd64"); ok {
+ t.Fatal("windows has a pin")
+ }
+ // The Mac worker's CLI checks against exactly that pin.
+ if got := NewClaudeCLI("/Users/u", "/Users/u/.local/lib/equipo-runner"); got.pin != want || got.home != "/Users/u" || got.installDir != "/Users/u/.local/lib/equipo-runner" {
+ t.Fatalf("NewClaudeCLI %+v", got)
+ }
+}
+
+// One changed byte is refused before the file is ever executable, and the
+// refused download leaves nothing behind.
+func TestProvisionChecksDigestBeforeExec(t *testing.T) {
+ dir := t.TempDir()
+ body := fakeClaude()
+ bad := slices.Clone(body)
+ bad[len(bad)/2] ^= 1
+ cli := claudeFor(dir, body)
+ for _, try := range [][]byte{bad, body} {
+ var during map[string]fs.FileMode
+ fetch := func(context.Context, string) (io.ReadCloser, error) {
+ return &watched{r: bytes.NewReader(try), atEOF: func() { during = entries(t, ClaudeDir(dir)) }}, nil
+ }
+ err := cli.Provision(context.Background(), fetch)
+ if len(during) != 1 {
+ t.Fatalf("the download was not staged as one file: %v", during)
+ }
+ for name, mode := range during {
+ if mode.Perm()&0111 != 0 || !mode.IsRegular() {
+ t.Fatalf("%s is %v while it downloads, before its digest is known", name, mode)
+ }
+ }
+ if bytes.Equal(try, bad) {
+ if !errors.Is(err, ErrClaudeRefused) {
+ t.Fatalf("one changed byte: %v", err)
+ }
+ if left := entries(t, ClaudeDir(dir)); len(left) != 0 {
+ t.Fatalf("a refused download left %v", left)
+ }
+ if _, err := cli.Verify(); err == nil {
+ t.Fatal("verified after a refused download")
+ }
+ continue
+ }
+ if err != nil {
+ t.Fatalf("the pinned bytes: %v", err)
+ }
+ path, err := cli.Verify()
+ if err != nil {
+ t.Fatal(err)
+ }
+ info, err := os.Lstat(path)
+ if err != nil || info.Mode().Perm() != 0700 {
+ t.Fatalf("placed %v %v", info.Mode(), err)
+ }
+ }
+}
+
+// A 512 MB bound; written only at tools/claude-2.1.312/claude under the
+// install dir, mode 0700, through no symlink; a wrong file in place is
+// replaced, a right one is kept.
+func TestProvisionBoundsAndPlace(t *testing.T) {
+ if MaxClaudeBinary != 512<<20 {
+ t.Fatalf("bound %d", MaxClaudeBinary)
+ }
+ if got := NewClaudeCLI("/", "/i").bound(); got != MaxClaudeBinary {
+ t.Fatalf("the worker's bound is %d", got)
+ }
+ ctx := context.Background()
+ body := fakeClaude()
+
+ t.Run("bound", func(t *testing.T) {
+ dir := t.TempDir()
+ cli := claudeFor(dir, body)
+ cli.limit = int64(len(body)) - 1
+ w := &watched{r: io.MultiReader(bytes.NewReader(body), bytes.NewReader(make([]byte, 1<<20)))}
+ if err := cli.Provision(ctx, func(context.Context, string) (io.ReadCloser, error) { return w, nil }); !errors.Is(err, ErrClaudeRefused) {
+ t.Fatalf("over the bound: %v", err)
+ }
+ if w.n > cli.limit+1 {
+ t.Fatalf("read %d bytes past a %d bound", w.n, cli.limit)
+ }
+ if left := entries(t, ClaudeDir(dir)); len(left) != 0 {
+ t.Fatalf("left %v", left)
+ }
+ cli.limit = int64(len(body))
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatalf("at the bound: %v", err)
+ }
+ })
+
+ t.Run("place", func(t *testing.T) {
+ dir := t.TempDir()
+ cli := claudeFor(dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ want := filepath.Join(dir, "tools", "claude-2.1.312", "claude")
+ if ClaudeDir(dir) != filepath.Dir(want) {
+ t.Fatalf("ClaudeDir %q", ClaudeDir(dir))
+ }
+ if path, err := cli.Verify(); err != nil || path != want {
+ t.Fatalf("Verify %q %v", path, err)
+ }
+ got := entries(t, dir)
+ wantModes := map[string]fs.FileMode{"tools": fs.ModeDir | 0700, "tools/claude-2.1.312": fs.ModeDir | 0700, "tools/claude-2.1.312/claude": 0700}
+ if len(got) != len(wantModes) {
+ t.Fatalf("wrote %v", got)
+ }
+ for name, mode := range wantModes {
+ if got[name] != mode {
+ t.Fatalf("%s is %v, want %v (all: %v)", name, got[name], mode, got)
+ }
+ }
+ // In place and right: kept, nothing fetched.
+ if err := cli.Provision(ctx, noFetch(t)); err != nil {
+ t.Fatal(err)
+ }
+ // In place and wrong: replaced.
+ if err := os.WriteFile(want, append(slices.Clone(body), '\n'), 0700); err != nil {
+ t.Fatal(err)
+ }
+ var urls []string
+ if err := cli.Provision(ctx, serve(body, &urls)); err != nil || len(urls) != 1 {
+ t.Fatalf("a wrong file: %v %v", err, urls)
+ }
+ if raw, _ := os.ReadFile(want); !bytes.Equal(raw, body) {
+ t.Fatal("the wrong file was not replaced")
+ }
+ // A download a crash left behind goes.
+ stale := filepath.Join(ClaudeDir(dir), ".claude-download-stale")
+ if err := os.WriteFile(stale, []byte("half"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ if err := cli.Provision(ctx, noFetch(t)); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := os.Lstat(stale); !errors.Is(err, fs.ErrNotExist) {
+ t.Fatalf("a stale download is still there: %v", err)
+ }
+ })
+
+ t.Run("tools is a symlink", func(t *testing.T) {
+ dir, outside := t.TempDir(), t.TempDir()
+ if err := os.Symlink(outside, filepath.Join(dir, "tools")); err != nil {
+ t.Fatal(err)
+ }
+ cli := claudeFor(dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err == nil {
+ t.Fatal("provisioned through a symlinked tools directory")
+ }
+ if left := entries(t, outside); len(left) != 0 {
+ t.Fatalf("wrote through the link: %v", left)
+ }
+ })
+
+ // os.Root alone refuses a link that leaves it; these stay inside, so
+ // only the provisioner's own refusal stops them.
+ t.Run("tools is a symlink inside the install dir", func(t *testing.T) {
+ dir := t.TempDir()
+ elsewhere := filepath.Join(dir, "elsewhere")
+ if err := os.Mkdir(elsewhere, 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink("elsewhere", filepath.Join(dir, "tools")); err != nil {
+ t.Fatal(err)
+ }
+ cli := claudeFor(dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err == nil {
+ t.Fatal("provisioned through a symlinked tools directory")
+ }
+ if left := entries(t, elsewhere); len(left) != 0 {
+ t.Fatalf("wrote through the link: %v", left)
+ }
+ })
+
+ t.Run("the version directory is a symlink", func(t *testing.T) {
+ dir := t.TempDir()
+ elsewhere := filepath.Join(dir, "tools", "elsewhere")
+ if err := os.MkdirAll(elsewhere, 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink("elsewhere", ClaudeDir(dir)); err != nil {
+ t.Fatal(err)
+ }
+ cli := claudeFor(dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err == nil {
+ t.Fatal("provisioned through a symlinked version directory")
+ }
+ if left := entries(t, elsewhere); len(left) != 0 {
+ t.Fatalf("wrote through the link: %v", left)
+ }
+ if _, err := cli.Verify(); err == nil {
+ t.Fatal("verified through a symlinked version directory")
+ }
+ })
+
+ t.Run("the binary is a symlink", func(t *testing.T) {
+ dir := t.TempDir()
+ cli := claudeFor(dir, body)
+ if err := cli.Provision(ctx, serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ // A link to a right copy beside it: never verified, replaced by a
+ // real file, the copy untouched.
+ path := ClaudePath(dir)
+ real := filepath.Join(ClaudeDir(dir), "claude.real")
+ if err := os.Rename(path, real); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Symlink("claude.real", path); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := cli.Verify(); !errors.Is(err, ErrClaudeUnpinned) {
+ t.Fatalf("a symlink verified: %v", err)
+ }
+ var urls []string
+ if err := cli.Provision(ctx, serve(body, &urls)); err != nil || len(urls) != 1 {
+ t.Fatalf("a symlink in place: %v %v", err, urls)
+ }
+ if info, err := os.Lstat(path); err != nil || !info.Mode().IsRegular() {
+ t.Fatalf("still a link: %v %v", info, err)
+ }
+ if raw, err := os.ReadFile(real); err != nil || !bytes.Equal(raw, body) {
+ t.Fatalf("the link's target changed: %v", err)
+ }
+ })
+}
+
+// roundTrip stands in for the network: nothing in a test leaves the
+// machine.
+type roundTrip func(*http.Request) (*http.Response, error)
+
+func (f roundTrip) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }
+
+// The URL comes from the version and platform constants; the official
+// source is an HTTPS GET of it that follows no redirect; a local file
+// stands in only in a test build.
+func TestProvisionOnlyFromTheOfficialURL(t *testing.T) {
+ const official = "https://downloads.claude.ai/claude-code-releases/2.1.312/darwin-arm64/claude"
+ if ClaudeURL() != official || ClaudeURL() != ClaudeReleaseBase+"/"+provider.ClaudeVersion+"/"+ClaudePlatform+"/claude" {
+ t.Fatalf("ClaudeURL %q", ClaudeURL())
+ }
+ ctx := context.Background()
+ body := fakeClaude()
+ var urls []string
+ if err := claudeFor(t.TempDir(), body).Provision(ctx, serve(body, &urls)); err != nil || !slices.Equal(urls, []string{official}) {
+ t.Fatalf("asked %v: %v", urls, err)
+ }
+
+ defer func(was http.RoundTripper) { claudeTransport = was }(claudeTransport)
+ var asked []string
+ status, location := http.StatusOK, ""
+ claudeTransport = roundTrip(func(r *http.Request) (*http.Response, error) {
+ asked = append(asked, r.Method+" "+r.URL.String())
+ h, code := http.Header{}, status
+ if r.URL.String() != official {
+ // A redirect's target answers, so a client that follows one
+ // shows here as a second request rather than looping.
+ code = http.StatusOK
+ } else if location != "" {
+ h.Set("Location", location)
+ }
+ return &http.Response{StatusCode: code, Header: h, Body: io.NopCloser(bytes.NewReader(body)), Request: r}, nil
+ })
+ local := filepath.Join(t.TempDir(), "claude")
+ if err := os.WriteFile(local, body, 0600); err != nil {
+ t.Fatal(err)
+ }
+ getenv := func(k string) string {
+ if k == ClaudeStandInEnv {
+ return local
+ }
+ return ""
+ }
+ if err := claudeFor(t.TempDir(), body).Provision(ctx, OfficialClaude(getenv)); err != nil {
+ t.Fatal(err)
+ }
+ if claudeStandInBuild {
+ if len(asked) != 0 {
+ t.Fatalf("a test build with a stand-in fetched %v", asked)
+ }
+ } else if !slices.Equal(asked, []string{"GET " + official}) {
+ t.Fatalf("a release build asked %v, the stand-in must be ignored", asked)
+ }
+
+ // The official source itself: no redirect followed, 200 only.
+ none := func(string) string { return "" }
+ asked, status, location = nil, http.StatusFound, "https://elsewhere.example/claude"
+ if err := claudeFor(t.TempDir(), body).Provision(ctx, OfficialClaude(none)); err == nil || !slices.Equal(asked, []string{"GET " + official}) {
+ t.Fatalf("a redirect: %v %v", err, asked)
+ }
+ asked, status, location = nil, http.StatusNotFound, ""
+ if err := claudeFor(t.TempDir(), body).Provision(ctx, OfficialClaude(none)); err == nil || len(asked) != 1 {
+ t.Fatalf("a 404: %v %v", err, asked)
+ }
+}
+
+// The launcher hashes the CLI again before each launch: a file swapped
+// after a launch stops the next one with engineering_unavailable, and
+// nothing starts.
+func TestVerifyBeforeEveryLaunch(t *testing.T) {
+ dir := t.TempDir()
+ body := fakeClaude()
+ cli := claudeFor(dir, body)
+ if err := cli.Provision(context.Background(), serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ var started [][]string
+ start := func(_ context.Context, argv []string) error {
+ started = append(started, argv)
+ return nil
+ }
+ for range 2 {
+ if err := cli.Launch(context.Background(), start, "-p", "--output-format", "stream-json"); err != nil {
+ t.Fatal(err)
+ }
+ }
+ want := []string{ClaudePath(dir), "-p", "--output-format", "stream-json"}
+ if len(started) != 2 || !slices.Equal(started[0], want) || !slices.Equal(started[1], want) {
+ t.Fatalf("started %v", started)
+ }
+ unavailable := func(err error) bool {
+ var u *ClaudeUnavailable
+ return errors.As(err, &u) && u.Reason() == wire.ReasonEngineeringUnavailable
+ }
+ // Swapped in place, same size and mode, one byte changed.
+ swapped := slices.Clone(body)
+ swapped[0] ^= 1
+ next := ClaudePath(dir) + ".next"
+ if err := os.WriteFile(next, swapped, 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Rename(next, ClaudePath(dir)); err != nil {
+ t.Fatal(err)
+ }
+ if err := cli.Launch(context.Background(), start); !unavailable(err) {
+ t.Fatalf("a swapped CLI: %v", err)
+ }
+ // None in place at all, or no CLI configured: the same stop.
+ if err := os.Remove(ClaudePath(dir)); err != nil {
+ t.Fatal(err)
+ }
+ if err := cli.Launch(context.Background(), start); !unavailable(err) {
+ t.Fatalf("a missing CLI: %v", err)
+ }
+ if err := (ClaudeCLI{}).Launch(context.Background(), start); !unavailable(err) {
+ t.Fatalf("no CLI: %v", err)
+ }
+ if len(started) != 2 {
+ t.Fatalf("started an unverified CLI: %v", started)
+ }
+}
+
+// The capability report runs no claude at all: it states the pinned
+// version only while the pinned file verifies.
+func TestDiscoveryNeverRunsUnpinnedClaude(t *testing.T) {
+ dir := t.TempDir()
+ body := fakeClaude()
+ cli := claudeFor(dir, body)
+ var ran []string
+ x := func(ctx context.Context, name string, args ...string) (string, error) {
+ ran = append(ran, strings.Join(append([]string{name}, args...), " "))
+ return recordedExec(t)(ctx, name, args...)
+ }
+ tools := Tools{Xcodebuild: "xcodebuild", Xcrun: "xcrun", Swift: "swift", Node: "node", SRT: "srt", Claude: cli}
+ if c := Capabilities(context.Background(), x, tools); c.Harness.Claude != "" {
+ t.Fatalf("claimed %q with nothing provisioned", c.Harness.Claude)
+ }
+ if err := cli.Provision(context.Background(), serve(body, nil)); err != nil {
+ t.Fatal(err)
+ }
+ c := Capabilities(context.Background(), x, tools)
+ if c.Harness.Claude != provider.ClaudeVersion || slices.Contains(c.Tags, wire.TagClaude) {
+ t.Fatalf("verified: harness %q tags %v", c.Harness.Claude, c.Tags)
+ }
+ if err := os.WriteFile(ClaudePath(dir), append(slices.Clone(body), 0), 0700); err != nil {
+ t.Fatal(err)
+ }
+ if c := Capabilities(context.Background(), x, tools); c.Harness.Claude != "" {
+ t.Fatalf("claimed %q for a changed file", c.Harness.Claude)
+ }
+ if len(ran) == 0 {
+ t.Fatal("the recorder saw nothing")
+ }
+ for _, cmd := range ran {
+ if strings.Contains(cmd, "claude") {
+ t.Fatalf("discovery ran %q", cmd)
+ }
+ }
+}
+
+// The worker keeps the pinned CLI itself: fetched from the official URL
+// only, again after a failure (warned, nothing claimed), refreshed when
+// it starts verifying, fetched anew when it is swapped, never run.
+func TestKeepClaude(t *testing.T) {
+ defer func(r, c time.Duration) { ClaudeRetry, ClaudeRecheck = r, c }(ClaudeRetry, ClaudeRecheck)
+ ClaudeRetry, ClaudeRecheck = time.Millisecond, time.Millisecond
+ dir := t.TempDir()
+ body := fakeClaude()
+ cli := claudeFor(dir, body)
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ var urls, warned, versions []string
+ fetch := func(_ context.Context, url string) (io.ReadCloser, error) {
+ urls = append(urls, url)
+ switch len(urls) {
+ case 1, 2:
+ if v := cli.Version(); v != "" {
+ t.Errorf("claimed %q before any fetch succeeded", v)
+ }
+ return nil, errors.New("offline")
+ case 4:
+ cancel()
+ }
+ return io.NopCloser(bytes.NewReader(body)), nil
+ }
+ refresh := func() {
+ versions = append(versions, cli.Version())
+ // Swapped once it verified: found at the next check.
+ if err := os.WriteFile(ClaudePath(dir), append(slices.Clone(body), 1), 0700); err != nil {
+ t.Error(err)
+ }
+ }
+ done := make(chan struct{})
+ go func() {
+ KeepClaude(ctx, cli, fetch, refresh, func(msg string, _ ...any) { warned = append(warned, msg) })
+ close(done)
+ }()
+ select {
+ case <-done:
+ case <-time.After(10 * time.Second):
+ t.Fatal("KeepClaude did not stop with its context")
+ }
+ if len(urls) != 4 || slices.ContainsFunc(urls, func(u string) bool { return u != ClaudeURL() }) {
+ t.Fatalf("asked %v", urls)
+ }
+ if len(warned) != 2 || !slices.Equal(versions, []string{provider.ClaudeVersion}) {
+ t.Fatalf("warned %v versions %v", warned, versions)
+ }
+ if cli.Version() != provider.ClaudeVersion {
+ t.Fatal("the swapped CLI was not fetched again")
+ }
+}
+
+// Env-gated, run on docs-t1 with task 1's download (never executed: it
+// is a darwin binary): the official 2.1.312 darwin-arm64 build matches
+// the compiled pin and provisions as the Mac would.
+func TestClaudeDarwinBinaryMatchesPin(t *testing.T) {
+ path := os.Getenv("EQUIPO_CLAUDE_DARWIN_BINARY")
+ if path == "" {
+ t.Skip("EQUIPO_CLAUDE_DARWIN_BINARY not set")
+ }
+ f, err := os.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+ h := sha256.New()
+ if _, err := io.Copy(h, f); err != nil {
+ t.Fatal(err)
+ }
+ if got := hex.EncodeToString(h.Sum(nil)); got != claude.ExecutableSHA256DarwinArm64 {
+ t.Fatalf("%s is %s, the pin is %s", path, got, claude.ExecutableSHA256DarwinArm64)
+ }
+ home, dir := install(t)
+ cli := NewClaudeCLI(home, dir)
+ var urls []string
+ fetch := func(_ context.Context, url string) (io.ReadCloser, error) {
+ urls = append(urls, url)
+ return os.Open(path)
+ }
+ if err := cli.Provision(context.Background(), fetch); err != nil || !slices.Equal(urls, []string{ClaudeURL()}) {
+ t.Fatalf("provision: %v %v", err, urls)
+ }
+ if cli.Version() != "2.1.312" {
+ t.Fatal("the provisioned binary does not verify")
+ }
+}
diff --git a/internal/runner/mac/claude_testbuild.go b/internal/runner/mac/claude_testbuild.go
new file mode 100644
index 00000000..f0f585f9
--- /dev/null
+++ b/internal/runner/mac/claude_testbuild.go
@@ -0,0 +1,23 @@
+//go:build testbuild
+
+package mac
+
+import (
+ "context"
+ "io"
+ "os"
+ "path/filepath"
+)
+
+// In a test build only, ClaudeStandInEnv may name a local file that
+// stands in for the official download (no test reaches the network).
+// What it serves is still checked against the pin.
+const claudeStandInBuild = true
+
+func claudeStandIn(getenv func(string) string) ClaudeFetch {
+ path := getenv(ClaudeStandInEnv)
+ if !filepath.IsAbs(path) {
+ return nil
+ }
+ return func(context.Context, string) (io.ReadCloser, error) { return os.Open(path) }
+}
diff --git a/internal/runner/provider/claude/pins.go b/internal/runner/provider/claude/pins.go
index a2db6154..cf9e368b 100644
--- a/internal/runner/provider/claude/pins.go
+++ b/internal/runner/provider/claude/pins.go
@@ -8,10 +8,10 @@ package claude
// machine.
const ExecutableSHA256Arm64 = "dc4af28917455e009d26704b82a438353a06149e825b6cdf782908b2d28661f5"
-// ReleasePin returns the digest of the official 2.1.312 binary built for
-// goarch: the certified pin on amd64, the arm64 build's on arm64. A test
-// hands it runtime.GOARCH to check the binary on the machine it runs on.
-// ok is false where there is no pinned build.
+// ReleasePin returns the digest of the official 2.1.312 Linux binary
+// built for goarch: the certified pin on amd64, the arm64 build's on
+// arm64. A test hands it runtime.GOARCH to check the binary on the
+// machine it runs on. ok is false where there is no pinned build.
func ReleasePin(goarch string) (pin string, ok bool) {
switch goarch {
case "amd64":
@@ -21,3 +21,27 @@ func ReleasePin(goarch string) (pin string, ok bool) {
}
return "", false
}
+
+// ExecutableSHA256DarwinArm64 is the official 2.1.312 darwin-arm64
+// binary, the one Claude Code a Mac worker runs (Mac runners spec §8.2).
+// Read on docs-t1 on 2026-11-28 (slice F task 1, S1): the release
+// manifest's darwin-arm64 checksum, and the sha256 of the 275988512
+// bytes downloaded from the official URL. The manifest is not trusted at
+// runtime; this constant is.
+const ExecutableSHA256DarwinArm64 = "6b5ec691195e551b02c41df9f7d723f4ea61eaa03c2df90acefe3736f1aeb620"
+
+// ReleasePinFor returns the digest of the official 2.1.312 binary for
+// goos/goarch: the certified linux/amd64 pin, the linux/arm64 test pin,
+// and darwin/arm64's. ok is false everywhere else, darwin/amd64
+// included: a Mac worker runs only the darwin/arm64 build.
+func ReleasePinFor(goos, goarch string) (pin string, ok bool) {
+ switch goos {
+ case "linux":
+ return ReleasePin(goarch)
+ case "darwin":
+ if goarch == "arm64" {
+ return ExecutableSHA256DarwinArm64, true
+ }
+ }
+ return "", false
+}
diff --git a/internal/runner/thin/mac.go b/internal/runner/thin/mac.go
index e7fcb547..4eab1f44 100644
--- a/internal/runner/thin/mac.go
+++ b/internal/runner/thin/mac.go
@@ -13,6 +13,7 @@ import (
"os"
"os/exec"
"path/filepath"
+ "runtime"
"slices"
"strconv"
"strings"
@@ -431,6 +432,8 @@ type macHost struct {
capsLogged atomic.Bool
// turns lets one gate at a time run (mac.Turns).
turns *mac.Turns
+ // fetchClaude fetches the pinned Claude Code (mac.OfficialClaude).
+ fetchClaude mac.ClaudeFetch
// warmMu guards warmed, the Xcode (version and build) whose plugin
// cache was last warmed.
warmMu sync.Mutex
@@ -473,6 +476,10 @@ func (h *macHost) warm(ctx context.Context, x wire.Xcode) {
h.warmed = key
}
+// claudeHere: only a darwin/arm64 worker provisions the pinned Claude
+// Code (the only darwin pin). Tests on Linux never fetch it.
+var claudeHere = runtime.GOOS == "darwin" && runtime.GOARCH == "arm64"
+
// slowCommand is how long a command the Mac worker runs may take before
// it is logged as slow: while it still runs, so a hung child shows.
var slowCommand = 10 * time.Second
@@ -483,7 +490,8 @@ var slowCommand = 10 * time.Second
var commandWaitDelay = 5 * time.Second
// Mac tool discovery (spec §3.3): EQUIPO_SRT_PATH and the installer's
-// private srt first, then the usual places.
+// private srt first, then the usual places. Claude Code is not
+// discovered: no EQUIPO_CLAUDE_PATH, no claude on a path (spec §8.2).
func macTools(installDir, home string, getenv func(string) string) mac.Tools {
dirs := []string{filepath.Join(installDir, "srt", "node_modules", ".bin"), filepath.Join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin"}
pinned := mac.PinnedTools(installDir)
@@ -503,7 +511,9 @@ func macTools(installDir, home string, getenv func(string) string) mac.Tools {
return ""
}
return mac.Tools{Xcodebuild: "/usr/bin/xcodebuild", Xcrun: "/usr/bin/xcrun", Swift: "/usr/bin/swift", Git: getenv("EQUIPO_GIT_PATH"),
- SRT: find("EQUIPO_SRT_PATH", "srt"), Node: find("EQUIPO_NODE_PATH", "node"), RG: find("EQUIPO_RG_PATH", "rg"), Claude: find("EQUIPO_CLAUDE_PATH", "claude"), Codex: find("EQUIPO_CODEX_PATH", "codex")}
+ SRT: find("EQUIPO_SRT_PATH", "srt"), Node: find("EQUIPO_NODE_PATH", "node"), RG: find("EQUIPO_RG_PATH", "rg"), Codex: find("EQUIPO_CODEX_PATH", "codex"),
+ // Never looked up: the pinned CLI the worker provisions itself.
+ Claude: mac.NewClaudeCLI(home, installDir)}
}
func executable(p string) bool {
@@ -643,6 +653,7 @@ func newMacHost(c runner.Config, o Options) (h *macHost, err error) {
others, err := mac.OtherHomes(macUsers, home)
h.paths = mac.Paths{Home: home, StateDir: c.StateDir, AccountsRoot: accounts, SessionRoot: SessionRoot(c), InstallDir: filepath.Dir(c.Executable), OtherHomes: others, HomesUnknown: err != nil}
h.tools = macTools(h.paths.InstallDir, home, getenv)
+ h.fetchClaude = mac.OfficialClaude(getenv)
h.env = []string{"HOME=" + home, "PATH=" + gatePath(h.tools), "CI=1", "LANG=en_US.UTF-8"}
// One turn for every gate and the warm, across this user's runner
// processes (the worker and the probe command).
@@ -837,6 +848,9 @@ func serveMac(ctx context.Context, c runner.Config, o Options, h *macHost) error
h.taint.changed = refresh
h.probes.start(ctx, refresh)
go h.probes.watch(ctx)
+ if claudeHere {
+ go mac.KeepClaude(ctx, h.tools.Claude, h.fetchClaude, refresh, h.warn)
+ }
},
welcomed: func(w wire.Welcome, worker *Worker, stop context.CancelCauseFunc) {
if w.Tainted {
diff --git a/internal/runner/thin/mac_claude_test.go b/internal/runner/thin/mac_claude_test.go
new file mode 100644
index 00000000..91c11519
--- /dev/null
+++ b/internal/runner/thin/mac_claude_test.go
@@ -0,0 +1,42 @@
+package thin
+
+import (
+ "os"
+ "path/filepath"
+ "reflect"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/runner/mac"
+)
+
+// Discovery on a Mac finds no claude: not EQUIPO_CLAUDE_PATH, not one on
+// the usual paths. The only Claude Code a Mac worker knows is the pinned
+// one under its install dir, which it verifies and never looks up.
+func TestMacToolsNeverFindAClaude(t *testing.T) {
+ root := t.TempDir()
+ home, install := filepath.Join(root, "home"), filepath.Join(root, "home", ".local", "lib", "equipo-runner")
+ planted := []string{filepath.Join(root, "env", "claude"), filepath.Join(home, ".local", "bin", "claude")}
+ for _, p := range planted {
+ if err := os.MkdirAll(filepath.Dir(p), 0700); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(p, []byte("#!/bin/sh\necho 2.1.312\n"), 0700); err != nil {
+ t.Fatal(err)
+ }
+ }
+ env := map[string]string{"EQUIPO_CLAUDE_PATH": planted[0]}
+ tools := macTools(install, home, func(k string) string { return env[k] })
+ v := reflect.ValueOf(tools)
+ for i := range v.NumField() {
+ if f := v.Field(i); f.Kind() == reflect.String {
+ for _, p := range planted {
+ if f.String() == p {
+ t.Fatalf("Tools.%s is the unpinned %s", v.Type().Field(i).Name, p)
+ }
+ }
+ }
+ }
+ if tools.Claude != mac.NewClaudeCLI(home, install) || tools.Claude.Version() != "" {
+ t.Fatalf("Tools.Claude %+v", tools.Claude)
+ }
+}
diff --git a/internal/runner/thin/startup_logs_test.go b/internal/runner/thin/startup_logs_test.go
index 16264388..4761ed84 100644
--- a/internal/runner/thin/startup_logs_test.go
+++ b/internal/runner/thin/startup_logs_test.go
@@ -147,7 +147,6 @@ func TestWorkerStartupLogs(t *testing.T) {
`level=INFO msg="capabilities gathering"`,
`level=INFO msg=command cmd=/usr/bin/xcodebuild args=-version took=`,
`level=INFO msg=command cmd=` + env["EQUIPO_NODE_PATH"] + ` args=--version took=`,
- `level=INFO msg=command cmd=` + env["EQUIPO_CLAUDE_PATH"] + ` args=--version took=`,
`level=INFO msg="capabilities gathered" took=`,
`level=INFO msg="hello sent" protocol=`,
`level=INFO msg=welcome protocol=2 role=worker generation=1`,
@@ -165,6 +164,10 @@ func TestWorkerStartupLogs(t *testing.T) {
}
at++
}
+ // The claude planted at EQUIPO_CLAUDE_PATH is never run (spec §8.2).
+ if strings.Contains(out, env["EQUIPO_CLAUDE_PATH"]) {
+ t.Fatalf("an unpinned claude ran:\n%s", out)
+ }
// The dial failure: the error and the wait before the next try.
if !strings.Contains(out, "503") || !strings.Contains(out, "retry_in=") {
t.Fatalf("the dial failure says neither why nor when:\n%s", out)