Merge origin/main into push/server
Keep carried-message and push models and both controller report inventories. Place push migrations 0096 and 0097 after main's 0095 migration, update the backfill test, and set conflicted budgets to measured source/test counts. Migration checks, push/chat/wire/personapi tests, TestPersonAPI, and the requested local gates pass.
Co-Authored-By: Codex GPT-6-Astra <noreply@openai.com>
59 files changed,
+2,803
−128
.rastrillo/budgets.txt+7 −7docs/superpowers/plans/2026-11-20-equipo-native-slice-2.md+153 −0docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+49 −1internal/equipo/chat/handoff.go+9 −3internal/equipo/chat/models.go+11 −1internal/equipo/chat/store.go+115 −4internal/equipo/chat/tools.go+7 −0internal/equipo/chat_page.go+5 −0internal/equipo/chat_roster.go+1 −1internal/equipo/copy.go+14 −2internal/equipo/migrations/0095_turn_carried.sql+4 −0internal/equipo/migrations/{0095_push.sql => 0096_push.sql}+0 −0internal/equipo/migrations/{0096_push_hold.sql => 0097_push_hold.sql}+0 −0internal/equipo/migrations/schema.sql+2 −0internal/equipo/migrations_test.go+3 −3internal/equipo/static/chat-compose.js+21 −0internal/equipo/static/chat-stream.js+56 −9internal/equipo/static/equipo.css+49 −1internal/equipo/static/work-stream.js+12 −0internal/equipo/templates/chat.html+8 −1internal/equipo/templates/work_parts.html+1 −1internal/equipo/track_working_test.go+84 −0internal/equipo/work_views.go+15 −3internal/fakeclaude/fake.go+4 −0internal/fakecodex/fake.go+4 −0internal/headless/ask_test.go+27 −3internal/headless/engineering_test.go+32 −5internal/headless/env_test.go+5 −2internal/headless/review_test.go+21 −5internal/plan3test/plan3_release_test.go+1 −1internal/runner/provider/accounts.go+9 −4internal/runner/provider/token_test.go+18 −0internal/runner/thin/bridge.go+20 −5internal/runner/thin/claude.go+3 −0internal/runner/thin/copy_reason_test.go+39 −0internal/runner/thin/forge.go+164 −17internal/runner/thin/start_default_test.go+384 −0internal/runner/thin/state.go+3 −1internal/thintest/batching_contract_test.go+27 −6internal/thintest/carried_contract_test.go+138 −0internal/thintest/empty_state_browser_test.go+108 −0internal/thintest/empty_state_pages_test.go+50 −0internal/thintest/instance_contract_test.go+123 −0internal/thintest/thinking_browser_test.go+107 −3internal/thintest/track_pulse_browser_test.go+143 −0native/apple/Sources/EquipoKit/Presentation/Roster.swift+81 −0native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings+176 −0native/apple/Sources/EquipoKit/UI/LiveCards.swift+91 −18native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift+1 −1native/apple/Sources/EquipoKit/UI/Screens/TaskScreens.swift+1 −1native/apple/Sources/EquipoMac/LiveTranscript.swift+55 −3native/apple/Tests/EquipoKitTests/MergeCardTests.swift+95 −0native/scripts/check-native.sh+1 −0native/scripts/check-parity.py+32 −0native/scripts/check-strings.py+1 −1native/scripts/strings.json+17 −1scripts/runner-reference-allowlist.json+30 −2scripts/staging-thin-test.py+117 −0scripts/staging-thin.py+49 −12
CI passed — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/push__server: Type Size Avail | ext4 96G 85G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 85G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.5s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.4s
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.5s
ci-box: opencode: installed and verified in 1.9s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 2.7s
ci-box: file times set from content: 2764 files, 176 directories
ci-box: ready in 16.0s
=== 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.250s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
5.4s
+ go list -export -test -tags testbuild -f ./...
5.2s
+ go list -export -test -tags browser,testbuild -f ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
3.1s
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-11 02:51:11 +0000 UTC
go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless
receipt: test step 1m30.428s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m28.655s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m28.65s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 69.11, cpu waiting 42.91%, memory waiting 0.00%, io waiting 0.37%
--- 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 1m34.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 1m32.138s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m32.14s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 67.50, cpu waiting 42.39%, memory waiting 0.00%, io waiting 0.35%
--- 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 1m36.135s 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.286s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m21.96s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 6.29s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 5.04s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 67.50, cpu waiting 42.39%, memory waiting 0.00%, io waiting 0.35%
--- 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 1m32.406s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m29.517s amadan.net/oficina/equipo/internal/headless
receipt: slow test 46.51s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 22.47s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.77s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.76s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 69.11, cpu waiting 42.91%, memory waiting 0.00%, io waiting 0.37%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 1m48.091s 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 1m45.909s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m8.41s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 12.21s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 10.43s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.94s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.91s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 61.27, cpu waiting 36.01%, memory waiting 0.00%, io waiting 0.28%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 3m21.124s 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 3m18.271s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m56.76s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 23.9s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.39s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 8.09s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.29s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 14.61, cpu waiting 7.60%, memory waiting 0.00%, io waiting 0.05%
--- 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 2m3.741s 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 2m1.23s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 7.82s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.78s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.55s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.63s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.47s amadan.net/oficina/equipo/internal/thintest TestResearchDoneFallsBack
machine: 32 CPUs, load 46.95, cpu waiting 27.79%, memory waiting 0.00%, io waiting 0.21%
--- 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 1m24.619s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m22.511s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.12s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.07s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.37s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.37s amadan.net/oficina/equipo/internal/thintest TestContractPublishNameTaken
receipt: slow test 2.36s amadan.net/oficina/equipo/internal/thintest TestContractPreview
machine: 32 CPUs, load 69.46, cpu waiting 43.28%, memory waiting 0.00%, io waiting 0.41%
--- 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 4m38.606s, over the 45s its record on line 44 allows; reported only, timing fails on CI
receipt: test step 4m44.026s 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 4m38.606s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37.1s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.94s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.75s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.45s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.95s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 4.29, cpu waiting 1.87%, memory waiting 0.00%, io waiting 0.00%
--- 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 50.204s 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 49.126s amadan.net/oficina/equipo/internal/runner
receipt: slow test 29.1s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 57.05, cpu waiting 32.69%, 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 1m2.457s 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 1m0.938s amadan.net/oficina/equipo/internal/runner
receipt: slow test 50.93s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 44.56s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.4s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.59s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 63.17, cpu waiting 39.90%, memory waiting 0.00%, io waiting 0.62%
--- 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 35.771s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 34.781s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.14s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.49s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.11s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.66s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 30.05, cpu waiting 22.40%, memory waiting 0.00%, io waiting 0.93%
--- 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 35.9%, load 20.04
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
receipt: test step 1m6.868s 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 1m4.684s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 27.04s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 27.01s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 25.05s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.29s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.09s amadan.net/oficina/equipo/internal/equipotest TestBudgetLoweringBelowUsage
machine: 32 CPUs, load 67.50, cpu waiting 41.62%, memory waiting 0.00%, io waiting 0.34%
--- 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 35.9%, load 20.04
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 1m15.476s 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 1m13.71s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 19.08s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 19.03s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
receipt: slow test 19.03s amadan.net/oficina/equipo/internal/equipotest TestProjectRetryAndRevision
receipt: slow test 19s amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
receipt: slow test 19s amadan.net/oficina/equipo/internal/equipotest TestProjectKindsAndDefaultBranch
machine: 32 CPUs, load 61.27, cpu waiting 37.20%, memory waiting 0.00%, io waiting 0.29%
--- 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 38.3%, load 20.04
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 1m13.54s 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.609s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 15.27s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 13.33s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 10.28s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 10.19s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 7.17s amadan.net/oficina/equipo/internal/equipotest TestRosterAuditFailureRollsBack
machine: 32 CPUs, load 61.27, cpu waiting 37.20%, 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 35.9%, load 20.04
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 1m7.535s 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 1m5.723s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 23.96s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 23.87s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.77s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 22.14s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsConcurrentRevision
receipt: slow test 22s amadan.net/oficina/equipo/internal/equipotest TestSigninCSRF
machine: 32 CPUs, load 67.50, cpu waiting 41.62%, memory waiting 0.00%, io waiting 0.34%
--- 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 35.9%, load 20.04
test lane plan3test: ./internal/plan3test
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/plan3test
receipt: test step 53.2s 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.214s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.64s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.47s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.58s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.44s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.24s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorDefinitiveRefusalReleasesQueue
machine: 32 CPUs, load 70.03, cpu waiting 43.42%, memory waiting 0.00%, io waiting 0.43%
--- 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 35.9%, load 20.04
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/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/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/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/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/wire/wireschema: 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/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/testci: its inputs changed
budget note: internal/equipo took 29.382s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 16.468s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/setup took 11.56s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 46.89s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 37.016s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/containment took 1m4.303s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 26.621s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/pi took 1m25.47s, over the 1m0s its record on line 27 allows; reported only, timing fails on CI
budget note: internal/runner/workspace took 13.613s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 1m59.387s against a 60s target (the gate's other steps are not in this figure)
receipt: 37 packages ran, 24 cached, 18 without tests, 0 failed
receipt: slow package 1m25.47s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1m14.488s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 1m4.303s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 1m0.17s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 46.89s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 30.56s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 26.4s amadan.net/oficina/equipo/cmd/equipo-runner TestReleaseRunnerHasNoFakeWorker
receipt: slow test 25.06s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 17.39s amadan.net/oficina/equipo/internal/runner/provider/pi TestPiGoBinaryIsolation
receipt: slow test 15.28s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeP1OnlyOpenCodeReachable
machine: 32 CPUs, load 32.34, cpu waiting 18.05%, memory waiting 0.00%, io waiting 0.13%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserChat
=== RUN TestBrowserChat
time=2026-11-20T13:29:22.447Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:29:22.447Z level=INFO msg="startup phase done" phase=state_lock took=81µs
time=2026-11-20T13:29:22.447Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:29:22.447Z level=INFO msg="startup phase done" phase=claim_roots took=106µs
time=2026-11-20T13:29:22.447Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:29:22.515Z level=INFO msg="startup phase done" phase=sweep took=67.725ms
time=2026-11-20T13:29:22.515Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:29:22.515Z level=INFO msg="startup phase done" phase=credentials took=132µs
time=2026-11-20T13:29:22.515Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:29:22.558Z level=INFO msg="startup phase done" phase=open_state took=42.558ms
time=2026-11-20T13:29:22.558Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:29:22.559Z level=INFO msg=connecting host=127.0.0.1:42763 protocol=28
time=2026-11-20T13:29:22.561Z level=INFO msg=connected host=127.0.0.1:42763 took=1.937ms
time=2026-11-20T13:29:22.561Z level=INFO msg="capabilities gathering"
time=2026-11-20T13:29:22.562Z level=INFO msg="capabilities gathered" took=482µs tags=linux,claude,go
time=2026-11-20T13:29:22.567Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:29:22.574Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T13:29:24.948Z level=INFO msg="connection checked" connection=claude-1 state=healthy
browser_test.go:46: waiting for [...document.querySelectorAll('[equipo-message="incoming"] [equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes('fake coordinator')): context deadline exceeded (last evaluation: <nil>)
--- FAIL: TestBrowserChat (6.28s)
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
=== RUN TestBrowserChatSendStaysOnPage
time=2026-11-20T13:29:28.751Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:29:28.751Z level=INFO msg="startup phase done" phase=state_lock took=252µs
time=2026-11-20T13:29:28.751Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:29:28.752Z level=INFO msg="startup phase done" phase=claim_roots took=267µs
time=2026-11-20T13:29:28.753Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:29:28.793Z level=INFO msg="startup phase done" phase=sweep took=40.319ms
time=2026-11-20T13:29:28.793Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:29:28.793Z level=INFO msg="startup phase done" phase=credentials took=236µs
time=2026-11-20T13:29:28.793Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:29:28.841Z level=INFO msg="startup phase done" phase=open_state took=47.512ms
time=2026-11-20T13:29:28.842Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:29:28.843Z level=INFO msg=connecting host=127.0.0.1:42373 protocol=28
time=2026-11-20T13:29:28.844Z level=INFO msg=connected host=127.0.0.1:42373 took=962µs
time=2026-11-20T13:29:28.844Z level=INFO msg="capabilities gathering"
rastrillo: budget test: go test failed
time=2026-11-20T13:29:28.845Z level=INFO msg="capabilities gathered" took=621µs tags=linux,claude,go
time=2026-11-20T13:29:28.850Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:29:28.853Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T13:29:31.302Z level=INFO msg="connection checked" connection=claude-1 state=healthy
browser_test.go:108: waiting for [...document.querySelectorAll('[equipo-message="incoming"] [equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes('fake coordinator')): context deadline exceeded (last evaluation: <nil>)
--- FAIL: TestBrowserChatSendStaysOnPage (6.27s)
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
=== RUN TestBrowserDraftIsTheMessage
time=2026-11-20T13:29:35.011Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:29:35.011Z level=INFO msg="startup phase done" phase=state_lock took=273µs
time=2026-11-20T13:29:35.011Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:29:35.011Z level=INFO msg="startup phase done" phase=claim_roots took=108µs
time=2026-11-20T13:29:35.011Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:29:35.081Z level=INFO msg="startup phase done" phase=sweep took=70.351ms
time=2026-11-20T13:29:35.082Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:29:35.082Z level=INFO msg="startup phase done" phase=credentials took=207µs
time=2026-11-20T13:29:35.082Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:29:35.175Z level=INFO msg="startup phase done" phase=open_state took=92.403ms
time=2026-11-20T13:29:35.175Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:29:35.177Z level=INFO msg=connecting host=127.0.0.1:33183 protocol=28
time=2026-11-20T13:29:35.181Z level=INFO msg=connected host=127.0.0.1:33183 took=3.797ms
time=2026-11-20T13:29:35.181Z level=INFO msg="capabilities gathering"
time=2026-11-20T13:29:35.183Z level=INFO msg="capabilities gathered" took=1.541ms tags=linux,claude,go
time=2026-11-20T13:29:35.189Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:29:35.201Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T13:29:37.626Z level=INFO msg="connection checked" connection=claude-1 state=healthy
browser_thinking_test.go:106: waiting for !!window.__m: context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserDraftIsTheMessage (8.39s)
--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 49.468s
FAIL amadan.net/oficina/equipo/internal/headless 49.814s
receipt: test step 51.23s 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 49.468s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.44s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 8.39s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 7.91s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.28s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 6.27s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' -v -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserDraftIsTheMessage$' -count=1 ./internal/headless (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserChat browser-headless-chat a986e1035e80965c5903bbfd3de5c8cb1a229528 6.28s 57.05
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
##############################################################################
FLAKE ./internal/headless:TestBrowserChatSendStaysOnPage browser-headless-chat a986e1035e80965c5903bbfd3de5c8cb1a229528 6.27s 57.05
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
##############################################################################
FLAKE ./internal/headless:TestBrowserDraftIsTheMessage browser-headless-chat a986e1035e80965c5903bbfd3de5c8cb1a229528 8.39s 57.05
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 56.76, cpu waiting 33.76%, memory waiting 0.00%, io waiting 0.26%
--- 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
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
=== RUN TestBrowserRailFollowsWork
time=2026-11-20T13:29:18.875Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:29:18.876Z level=INFO msg="startup phase done" phase=state_lock took=767µs
time=2026-11-20T13:29:18.876Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:29:18.877Z level=INFO msg="startup phase done" phase=claim_roots took=305µs
time=2026-11-20T13:29:18.877Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:29:18.906Z level=INFO msg="startup phase done" phase=sweep took=29.735ms
time=2026-11-20T13:29:18.906Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:29:18.907Z level=INFO msg="startup phase done" phase=credentials took=113µs
time=2026-11-20T13:29:18.907Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:29:18.946Z level=INFO msg="startup phase done" phase=open_state took=39.764ms
time=2026-11-20T13:29:18.947Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:29:18.948Z level=INFO msg=connecting host=127.0.0.1:42817 protocol=28
time=2026-11-20T13:29:18.949Z level=INFO msg=connected host=127.0.0.1:42817 took=880µs
time=2026-11-20T13:29:18.949Z level=INFO msg="capabilities gathering"
time=2026-11-20T13:29:18.950Z level=INFO msg="capabilities gathered" took=411µs tags=linux,claude,go
time=2026-11-20T13:29:18.950Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:29:18.958Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T13:29:20.245Z level=INFO msg="connection checked" connection=claude-1 state=healthy
time=2026-11-20T13:29:29.571Z level=INFO msg="kept sessions" kept=1 bytes=2770 expired=0
time=2026-11-20T13:29:34.255Z level=INFO msg="kept sessions" kept=2 bytes=4922 expired=0
time=2026-11-20T13:29:34.990Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:29:34.990Z level=INFO msg="startup phase done" phase=state_lock took=236µs
time=2026-11-20T13:29:34.990Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:29:34.990Z level=INFO msg="startup phase done" phase=claim_roots took=184µs
time=2026-11-20T13:29:34.990Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:29:35.034Z level=INFO msg="startup phase done" phase=sweep took=43.33ms
time=2026-11-20T13:29:35.034Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:29:35.034Z level=INFO msg="startup phase done" phase=credentials took=201µs
time=2026-11-20T13:29:35.034Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:29:35.100Z level=INFO msg="startup phase done" phase=open_state took=65.379ms
time=2026-11-20T13:29:35.100Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:29:35.101Z level=INFO msg=connecting host=127.0.0.1:35365 protocol=28
time=2026-11-20T13:29:35.102Z level=INFO msg=connected host=127.0.0.1:35365 took=927µs
time=2026-11-20T13:29:35.102Z level=INFO msg="capabilities gathering"
time=2026-11-20T13:29:35.104Z level=INFO msg="capabilities gathered" took=1.986ms tags=linux,claude,go
time=2026-11-20T13:29:35.105Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:29:35.110Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T13:29:37.519Z level=INFO msg="connection checked" connection=claude-1 state=healthy
browser_review_test.go:57: waiting for document.querySelector('#rail [data-specialist="engineering"]')?.dataset.state==='working' && document.querySelector('#rail [data-specialist="engineering"]').querySelector('[equipo-nav-task]')?.textContent==='Slow sidebar change' && document.querySelector('#nav-tasks [data-count]')?.textContent==='1': context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserRailFollowsWork (22.52s)
--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m38.449s
FAIL amadan.net/oficina/equipo/internal/headless 98.811s
rastrillo: budget test: go test failed
receipt: test step 1m40.368s 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 1m38.449s amadan.net/oficina/equipo/internal/headless
receipt: slow test 28s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 22.52s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 14.79s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 11.89s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
receipt: slow test 11.09s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' -v -run '^TestBrowserRailFollowsWork$' -count=1 ./internal/headless (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserRailFollowsWork browser-headless-work a986e1035e80965c5903bbfd3de5c8cb1a229528 22.52s 63.29
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 46.95, cpu waiting 27.79%, memory waiting 0.00%, io waiting 0.21%
--- 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 1m49.742s 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 1m47.821s amadan.net/oficina/equipo/internal/headless
receipt: slow test 18.32s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 14.43s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 13.13s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 11.31s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.43s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 56.76, cpu waiting 33.76%, 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|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN TestBrowserCopyContinue
time=2026-11-20T13:29:33.972Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:29:33.972Z level=INFO msg="startup phase done" phase=state_lock took=55µs
time=2026-11-20T13:29:33.972Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:29:33.972Z level=INFO msg="startup phase done" phase=claim_roots took=82µs
time=2026-11-20T13:29:33.972Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:29:34.016Z level=INFO msg="startup phase done" phase=sweep took=43.883ms
time=2026-11-20T13:29:34.016Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:29:34.017Z level=INFO msg="startup phase done" phase=credentials took=146µs
time=2026-11-20T13:29:34.017Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:29:34.060Z level=INFO msg="startup phase done" phase=open_state took=43.069ms
time=2026-11-20T13:29:34.060Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:29:34.061Z level=INFO msg=connecting host=127.0.0.1:33825 protocol=28
time=2026-11-20T13:29:34.062Z level=INFO msg=connected host=127.0.0.1:33825 took=923µs
time=2026-11-20T13:29:34.062Z level=INFO msg="capabilities gathering"
time=2026-11-20T13:29:34.065Z level=INFO msg="capabilities gathered" took=2.486ms tags=linux,claude,go
time=2026-11-20T13:29:34.071Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:29:34.084Z level=INFO msg=welcome protocol=28 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.39s)
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN TestBrowserEmptyExplore
time=2026-11-20T13:30:14.711Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T13:30:14.711Z level=INFO msg="startup phase done" phase=state_lock took=166µs
time=2026-11-20T13:30:14.711Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T13:30:14.711Z level=INFO msg="startup phase done" phase=claim_roots took=98µs
time=2026-11-20T13:30:14.711Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T13:30:14.738Z level=INFO msg="startup phase done" phase=sweep took=26.984ms
time=2026-11-20T13:30:14.738Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T13:30:14.738Z level=INFO msg="startup phase done" phase=credentials took=204µs
time=2026-11-20T13:30:14.738Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T13:30:14.781Z level=INFO msg="startup phase done" phase=open_state took=42.116ms
time=2026-11-20T13:30:14.781Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T13:30:14.782Z level=INFO msg=connecting host=127.0.0.1:40253 protocol=28
time=2026-11-20T13:30:14.783Z level=INFO msg=connected host=127.0.0.1:40253 took=918µs
time=2026-11-20T13:30:14.783Z level=INFO msg="capabilities gathering"
time=2026-11-20T13:30:14.784Z level=INFO msg="capabilities gathered" took=487µs tags=linux,claude,go
time=2026-11-20T13:30:14.785Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T13:30:14.788Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T13:30:15.899Z level=INFO msg="connection checked" connection=claude-1 state=healthy
browser_receipts_test.go:169: waiting for [...document.querySelectorAll('[equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes("I'm your coordinator")): context deadline exceeded (last evaluation: <nil>)
--- FAIL: TestBrowserEmptyExplore (5.84s)
--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m39.728s
FAIL amadan.net/oficina/equipo/internal/headless 100.018s
receipt: test step 1m41.252s 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 1m39.728s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.17s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 12.95s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 11.85s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 10.86s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 8.09s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
rastrillo: budget test: go test failed
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$|^TestBrowserEmptyExplore$' -count=1 ./internal/headless (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest a986e1035e80965c5903bbfd3de5c8cb1a229528 6.39s 63.29
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
##############################################################################
FLAKE ./internal/headless:TestBrowserEmptyExplore browser-headless-rest a986e1035e80965c5903bbfd3de5c8cb1a229528 5.84s 63.29
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 52.94, cpu waiting 32.68%, memory waiting 0.00%, io waiting 0.25%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation)$' ./internal/equipo
receipt: test step 2.278s 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 629ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 630ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor)$' ./internal/idtest
receipt: test step 2.773s 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 1.59s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 1.59s 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 3.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 1.813s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 1.81s 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|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre)$' ./internal/thintest
receipt: test step 3m22.983s 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 3m21.45s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 17.44s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.36s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 11.96s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.54s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 8.08s amadan.net/oficina/equipo/internal/thintest TestBrowserInnerScreens
machine: 32 CPUs, load 12.44, cpu waiting 6.22%, memory waiting 0.00%, io waiting 0.04%
--- 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 (58s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.23s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.42s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 10.50s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 11.20s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 27.50s
+ 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 (77s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 17.57s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 19.34s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 21.58s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 16.40s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless (24s)
ok ./internal/headless TestMixedVersions 21.75s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.84s
+ 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 71.07, cpu waiting 43.63%, memory waiting 0.00%, io waiting 0.47%
--- 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.559s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 3 without tests, 0 failed
receipt: slow package 7.748s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 226ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 87ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 5ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 5.56s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.71s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 360ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 220ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 90ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment
receipt: test step 4.054s 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.96s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 280ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 200ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceExitStatus
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
machine: 32 CPUs, load 9.23, cpu waiting 10.83%, memory waiting 0.00%, io waiting 1.30%
--- 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 35.9%, load 20.04
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2478 text files, 2846 matches, 0 failures
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 88 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok amadan.net/oficina/equipo/internal/equipo 2.636s
machine: 32 CPUs, load 71.07, cpu waiting 43.63%, memory waiting 0.00%, io waiting 0.47%
--- 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 35.9%, load 20.04
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 61.45, cpu waiting 38.08%, memory waiting 0.00%, io waiting 0.66%
--- 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 38.3%, load 20.04
shard 27: make govulncheck
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
=== Symbol Results ===
No vulnerabilities found.
Your code is affected by 0 vulnerabilities.
This scan also found 0 vulnerabilities in packages you import and 5
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 42.06, cpu waiting 24.15%, memory waiting 0.00%, io waiting 0.90%
--- 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 35.9%, load 20.04
shard 28: make gitleaks
[90m1:29PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net
[90m1:29PM[0m [32mINF[0m [1m1054 commits scanned.[0m
[90m1:29PM[0m [32mINF[0m [1mscanned ~60353213 bytes (60.35 MB) in 24.1s[0m
[90m1:29PM[0m [32mINF[0m [1mno leaks found[0m
machine: 32 CPUs, load 61.45, cpu waiting 35.54%, memory waiting 0.00%, io waiting 0.71%
=== perf ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -require TestPerfScreens,TestPerfBoot -tags perf -count=1 -p 1 -parallel 1 -run '^TestPerf' ./...
perf: GET /: median 1.036ms, worst 1.107ms, budget 150ms
perf: GET /api/runner/protocol: median 86µs, worst 91µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 606µs, worst 621µs, budget 150ms
perf: GET /api/v1/accounts: median 422µs, worst 459µs, budget 150ms
perf: GET /api/v1/auth/devices: median 439µs, worst 481µs, budget 150ms
perf: GET /api/v1/budgets: median 478µs, worst 511µs, budget 150ms
perf: GET /api/v1/capabilities: median 246µs, worst 298µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.274ms, worst 2.897ms, budget 150ms
perf: GET /api/v1/connections: median 572µs, worst 668µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 545µs, worst 553µs, budget 150ms
perf: GET /api/v1/conversation: median 900µs, worst 925µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.444ms, worst 1.535ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.63ms, worst 1.713ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 443µs, worst 473µs, budget 150ms
perf: GET /api/v1/journey: median 7.07ms, worst 7.303ms, budget 150ms
perf: GET /api/v1/me: median 407µs, worst 424µs, budget 150ms
perf: GET /api/v1/me/settings: median 498µs, worst 550µs, budget 150ms
perf: GET /api/v1/needs-you: median 7.099ms, worst 7.508ms, budget 150ms
perf: GET /api/v1/notifications: median 1.609ms, worst 1.656ms, budget 150ms
perf: GET /api/v1/onboarding: median 386µs, worst 415µs, budget 150ms
perf: GET /api/v1/people: median 435µs, worst 454µs, budget 150ms
perf: GET /api/v1/playbooks: median 567µs, worst 596µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 518µs, worst 569µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 822µs, worst 885µs, budget 150ms
perf: GET /api/v1/preferences: median 725µs, worst 757µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 453µs, worst 502µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 557µs, worst 595µs, budget 150ms
perf: GET /api/v1/roster: median 453µs, worst 469µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 418µs, worst 447µs, budget 150ms
perf: GET /api/v1/specialists: median 7.887ms, worst 8.009ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.751ms, worst 7.872ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 811µs, worst 847µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.084ms, worst 1.138ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 709µs, worst 745µs, budget 150ms
perf: GET /api/v1/teams: median 415µs, worst 447µs, budget 150ms
perf: GET /api/v1/templates: median 597µs, worst 629µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 438µs, worst 464µs, budget 150ms
perf: GET /auth/callback: median 73µs, worst 104µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.201ms, worst 3.258ms, budget 150ms
perf: GET /auth/verify: median 75µs, worst 108µs, budget 150ms
perf: GET /connections: median 3.626ms, worst 3.763ms, budget 150ms
perf: GET /conversation: median 7.428ms, worst 7.859ms, budget 150ms
perf: GET /conversation/connections: median 242µs, worst 285µs, budget 150ms
perf: GET /conversation/notebook: median 242µs, worst 261µs, budget 150ms
perf: GET /conversation/settings: median 3.873ms, worst 3.948ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.458ms, worst 3.518ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.103ms, worst 6.308ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.277ms, worst 6.295ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.491ms, worst 3.537ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 4.061ms, worst 4.137ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.506ms, worst 6.549ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.364ms, worst 4.488ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.272ms, worst 3.323ms, budget 150ms
perf: GET /conversation/settings/thinking: median 3.772ms, worst 3.937ms, budget 150ms
perf: GET /housekeeping: median 3.567ms, worst 3.671ms, budget 150ms
perf: GET /invites/new: median 577µs, worst 612µs, budget 150ms
perf: GET /invites/{id}: median 582µs, worst 627µs, budget 150ms
perf: GET /jobs: median 3.111ms, worst 3.225ms, budget 150ms
perf: GET /jobs/{id}: median 4.267ms, worst 4.408ms, budget 150ms
perf: GET /journey: median 11.114ms, worst 11.381ms, budget 150ms
perf: GET /nav/rail: median 2.964ms, worst 3.04ms, budget 150ms
perf: GET /needs-you: median 11.329ms, worst 14.265ms, budget 150ms
perf: GET /onboarding: median 4.044ms, worst 4.233ms, budget 150ms
perf: GET /people: median 3.45ms, worst 3.499ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.857ms, worst 4.975ms, budget 150ms
perf: GET /playbooks: median 4.19ms, worst 4.268ms, budget 150ms
perf: GET /playbooks/new: median 4.337ms, worst 4.469ms, budget 150ms
perf: GET /playbooks/{id}: median 5.442ms, worst 5.468ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 5.368ms, worst 5.511ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 4.206ms, worst 4.451ms, budget 150ms
perf: GET /preferences: median 4.149ms, worst 4.411ms, budget 150ms
perf: GET /preferences/sources/{source}: median 4.47ms, worst 7.693ms, budget 150ms
perf: GET /projects: median 5.547ms, worst 5.89ms, budget 150ms
perf: GET /projects/accounts: median 3.779ms, worst 3.856ms, budget 150ms
perf: GET /projects/new: median 3.721ms, worst 3.773ms, budget 150ms
perf: GET /projects/{id}: median 10.517ms, worst 10.822ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.584ms, worst 3.66ms, budget 150ms
perf: GET /runners/enrol: median 4.486ms, worst 4.765ms, budget 150ms
perf: GET /settings: median 3.563ms, worst 3.71ms, budget 150ms
perf: GET /settings/coordinator: median 5.658ms, worst 5.797ms, budget 150ms
perf: GET /settings/devices: median 3.336ms, worst 5.662ms, budget 150ms
perf: GET /settings/recovery: median 3.553ms, worst 3.824ms, budget 150ms
perf: GET /settings/recovery/release: median 3.418ms, worst 3.522ms, budget 150ms
perf: GET /settings/thinking: median 248µs, worst 278µs, budget 150ms
perf: GET /signin: median 317µs, worst 350µs, budget 150ms
perf: GET /specialists/new: median 3.275ms, worst 3.419ms, budget 150ms
perf: GET /specialists/{key}: median 10.815ms, worst 11.092ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.67ms, worst 3.859ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 3.788ms, worst 3.823ms, budget 150ms
perf: GET /tasks: median 5.293ms, worst 5.4ms, budget 150ms
perf: GET /tasks/new: median 3.194ms, worst 3.304ms, budget 150ms
perf: GET /tasks/{id}: median 5.511ms, worst 5.682ms, budget 150ms
perf: GET /tasks/{id}/merge: median 4.957ms, worst 7.438ms, budget 150ms
perf: GET /tasks/{id}/move: median 4.562ms, worst 4.74ms, budget 150ms
perf: GET /tasks/{id}/plan: median 5.688ms, worst 5.812ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.477ms, worst 1.595ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 5.128ms, worst 5.352ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 5.071ms, worst 5.222ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.551ms, worst 4.683ms, budget 150ms
perf: GET /tasks/{id}/thread: median 8.296ms, worst 8.42ms, budget 150ms
perf: GET /team/{specialist}: median 4.492ms, worst 4.745ms, budget 150ms
perf: GET /teams: median 10.64ms, worst 12.992ms, budget 150ms
perf: GET /templates: median 3.423ms, worst 3.502ms, budget 150ms
perf: GET /usage: median 4.184ms, worst 4.349ms, budget 150ms
perf: GET /work: median 3.048ms, worst 3.167ms, budget 150ms
perf: cold boot: median 261ms of [260.399802ms 261.423255ms 263.534864ms], budget 500ms
receipt: test step 48.687s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 84 without tests, 0 failed
receipt: slow package 8.889s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-runner
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-tool-proxy
receipt: slow package 0s amadan.net/oficina/equipo/internal/advice
receipt: slow package 0s amadan.net/oficina/equipo/internal/attach
receipt: slow test 8.05s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 840ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 4.62 GiB in 26551 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 0.84 GiB in 27329 files
ci-box: build cache over 4.0 GiB: dropped 2.20 GiB this job did not read, kept 2.42 GiB
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index bbc100b6..1df51253 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -14,8 +14,8 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr |
| time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI. |
| time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage. |
| -size internal/equipo 21464 - Native slice 2: push registrations, the push outbox and its rules, set aside, and the review fixes (one token a credential, sealed at rest, CARLOS outcomes); measured 21464/3301 source/test lines. |
| -size internal/wire 6768 - Native slice 2: push registrations, the push outbox and its rules, set aside; measured 6768/2972 source/test lines. |
| +size internal/equipo 21493 - Merge main conversation starters and work status with native push configuration; measured 21493/3385 source/test lines. |
| +size internal/wire 6768 - Native slice 2 push registrations and set aside, with main integrated; measured 6768/2972 source/test lines. |
| size internal/equipotest - 12013 Task 21 repairs historical migration and conversation fixtures after Plan 3; measured 0/12013 source/test lines. |
| time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); |
| time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). |
| @@ -26,7 +26,7 @@ time internal/runner/provider/claude 45s Task 5 measured 32.430s for fake CLI se |
| time internal/runner/provider/codex 35s Plan 3 CI repair measured 24.464s for the full package (controller CI 27.908s). |
| time internal/runner/provider/pi 60s The real pinned Pi in bubblewrap against a fake TensorX: probes P1 to P5 (a hundred RPC turns), the hostile repository, and the pinned tree checked whole (about 160 MB); measured 22s locally. |
| time internal/runner/provider/opencode 90s The real pinned OpenCode in bubblewrap against a fake Go: probes, the hostile repository per source, termination, resume; the 260 MB binary hashed per launch. Measured 40s. |
| -size internal/runner/provider 5598 - Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; measured 5598/4345 source/test lines. |
| +size internal/runner/provider 5603 - Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; measured 5603/4363 source/test lines (containment reasons logged). |
| time internal/plan3test 300s Initial cap for combined browser and runner acceptance; measure at both usable stops. |
| @@ -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 27849 21023 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; measured 27849/21023 source/test lines. |
| +size internal/runner/thin 28016 21446 Fable follow-up gates and guards, then main started at repo creation; measured 28016/21446 source/test lines (containment reasons logged). |
| 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). |
| @@ -56,7 +56,7 @@ perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for device |
| perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen. |
| -size internal/equipo/chat 31887 - Native slice 2 review: preserve replaced activity memory and hurry its pending end on a late token; adds 6 source lines, measured 31887/6905 source/test lines. |
| +size internal/equipo/chat 32021 - Merge main carried messages with native push and activity review fixes; measured 32021/6905 source/test lines. |
| perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}. |
| perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}. |
| perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections. |
| @@ -70,8 +70,8 @@ perf GET /api/v1/tasks/{id}/files/{file} skip Research kept images: bearer-only |
| perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one image, shown on the task page; a file, not a screen. |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally). |
| -size internal/headless - 11249 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; measured 0/11249 source/test lines (live first-stage check). |
| -size internal/thintest - 31933 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; measured 1515/31933 source/test lines. |
| +size internal/headless - 11319 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; live staging witnesses; measured 0/11319 source/test lines (live first-stage check). |
| +size internal/thintest - 32620 Fable follow-up: base and diagnostic gates, preview isolation and provenance guards; empty conversation page and browser checks; measured 1515/32338 source/test lines. |
| perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}. |
| perf GET /api/v1/usage skip Thin v1 person API: bearer-only JSON for devices; the browser reads usage through /usage. |
diff --git a/docs/superpowers/plans/2026-11-20-equipo-native-slice-2.md b/docs/superpowers/plans/2026-11-20-equipo-native-slice-2.md| new file mode 100644 |
| index 00000000..2b1cd5c8 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-20-equipo-native-slice-2.md |
| @@ -0,0 +1,153 @@ |
| +# Equipo native, slice 2 (plan for Paul, 2026-11-20) |
| + |
| +Slice 1 landed on 2026-11-19: pairing, the conversation in the Roster look, |
| +question cards, Needs you, Tasks and the task view (plan |
| +`2026-11-18-equipo-native-slice-1.md`). TestFlight has 0.1.0 (2); the Mac has |
| +0.1.0 (1) on Sparkle. Slice 2 makes the apps something you can leave running: |
| +they tell you when something needs you, show work in progress without opening |
| +them, and let you answer the most common decision on the device. |
| + |
| +Paul asked on 2026-11-20 for push notifications and a Live Activity, after |
| +merges on the device. Decisions this plan needs are at the end, each with a |
| +recommendation. |
| + |
| +## What a person can do |
| + |
| +1. **Answer a merge on the device.** The merge card shows the server's |
| + question, the preview link when there is one, and its choices (Merge, Wait |
| + for a Mac), Merge primary, exactly as the web does. "Does main ship?" cards |
| + (`merge_ships`) too. Other decisions still open the web. |
| +2. **Be told when something needs you.** A notification when a decision or a |
| + question waits on you, when the coordinator replies while the app is not in |
| + front, and when a task you started finishes or stops. The app badge is your |
| + Needs you count. Tapping a notification opens the card or task. |
| +3. **Watch a task without opening the app.** A Live Activity for each task you |
| + started, from the moment work starts until it ends: the title, the five-stop |
| + stage track, who is working on it and the latest activity line. When it |
| + needs you it turns amber and alerts; tapping opens the decision. On the Mac, |
| + macOS 26 shows the iPhone's Live Activities in the menu bar. |
| +4. **Set a card aside** (if it fits; D5). The web's Set aside and Undo: never |
| + answers, cancels or starts anything; the card stays in Needs you, grouped |
| + under Set aside. |
| + |
| +## What waits |
| + |
| +- The other decision cards (What next, Publish, Add a specialist, Grant |
| + access, Research), Copy hold and Wrong project? still open the web. |
| +- Replies inside an answered card, and the day roll-up (no server support yet). |
| +- Answering from the notification itself (D4). |
| + |
| +## Shape of the work |
| + |
| +### Server (Equipo) |
| + |
| +- **Device push registrations.** `POST /api/v1/push-registrations` with the |
| + device's APNs token, its environment (development or production) and, on |
| + iPhone, its Live Activity push-to-start token. Bound to the paired device |
| + credential, replaced on re-registration, deleted when the device is revoked, |
| + the person is removed, or Apple answers `Unregistered`. Tokens are never |
| + logged. Documented in the OpenAPI file and covered by the device contract |
| + test like every other device route. |
| +- **A push outbox.** The engine already appends an event for every change |
| + (`t.event`). Inside the same transaction, a small rule table decides whether |
| + the change is a push, and writes a `push_outbox` row: |
| + - a card that waits on the person opens (merge, question, other decisions): |
| + an alert, `apns-collapse-id` the card, priority 10; |
| + - the coordinator's reply finishes while the person has no open stream: an |
| + alert; |
| + - a task the person started reaches done, cancelled or failed: a passive |
| + alert; |
| + - every Needs you change: the badge count; |
| + - a task the person started is dispatched: a Live Activity start; its stage, |
| + step or needs-you change: an update (priority 10 for needs you, 5 for the |
| + rest); its end: an end with the outcome. |
| + Activity lines (the "Reading README.md" line) update the Live Activity at |
| + most once a minute, so the activity stays inside Apple's update budget. |
| +- **A sender** drains the outbox through a transport, retries with backoff, |
| + and records Apple's answer. Transports mirror mail's: the CARLOS platform |
| + transport in production (D1), a logged transport only on loopback or |
| + staging, as `EQUIPO_ALLOW_LOGGED_MAIL` is for mail. |
| +- **Notification text** is server-rendered from `copy.go`, in the |
| + recipient's locale where Equipo has one, through copy review. The body of a |
| + coordinator reply is the reply's first line (D2). |
| +- **Set aside** (D5): the store already has `SetCardAside` and the |
| + `chat_card_visibility` table; the engine gains `POST /cards/{id}/visibility` |
| + and the card's per-person `aside` field, and Needs you keeps set-aside cards. |
| + |
| +### Platform (CARLOS), if D1 is the platform |
| + |
| +A `POST /v1/push` verb on the per-instance control socket, as mail submission |
| +added `POST /v1/mail`: the instance submits a device token, topic, push type, |
| +priority, collapse ID and payload; a box-local sender with its own uid holds |
| +the Team Tito APNs auth key and talks HTTP/2 to Apple. Policy before sending: |
| +the topic must be one of the app's bundle IDs, a per-instance rate cap, a pause |
| +switch. The instance holds no Apple credential. rastrillo gains a `push` |
| +transport like `mail`'s `submit`. |
| + |
| +### iPhone and Mac |
| + |
| +- **Notifications** (both): ask permission after pairing, not at first launch; |
| + register the token; handle a tap by opening the card or task; categories for |
| + "Needs you" with "Open" only (D4). The Mac needs the `aps-environment` |
| + entitlement, which means a Developer ID provisioning profile for |
| + `works.oficina.equipo`, as the other Oficina Mac apps already have. |
| +- **Live Activity** (iPhone): a widget extension, `works.oficina.equipo.activity`, |
| + with the Lock Screen and Dynamic Island layouts drawn from Roster (the stage |
| + track, the specialist's tile, amber for needs you). The app sends its |
| + push-to-start token at registration so the server can start an activity |
| + without the app running. At most three at once, the three most recently |
| + started tasks (D3); Apple caps them anyway. |
| +- **Merge card**: native buttons on `POST /cards/{id}/answer`, bound to the |
| + revision seen, the slice 1 rules for stale and lost answers unchanged. |
| + Parity row R-02 is `must_match`: the same question text, choices, primary and |
| + outcome line as the web; a test renders both from the same server fixture. |
| + |
| +## Decisions for Paul |
| + |
| +**Ruled 2026-11-20:** Paul approved the plan with every recommendation below ("Go ahead"), and copy review by Luna ("Luna can probably do copy review"): Luna's verdicts are the review for slice 2's strings. |
| + |
| +| | Decision | Recommendation | |
| +| --- | --- | --- | |
| +| D1 | Who holds the Apple push key | **CARLOS platform push**, like mail submission: instances hold no sending credential (your 2026-11-12 ruling for mail). It needs a CARLOS piece first. The alternative, the key as a secret on each Equipo instance, is faster but puts the same key on every team's box. | |
| +| D2 | What a notification shows on the Lock Screen | The card's question and the reply's first line, as Messages does; iOS already hides previews while locked unless you change that. The alternative is a fixed "Your coordinator replied" with no content. | |
| +| D3 | Live Activities | One per task you started, at most three; nothing for the coordinator's own turns (they last seconds and the app's thinking line covers them). | |
| +| D4 | Answering from a notification | Not in slice 2: a notification opens the card, and you answer in the app. A merge from a notification button is a tap, but the person API says a notification action is never authentication, and the card's context (Checks, Review, preview) should be in front of you. Revisit after living with it. | |
| +| D5 | Set aside in slice 2 | Yes, if the push work lands first; it is small on the server (the store already has it). | |
| + |
| +## Steps for Paul |
| + |
| +- The Apple push key (an APNs auth key for Team Tito, in the developer portal). |
| + I can make it in the browser while you are signed in; it goes to the |
| + CARLOS box (D1) and never into a repository. |
| +- Approving the Push Notifications capability on `works.oficina.equipo`, |
| + the new `works.oficina.equipo.activity` ID and the profiles they need; I can |
| + do these through the App Store Connect API. |
| +- Copy review of the notification and Live Activity strings, in the copy |
| + review app. |
| + |
| +## Gates |
| + |
| +- Server: failing tests first for the rules (which change pushes what, to |
| + whom, never to someone removed or revoked), the outbox written in the same |
| + transaction as the event, idempotent sends (collapse IDs, no duplicate after |
| + a retry), token deletion on `Unregistered`, the logged transport refused on a |
| + public origin; the device contract test covering the new routes; payload |
| + goldens for every push kind. Mutations of each guard. |
| +- Native: EquipoKit tests for registration, the tap routing and the Live |
| + Activity content state from server fixtures; the merge card parity test; the |
| + existing native gate. |
| +- End to end: a local drive with the logged transport, then a real device |
| + through TestFlight against staging: a merge card arrives as a notification, |
| + the Live Activity starts, moves through its stages and ends, and a merge |
| + answered on the phone lands. |
| +- One Fable review per branch; Paul lands each. |
| + |
| +## Order |
| + |
| +1. CARLOS push submission (if D1), in parallel with 2. |
| +2. Equipo: registrations, outbox, rules, logged transport, copy. |
| +3. Native: the merge card (no push needed; can ship first). |
| +4. Native: notifications on iPhone and Mac. |
| +5. Native: the Live Activity extension. |
| +6. Set aside (D5). |
| +7. TestFlight and Mac releases; live check on staging. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index c45bab0c..6d9a935e 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -5696,7 +5696,7 @@ records remain unchanged. |
| | `plan.unselected` | Choose later | 9 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `plan.action.scope` | Define scope | 9 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `conversation.title` | Conversation | 9 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| -| `conversation.empty` | Say what you want done. Your coordinator picks the project and tells you, and you can change it. | Thin v1 slice 2 chat empty state (no confirmation step) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `conversation.empty` | What needs doing? | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| | `conversation.composer` | Message your coordinator | 9 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `conversation.send` | Send message | 9 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `conversation.queued` | Message queued | 9 | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| @@ -6762,6 +6762,14 @@ records remain unchanged. |
| | `push.activity.started` | Work has started. | alert with a task's Live Activity starting (title: the task) (native slice 2 push, 2026-11-20; Luna, codex gpt-5.6-luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-20) | |
| | `docs/api/equipo-v1.md / Talk to your Coordinator from a device: set aside` | Set a card aside with `POST /api/v1/cards/{id}/visibility`, sending `{"aside":true,"revision":2}`, or `false` to bring it back. It never answers, cancels or starts anything, and the card stays in Needs you. It returns `200` with the card. Its `aside` is `true` while you have set it aside. An outdated revision or a card that no longer waits on you returns `409 card_stale` with the current card. | API doc: Set aside for a device (native slice 2, 2026-11-20; Luna, codex gpt-5.6-luna, house rules) | Document section; COPY ACCEPTED BY DELEGATION (Luna, 2026-11-20) | |
| | `docs/api/equipo-v1.md / Receive pushes on a device` | ## Receive pushes on a device<br><br>Register the device with `POST /api/v1/push-registrations` and the device's bearer token:<br><br>```json<br>{"token":"<APNs token, hex>","environment":"production","platform":"ios","start_token":"<Live Activity push-to-start token, hex>"}<br>```<br><br>`environment` is `production` or `development`. `platform` is `ios` or `macos`. Only `ios` sends `start_token`. The registration belongs to the device credential that sends it. A new registration replaces the previous one. A token belongs to one device credential at a time. Registering it removes it from any other device credential and anything waiting for that credential. It returns `200` with `environment`, `platform`, `live_activities` and `updated_at`, never a token. The registration is deleted when the device is revoked, when its person leaves the team, or when Apple says the token is no longer valid (`Unregistered`, `ExpiredToken`, `BadDeviceToken` or `DeviceTokenNotForTopic`).<br><br>The server decides on pushes in the same transaction as the change, so a change that does not happen pushes nothing:<br><br>- an alert when a card waits on you, with the card's question. `apns-collapse-id` is the card's ID and `equipo` is `{"kind":"card","card_id":"<card ID>","task_id":"<task ID or empty>"}`;<br>- an alert when the coordinator replies while you have no `/events` stream open, with the reply's first line and `{"kind":"reply","turn_id":"<turn ID>"}`;<br>- a passive alert when a task you started ends, or when one of its steps stops and waits for Retry, with `{"kind":"task","task_id":"<task ID>"}`;<br>- the badge showing your Needs you count when the device registers and whenever that count changes.<br><br>Alerts that wait on you have the category `needs_you`. Each task you started gets a Live Activity, at most three at once for you: those of the three most recently started tasks. It starts by push-to-start when work starts, with `attributes-type` `EquipoTaskAttributes` and attributes `{"task_id":"<task ID>"}`. Its content state has `task_id`, `title`, `stage`, `specialist`, `activity`, `needs_you`, `tone` (`positive`, `warning` or `negative`) and, at the end, `outcome` (`done`, `cancelled`, or `replaced` when a newer task took its place). It updates when the stage, step or `needs_you` changes, and at most once a minute for a new activity line. When the task starts needing you, the update is urgent but has no alert: the decision card's alert is the only sound. Send each running activity's own token with `POST /api/v1/push-registrations/activities`, `{"task_id":"tk...","token":"<hex>"}`, which returns `204`. When the token is received, the activity gets the task's full current state. After the task ends, the token is accepted only while the activity's end notification is waiting to be sent. The server then sends the end notification immediately. After that, it returns `409 task_ended`. The server forgets the token when the activity ends. | API doc: push registrations, what pushes and the Live Activity content state (native slice 2, 2026-11-20, revised after review 2026-11-20; Luna, codex gpt-5.6-luna, house rules) | Document section; COPY ACCEPTED BY DELEGATION (Luna, 2026-11-20) | |
| +| `conversation.start.label` | Ways to start | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `conversation.start.bug` | Fix a bug | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `conversation.start.bug_draft` | Fix a bug where | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `conversation.start.feature` | Plan a feature | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `conversation.start.feature_draft` | Plan a feature that | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `conversation.start.project` | Ask about a project | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `conversation.start.project_draft` | What’s the latest on | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| +| `work.track.working` | (work underway) | Copy specialist | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) | |
| ## Task 21 |
| @@ -7906,3 +7914,43 @@ Hosted CI on `19c886bb` found that the scoped inventory allowance exceeded |
| the package’s test-line budget by six lines. The allowance now shares the |
| existing delegation predicate, with the same four keys and date. The budget |
| limit is unchanged. `make budget` and the inventory checks pass locally. |
| + |
| +## Delegated copy pass: empty conversation (Astra, 2026-11-20) |
| + |
| +Paul, 2026-11-20, on the empty conversation’s one line (“Say what you want |
| +done. Your coordinator picks the project and tells you, and you can change |
| +it.”): stern; “it probably doesn’t need to be conversational. It can be maybe |
| +an illustration or something that just entices you to type a first message.” |
| +The empty state is now a small drawing, the heading `conversation.empty` and |
| +three starters that fill the composer and never send (branch |
| +empty-state-welcome). The composer placeholder stays “Message”. |
| + |
| +Paul delegated copy review on 2026-10-25. One Astra pass (gpt-6-astra, |
| +effort high, read-only) reviewed the eight strings: `conversation.empty` |
| +(“What needs doing?”), `conversation.start.label` (“Ways to start”, the |
| +starters’ group name for screen readers) and the three starters with their |
| +drafts (`conversation.start.bug`/`_draft` “Fix a bug” / “Fix a bug where ”, |
| +`.feature`/`_draft` “Plan a feature” / “Plan a feature that ”, |
| +`.project`/`_draft` “Ask about a project” / “What’s the latest on ”). It kept |
| +all eight. Its two flags were accessibility checks: the drawing and the |
| +icons are hidden from screen readers (the button text is each name), and |
| +Enter and Space both fill the composer without sending |
| +(`TestBrowserEmptyConversation`). Rows above, COPY ACCEPTED BY DELEGATION |
| +(Astra, 2026-11-20); copy.go matches. |
| + |
| +Verification (Go commands used `CGO_ENABLED=0` and the default Go caches): |
| + |
| +| Command | Result | |
| +|---|---| |
| +| `go test -tags browser ./internal/thintest -run '^TestBrowserEmptyConversation$'` | Failed before the change (no drawing, no starters); passes after, at 1280 and 390, light and dark | |
| +| The same, with `event.preventDefault()` removed from the starter script | Fails: the page navigates | |
| +| The same, with a starter always replacing the composer | Fails: “typed words kept” | |
| +| `go test ./internal/thintest -run '^TestPagesEmptyConversationStarters$'` | Passes; fails with the scriptless `?start=` draft switched off | |
| +| `go test ./internal/plan3test -run '^TestPlan3ReleaseBoundaries$'` | Passes; fails with one row’s acceptance date changed, and with a draft changed in copy.go only | |
| +| `go test -tags browser ./internal/thintest -run '^TestBrowserInstant.*$'` | Passes (the first message still clears the empty state) | |
| +| `make copy-release-check`, `python3 scripts/plan3-copy-check.py`, `make fmt-check`, `make budget`, `python3 scripts/ci-test.py check` | Exit 0 | |
| + |
| +`make budget` needed two records raised: internal/equipo by 16 source |
| +lines (the copy and the scriptless draft) and internal/thintest by 158 test |
| +lines (the two new tests). The inventory allowance shares the existing |
| +delegation predicate, so internal/plan3test’s limit is unchanged. |
diff --git a/internal/equipo/chat/handoff.go b/internal/equipo/chat/handoff.go| index f5b4799c..92b147c2 100644 |
| --- a/internal/equipo/chat/handoff.go |
| +++ b/internal/equipo/chat/handoff.go |
| @@ -328,8 +328,9 @@ func (t *txn) liveCall(call toolCallRecord) (turnRecord, error) { |
| } |
| // quote is words as the person wrote them in one of the turn's |
| -// messages: found there compared lower-cased with each run of |
| -// whitespace as one space, at least minQuote characters. Only a turn |
| +// messages, or one it carried from a turn that failed before the model |
| +// saw it (carriedRecord): found there compared lower-cased with each run |
| +// of whitespace as one space, at least minQuote characters. Only a turn |
| // the person started has their words (a team_update turn has none). |
| func (t *txn) quote(r turnRecord, words string) (string, error) { |
| refuse := assist.Failure{Code: "not_their_words"} |
| @@ -342,7 +343,12 @@ func (t *txn) quote(r turnRecord, words string) (string, error) { |
| if err := t.db.Model(&messageRecord{}).Where("turn_id = ? AND person = ? AND role = ?", r.ID, r.Person, wire.RolePerson).Order("seq").Pluck("text", &texts).Error; err != nil { |
| return "", err |
| } |
| - for _, text := range texts { |
| + // Exactly the messages dispatch carried: the person's own, in the lane. |
| + var carried []string |
| + if err := t.db.Model(&messageRecord{}).Where("person = ? AND role = ? AND origin = ? AND coalesce(lane, '') = ? AND id IN (SELECT message_id FROM chat_turn_carried WHERE turn_id = ? AND person = ?)", r.Person, wire.RolePerson, originComposer, r.Lane, r.ID, r.Person).Order("seq").Pluck("text", &carried).Error; err != nil { |
| + return "", err |
| + } |
| + for _, text := range append(texts, carried...) { |
| if found, ok := quoteIn(text, w); ok { |
| return found, nil |
| } |
diff --git a/internal/equipo/chat/models.go b/internal/equipo/chat/models.go| index 37deed9c..ae54e7cd 100644 |
| --- a/internal/equipo/chat/models.go |
| +++ b/internal/equipo/chat/models.go |
| @@ -11,7 +11,7 @@ import ( |
| ) |
| // Models are the tables this package owns, for the migration check. |
| -var Models = append([]any{&cardVisibility{}, &cardThreadRecord{}, ©AttemptRecord{}, ©ReviewRecord{}, ©FeedbackRecord{}, &turnRecord{}, &messageRecord{}, &eventRecord{}, &commandRecord{}, &inboxRecord{}, &runnerSessionRecord{}, &projectRecord{}, &cardRecord{}, &toolCallRecord{}, &settingRecord{}, &coordinatorRecord{}, ¬ebookRecord{}, &taskRecord{}, &stepRecord{}, &entryRecord{}, &attachmentRecord{}, &starRecord{}, &questionRecord{}, &connectionRecord{}, &usageRecord{}, &distinctRecord{}, &hkRecord{}, &hkFailureRecord{}, &hkSettingsRecord{}, &fileRecord{}, &fileDataRecord{}, &transferRecord{}, &mergePolicyRecord{}, &mergeAuditRecord{}, &specialistRecord{}, &grantRecord{}, &specialistAuditRecord{}, &researchSourceRecord{}, &researchAddressRecord{}, &researchPrefixRecord{}, &researchInventoryRecord{}, &researchRecord{}, &researchFetchRecord{}, &taskFileRecord{}, &taskFileDataRecord{}, &releaseRecord{}, &adviceRecord{}, &assistantHostRecord{}, &handoffRecord{}, &handoffTurnRecord{}, &handoffTaskRecord{}, &handoffActionRecord{}, &connectTurnRecord{}}, push.Models...) |
| +var Models = append([]any{&cardVisibility{}, &cardThreadRecord{}, ©AttemptRecord{}, ©ReviewRecord{}, ©FeedbackRecord{}, &turnRecord{}, &messageRecord{}, &eventRecord{}, &commandRecord{}, &inboxRecord{}, &runnerSessionRecord{}, &projectRecord{}, &cardRecord{}, &toolCallRecord{}, &settingRecord{}, &coordinatorRecord{}, ¬ebookRecord{}, &taskRecord{}, &stepRecord{}, &entryRecord{}, &attachmentRecord{}, &starRecord{}, &questionRecord{}, &connectionRecord{}, &usageRecord{}, &distinctRecord{}, &hkRecord{}, &hkFailureRecord{}, &hkSettingsRecord{}, &fileRecord{}, &fileDataRecord{}, &transferRecord{}, &mergePolicyRecord{}, &mergeAuditRecord{}, &specialistRecord{}, &grantRecord{}, &specialistAuditRecord{}, &researchSourceRecord{}, &researchAddressRecord{}, &researchPrefixRecord{}, &researchInventoryRecord{}, &researchRecord{}, &researchFetchRecord{}, &taskFileRecord{}, &taskFileDataRecord{}, &releaseRecord{}, &adviceRecord{}, &assistantHostRecord{}, &handoffRecord{}, &handoffTurnRecord{}, &handoffTaskRecord{}, &handoffActionRecord{}, &connectTurnRecord{}, &carriedRecord{}}, push.Models...) |
| type turnRecord struct { |
| CreateRepo string |
| @@ -44,6 +44,16 @@ type turnRecord struct { |
| func (turnRecord) TableName() string { return "chat_turns" } |
| +// carriedRecord is one person's message a turn carried, unanswered, from |
| +// a turn that failed before it (dispatch, unanswered). |
| +type carriedRecord struct { |
| + TurnID string `gorm:"primaryKey"` |
| + MessageID string `gorm:"primaryKey"` |
| + Person string |
| +} |
| + |
| +func (carriedRecord) TableName() string { return "chat_turn_carried" } |
| + |
| // messageRecord's integer key is the SQLite rowid, so the person index |
| // orders by it. Coordinator replies use the key "reply:<turn>". A key is |
| // unique per person and lane. |
diff --git a/internal/equipo/chat/store.go b/internal/equipo/chat/store.go| index 7077527d..542092d5 100644 |
| --- a/internal/equipo/chat/store.go |
| +++ b/internal/equipo/chat/store.go |
| @@ -7,7 +7,9 @@ import ( |
| "encoding/hex" |
| "encoding/json" |
| "errors" |
| + "fmt" |
| "log/slog" |
| + "slices" |
| "strconv" |
| "strings" |
| "sync" |
| @@ -337,9 +339,25 @@ func (t *txn) dispatch(r *turnRecord) error { |
| if err := t.db.Where("person = ? AND coalesce(lane, '') = ? AND turn_id <> ? AND turn_id NOT IN (SELECT id FROM chat_turns WHERE person = ? AND dispatched = ? AND state = ?)", r.Person, r.Lane, r.ID, r.Person, false, wire.TurnQueued).Order("seq DESC").Limit(wire.MaxTailMessages).Find(&prior).Error; err != nil { |
| return err |
| } |
| + // The person's words in turns that failed before the model ran never |
| + // reached the coordinator: they ride in this turn's frame, marked |
| + // unanswered, and not in the tail as if answered. |
| + var carried []messageRecord |
| + if r.Kind == wire.TurnPerson { |
| + var err error |
| + if carried, err = t.unanswered(r); err != nil { |
| + return err |
| + } |
| + } |
| + inFrame := map[string]bool{} |
| + for _, m := range carried { |
| + inFrame[m.ID] = true |
| + } |
| tail := make([]wire.TailMessage, 0, len(prior)) |
| for i := len(prior) - 1; i >= 0; i-- { |
| - tail = append(tail, wire.TailMessage{Role: prior[i].Role, Text: prior[i].Text}) |
| + if !inFrame[prior[i].ID] { |
| + tail = append(tail, wire.TailMessage{Role: prior[i].Role, Text: prior[i].Text}) |
| + } |
| } |
| texts := make([]string, 0, len(mine)) |
| own := make([]string, 0, len(mine)) |
| @@ -385,18 +403,111 @@ func (t *txn) dispatch(r *turnRecord) error { |
| text += "\n\n" + block |
| } |
| } |
| - cmd := wire.MessageCommand{Person: r.Person, TurnID: r.ID, Attempt: r.Attempt, Kind: r.Kind, Text: text, PersonText: own, Tail: tail, Attachments: files, Lane: r.Lane} |
| + cmd := wire.MessageCommand{Person: r.Person, TurnID: r.ID, Attempt: r.Attempt, Kind: r.Kind, Attachments: files, Lane: r.Lane} |
| if wire.CoordinatorRole(r.Lane) { |
| if cmd.PlacementNotes, err = t.placementNotes(r.Person); err != nil { |
| return err |
| } |
| } |
| - if cmd.Tail, err = fitTail(cmd); err != nil { |
| - return err |
| + // The tail gives way first, then the oldest unanswered message: a |
| + // runner refuses a frame too big, every time it is resent. |
| + for { |
| + words := make([]string, 0, len(carried)+len(own)) |
| + for _, m := range carried { |
| + words = append(words, m.Text) |
| + } |
| + cmd.Text, cmd.PersonText, cmd.Tail = withUnanswered(carried, text), append(words, own...), tail |
| + if cmd.Tail, err = fitTail(cmd); err != nil { |
| + return err |
| + } |
| + raw, err := json.Marshal(cmd) |
| + if err != nil { |
| + return err |
| + } |
| + if len(raw) <= frameRoom || len(carried) == 0 { |
| + break |
| + } |
| + carried = carried[1:] |
| + } |
| + // In this turn the carried words are the person's too (quote). |
| + for _, m := range carried { |
| + if err := t.db.Create(&carriedRecord{TurnID: r.ID, MessageID: m.ID, Person: r.Person}).Error; err != nil { |
| + return err |
| + } |
| } |
| return t.command(r.Person, wire.FrameMessage, cmd) |
| } |
| +// A turn carries the person's words from at most maxCarriedTurns failed |
| +// turns, and at most maxUnanswered messages: words that rode in two turns |
| +// that failed too may be what makes them fail, so they stop riding. |
| +const ( |
| + maxCarriedTurns = 2 |
| + maxUnanswered = 10 |
| +) |
| + |
| +// reachedModel is SQL true when the chat_turns row reached the model: a |
| +// delta or an activity was recorded for it, or a tool call, or usage. |
| +// Events are kept a day (wire.EventRetention), longer than a session |
| +// resumes (the same UTC day); tool calls and usage are kept. |
| +const reachedModel = "(EXISTS (SELECT 1 FROM chat_tool_calls c WHERE c.turn_id = chat_turns.id) OR EXISTS (SELECT 1 FROM chat_usage u WHERE u.turn_id = chat_turns.id) OR EXISTS (SELECT 1 FROM chat_events e WHERE e.person = chat_turns.person AND e.type IN ('" + wire.EventDelta + "', '" + wire.EventActivity + "') AND e.body LIKE '%\"turn_id\":\"' || chat_turns.id || '\"%'))" |
| + |
| +// unanswered is the person's plain messages (composer words, not a card's |
| +// answer or reply, which reach the model with their card) in the lane's |
| +// failed person turns since the last that reached the model (answered, |
| +// or ended after it began), the newest maxCarriedTurns of them, oldest |
| +// first. So each failed before the model ran: its words are in no |
| +// transcript, and the tail showed them as if answered. A turn that |
| +// reached the model bounds them, its own words and those it carried: a |
| +// resumed session's transcript may hold them. A cancelled turn's are not |
| +// carried: the person stopped it. |
| +func (t *txn) unanswered(r *turnRecord) ([]messageRecord, error) { |
| + turns := "SELECT id FROM chat_turns WHERE person = ? AND coalesce(lane, '') = ? AND coalesce(kind, '') = '' AND " |
| + var last int64 |
| + if err := t.db.Model(&messageRecord{}).Select("coalesce(max(seq), 0)").Where("person = ? AND coalesce(lane, '') = ? AND role = ? AND turn_id IN ("+turns+"(state = ? OR state IN ? AND "+reachedModel+"))", r.Person, r.Lane, wire.RolePerson, r.Person, r.Lane, wire.TurnReplied, []string{wire.TurnFailed, wire.TurnCancelled}).Scan(&last).Error; err != nil { |
| + return nil, err |
| + } |
| + var rows []messageRecord |
| + if err := t.db.Where("person = ? AND coalesce(lane, '') = ? AND role = ? AND seq > ? AND turn_id <> ? AND turn_id IN ("+turns+"state = ?)", r.Person, r.Lane, wire.RolePerson, last, r.ID, r.Person, r.Lane, wire.TurnFailed).Order("seq DESC").Limit(wire.MaxTailMessages).Find(&rows).Error; err != nil { |
| + return nil, err |
| + } |
| + var out []messageRecord |
| + seen := map[string]bool{} |
| + for _, m := range rows { |
| + if !seen[m.TurnID] && len(seen) == maxCarriedTurns { |
| + break |
| + } |
| + seen[m.TurnID] = true |
| + if m.Origin != originComposer || len(out) == maxUnanswered { |
| + continue |
| + } |
| + var cards int64 |
| + if err := t.db.Model(&cardRecord{}).Where("person = ? AND (answer_message = ? OR id IN (SELECT card_id FROM chat_card_threads WHERE message_id = ? AND person = ?))", m.Person, m.ID, m.ID, m.Person).Count(&cards).Error; err != nil { |
| + return nil, err |
| + } |
| + if cards == 0 { |
| + out = append(out, m) |
| + } |
| + } |
| + slices.Reverse(out) |
| + return out, nil |
| +} |
| + |
| +// withUnanswered is a turn's text with the unanswered messages before |
| +// it, each quoted under its label; text alone with none. |
| +func withUnanswered(carried []messageRecord, text string) string { |
| + if len(carried) == 0 { |
| + return text |
| + } |
| + var b strings.Builder |
| + b.WriteString(noteUnanswered + "\n") |
| + for _, m := range carried { |
| + b.WriteString(fmt.Sprintf(noteUnansweredMessage, m.Text) + "\n") |
| + } |
| + b.WriteString("\n" + noteNewest + text) |
| + return b.String() |
| +} |
| + |
| // frameRoom is what a message command's body may take: the frame limit |
| // less its envelope (id and type). |
| const frameRoom = wire.MaxFrameBytes - 1<<10 |
diff --git a/internal/equipo/chat/tools.go b/internal/equipo/chat/tools.go| index b9aff70d..c73a3393 100644 |
| --- a/internal/equipo/chat/tools.go |
| +++ b/internal/equipo/chat/tools.go |
| @@ -97,6 +97,13 @@ const ( |
| noteOpenQuestion = "- Job %q (request %s): %q" |
| noteMoreQuestion = "1 more job has an open question not listed here: team_status lists every open request with its question, ten at a time (pass its next as after to read on)." |
| noteMoreQuestions = "%d more jobs have open questions not listed here: team_status lists every open request with its question, ten at a time (pass its next as after to read on)." |
| + // noteUnanswered heads the person's messages whose turns failed before |
| + // the model ran, since the lane's last turn that reached it |
| + // (unanswered). Each follows quoted (noteUnansweredMessage), then the |
| + // turn's own text (noteNewest). |
| + noteUnanswered = "[Equipo: these earlier messages from the person got no answer: their turns failed before you saw them. They are the person's own words, oldest first, still waiting. Answer them together with the newest message.]" |
| + noteUnansweredMessage = "Not yet answered, the person's words: %q" |
| + noteNewest = "The person's newest message:\n" |
| // noteConnected is the note of the turn queued once the person |
| // connected the apps a connect card asked for (carryOn). |
| noteConnected = "The person has just connected their Oficina apps. Now complete their most recent request that needed them, as they asked it in the conversation. If that request is already done or no longer applies, end your turn without writing anything, or reply in one short line." |
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go| index 4d6f0d97..7f4e8630 100644 |
| --- a/internal/equipo/chat_page.go |
| +++ b/internal/equipo/chat_page.go |
| @@ -349,6 +349,11 @@ func (a *application) chatPage(w http.ResponseWriter, r *http.Request) { |
| view.Draft = fmt.Sprintf(copyText("work.ask_about.draft"), t.Title) |
| } |
| } |
| + // A starter on the empty conversation, without script: the composer |
| + // opens with its words (chat.html "starter"). |
| + if k := r.URL.Query().Get("start"); view.Draft == "" && (k == "bug" || k == "feature" || k == "project") { |
| + view.Draft = copyText("conversation.start." + k + "_draft") |
| + } |
| // Today, in the person's zone, is the conversation; each earlier day |
| // is a day box (chat_days.go), open when asked for (?day=) or when a |
| // task's "From your conversation" link names one of its messages. |
diff --git a/internal/equipo/chat_roster.go b/internal/equipo/chat_roster.go| index cdcede6a..ad4ba4f6 100644 |
| --- a/internal/equipo/chat_roster.go |
| +++ b/internal/equipo/chat_roster.go |
| @@ -196,7 +196,7 @@ func rosterTrack(t wire.Task) []trackStop { |
| out[i].State = "done" |
| } |
| if i == current { |
| - out[i].State, out[i].Tone = "current", rosterTone(t) |
| + out[i].State, out[i].Tone, out[i].Working = "current", rosterTone(t), workingNow(t) |
| } |
| } |
| return out |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index 384130d9..4c4d45a4 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -854,6 +854,7 @@ var pageCopy = map[string]string{ |
| "work.track.reviewed": "Review", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12) |
| "work.track.preview": "Preview", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12) |
| "work.track.decided": "Decided", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12) |
| + "work.track.working": "(work underway)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| "work.tl.merge_dropped": "An earlier attempt to add this change was dropped when the task became an exploration.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12) |
| "work.stopped": "Stopped: %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "work.reason.runner_restarted": "the runner restarted", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| @@ -1728,8 +1729,19 @@ var pageCopy = map[string]string{ |
| "oficina.connect.unavailable": "Oficina could not be reached. Try again in a minute.", // COPY APPROVED (Paul, 2026-11-16, copy-review arfnqquz6wks4vdyxptv6ditju, unchanged) |
| "oficina.connect.disconnected": "Your Oficina apps are disconnected. Your assistant can no longer use them.", // COPY APPROVED (Paul, 2026-11-16, copy-review arfnqquz6wks4vdyxptv6ditju, unchanged) |
| - // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): conversation.empty |
| - "conversation.empty": "Say what you want done. Your coordinator picks the project and tells you, and you can change it.", |
| + // The empty conversation (2026-11-20): a short line under the drawing, |
| + // and three starters. A starter's label is its button; its draft is the |
| + // words it puts in the composer, the cursor after them (it never sends). |
| + // The label names the starters' group for a screen reader. |
| + "conversation.empty": "What needs doing?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.label": "Ways to start", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.bug": "Fix a bug", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.bug_draft": "Fix a bug where ", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.feature": "Plan a feature", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.feature_draft": "Plan a feature that ", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.project": "Ask about a project", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + "conversation.start.project_draft": "What’s the latest on ", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20) |
| + |
| "conversation.age_minutes": "%d min", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "conversation.age_hours": "%d hr", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "conversation.age_days": "%d d", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/migrations/0095_turn_carried.sql b/internal/equipo/migrations/0095_turn_carried.sql| new file mode 100644 |
| index 00000000..334accda |
| --- /dev/null |
| +++ b/internal/equipo/migrations/0095_turn_carried.sql |
| @@ -0,0 +1,4 @@ |
| +-- The person's messages a turn carried, unanswered, from turns that |
| +-- failed before it (dispatch): in that turn they are the person's words |
| +-- too (quote). A message rides in at most two turns. |
| +CREATE TABLE chat_turn_carried (turn_id text, message_id text, person text, PRIMARY KEY (turn_id, message_id)); |
diff --git a/internal/equipo/migrations/0095_push.sql b/internal/equipo/migrations/0096_push.sql| similarity index 100% |
| rename from internal/equipo/migrations/0095_push.sql |
| rename to internal/equipo/migrations/0096_push.sql |
diff --git a/internal/equipo/migrations/0096_push_hold.sql b/internal/equipo/migrations/0097_push_hold.sql| similarity index 100% |
| rename from internal/equipo/migrations/0096_push_hold.sql |
| rename to internal/equipo/migrations/0097_push_hold.sql |
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql| index 41707562..ac24d893 100644 |
| --- a/internal/equipo/migrations/schema.sql |
| +++ b/internal/equipo/migrations/schema.sql |
| @@ -735,6 +735,8 @@ WHERE CASE WHEN json_valid(entries) THEN json_type(entries) = 'array' ELSE 0 END |
| ALTER TABLE chat_steps ADD COLUMN base_checks text; |
| +CREATE TABLE chat_turn_carried (turn_id text, message_id text, person text, PRIMARY KEY (turn_id, message_id)); |
| + |
| CREATE TABLE push_registrations (credential text PRIMARY KEY, person text, token text, environment text, platform text, start_token text, created_at datetime, updated_at datetime); |
| CREATE INDEX push_registration_person ON push_registrations(person); |
| CREATE TABLE push_activities (credential text, task_id text, person text, token text, created_at datetime, PRIMARY KEY (credential, task_id)); |
diff --git a/internal/equipo/migrations_test.go b/internal/equipo/migrations_test.go| index 2df747e2..c50e8796 100644 |
| --- a/internal/equipo/migrations_test.go |
| +++ b/internal/equipo/migrations_test.go |
| @@ -140,19 +140,19 @@ func TestAssistantLaneMigrationKeepsKeys(t *testing.T) { |
| } |
| // Cards already waiting when push arrives opened before any device could |
| -// hear of them: 0095 marks them alerted, so a later write of one (setting |
| +// hear of them: 0096 marks them alerted, so a later write of one (setting |
| // it aside included) never alerts it late. Others are not marked. |
| func TestPushMigrationMarksOpenCards(t *testing.T) { |
| ctx := context.Background() |
| all := Schema.All() |
| at := -1 |
| for i, m := range all { |
| - if m.ID == "equipo/0095_push" { |
| + if m.ID == "equipo/0096_push" { |
| at = i |
| } |
| } |
| if at < 0 { |
| - t.Fatal("no 0095_push") |
| + t.Fatal("no 0096_push") |
| } |
| d, err := migrate.Replay(ctx, all[:at]) |
| if err != nil { |
diff --git a/internal/equipo/static/chat-compose.js b/internal/equipo/static/chat-compose.js| index 59da905e..99308e4c 100644 |
| --- a/internal/equipo/static/chat-compose.js |
| +++ b/internal/equipo/static/chat-compose.js |
| @@ -59,3 +59,24 @@ |
| e.preventDefault();var send=form.querySelector("[data-thread-send]");if(send && !send.disabled)form.requestSubmit(send); |
| }); |
| })(); |
| + |
| +// The empty conversation's starters fill the composer with their opening |
| +// words and put the cursor after them; they never send. Words the person |
| +// typed stay theirs: a starter replaces only an empty composer or another |
| +// starter's words. Without script each is a GET that opens the page so. |
| +(function () { |
| + "use strict"; |
| + document.addEventListener("click", function (event) { |
| + var button = event.target.closest && event.target.closest("[equipo-starters] button[data-draft]"); |
| + var input = document.querySelector("#composer textarea"); |
| + if (!button || !input) return; |
| + event.preventDefault(); |
| + var drafts = [].map.call(button.form.querySelectorAll("button[data-draft]"), function (b) { return b.dataset.draft; }); |
| + if (!/\S/.test(input.value) || drafts.indexOf(input.value) >= 0) { |
| + input.value = button.dataset.draft; |
| + input.dispatchEvent(new Event("input", { bubbles: true })); |
| + } |
| + input.focus({ preventScroll: true }); |
| + input.setSelectionRange(input.value.length, input.value.length); |
| + }); |
| +})(); |
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js| index fc6ab1f4..a7e9f0df 100644 |
| --- a/internal/equipo/static/chat-stream.js |
| +++ b/internal/equipo/static/chat-stream.js |
| @@ -167,10 +167,29 @@ |
| } |
| return list[deal(key, list.length) % list.length]; |
| } |
| + // Each phrase stays at least DWELL ms (Paul, 2026-11-20: "the |
| + // thinking kept flashing quite quickly"): a turn's first moments bring |
| + // thinking, a tool's label and then its named one, all within a second. |
| + // An activity that comes sooner waits, and only the latest waiting one |
| + // is drawn; the accessible label and tooltip follow it at once. |
| + var DWELL = 1500; |
| + function want(li, label) { |
| + li.wanted = label; |
| + if (li.waiting) return; |
| + var wait = DWELL - (Date.now() - (li.shownAt || 0)); |
| + if (wait <= 0) return flush(li); |
| + li.waiting = setTimeout(function () { flush(li); }, wait); |
| + } |
| + function flush(li) { |
| + var label = li.wanted; |
| + li.waiting = 0; |
| + li.wanted = null; |
| + if (label !== null && label !== undefined) draw(li, themed(li, label), false); |
| + } |
| // The next phrase of the situation, when its time has come. |
| function cycle(li) { |
| var list = phrases(li); |
| - if (list.length < 2 || !li.wordKey || Date.now() - (li.wordAt || 0) < li.wordDelay) return; |
| + if (li.waiting || list.length < 2 || !li.wordKey || Date.now() - (li.wordAt || 0) < li.wordDelay) return; |
| li.wordDelay = nextDelay(); |
| li.wordAt = Date.now(); |
| draw(li, list[deal(li.wordKey, list.length) % list.length], false); |
| @@ -222,6 +241,7 @@ |
| if (keep < b.length) while (keep > 0 && !/[\s…]/.test(b[keep - 1])) keep--; |
| } |
| li.phrase = text; |
| + li.shownAt = Date.now(); |
| var measure = phrase.querySelector("[data-measure]"); |
| measure.textContent = text; |
| var natural = measure.offsetWidth + 1; |
| @@ -233,6 +253,9 @@ |
| var gap=parseFloat(getComputedStyle(line).columnGap)||0; |
| room=Math.floor(line.clientWidth-(elapsed?elapsed.offsetWidth:0)-(sep?sep.offsetWidth:0)-gap*3-8); |
| } |
| + // One phrase at a time: the old one fades in .2 s, before the new |
| + // one's letters start (equipo.css), and one still fading goes now. |
| + phrase.querySelectorAll("[data-out]").forEach(function (old) { old.remove(); }); |
| phrase.querySelectorAll("[data-in]").forEach(function (old) { |
| old.removeAttribute("data-in"); |
| old.setAttribute("data-out", ""); |
| @@ -240,7 +263,7 @@ |
| if (i < keep) c.style.visibility = "hidden"; |
| else c.style.setProperty("--n", 0); |
| }); |
| - setTimeout(function () { old.remove(); }, 600); |
| + setTimeout(function () { old.remove(); }, 250); |
| }); |
| var next = letters(text, keep); |
| next.setAttribute("data-in", ""); |
| @@ -267,7 +290,7 @@ |
| span.textContent = label; |
| var line = li.querySelector("[equipo-activity-line]"); |
| if (line) line.title = label; |
| - draw(li, themed(li, label), false); |
| + want(li, label); |
| } |
| // The line gives way (the first words arrived) or comes back (a tool |
| // after text). |
| @@ -842,7 +865,7 @@ |
| card.querySelectorAll("textarea, input:not([type=hidden])").forEach(function (el) { if (values[el.name]) { el.value = values[el.name]; el.closest("form").setAttribute("data-has-content", ""); } }); |
| }); |
| feed.querySelectorAll("[data-message]").forEach(function (el) { shown[el.dataset.message] = true; }); |
| - feed.replaceChildren.apply(feed, Array.from(next.children).map(function (el) { |
| + var items = Array.from(next.children).map(function (el) { |
| var fresh = el.matches('[equipo-message="incoming"][data-turn-id]') && !shown[el.dataset.message]; |
| var turn = el.hasAttribute("equipo-thinking") ? el.dataset.turn : fresh ? el.dataset.turnId : ""; |
| var old = turn && keep[turn]; |
| @@ -875,15 +898,17 @@ |
| return old; |
| } |
| return settle(old, el); |
| - }).filter(Boolean)); |
| + }).filter(Boolean); |
| + // A stale page lacks lines for turns that started since: they stay. |
| + if (stale) Object.keys(keep).forEach(function (turn) { if (!ended[turn] && !queued[turn]) items.push(keep[turn]); }); |
| + // Lines shown since a send that no turn has adopted yet come last. |
| + arrange(items.concat(pending)); |
| + if (window.equipoPulse) window.equipoPulse(feed); |
| if(cardFocus) { |
| var target=feed.querySelector('[data-card="'+CSS.escape(cardFocus.id)+'"] [name="'+CSS.escape(cardFocus.name)+'"]'); |
| if(target) {target.focus({preventScroll:true});if(target.setSelectionRange)target.setSelectionRange(cardFocus.start,cardFocus.end);} |
| } |
| - // A stale page lacks lines for turns that started since: they stay. |
| - if (stale) Object.keys(keep).forEach(function (turn) { if (!ended[turn] && !queued[turn]) feed.append(keep[turn]); }); |
| local.forEach(function (el) { place(el); }); |
| - pending.forEach(function (el) { feed.append(el); }); |
| Object.keys(drafts).forEach(function (turn) { |
| if (feed.querySelector('[equipo-thinking][data-turn="' + CSS.escape(turn) + '"], [data-roster-turn="' + CSS.escape(turn) + '"] [equipo-thread-draft]')) showDraft(turn); |
| }); |
| @@ -892,6 +917,19 @@ |
| scroll(); |
| }); |
| } |
| + // arrange makes the feed the items, in order, moving only what must |
| + // move: an element taken out and put back starts its animations again, |
| + // so a thinking line kept across a refresh drew every fading phrase |
| + // over the new one (Paul, 2026-11-20). |
| + function arrange(items) { |
| + var keep = new Set(items); |
| + Array.from(feed.children).forEach(function (el) { if (!keep.has(el)) el.remove(); }); |
| + var at = feed.firstElementChild; |
| + items.forEach(function (el) { |
| + if (el === at) at = at.nextElementSibling; |
| + else feed.insertBefore(el, at); |
| + }); |
| + } |
| function apply(type, data) { |
| var e = JSON.parse(data); |
| if (e.cursor <= cursor) return; |
| @@ -1041,7 +1079,16 @@ |
| showActivity(v); |
| } else if (type === "card" || type === "task" || type === "step") { |
| // Cards (and the tasks on them) are rendered by the server, like |
| - // committed replies. |
| + // committed replies. A step that starts or stops starts or stops |
| + // its track's pulse at once; the refresh then has the last word |
| + // (a finished step may hand straight on to the next). |
| + if (type === "step" && v && v.task_id) { |
| + var on = v.state === "running"; |
| + if (on || v.state === "failed" || v.state === "cancelled") { |
| + document.querySelectorAll('[data-track-task="' + CSS.escape(v.task_id) + '"] > [aria-current="step"]').forEach(function (li) { li.toggleAttribute("data-working", on); }); |
| + if (window.equipoPulse) window.equipoPulse(document.body); |
| + } |
| + } |
| refreshSoon(); |
| } else if (type === "runner" && offline && v.role !== "worker") { |
| // The offline line is the primary's: a worker going offline is not |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index dc2a92eb..3a897049 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -232,7 +232,9 @@ html:has([equipo-conversation]) { overflow: hidden; scrollbar-gutter: auto; } |
| [equipo-phrase] > span > span { display: inline-block; white-space: pre; } |
| [equipo-phrase] > [data-in] > span { animation: equipo-letter-in .32s ease-out calc(.2s + var(--n) * var(--stagger, 14ms)) both, equipo-wave 3.2s ease-in-out calc(.7s + var(--j) * 45ms) infinite; } |
| [equipo-phrase] > [data-in] > [data-keep] { animation: equipo-wave 3.2s ease-in-out calc(.7s + var(--j) * 45ms) infinite; } |
| -[equipo-phrase] > [data-out] > span, [equipo-activity-line][data-leaving] [equipo-phrase] > span > span { animation: equipo-letter-out .6s ease both; } |
| +/* The old phrase is gone in .2 s, as the new one's letters start. */ |
| +[equipo-phrase] > [data-out] > span { animation: equipo-letter-out .2s ease-in both; } |
| +[equipo-activity-line][data-leaving] [equipo-phrase] > span > span { animation: equipo-letter-out .6s ease both; } |
| @keyframes equipo-letter-in { from { opacity: 0; transform: translateY(.18em); } } |
| @keyframes equipo-letter-out { to { opacity: 0; transform: translateY(-.15em); } } |
| @keyframes equipo-wave { 0%, 22%, 100% { color: var(--rst-text); } 8% { color: var(--rst-accent); } } |
| @@ -477,6 +479,25 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| [equipo-track-full] li[data-s="current"] > span:not([equipo-dot]) { color: var(--rst-text); font-weight: 600; } |
| [equipo-track-full] li > span { text-align: center; white-space: nowrap; } |
| [equipo-track-full] li > small { color: var(--rst-text-faint); margin-block-start: -.3rem; } |
| +/* While a specialist works on the current stop (data-working), the track |
| + shows it: every 2.4s a light runs along the line into the stop and its |
| + marker sends out one soft ring in the stop's own tone. Nothing moves |
| + while the task waits on the person or nothing runs. Reduced motion |
| + keeps a still ring. equipoPulse (work-stream.js) holds one phase |
| + across live swaps. */ |
| +[equipo-track-full] li[data-s="current"] { --equipo-pulse: var(--rst-accent); } |
| +[equipo-track-full] li[data-s="current"][data-tone="positive"] { --equipo-pulse: var(--rst-tone-positive-fg); } |
| +[equipo-track-full] li[data-s="current"][data-tone="negative"] { --equipo-pulse: var(--rst-tone-negative-fg); } |
| +[equipo-track-full] li[data-s="current"]:is([data-tone="attention"], [data-tone="warning"]) { --equipo-pulse: var(--rst-tone-warning-fg); } |
| +[equipo-track-full] li[data-working] [equipo-dot]::before { content: ""; position: absolute; inset: 0; border: 1px solid var(--equipo-pulse); border-radius: 50%; box-sizing: border-box; opacity: 0; pointer-events: none; animation: equipo-tl-ring 2.4s cubic-bezier(.16, 1, .3, 1) infinite; } |
| +[equipo-track-full] li:has(+ li[data-working])::before { mask-image: linear-gradient(90deg, rgb(0 0 0 / .72) 0 43%, #000 50%, rgb(0 0 0 / .72) 57% 100%); mask-size: 300% 100%; mask-repeat: no-repeat; animation: equipo-tl-flow 2.4s cubic-bezier(.45, 0, .55, 1) infinite; } |
| +[equipo-track-full] li:not([data-working]) > [data-working-cue] { display: none; } |
| +@keyframes equipo-tl-ring { 0%, 34% { opacity: 0; transform: scale(1.2); } 40% { opacity: .5; } 100% { opacity: 0; transform: scale(2.8); } } |
| +@keyframes equipo-tl-flow { 0% { mask-position: 100% 0; } 45%, 100% { mask-position: 0 0; } } |
| +@media (prefers-reduced-motion: reduce) { |
| + [equipo-track-full] li[data-working] [equipo-dot]::before { animation: none; opacity: .6; transform: scale(1.9); } |
| + [equipo-track-full] li:has(+ li[data-working])::before { animation: none; mask-image: none; } |
| +} |
| /* Badges for checks and review. */ |
| [equipo-badge2] { display: inline-flex; align-items: center; gap: .35em; padding: .1rem .5rem .1rem .4rem; border-radius: var(--rst-radius-pill); font-size: var(--rst-fs-xs); white-space: nowrap; border: 1px solid transparent; color: var(--rst-tone-neutral-fg); background: var(--rst-tone-neutral-bg); cursor: default; } |
| [equipo-badge2] .icon { inline-size: .95em; block-size: .95em; margin: 0; } |
| @@ -2121,3 +2142,30 @@ body[equipo-preview] { margin: 0; min-block-size: 100dvh; } |
| [equipo-preview] iframe { border: 0; display: block; inline-size: 100%; block-size: 100dvh; } |
| [equipo-preview-note] { margin: 0; padding: var(--rst-sp-4); background: var(--rst-surface-2); color: var(--rst-text); } |
| [equipo-preview-confirm] { max-inline-size: 42rem; margin: var(--rst-sp-6) auto; padding: var(--rst-sp-4); } |
| + |
| +/* The empty conversation (chat.html "chat-welcome"): a small drawing, one |
| + line and three starters, centred in the scroll area and a little above |
| + the middle. Neutral ink; the only colour is the caret in your message, |
| + which blinks a few times on arrival and then rests. */ |
| +[equipo-feed]:has(> [equipo-welcome]) { margin-block: auto; } |
| +[equipo-welcome] { display: flex; flex-direction: column; align-items: center; gap: var(--rst-sp-4); padding-block: var(--rst-sp-5) var(--rst-sp-6); text-align: center; list-style: none; } |
| +[equipo-welcome-art] { inline-size: 7.5rem; block-size: auto; margin-block-end: var(--rst-sp-2); overflow: visible; } |
| +[equipo-welcome-art] [data-part="own"] { fill: color-mix(in oklab, var(--rst-accent-soft) 40%, var(--rst-surface)); stroke: var(--rst-line); stroke-width: 1.25; } |
| +[equipo-welcome-art] [data-part="words"] { fill: none; stroke: var(--rst-line-strong); stroke-width: 2.5; stroke-linecap: round; opacity: .5; } |
| +[equipo-welcome-art] [data-part="caret"] { fill: none; stroke: var(--rst-accent); stroke-width: 1.75; stroke-linecap: round; } |
| +[equipo-welcome-art] [data-part="reply"] { fill: var(--rst-surface); stroke: var(--rst-line); stroke-width: 1.25; } |
| +[equipo-welcome-art] [data-part="dots"] { fill: var(--rst-text-faint); opacity: .55; } |
| +[equipo-welcome-art] [data-part="mark"] { fill: none; stroke: var(--rst-text-faint); stroke-width: 1.4; stroke-linejoin: round; } |
| +[equipo-welcome-title] { margin: 0; color: var(--rst-text); font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; } |
| +[equipo-starters] { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--rst-sp-2); max-inline-size: 34rem; margin: 0; } |
| +[equipo-conversation] [equipo-starters] [rst-btn] { --rst-control-border: var(--rst-line); min-block-size: max(2.25rem, var(--rst-target)); padding: 0 1rem 0 .85rem; border-radius: 999px; color: var(--rst-text-muted); font-size: .875rem; font-weight: 500; } |
| +[equipo-conversation] [equipo-starters] [rst-btn]:hover, [equipo-conversation] [equipo-starters] [rst-btn]:focus-visible { color: var(--rst-text); } |
| +[equipo-starters] [rst-btn] .icon { margin: 0; color: var(--rst-text-faint); } |
| +@media (prefers-reduced-motion: no-preference) { |
| + [equipo-welcome] { animation: equipo-welcome-in .6s cubic-bezier(.16, 1, .3, 1) both; } |
| + [equipo-welcome-art] [data-part="caret"] { animation: equipo-caret 1.1s steps(1) .5s 4; } |
| +} |
| +@keyframes equipo-welcome-in { from { opacity: 0; transform: translateY(.5rem); } } |
| +@keyframes equipo-caret { 50% { opacity: 0; } } |
| +@media (max-height: 34rem) { [equipo-welcome-art] { display: none; } } |
| +@media (max-width: 40rem) { [equipo-welcome-art] { inline-size: 7rem; } [equipo-welcome-title] { font-size: 1.125rem; } } |
diff --git a/internal/equipo/static/work-stream.js b/internal/equipo/static/work-stream.js| index 2b32690f..222baca1 100644 |
| --- a/internal/equipo/static/work-stream.js |
| +++ b/internal/equipo/static/work-stream.js |
| @@ -6,6 +6,17 @@ |
| // thread is not a region: chat-stream.js follows it. |
| (function () { |
| "use strict"; |
| + // equipoPulse(root): a stage track's working pulse (equipo.css) keeps |
| + // one phase on every page and across swaps. Each ring and light under |
| + // root is timed from the document's start, so a track swapped in or |
| + // marked working carries on in step, never from the top. |
| + window.equipoPulse = function (root) { |
| + if (!root || !root.getAnimations) return; |
| + root.getAnimations({ subtree: true }).forEach(function (a) { |
| + if (a.animationName === "equipo-tl-ring" || a.animationName === "equipo-tl-flow") a.startTime = 0; |
| + }); |
| + }; |
| + window.equipoPulse(document.body); |
| if (!document.querySelector("[data-work-live]") || !window.fetch) return; |
| var inflight = null, again = false, timer = 0; |
| function busy() { |
| @@ -26,6 +37,7 @@ |
| var had = old.querySelectorAll("[equipo-tl] > li").length; |
| var focus = document.activeElement && old.contains(document.activeElement) ? document.activeElement.getAttribute("href") : null; |
| old.replaceWith(next); |
| + window.equipoPulse(next); |
| Object.keys(open).forEach(function (id) { var d = document.getElementById(id); if (d) d.open = open[id]; }); |
| var items = next.querySelectorAll("[equipo-tl] > li"); |
| for (var i = had; had > 0 && i < items.length; i++) items[i].setAttribute("data-new", ""); |
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html| index c477b284..d83e99cd 100644 |
| --- a/internal/equipo/templates/chat.html |
| +++ b/internal/equipo/templates/chat.html |
| @@ -28,6 +28,13 @@ |
| {{define "roster-undo"}}<form method="post" action="/conversation/cards/{{.ID}}/visibility" data-card-form><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="aside" value="false">{{template "card-job" .}}<button equipo-link type="submit" data-aside-undo data-busy-label="{{copy "roster.restoring"}}">{{copy "roster.undo"}}</button></form>{{end}} |
| {{define "roster-byline"}}<div equipo-roster-byline><span equipo-roster-avatar{{if eq .AuthorIcon "sparkles"}} equipo-coordinator-mark{{end}}>{{if eq .AuthorIcon "sparkles"}}{{template "roster-mark" .}}{{else}}{{icon .AuthorIcon}}{{end}}</span>{{if eq .AuthorIcon "sparkles"}}<span equipo-visually-hidden>{{.Author}} {{.Verb}}</span>{{else}}<span equipo-roster-author><b>{{.Author}}</b> <span>{{.Verb}}</span></span>{{end}}{{template "roster-project" .}}<time datetime="{{.BylineAt.Format "2006-01-02T15:04:05Z07:00"}}">{{.BylineAt.Format "15:04"}}</time></div>{{end}} |
| {{define "roster-project"}}{{if and .TaskID .Presentation.Context.ProjectTitle}}{{if .Task}}{{template "placement-chip" .Task}}{{else}}{{template "placement-chip" (dict "ID" .TaskID "Project" .Presentation.Context.ProjectTitle "Mono" .ProjectMono)}}{{end}}{{else if .Presentation.Context.ProjectTitle}}<span equipo-roster-project><span aria-hidden="true">·</span>{{if not .ProjectMono.InTitle}}{{template "mono-s" .ProjectMono}}{{end}}<span equipo-project-name title="{{.Presentation.Context.ProjectTitle}}">{{.Presentation.Context.ProjectTitle}}</span></span>{{end}}{{end}} |
| +{{/* The empty conversation: a quiet drawing (your message on the right, the |
| + coordinator's reply on the left with its mark), one short line and three starters. A starter fills the |
| + composer with its opening words and never sends; without script it is |
| + a GET that opens the conversation with those words in the composer. */}} |
| +{{define "chat-welcome"}}<li equipo-welcome data-empty-state="conversation.empty">{{template "welcome-art"}}<h2 equipo-welcome-title>{{copy "conversation.empty"}}</h2>{{if not .Chat.Job}}<form equipo-starters method="get" action="/conversation" aria-label="{{copy "conversation.start.label"}}">{{template "starter" "bug"}}{{template "starter" "feature"}}{{template "starter" "project"}}</form>{{end}}</li>{{end}} |
| +{{define "starter"}}<button type="submit" rst-btn name="start" value="{{.}}" data-draft="{{copy (printf "conversation.start.%s_draft" .)}}">{{if eq . "bug"}}{{icon "wrench"}}{{else if eq . "feature"}}{{icon "lightbulb"}}{{else}}{{icon "folder"}}{{end}}<span>{{copy (printf "conversation.start.%s" .)}}</span></button>{{end}} |
| +{{define "welcome-art"}}<svg equipo-welcome-art viewBox="0 0 112 70" aria-hidden="true" focusable="false"><rect data-part="own" x="40" y="4" width="68" height="28" rx="14"/><path data-part="words" d="M53 14h42M53 22h20"/><path data-part="caret" d="M78 17.5v9"/><path data-part="mark" d="M12 44c1 5.2 2.8 7 8 8-5.2 1-7 2.8-8 8-1-5.2-2.8-7-8-8 5.2-1 7-2.8 8-8Z"/><rect data-part="reply" x="26" y="38" width="44" height="28" rx="14"/><g data-part="dots"><circle cx="38" cy="52" r="2.2"/><circle cx="48" cy="52" r="2.2"/><circle cx="58" cy="52" r="2.2"/></g></svg>{{end}} |
| {{define "roster-mark"}}<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3c1.1 5.8 3.2 7.9 9 9-5.8 1.1-7.9 3.2-9 9-1.1-5.8-3.2-7.9-9-9 5.8-1.1 7.9-3.2 9-9Z"/></svg>{{end}} |
| {{define "work-task-receipt"}}{{$card := .}}{{with .Task}}<div equipo-roster-report{{if $card.SlimReport}} data-slim{{end}}{{if $card.Compact}} data-compact{{end}}> |
| <div equipo-roster-report-head><span equipo-roster-stage equipo-stage data-stage="{{.Stage}}" data-tone="{{.RosterTone}}">{{.Eyebrow}}</span>{{if .NeedsYou}}<span equipo-needs-chip>{{icon "hand"}}{{copy "nav.needs-you"}}</span>{{end}}<h3 equipo-card-line><a href="/tasks/{{.ID}}">{{.Title}}</a></h3>{{if not $card.Compact}}{{with .Why}}<p equipo-roster-why>{{.}}</p>{{end}}{{end}}</div> |
| @@ -76,7 +83,7 @@ |
| {{if .Chat.HasOpen}}<li equipo-day-note data-still-open>{{copy "chat.day.still_open"}}</li>{{end}} |
| {{template "chat-lines" (.Chat.Earlier .Address)}} |
| {{template "chat-lines" (.Chat.Today .Address)}} |
| -{{if not (or .Chat.Days .Chat.Open .Chat.Messages)}}<li data-empty-state="conversation.empty">{{copy "conversation.empty"}}</li>{{end}} |
| +{{if not (or .Chat.Days .Chat.Open .Chat.Messages)}}{{template "chat-welcome" .}}{{end}} |
| {{range .Chat.Waiting}}<li equipo-message="incoming" equipo-thinking data-turn="{{.ID}}"{{with .Kind}} data-kind="{{.}}"{{end}} data-started="{{.CreatedAt.UnixMilli}}" aria-busy="true"><div equipo-message-meta><strong><span equipo-coordinator-mark>{{template "roster-mark" .}}</span><span equipo-visually-hidden>{{copy "conversation.coordinator"}}</span></strong><time></time></div><div equipo-bubble><div equipo-message-body equipo-markdown data-stream-text></div><p equipo-activity-line><span equipo-activity>{{if eq .Kind "move_in"}}{{copy "chat.moving_in"}}{{else if eq .Kind "explore"}}{{copy "chat.exploring"}}{{else}}{{copy "chat.activity.thinking"}}{{end}}</span><span equipo-activity-sep aria-hidden="true">·</span><span equipo-elapsed></span></p><form method="post" action="/conversation/turns/{{.ID}}/stop" data-card-form equipo-turn-stop>{{with $.Chat.Job}}<input type="hidden" name="from" value="job"><input type="hidden" name="job" value="{{.ID}}">{{end}}<button rst-btn data-quiet type="submit" data-turn-stop data-busy-label="{{copy "roster.stopping"}}">{{copy "roster.stop"}}</button></form></div></li>{{end}} |
| {{with .Chat.NoConnection}}<li equipo-card="no_connection" data-no-connection="{{.TurnID}}"><p equipo-card-line>{{.Line}}</p><p equipo-actions><a rst-btn="primary" href="/conversation/settings/connections/add" data-add-connection>{{copy "chat.no_connection.add"}}</a></p></li>{{end}} |
| {{with .Chat.Ended}}<li equipo-system-note data-ended="{{.ID}}"><p>{{copy .Key}}</p></li>{{end}} |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index ced6c824..2391a944 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -11,7 +11,7 @@ |
| {{define "mono-l"}}<span equipo-mono data-size="l" data-h="{{.Hue}}" title="{{.Title}}" aria-hidden="true">{{.Letter}}</span>{{end}} |
| {{define "mono-s"}}<span equipo-mono data-size="s" data-h="{{.Hue}}" aria-hidden="true">{{.Letter}}</span>{{end}} |
| {{define "track"}}<ol equipo-track role="img" aria-label="{{.StepLabel}}">{{range .Track}}<li data-s="{{.State}}"{{if .Tone}} data-tone="{{.Tone}}"{{end}}{{if .Live}} data-live{{end}} title="{{.Label}}">{{if .Live}}{{template "mark" "s"}}{{end}}</li>{{end}}</ol>{{end}} |
| -{{define "track-full"}}<ol equipo-track-full data-track aria-label="{{.StageLine}}">{{range .Track}}<li data-s="{{.State}}"{{if .Tone}} data-tone="{{.Tone}}"{{end}}{{if .Live}} data-live{{end}}{{if eq .State "current"}} aria-current="step"{{end}}><span equipo-dot>{{if .Live}}{{template "mark" "s"}}{{end}}</span><span>{{.Label}}</span>{{with .At}}<small><time datetime="{{.Format "2006-01-02T15:04:05Z07:00"}}">{{.Format "15:04"}}</time></small>{{end}}</li>{{end}}</ol>{{end}} |
| +{{define "track-full"}}<ol equipo-track-full data-track data-track-task="{{.ID}}" aria-label="{{.StageLine}}">{{range .Track}}<li data-s="{{.State}}"{{if .Tone}} data-tone="{{.Tone}}"{{end}}{{if .Live}} data-live{{end}}{{if .Working}} data-working{{end}}{{if eq .State "current"}} aria-current="step"{{end}}><span equipo-dot>{{if .Live}}{{template "mark" "s"}}{{end}}</span><span>{{.Label}}</span>{{if eq .State "current"}}<i equipo-visually-hidden data-working-cue> {{copy "work.track.working"}}</i>{{end}}{{with .At}}<small><time datetime="{{.Format "2006-01-02T15:04:05Z07:00"}}">{{.Format "15:04"}}</time></small>{{end}}</li>{{end}}</ol>{{end}} |
| {{define "badge"}}<span equipo-badge2 data-kind="{{.Kind}}" data-tone="{{.Tone}}" title="{{.Title}}">{{if .Live}}{{template "mark" "s"}}{{else if .Icon}}{{icon .Icon}}{{end}}<span>{{.Text}}</span></span>{{end}} |
| {{define "chip"}}{{with .Chip}}<span equipo-chip{{if .Live}} data-live{{end}}>{{if .Live}}{{template "mark" "s"}}{{else if .Icon}}{{icon .Icon}}{{end}}<span>{{.Text}}</span>{{with .Since}}{{template "elapsed" .}}{{end}}</span>{{end}}{{end}} |
| {{define "source"}}{{if .SourceHref}}<a href="{{.SourceHref}}" equipo-source>{{.Source}}</a>{{else}}<span equipo-source>{{.Source}}</span>{{end}}{{end}} |
diff --git a/internal/equipo/track_working_test.go b/internal/equipo/track_working_test.go| new file mode 100644 |
| index 00000000..39d15148 |
| --- /dev/null |
| +++ b/internal/equipo/track_working_test.go |
| @@ -0,0 +1,84 @@ |
| +package equipo |
| + |
| +import ( |
| + "bytes" |
| + "regexp" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// working is the data-working attribute itself, not data-working-cue. |
| +var working = regexp.MustCompile(`\sdata-working[\s>]`) |
| + |
| +// TestTrackWorkingPulse: the full stage track marks its current stop |
| +// as working while a specialist's step is queued or running, on the task |
| +// page and on the conversation's report card, and never while the task |
| +// waits on the person or nothing runs. |
| +func TestTrackWorkingPulse(t *testing.T) { |
| + step := func(specialist, state string) wire.Step { |
| + return wire.Step{ID: "s-" + state, TaskID: "tk", Specialist: specialist, State: state} |
| + } |
| + for _, tc := range []struct { |
| + name string |
| + task wire.Task |
| + want bool |
| + }{ |
| + {"running", wire.Task{Stage: wire.StageInProgress, Steps: []wire.Step{step(wire.SpecialistEngineering, wire.StepRunning)}}, true}, |
| + {"queued", wire.Task{Stage: wire.StageInReview, Steps: []wire.Step{step(wire.SpecialistEngineering, wire.StepDone), step(wire.SpecialistChecks, wire.StepQueued)}}, true}, |
| + {"exploration in review", wire.Task{Kind: wire.KindExplore, Stage: wire.StageInReview, Steps: []wire.Step{step(wire.SpecialistEngineering, wire.StepDone), step(wire.SpecialistReview, wire.StepRunning)}}, true}, |
| + {"merging", wire.Task{Stage: wire.StageMerging, Steps: []wire.Step{step(wire.SpecialistMerge, wire.StepRunning)}}, true}, |
| + {"noted", wire.Task{Stage: wire.StageNoted}, false}, |
| + {"step done", wire.Task{Stage: wire.StageInReview, Steps: []wire.Step{step(wire.SpecialistEngineering, wire.StepDone)}}, false}, |
| + {"stopped", wire.Task{Stage: wire.StageInProgress, Steps: []wire.Step{step(wire.SpecialistEngineering, wire.StepFailed)}}, false}, |
| + {"waits on the person", wire.Task{Stage: wire.StageInProgress, NeedsYou: wire.NeedsRunnerOffline, Steps: []wire.Step{step(wire.SpecialistEngineering, wire.StepQueued)}}, false}, |
| + {"copy held", wire.Task{Stage: wire.StageInReview, CopyHold: true, Steps: []wire.Step{step(wire.SpecialistCopy, wire.StepQueued)}}, false}, |
| + {"done", wire.Task{Stage: wire.StageDone, Steps: []wire.Step{step(wire.SpecialistMerge, wire.StepRunning)}}, false}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + tc.task.ID, tc.task.Creator, tc.task.Title = "tk", "owner@example.com", "Fix it" |
| + now := time.Now() |
| + // The task page's track. |
| + page := taskLineOf(tc.task, tc.task.Creator) |
| + page.richOf(tc.task, tc.task.Creator, nil, now) |
| + // The conversation card's track. |
| + card := taskLineOf(tc.task, tc.task.Creator) |
| + card.richOf(tc.task, tc.task.Creator, nil, now) |
| + card.Track = rosterTrack(tc.task) |
| + for where, v := range map[string]taskLine{"task page": page, "card": card} { |
| + var b bytes.Buffer |
| + if err := pages["work_task"].ExecuteTemplate(&b, "track-full", v); err != nil { |
| + t.Fatal(err) |
| + } |
| + html := b.String() |
| + if !strings.Contains(html, `data-track-task="tk"`) { |
| + t.Fatalf("%s: the track does not name its task: %s", where, html) |
| + } |
| + items := strings.Split(html, "<li")[1:] |
| + n := 0 |
| + for _, li := range items { |
| + if !working.MatchString("<li" + li) { |
| + continue |
| + } |
| + n++ |
| + if !strings.Contains(li, `aria-current="step"`) { |
| + t.Errorf("%s: a stop other than the current one is working: %s", where, li) |
| + } |
| + } |
| + if tc.want && n != 1 || !tc.want && n != 0 { |
| + t.Errorf("%s: %d working stops, want working=%v: %s", where, n, tc.want, html) |
| + } |
| + // The current stop carries the hidden cue; CSS shows it to |
| + // assistive technology only while the stop is working. |
| + for _, li := range items { |
| + cue := strings.Contains(li, `<i equipo-visually-hidden data-working-cue> (work underway)</i>`) |
| + if cue != strings.Contains(li, `aria-current="step"`) { |
| + t.Errorf("%s: working cue on the wrong stop: %s", where, li) |
| + } |
| + } |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/equipo/work_views.go b/internal/equipo/work_views.go| index e83917b0..fad87e35 100644 |
| --- a/internal/equipo/work_views.go |
| +++ b/internal/equipo/work_views.go |
| @@ -101,10 +101,12 @@ func exploreIndex(t wire.Task) int { |
| } |
| // trackStop is one stop: done, current or todo, the current one with a |
| -// tone and, while someone is at work, the living mark. |
| +// tone and, while someone is at work, the living mark. Working is the |
| +// current stop while a specialist's step is queued or running: its |
| +// marker pulses. |
| type trackStop struct { |
| Stage, Label, State, Tone string |
| - Live bool |
| + Live, Working bool |
| At *time.Time |
| } |
| @@ -201,6 +203,16 @@ func liveStep(t wire.Task) *wire.Step { |
| return nil |
| } |
| +// workingNow reports whether a specialist is at work on t: its newest |
| +// step queued or running, the task open and not waiting on the person. |
| +func workingNow(t wire.Task) bool { |
| + if len(t.Steps) == 0 || wire.FinalStage(t.Stage) || t.NeedsYou != "" || t.CopyHold || t.CopyCanSkip { |
| + return false |
| + } |
| + s := t.Steps[len(t.Steps)-1].State |
| + return s == wire.StepQueued || s == wire.StepRunning |
| +} |
| + |
| // stoppedStep is the newest step when it failed on a task still open. |
| func stoppedStep(t wire.Task) *wire.Step { |
| if s := lastStep(t); s != nil && s.State == wire.StepFailed && !wire.FinalStage(t.Stage) { |
| @@ -295,7 +307,7 @@ func (v *taskLine) trackOf(t wire.Task) { |
| case i < cur: |
| n.State = "done" |
| case i == cur: |
| - n.State, n.Tone, n.Live = "current", v.Tone, v.Live |
| + n.State, n.Tone, n.Live, n.Working = "current", v.Tone, v.Live, workingNow(t) |
| switch { |
| case t.Stage == wire.StageMerging: |
| n.Label = copyText("work.stage.merging") |
diff --git a/internal/fakeclaude/fake.go b/internal/fakeclaude/fake.go| index b3bc7958..231be71e 100644 |
| --- a/internal/fakeclaude/fake.go |
| +++ b/internal/fakeclaude/fake.go |
| @@ -1006,6 +1006,10 @@ func (f *fake) serve(stdin io.Reader, stdout, stderr io.Writer) int { |
| if _, after, ok := strings.Cut(prompt, "Newest message:\n"); ok { |
| newest = after |
| } |
| + // Words a failed turn left unanswered ride before it, as context. |
| + if _, after, ok := strings.Cut(newest, "The person's newest message:\n"); ok { |
| + newest = after |
| + } |
| // A move-in or explore turn has no person message to steer by. |
| steps, intro, settle := settling(prompt) |
| if settle { |
diff --git a/internal/fakecodex/fake.go b/internal/fakecodex/fake.go| index 7ffa2749..5c56412c 100644 |
| --- a/internal/fakecodex/fake.go |
| +++ b/internal/fakecodex/fake.go |
| @@ -411,6 +411,10 @@ func (s *server) runTurn(thread, turn, prompt string, stop chan struct{}) { |
| if _, after, ok := strings.Cut(prompt, "Newest message:\n"); ok { |
| newest = after |
| } |
| + // Words a failed turn left unanswered ride before it, as context. |
| + if _, after, ok := strings.Cut(newest, "The person's newest message:\n"); ok { |
| + newest = after |
| + } |
| done := func(status string, turnErr any) { |
| s.notify("turn/completed", map[string]any{"threadId": thread, "turn": map[string]any{"id": turn, "status": status, "items": []any{}, "error": turnErr}}) |
| } |
diff --git a/internal/headless/ask_test.go b/internal/headless/ask_test.go| index 373d2cf0..4829c8a0 100644 |
| --- a/internal/headless/ask_test.go |
| +++ b/internal/headless/ask_test.go |
| @@ -171,14 +171,18 @@ func scenarioAsk(t *testing.T, env *Env) { |
| } |
| } |
| -// The staging witness (EQUIPO_STAGING_ASK_TASK): on a task whose steps |
| -// ran with their sessions kept, ask Engineering what it changed and |
| +// The staging witness (EQUIPO_STAGING_ASK_TASK, else the task this run's |
| +// 3_engineering pushed, which 4_review has seen judged): on a task whose |
| +// steps ran with their sessions kept, ask Engineering what it changed and |
| // Review what it was unsure about, then ask Engineering to fix a typo, |
| // which it must decline from here. Answers and timings go to the report. |
| func scenarioAskWitness(t *testing.T, env *Env) { |
| id := os.Getenv("EQUIPO_STAGING_ASK_TASK") |
| + if id == "" { |
| + id = pushedTask |
| + } |
| if !env.Live || id == "" { |
| - t.Skip("staging only, with EQUIPO_STAGING_ASK_TASK") |
| + t.Skip("staging only, with EQUIPO_STAGING_ASK_TASK or this run's 3_engineering task") |
| } |
| s := open(t, env) |
| s.keep() |
| @@ -186,6 +190,26 @@ func scenarioAskWitness(t *testing.T, env *Env) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| + if os.Getenv("EQUIPO_STAGING_ASK_TASK") == "" { |
| + // Only a Claude step keeps its session (a Codex step keeps none, |
| + // by design), and where this run's steps ran is the runner's call. |
| + // The newest finished step of each is the one a question goes to. |
| + newest := map[string]wire.Step{} |
| + for _, st := range k.Steps { |
| + if st.State == wire.StepDone && (st.Specialist == wire.SpecialistEngineering || st.Specialist == wire.SpecialistReview) { |
| + newest[st.Specialist] = st |
| + } |
| + } |
| + for _, name := range []string{wire.SpecialistEngineering, wire.SpecialistReview} { |
| + st := newest[name] |
| + if st.Family != "claude" { |
| + t.Skipf("live: this run's %s ran on %s (%s), which keeps no session to ask", st.Specialist, st.Account, st.Family) |
| + } |
| + if !st.Askable { |
| + t.Fatalf("a finished Claude step kept no session: %+v", st) |
| + } |
| + } |
| + } |
| before := k.CandidateSHA |
| out := map[string]any{"task": id} |
| for _, q := range []struct{ name, text, specialist string }{ |
diff --git a/internal/headless/engineering_test.go b/internal/headless/engineering_test.go| index 27e4f217..59d3d9d0 100644 |
| --- a/internal/headless/engineering_test.go |
| +++ b/internal/headless/engineering_test.go |
| @@ -74,6 +74,10 @@ func forgeShow(t *testing.T, bare string, args ...string) string { |
| return string(out) |
| } |
| +// pushedTask is the task a live 3_engineering pushed in this run, for the |
| +// scenarios that judge and ask about it without a new message. |
| +var pushedTask string |
| + |
| // Scenario 2, to the branch: the person reports a bug; the task is noted |
| // at once, investigated with a finding, and Engineering's step commits in |
| // a task tree, records the candidate SHA and pushes the task's own branch |
| @@ -120,6 +124,7 @@ func scenarioEngineering(t *testing.T, env *Env) { |
| } |
| noRepoQuestion(t, s, sent.Turn.ID) |
| if env.Live { |
| + pushedTask = id |
| return |
| } |
| if !slices.Contains(stages, wire.StageInvestigated) || task.Findings[0].Path != "README.md" || task.Findings[0].Line != 5 { |
| @@ -163,11 +168,15 @@ func scenarioStepCrash(t *testing.T, env *Env) { |
| s.wait(t, "runner online", 30*time.Second, func(c *thintest.Conversation) bool { return c.Runner.Online }) |
| text := "tool:record_task:oficina/sample|Fix the README typo|teh\ntool:start_task:$task|Slowly. stepsleep:4000 edit:README.md|teh panes|the panes" |
| if env.Live { |
| + if env.CrashWitness == "" { |
| + t.Fatal("EQUIPO_STAGING_CRASH_WITNESS is not set") |
| + } |
| text = env.CrashWitness |
| } |
| sent := s.send(t, text) |
| id := s.taskOf(t, sent.Turn.ID) |
| - running := s.step(t, id, 5*time.Minute, wire.StepRunning) |
| + // Live, the step may queue behind the earlier tasks' checks and review. |
| + running := s.step(t, id, 10*time.Minute, wire.StepRunning) |
| if !env.Live { |
| // What Engineering started shows while it runs: the fake reads the |
| // file it will edit before it sleeps. |
| @@ -225,23 +234,38 @@ func scenarioStepCrash(t *testing.T, env *Env) { |
| } |
| // Cancel during a step: the task ends only when the runner reports the |
| -// attempt's termination; nothing is pushed. |
| +// attempt's termination; nothing is pushed. Live, the person asks for a |
| +// real change (EQUIPO_STAGING_CANCEL_WITNESS) and cancels it a second |
| +// after the real Engineering step starts, long before it could push. |
| func scenarioStepCancel(t *testing.T, env *Env) { |
| s := open(t, env) |
| s.keep() |
| - sent := s.send(t, "tool:record_task:oficina/sample|Slow change|x\ntool:start_task:$task|stepsleep:20000 edit:README.md|teh|the") |
| + text, running, ended := "tool:record_task:oficina/sample|Slow change|x\ntool:start_task:$task|stepsleep:20000 edit:README.md|teh|the", time.Minute, time.Minute |
| + if env.Live { |
| + if env.CancelWitness == "" { |
| + t.Fatal("EQUIPO_STAGING_CANCEL_WITNESS is not set") |
| + } |
| + // The live step may queue behind the earlier task's checks and |
| + // review, and ends only when the runner has stopped a real |
| + // process tree. |
| + text, running, ended = env.CancelWitness, 10*time.Minute, 3*time.Minute |
| + } |
| + sent := s.send(t, text) |
| id := s.taskOf(t, sent.Turn.ID) |
| - s.step(t, id, time.Minute, wire.StepRunning) |
| + s.step(t, id, running, wire.StepRunning) |
| time.Sleep(time.Second) |
| acc, err := env.Client.CancelTask(s.ctx, id) |
| if err != nil || acc.Attempt != 1 { |
| t.Fatalf("cancel: %+v %v", acc, err) |
| } |
| - st := s.step(t, id, time.Minute, wire.StepCancelled, wire.StepFailed, wire.StepDone) |
| + st := s.step(t, id, ended, wire.StepCancelled, wire.StepFailed, wire.StepDone) |
| if st.State != wire.StepCancelled || !st.Terminated || st.Pushed { |
| t.Fatalf("cancelled step %+v", st) |
| } |
| s.wait(t, "task cancelled", 30*time.Second, func(c *thintest.Conversation) bool { return c.Tasks[id].Stage == wire.StageCancelled }) |
| + if env.Live { |
| + return |
| + } |
| if forgeHead(t, env.ForgePath("amadan.net/oficina/sample"), wire.TaskBranch(id, "Slow change")) != "" { |
| t.Fatal("a cancelled step pushed") |
| } |
| @@ -250,6 +274,9 @@ func scenarioStepCancel(t *testing.T, env *Env) { |
| // A step that asks to write outside /workspace is denied by the |
| // permission callback, and the tree commits only what it changed inside. |
| func scenarioStepContained(t *testing.T, env *Env) { |
| + if env.Live { |
| + t.Skip("local only: the fake CLI asks to write outside /workspace; a live model is never steered to") |
| + } |
| s := open(t, env) |
| s.keep() |
| sent := s.send(t, "tool:record_task:oficina/sample|Contained|x\ntool:start_task:$task|escape:/etc/hostname escape:/home/runner/.claude/x edit:README.md|teh|the") |
diff --git a/internal/headless/env_test.go b/internal/headless/env_test.go| index e906a10a..17b0a351 100644 |
| --- a/internal/headless/env_test.go |
| +++ b/internal/headless/env_test.go |
| @@ -94,8 +94,10 @@ type Env struct { |
| // BreakDesk makes the desk record unwritable, then starts the runner. |
| BreakDesk func(t *testing.T) |
| // Witness is what the person says in the live Engineering scenario |
| - // (EQUIPO_STAGING_WITNESS); CrashWitness the same for scenario 4. |
| - Witness, CrashWitness string |
| + // (EQUIPO_STAGING_WITNESS); CrashWitness the same for scenario 4 and |
| + // CancelWitness for the step cancel. Each asks for a different change, |
| + // so no two of a run's tasks read alike. |
| + Witness, CrashWitness, CancelWitness string |
| // ForgePath is a local forge repository's bare path (local only). |
| ForgePath func(repo string) string |
| // GrantNow makes a repository reachable without restarting the |
| @@ -447,6 +449,7 @@ func stagingEnv(t *testing.T) *Env { |
| Project: os.Getenv("EQUIPO_STAGING_PROJECT"), |
| Witness: os.Getenv("EQUIPO_STAGING_WITNESS"), |
| CrashWitness: os.Getenv("EQUIPO_STAGING_CRASH_WITNESS"), |
| + CancelWitness: os.Getenv("EQUIPO_STAGING_CANCEL_WITNESS"), |
| turns: &turns, |
| } |
| } |
diff --git a/internal/headless/review_test.go b/internal/headless/review_test.go| index f78f3daa..8844f871 100644 |
| --- a/internal/headless/review_test.go |
| +++ b/internal/headless/review_test.go |
| @@ -69,20 +69,32 @@ func witnessTask(t *testing.T, k wire.Task, checks, review wire.Step, since time |
| // and verdict agree, so the task is ready to merge, and Equipo merges that |
| // SHA into main through the forge (a merge commit, the branch deleted) and |
| // says so in one line. |
| +// |
| +// Live, the task is the one 3_engineering pushed in this run, judged with |
| +// no new message (or a new one from EQUIPO_STAGING_REVIEW_WITNESS): it |
| +// ends ready to merge or needing its person, on one SHA, and checks that |
| +// could not run say why. |
| func scenarioReview(t *testing.T, env *Env) { |
| - if env.Live && os.Getenv("EQUIPO_STAGING_REVIEW_WITNESS") == "" { |
| - t.Skip("EQUIPO_STAGING_REVIEW_WITNESS is not set") |
| + witness := os.Getenv("EQUIPO_STAGING_REVIEW_WITNESS") |
| + if env.Live && witness == "" && pushedTask == "" { |
| + t.Skip("live: needs this run's 3_engineering task or EQUIPO_STAGING_REVIEW_WITNESS") |
| } |
| s := open(t, env) |
| s.keep() |
| s.wait(t, "runner online", 30*time.Second, func(c *thintest.Conversation) bool { return c.Runner.Online }) |
| text := "tool:record_task:oficina/sample|Make edge swipe go back|Swiping from the edge does nothing.\ntool:start_task:$task|review:need:README.md|keeps your place, always|edit=README.md~keeps your place~keeps your place, always; edit:panes/swipe.go|return false|return true" |
| if env.Live { |
| - text = os.Getenv("EQUIPO_STAGING_REVIEW_WITNESS") |
| + text = witness |
| } |
| start := time.Now() |
| - sent := s.send(t, text) |
| - id := s.taskOf(t, sent.Turn.ID) |
| + var sent wire.Sent |
| + var id string |
| + if env.Live && witness == "" { |
| + id = pushedTask |
| + } else { |
| + sent = s.send(t, text) |
| + id = s.taskOf(t, sent.Turn.ID) |
| + } |
| k := s.settled(t, id, 40*time.Minute) |
| checks, review := oneSHA(t, k) |
| witnessTask(t, k, checks, review, start) |
| @@ -91,6 +103,10 @@ func scenarioReview(t *testing.T, env *Env) { |
| if k.Stage != wire.StageReadyToMerge && k.NeedsYou == "" { |
| t.Fatalf("task ended %s", k.Stage) |
| } |
| + // Honest checks: what could not run says why, and is never a pass. |
| + if k.Checks == wire.ChecksCannotRun && (k.ChecksReason == "" || checks.Checks != wire.ChecksCannotRun) { |
| + t.Fatalf("checks that could not run: task %s (%q), step %+v", k.Checks, k.ChecksReason, checks) |
| + } |
| return |
| } |
| // Approved with checks passed on the branch's head: Equipo merges it. |
diff --git a/internal/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go| index 3c355d0e..90187195 100644 |
| --- a/internal/plan3test/plan3_release_test.go |
| +++ b/internal/plan3test/plan3_release_test.go |
| @@ -170,7 +170,7 @@ func plan3CopyInventory(t *testing.T) { |
| acceptedRound2 := slices.Contains([]string{"CopyCalibrationFunding"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)" |
| // Paul delegated copy review on 2026-10-25; a row Astra's |
| // delegated pass accepted carries that marker. |
| - acceptedDelegation := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)") || slices.Contains([]string{"docs/api/equipo-v1.md / COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)", "docs/api/equipo-v1.md / Retry writes and handle revisions", "docs/api/equipo-v1.md / Reconnect and answer questions", "docs/api/equipo-v1.md / Talk to your Coordinator from a device"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-19)") |
| + acceptedDelegation := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-12)") || strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)") || slices.Contains([]string{"docs/api/equipo-v1.md / COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)", "docs/api/equipo-v1.md / Retry writes and handle revisions", "docs/api/equipo-v1.md / Reconnect and answer questions", "docs/api/equipo-v1.md / Talk to your Coordinator from a device"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-19)") || slices.Contains([]string{"conversation.empty", "conversation.start.label", "conversation.start.bug", "conversation.start.bug_draft", "conversation.start.feature", "conversation.start.feature_draft", "conversation.start.project", "conversation.start.project_draft", "work.track.working"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Astra, 2026-11-20)") |
| // Paul's own review of the publish strings (base-publish). |
| approvedPublish := strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-12, copy-review jadya3tfrmkf7t3ym2nqhpgira, unchanged)") |
| // Paul's own review of the Assistant lane's strings and API section. |
diff --git a/internal/runner/provider/accounts.go b/internal/runner/provider/accounts.go| index edd6a829..5ce82146 100644 |
| --- a/internal/runner/provider/accounts.go |
| +++ b/internal/runner/provider/accounts.go |
| @@ -8,7 +8,6 @@ import ( |
| "encoding/hex" |
| "encoding/json" |
| "errors" |
| - "fmt" |
| "io" |
| "os" |
| "os/user" |
| @@ -900,6 +899,12 @@ func (l *AccountLease) PreflightFingerprint(ctx context.Context) (string, error) |
| return hex.EncodeToString(sum[:]), nil |
| } |
| -func accountContainment(reason string) error { |
| - return fmt.Errorf("%w: %s", ErrContainment, reason) |
| -} |
| +// containmentError is ErrContainment with its category, always a literal. |
| +type containmentError struct{ reason string } |
| + |
| +func (e containmentError) Error() string { return string(ErrContainment) + ": " + e.reason } |
| +func (e containmentError) Unwrap() error { return ErrContainment } |
| +func accountContainment(reason string) error { return containmentError{reason} } |
| + |
| +// ContainmentReason is a containment refusal's category, safe to log; "" otherwise. |
| +func ContainmentReason(err error) string { var c containmentError; errors.As(err, &c); return c.reason } |
diff --git a/internal/runner/provider/token_test.go b/internal/runner/provider/token_test.go| index 8a9a129d..47798190 100644 |
| --- a/internal/runner/provider/token_test.go |
| +++ b/internal/runner/provider/token_test.go |
| @@ -118,3 +118,21 @@ func TestClaudeTokenIdentity(t *testing.T) { |
| t.Fatal(err) |
| } |
| } |
| + |
| +// A containment refusal keeps its fixed category: the runner's log needs |
| +// it to say what changed in a copy, and it is never a path. |
| +func TestContainmentKeepsItsReason(t *testing.T) { |
| + l := openTokenCopy(t, tokenFixture(t)) |
| + // A signed-in CLI records the account in its native config. |
| + writeFake(t, filepath.Join(l.Binding().Home, ".claude.json"), `{"oauthAccount":{"emailAddress":"a@example.com","accountUuid":"u1"}}`) |
| + err := l.CheckCopy(context.Background()) |
| + if !errors.Is(err, ErrContainment) { |
| + t.Fatalf("changed account metadata accepted: %v", err) |
| + } |
| + if got := ContainmentReason(err); got != "runtime_claude_identity" { |
| + t.Fatalf("reason %q", got) |
| + } |
| + if got := ContainmentReason(ErrPolicy); got != "" { |
| + t.Fatalf("a policy refusal has containment reason %q", got) |
| + } |
| +} |
diff --git a/internal/runner/thin/bridge.go b/internal/runner/thin/bridge.go| index a0e93615..8ca8919e 100644 |
| --- a/internal/runner/thin/bridge.go |
| +++ b/internal/runner/thin/bridge.go |
| @@ -100,15 +100,30 @@ func (b *bridge) call(ctx context.Context, person, turn string, attempt int64, n |
| } |
| // Creation progress is kept with the call: a resent call never |
| // creates twice, and a repository that already exists (an earlier |
| - // answer was lost) is adopted. |
| + // answer was lost, or another writer made it) is adopted as it is. |
| + // "made" is recorded only once the hub answered that this call |
| + // created it, so only such a repository gets main started, also |
| + // when a resent call finishes a start that failed. |
| state, err := b.State.creation(ctx, base, repo) |
| if err != nil { |
| return toolCreateError, true |
| } |
| - if state == "" { |
| - exists, err := b.Forge.Exists(ctx, repo) |
| - if err == nil && !exists { |
| - err = b.Forge.Create(ctx, repo) |
| + if state == "" || state == "made" { |
| + ours := state == "made" |
| + if !ours { |
| + var exists bool |
| + if exists, err = b.Forge.Exists(ctx, repo); err == nil && !exists { |
| + switch err = b.Forge.Create(ctx, repo); { |
| + case err == nil: |
| + ours, err = true, b.State.setCreation(ctx, base, repo, "made") |
| + case errors.Is(err, ErrAdopted): |
| + err = nil |
| + } |
| + } |
| + } |
| + if err == nil && ours && b.Clones != nil { |
| + // main first, so task branches start from it and merge into it. |
| + err = b.Clones.StartDefault(ctx, repo) |
| } |
| if err == nil { |
| err = b.State.setCreation(ctx, base, repo, "created") |
diff --git a/internal/runner/thin/claude.go b/internal/runner/thin/claude.go| index cb80a226..402d40c0 100644 |
| --- a/internal/runner/thin/claude.go |
| +++ b/internal/runner/thin/claude.go |
| @@ -277,6 +277,9 @@ func (c *coordBase) log(msg string, err error) { |
| // sanitize keeps only provider error codes: no paths or provider output. |
| func sanitize(err error) string { |
| + if reason := provider.ContainmentReason(err); reason != "" { |
| + return string(provider.ErrContainment) + ": " + reason |
| + } |
| var p provider.Error |
| if errors.As(err, &p) { |
| return string(p) |
diff --git a/internal/runner/thin/copy_reason_test.go b/internal/runner/thin/copy_reason_test.go| new file mode 100644 |
| index 00000000..5a78e489 |
| --- /dev/null |
| +++ b/internal/runner/thin/copy_reason_test.go |
| @@ -0,0 +1,39 @@ |
| +package thin |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "os" |
| + "path/filepath" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/provider" |
| +) |
| + |
| +// The log keeps a containment refusal's fixed category (2026-11-20: |
| +// production logged only provider_account_containment). |
| +func TestSanitizeKeepsContainmentReason(t *testing.T) { |
| + root := t.TempDir() |
| + home := filepath.Join(root, "claude-1") |
| + id := provider.Identity{AccountID: "token:claude-1", HomeID: "h", ProviderVersion: provider.ClaudeVersion} |
| + raw, _ := json.Marshal(id) |
| + if os.Mkdir(home, 0700) != nil || os.WriteFile(filepath.Join(home, provider.IdentityFile), raw, 0600) != nil || os.WriteFile(filepath.Join(home, provider.TokenFile), []byte("sk-ant-oat01-canary"), 0600) != nil { |
| + t.Fatal("home") |
| + } |
| + b := provider.Binding{ID: "claude-1", Home: home, AccountID: id.AccountID, Provider: "claude", Token: true, Expected: id, RuntimeRoot: filepath.Join(root, "homes")} |
| + l, err := provider.OpenRuntimeCopy(context.Background(), b, func(context.Context, provider.Binding) (provider.Identity, error) { return id, nil }, time.Second) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer l.Close() |
| + if err = os.WriteFile(filepath.Join(l.Binding().Home, provider.TokenFile), []byte("x"), 0600); err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := sanitize(l.CheckCopy(context.Background())); got != "provider_account_containment: runtime_token_credential" { |
| + t.Fatalf("logged %q", got) |
| + } |
| + if got := sanitize(provider.ErrPolicy); got != "provider_policy_rejected" { |
| + t.Fatalf("logged %q", got) |
| + } |
| +} |
diff --git a/internal/runner/thin/forge.go b/internal/runner/thin/forge.go| index 58d48d16..2baf2817 100644 |
| --- a/internal/runner/thin/forge.go |
| +++ b/internal/runner/thin/forge.go |
| @@ -35,7 +35,8 @@ type Forge interface { |
| Remote(ctx context.Context, repo string) (workspace.Remote, error) |
| // CreateIn lists namespaces the runner's agent may create repositories in. |
| CreateIn(ctx context.Context) []string |
| - // Create makes a new private repository and adds it to Repos. |
| + // Create makes a new private repository and adds it to Repos. One that |
| + // exists already is added too, with ErrAdopted: it is not this runner's. |
| Create(ctx context.Context, repo string) error |
| // Reachable lists every repository the agent can reach, for the |
| // context index. It includes Repos. |
| @@ -54,6 +55,11 @@ type Forge interface { |
| // ErrNoCreate means repositories cannot be created in that namespace. |
| var ErrNoCreate = errors.New("repository creation is not available here") |
| +// ErrAdopted means Create did not make the repository: it existed, or the |
| +// hub's answer was lost and it exists now. It is adopted, and is not this |
| +// runner's to start. |
| +var ErrAdopted = errors.New("the repository already exists; adopted") |
| + |
| // ErrEmptyRepo means the forge serves the repository and it has no |
| // commits yet: no branch, nothing to read. It is not an access failure. |
| var ErrEmptyRepo = errors.New("the repository has no commits yet") |
| @@ -263,6 +269,8 @@ func (f *fileForge) Exists(ctx context.Context, repo string) (bool, error) { |
| // Create makes repo once: an existing one (an earlier answer was lost) is |
| // adopted, and after any failure the hub is asked again before giving up. |
| +// Only the hub's own "created" answer makes it this runner's; an adopted |
| +// one returns ErrAdopted. |
| func (f *fileForge) Create(ctx context.Context, repo string) error { |
| parts := strings.Split(strings.TrimPrefix(repo, nsPrefix), "/") |
| if !ValidNewRepo(repo) || !slices.Contains(f.CreateIn(ctx), parts[0]) { |
| @@ -271,7 +279,7 @@ func (f *fileForge) Create(ctx context.Context, repo string) error { |
| if ok, err := f.Exists(ctx, repo); err != nil { |
| return err |
| } else if ok { |
| - return f.record(repo) |
| + return f.adopt(repo) |
| } |
| c, err := f.agent(ctx) |
| if err != nil { |
| @@ -288,12 +296,20 @@ func (f *fileForge) Create(ctx context.Context, repo string) error { |
| return f.record(repo) |
| } |
| } |
| + // "Already exists", or no answer: someone else's, or not known to be ours. |
| if ok, xerr := f.Exists(ctx, repo); xerr == nil && ok { |
| - return f.record(repo) |
| + return f.adopt(repo) |
| } |
| return ErrNoCreate |
| } |
| +func (f *fileForge) adopt(repo string) error { |
| + if err := f.record(repo); err != nil { |
| + return err |
| + } |
| + return ErrAdopted |
| +} |
| + |
| // Merge sends the hub the merge request with the agent's credential for |
| // repo (its own entry, or the agent-wide one). |
| func (f *fileForge) Merge(ctx context.Context, repo, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| @@ -397,20 +413,9 @@ func (c *Clones) fetch(ctx context.Context, repo string, shallow bool, branch st |
| if err != nil { |
| return err |
| } |
| - env := workspace.GitEnvironment() |
| - env["HOME"] = "/nonexistent" |
| - protocol := "https" |
| - if filepath.IsAbs(remote.URL) { |
| - protocol = "file" |
| - if remote.GitPassword != "" { |
| - return ErrNoCreate |
| - } |
| - } else if remote.GitPassword == "" || !strings.HasPrefix(remote.URL, "https://") { |
| - return workspace.ErrGitPassword |
| - } else { |
| - env["GIT_CONFIG_COUNT"] = "10" |
| - env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| + env, protocol, err := remoteEnv(remote) |
| + if err != nil { |
| + return err |
| } |
| dir := c.Path(repo) |
| if err = os.MkdirAll(filepath.Dir(dir), 0700); err != nil { |
| @@ -475,6 +480,148 @@ func groupCommand(ctx context.Context, name string, args ...string) *exec.Cmd { |
| return cmd |
| } |
| +// remoteEnv is git's environment for a resolved remote: no home, and the |
| +// password only in a header. A local path takes no password; an https |
| +// remote needs one. |
| +func remoteEnv(remote workspace.Remote) (map[string]string, string, error) { |
| + env := workspace.GitEnvironment() |
| + env["HOME"] = "/nonexistent" |
| + if filepath.IsAbs(remote.URL) { |
| + if remote.GitPassword != "" { |
| + return nil, "", ErrNoCreate |
| + } |
| + return env, "file", nil |
| + } |
| + if remote.GitPassword == "" || !strings.HasPrefix(remote.URL, "https://") { |
| + return nil, "", workspace.ErrGitPassword |
| + } |
| + env["GIT_CONFIG_COUNT"] = "10" |
| + env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| + return env, "https", nil |
| +} |
| + |
| +// startDefaultGap runs between StartDefault's emptiness check and its |
| +// push; tests put another writer there. |
| +var startDefaultGap = func() {} |
| + |
| +// startDate makes the start commit the same bytes every time. |
| +const startDate = "2026-01-01T00:00:00+0000" |
| + |
| +// lsRefs reads ls-remote's lines: each ref once, without HEAD and without |
| +// the peeled lines of annotated tags (refs/tags/v1^{}), which are no refs |
| +// of their own. |
| +func lsRefs(out string) map[string]string { |
| + got := map[string]string{} |
| + for _, line := range strings.Split(out, "\n") { |
| + if sha, ref, ok := strings.Cut(line, "\t"); ok && ref != "HEAD" && !strings.HasSuffix(ref, "^{}") { |
| + got[ref] = sha |
| + } |
| + } |
| + return got |
| +} |
| + |
| +// StartDefault gives a repository this runner just created its default |
| +// branch before any task branch exists: main, at an empty first commit |
| +// with no parent. Task branches then start from main, and every merge |
| +// targets it. Left unborn, the hub made the first task branch pushed the |
| +// default, and a later task's merge was asked to merge into that |
| +// unrelated branch. A repository with any ref at all is left alone. |
| +// |
| +// Another writer may push between the check and the push. The start |
| +// commit is deterministic (fixed dates), so main is recognisable as this |
| +// start, and it is pushed create-only (an empty lease): a main of theirs |
| +// is never replaced, and is the default. Any other ref that does not |
| +// start from this main fails the start, now and on every retry; main is |
| +// withdrawn when the forge allows (only while it is still the start), so |
| +// no main unrelated to their work is left behind quietly. |
| +func (c *Clones) StartDefault(ctx context.Context, repo string) error { |
| + if !repoKey.MatchString(repo) { |
| + return ErrNoCreate |
| + } |
| + remote, err := readRemote(ctx, c.Forge, repo) |
| + if err != nil { |
| + return err |
| + } |
| + refs := func() (map[string]string, error) { |
| + out, err := c.lsRemote(ctx, remote, "--", remote.URL) |
| + if err != nil { |
| + return nil, err |
| + } |
| + return lsRefs(string(out)), nil |
| + } |
| + env, protocol, err := remoteEnv(remote) |
| + if err != nil { |
| + return err |
| + } |
| + dir, err := os.MkdirTemp(c.Root, "start-") |
| + if err != nil { |
| + return err |
| + } |
| + defer os.RemoveAll(dir) |
| + for k, v := range map[string]string{"GIT_DIR": dir, "GIT_AUTHOR_NAME": commitName, "GIT_AUTHOR_EMAIL": commitEmail, "GIT_COMMITTER_NAME": commitName, "GIT_COMMITTER_EMAIL": commitEmail, "GIT_AUTHOR_DATE": startDate, "GIT_COMMITTER_DATE": startDate} { |
| + env[k] = v |
| + } |
| + git := func(stdin string, args ...string) (string, error) { |
| + cmd := groupCommand(ctx, c.Git, append([]string{"-c", "protocol." + protocol + ".allow=always", "-c", "http.followRedirects=false"}, args...)...) |
| + cmd.Dir = dir |
| + for k, v := range env { |
| + cmd.Env = append(cmd.Env, k+"="+v) |
| + } |
| + cmd.Stdin, cmd.Stderr = strings.NewReader(stdin), io.Discard |
| + out, err := cmd.Output() |
| + return strings.TrimSpace(string(out)), err |
| + } |
| + if _, err := git("", "init", "-q", "--bare", "--template=", dir); err != nil { |
| + return err |
| + } |
| + tree, err := git("", "hash-object", "-t", "tree", "-w", "--stdin") |
| + if err != nil { |
| + return err |
| + } |
| + sha, err := git("Start the repository\n", "commit-tree", tree) |
| + if err != nil || !shaPattern.MatchString(sha) { |
| + return fmt.Errorf("start %s: no first commit", repo) |
| + } |
| + main := "refs/heads/" + unbornDefault |
| + have, err := refs() |
| + if err != nil { |
| + return err |
| + } |
| + if len(have) == 0 { |
| + startDefaultGap() |
| + _, perr := git("", "push", "-q", "--no-verify", "--force-with-lease="+main+":", "--", remote.URL, sha+":"+main) |
| + if have, err = refs(); err != nil { |
| + return err |
| + } |
| + if perr != nil && have[main] == "" { |
| + return fmt.Errorf("start %s: push main: %w", repo, perr) |
| + } |
| + } |
| + if have[main] != sha { |
| + return nil // refs of their own, or their main: left as they are |
| + } |
| + delete(have, main) |
| + if len(have) == 0 { |
| + return nil |
| + } |
| + if _, err := git("", "fetch", "-q", "--no-tags", "--", remote.URL, "+refs/*:refs/check/*"); err == nil { |
| + related := true |
| + for ref := range have { |
| + if _, err := git("", "merge-base", "--is-ancestor", sha, "refs/check/"+strings.TrimPrefix(ref, "refs/")); err != nil { |
| + related = false |
| + } |
| + } |
| + if related { |
| + return nil |
| + } |
| + } |
| + if _, err := git("", "push", "-q", "--no-verify", "--force-with-lease="+main+":"+sha, "--", remote.URL, ":"+main); err != nil { |
| + return fmt.Errorf("start %s: another writer's branch does not start from main, and main could not be withdrawn: %w", repo, err) |
| + } |
| + return fmt.Errorf("start %s: another writer's branch does not start from main; main withdrawn", repo) |
| +} |
| + |
| // DefaultBranch asks the remote which branch HEAD names. |
| func (c *Clones) DefaultBranch(ctx context.Context, repo string) (string, error) { |
| remote, err := readRemote(ctx, c.Forge, repo) |
diff --git a/internal/runner/thin/start_default_test.go b/internal/runner/thin/start_default_test.go| new file mode 100644 |
| index 00000000..7557bc28 |
| --- /dev/null |
| +++ b/internal/runner/thin/start_default_test.go |
| @@ -0,0 +1,384 @@ |
| +package thin |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "errors" |
| + "net/http" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// creatingForge makes each repository it creates as an empty bare |
| +// repository, the way the hub serves a new one. |
| +type creatingForge struct { |
| + pathForge |
| + t *testing.T |
| + failPush bool |
| +} |
| + |
| +func (f *creatingForge) Create(ctx context.Context, repo string) error { |
| + if err := f.countingForge.Create(ctx, repo); err != nil { |
| + return err |
| + } |
| + gitT(f.t, filepath.Dir(f.path(repo)), "init", "-q", "--bare", "-b", "main", f.path(repo)) |
| + if f.failPush { |
| + // The hub refuses the first push: no main, and nothing recorded. |
| + os.Chmod(filepath.Join(f.path(repo), "objects"), 0500) |
| + f.t.Cleanup(func() { os.Chmod(filepath.Join(f.path(repo), "objects"), 0700) }) |
| + } |
| + return nil |
| +} |
| + |
| +func startRig(t *testing.T) (*creatingForge, *Clones) { |
| + t.Helper() |
| + root := t.TempDir() |
| + f := &creatingForge{pathForge: pathForge{root: filepath.Join(root, "forge")}, t: t} |
| + os.MkdirAll(f.root, 0700) |
| + os.MkdirAll(filepath.Join(root, "work"), 0700) |
| + return f, &Clones{Root: filepath.Join(root, "work"), Git: "git", Forge: f} |
| +} |
| + |
| +// A repository Equipo creates gets its default branch, main, at an empty |
| +// first commit before any task branch exists. Task branches then start |
| +// from main and every merge targets it. Without it, the hub made the |
| +// first task branch pushed the default, and the next task's merge was |
| +// asked to merge into that unrelated branch ("could not compute the |
| +// merge"). |
| +func TestStartDefaultMakesMainBeforeAnyTaskBranch(t *testing.T) { |
| + f, c := startRig(t) |
| + const repo = "amadan.net/oficina/site" |
| + ctx := context.Background() |
| + if err := f.Create(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := c.DefaultBranch(ctx, repo); !errors.Is(err, ErrEmptyRepo) { |
| + t.Fatalf("a new repository should start empty: %v", err) |
| + } |
| + if err := c.StartDefault(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + remote := f.path(repo) |
| + if refs := gitT(t, remote, "for-each-ref", "--format=%(refname)"); refs != "refs/heads/main" { |
| + t.Fatalf("refs after start: %q", refs) |
| + } |
| + main := gitT(t, remote, "rev-parse", "refs/heads/main") |
| + if tree := gitT(t, remote, "rev-parse", main+"^{tree}"); tree != gitT(t, remote, "hash-object", "-t", "tree", "/dev/null") { |
| + t.Fatalf("main's first commit is not empty: tree %s", tree) |
| + } |
| + if parents := gitT(t, remote, "rev-list", "--parents", "-n1", main); parents != main { |
| + t.Fatalf("main's first commit has parents: %s", parents) |
| + } |
| + if def, err := c.DefaultBranch(ctx, repo); err != nil || def != "main" { |
| + t.Fatalf("default after start: %q %v", def, err) |
| + } |
| + // Again (a resent create): nothing new. |
| + if err := c.StartDefault(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if again := gitT(t, remote, "rev-parse", "refs/heads/main"); again != main { |
| + t.Fatalf("main moved on a second start: %s -> %s", main, again) |
| + } |
| +} |
| + |
| +// A repository with any branch already, including one holding only task |
| +// branches (the stuck ones), is left exactly as it is. |
| +func TestStartDefaultLeavesBranchesAlone(t *testing.T) { |
| + f, c := startRig(t) |
| + const repo = "amadan.net/oficina/stuck" |
| + ctx := context.Background() |
| + if err := f.Create(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + seed := filepath.Join(t.TempDir(), "seed") |
| + gitT(t, filepath.Dir(seed), "init", "-q", "-b", "equipo/tk1-demo", seed) |
| + os.WriteFile(filepath.Join(seed, "index.html"), []byte("demo\n"), 0600) |
| + gitT(t, seed, "add", "-A") |
| + gitT(t, seed, "commit", "-q", "-m", "demo") |
| + gitT(t, seed, "push", "-q", f.path(repo), "equipo/tk1-demo") |
| + before := gitT(t, f.path(repo), "for-each-ref", "--format=%(refname) %(objectname)") |
| + if err := c.StartDefault(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if after := gitT(t, f.path(repo), "for-each-ref", "--format=%(refname) %(objectname)"); after != before { |
| + t.Fatalf("refs changed: %q -> %q", before, after) |
| + } |
| +} |
| + |
| +// create_project starts main as part of creating the repository; a |
| +// failed start is not recorded as created, so the resent call (the |
| +// repository exists by then) starts it. |
| +func TestCreateProjectStartsMain(t *testing.T) { |
| + state, err := OpenState(context.Background(), t.TempDir()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer state.Close() |
| + f, c := startRig(t) |
| + f.failPush = true |
| + b := &bridge{State: state, Forge: f, Clones: c, speaks: wire.ProtocolCurrent, trip: func(_ context.Context, call wire.ToolCall) wire.ToolResult { |
| + var in struct{ Repo string } |
| + _ = json.Unmarshal(call.Args, &in) |
| + if call.Name == wire.ToolCreateProject { |
| + return wire.ToolResult{Code: "create", Repo: in.Repo} |
| + } |
| + return wire.ToolResult{Code: "created", Repo: in.Repo, Text: "Created."} |
| + }} |
| + args := json.RawMessage(`{"namespace":"oficina","name":"site"}`) |
| + if _, isErr := b.Call(context.Background(), "p", "t1", 1, wire.ToolCreateProject, "toolu_1", args); !isErr { |
| + t.Fatal("a repository without main was reported created") |
| + } |
| + remote := f.path("amadan.net/oficina/site") |
| + os.Chmod(filepath.Join(remote, "objects"), 0700) |
| + if text, isErr := b.Call(context.Background(), "p", "t1", 1, wire.ToolCreateProject, "toolu_1", args); isErr { |
| + t.Fatalf("resent create: %s", text) |
| + } |
| + if f.creates != 1 { |
| + t.Fatalf("created %d times", f.creates) |
| + } |
| + if refs := gitT(t, remote, "for-each-ref", "--format=%(refname)"); strings.TrimSpace(refs) != "refs/heads/main" { |
| + t.Fatalf("refs after create: %q", refs) |
| + } |
| +} |
| + |
| +// Only a repository this bridge created is started. One that already |
| +// existed, empty or holding only tags, is adopted exactly as it is. |
| +func TestCreateProjectAdoptsExistingRepositoriesAsTheyAre(t *testing.T) { |
| + state, err := OpenState(context.Background(), t.TempDir()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer state.Close() |
| + f, c := startRig(t) |
| + b := &bridge{State: state, Forge: f, Clones: c, speaks: wire.ProtocolCurrent, trip: func(_ context.Context, call wire.ToolCall) wire.ToolResult { |
| + var in struct{ Repo string } |
| + _ = json.Unmarshal(call.Args, &in) |
| + if call.Name == wire.ToolCreateProject { |
| + return wire.ToolResult{Code: "create", Repo: in.Repo} |
| + } |
| + return wire.ToolResult{Code: "created", Repo: in.Repo, Text: "Created."} |
| + }} |
| + ctx := context.Background() |
| + for i, name := range []string{"empty", "tagged"} { |
| + repo := "amadan.net/oficina/" + name |
| + if err := f.Create(ctx, repo); err != nil { // someone else's, before the call |
| + t.Fatal(err) |
| + } |
| + if name == "tagged" { |
| + seed := filepath.Join(t.TempDir(), "seed") |
| + gitT(t, filepath.Dir(seed), "init", "-q", seed) |
| + gitT(t, seed, "commit", "-q", "--allow-empty", "-m", "tagged") |
| + gitT(t, seed, "push", "-q", f.path(repo), "HEAD:refs/tags/v1") |
| + } |
| + before := gitT(t, f.path(repo), "for-each-ref", "--format=%(refname) %(objectname)") |
| + call := "toolu_adopt" + string(rune('0'+i)) |
| + if text, isErr := b.Call(ctx, "p", "t3", 1, wire.ToolCreateProject, call, json.RawMessage(`{"namespace":"oficina","name":"`+name+`"}`)); isErr { |
| + t.Fatalf("adopt %s: %s", name, text) |
| + } |
| + if after := gitT(t, f.path(repo), "for-each-ref", "--format=%(refname) %(objectname)"); after != before { |
| + t.Fatalf("%s changed on adoption: %q -> %q", name, before, after) |
| + } |
| + } |
| + if f.creates != 2 { |
| + t.Fatalf("adoption created repositories: %d creates", f.creates) |
| + } |
| +} |
| + |
| +// A repository holding only tags is not empty: StartDefault leaves it. |
| +func TestStartDefaultLeavesTagsAlone(t *testing.T) { |
| + f, c := startRig(t) |
| + const repo = "amadan.net/oficina/tags" |
| + ctx := context.Background() |
| + if err := f.Create(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + seed := filepath.Join(t.TempDir(), "seed") |
| + gitT(t, filepath.Dir(seed), "init", "-q", seed) |
| + gitT(t, seed, "commit", "-q", "--allow-empty", "-m", "tagged") |
| + gitT(t, seed, "push", "-q", f.path(repo), "HEAD:refs/tags/v1") |
| + if err := c.StartDefault(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if refs := gitT(t, f.path(repo), "for-each-ref", "--format=%(refname)"); refs != "refs/tags/v1" { |
| + t.Fatalf("refs: %q", refs) |
| + } |
| +} |
| + |
| +// Another writer between the emptiness check and the push. A main of |
| +// theirs is never replaced and is the default. A branch of theirs that |
| +// does not start from main fails the start, every time it is retried; |
| +// main is withdrawn where the forge allows deleting it (git refuses to |
| +// delete the current branch, so both are tested). |
| +func TestStartDefaultConcurrentWriter(t *testing.T) { |
| + for _, c := range []struct { |
| + name, theirs string |
| + deletable bool |
| + }{{"their main", "main", false}, {"their branch", "trunk", false}, {"their branch, main withdrawn", "trunk", true}} { |
| + t.Run(c.name, func(t *testing.T) { |
| + f, clones := startRig(t) |
| + const repo = "amadan.net/oficina/raced" |
| + ctx := context.Background() |
| + if err := f.Create(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if c.deletable { |
| + gitT(t, f.path(repo), "config", "receive.denyDeleteCurrent", "false") |
| + } |
| + seed := filepath.Join(t.TempDir(), "seed") |
| + gitT(t, filepath.Dir(seed), "init", "-q", "-b", c.theirs, seed) |
| + os.WriteFile(filepath.Join(seed, "index.html"), []byte("theirs\n"), 0600) |
| + gitT(t, seed, "add", "-A") |
| + gitT(t, seed, "commit", "-q", "-m", "theirs") |
| + tip := gitT(t, seed, "rev-parse", "HEAD") |
| + old := startDefaultGap |
| + t.Cleanup(func() { startDefaultGap = old }) |
| + startDefaultGap = func() { gitT(t, seed, "push", "-q", f.path(repo), c.theirs) } |
| + err := clones.StartDefault(ctx, repo) |
| + startDefaultGap = func() {} |
| + again := clones.StartDefault(ctx, repo) |
| + refs := gitT(t, f.path(repo), "for-each-ref", "--format=%(refname) %(objectname)") |
| + theirs := "refs/heads/" + c.theirs + " " + tip |
| + switch { |
| + case c.theirs == "main": |
| + if err != nil || again != nil || refs != theirs { |
| + t.Fatalf("their main: %v / %v, refs %q", err, again, refs) |
| + } |
| + case c.deletable: |
| + if err == nil || refs != theirs { |
| + t.Fatalf("main left beside their branch: %v, refs %q", err, refs) |
| + } |
| + default: |
| + if err == nil || again == nil || !strings.Contains(refs, theirs) { |
| + t.Fatalf("a start beside their unrelated branch reported success: %v / %v, refs %q", err, again, refs) |
| + } |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// Create owns a repository only when the hub answered that it created |
| +// it. "Already exists", or an answer that never came while the |
| +// repository turns out to exist, is adopted and not this runner's. |
| +func TestFileForgeCreateOwnsOnlyWhatTheHubCreated(t *testing.T) { |
| + for _, c := range []struct { |
| + name string |
| + before bool // the repository exists before the request |
| + status int // the hub's answer to the create; 0 drops it |
| + afterward bool // it exists when asked again |
| + want error |
| + }{ |
| + {"created", false, http.StatusOK, true, nil}, |
| + {"exists already", true, 0, true, ErrAdopted}, |
| + {"another writer won", false, http.StatusConflict, true, ErrAdopted}, |
| + {"answer lost", false, 0, true, ErrAdopted}, |
| + {"refused", false, http.StatusForbidden, false, ErrNoCreate}, |
| + } { |
| + t.Run(c.name, func(t *testing.T) { |
| + exists, posts := c.before, 0 |
| + f := accessForge(t, func(w http.ResponseWriter, r *http.Request) { |
| + switch { |
| + case r.Method == http.MethodGet && r.URL.Path == "/api/v1/repos": |
| + repos := `{"ns":"oficina","name":"other"}` |
| + if exists { |
| + repos += `,{"ns":"oficina","name":"site"}` |
| + } |
| + w.Write([]byte(`{"repos":[` + repos + `]}`)) |
| + case r.Method == http.MethodPost && r.URL.Path == "/api/v1/repos": |
| + posts++ |
| + exists = c.afterward |
| + if c.status == 0 { |
| + hj, _ := w.(http.Hijacker) |
| + conn, _, _ := hj.Hijack() |
| + conn.Close() |
| + return |
| + } |
| + w.WriteHeader(c.status) |
| + default: |
| + w.WriteHeader(http.StatusNotFound) |
| + } |
| + }) |
| + err := f.Create(context.Background(), "amadan.net/oficina/site") |
| + if !errors.Is(err, c.want) || c.want == nil && err != nil { |
| + t.Fatalf("Create = %v, want %v", err, c.want) |
| + } |
| + if c.before && posts != 0 { |
| + t.Fatal("asked the hub to create a repository that exists") |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// Another writer creates the repository between Exists and Create: |
| +// create_project adopts it and never starts main in it, then or on retry. |
| +func TestCreateProjectNeverStartsARepositoryItDidNotMake(t *testing.T) { |
| + state, err := OpenState(context.Background(), t.TempDir()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + defer state.Close() |
| + f, c := startRig(t) |
| + lost := &adoptingForge{creatingForge: f} |
| + b := &bridge{State: state, Forge: lost, Clones: c, speaks: wire.ProtocolCurrent, trip: func(_ context.Context, call wire.ToolCall) wire.ToolResult { |
| + var in struct{ Repo string } |
| + _ = json.Unmarshal(call.Args, &in) |
| + if call.Name == wire.ToolCreateProject { |
| + return wire.ToolResult{Code: "create", Repo: in.Repo} |
| + } |
| + return wire.ToolResult{Code: "created", Repo: in.Repo, Text: "Created."} |
| + }} |
| + args := json.RawMessage(`{"namespace":"oficina","name":"site"}`) |
| + for range 2 { |
| + if text, isErr := b.Call(context.Background(), "p", "t4", 1, wire.ToolCreateProject, "toolu_4", args); isErr { |
| + t.Fatalf("adopt: %s", text) |
| + } |
| + if refs := gitT(t, f.path("amadan.net/oficina/site"), "for-each-ref"); refs != "" { |
| + t.Fatalf("main started in someone else's repository: %q", refs) |
| + } |
| + } |
| +} |
| + |
| +// adoptingForge loses the race: the repository is made, by someone else. |
| +type adoptingForge struct{ *creatingForge } |
| + |
| +func (f *adoptingForge) Create(ctx context.Context, repo string) error { |
| + if err := f.creatingForge.Create(ctx, repo); err != nil { |
| + return err |
| + } |
| + return ErrAdopted |
| +} |
| + |
| +// An annotated tag on the start commit: ls-remote lists it peeled too |
| +// (refs/tags/v1^{}), and neither line is someone else's unrelated work. |
| +func TestStartDefaultAnnotatedTagOnMain(t *testing.T) { |
| + f, c := startRig(t) |
| + const repo = "amadan.net/oficina/tagged-main" |
| + ctx := context.Background() |
| + if err := f.Create(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := c.StartDefault(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + main := gitT(t, f.path(repo), "rev-parse", "refs/heads/main") |
| + gitT(t, f.path(repo), "tag", "-a", "-m", "first", "v1", main) |
| + if err := c.StartDefault(ctx, repo); err != nil { |
| + t.Fatalf("an annotated tag on main failed the start: %v", err) |
| + } |
| + if again := gitT(t, f.path(repo), "rev-parse", "refs/heads/main"); again != main { |
| + t.Fatalf("main changed: %s -> %s", main, again) |
| + } |
| +} |
| + |
| +// lsRefs keeps each ref once: HEAD and the peeled lines of annotated tags |
| +// (refs/tags/v1^{}) are not refs of their own. |
| +func TestLsRefsSkipsHeadAndPeeledTags(t *testing.T) { |
| + a, b := strings.Repeat("a", 40), strings.Repeat("b", 40) |
| + got := lsRefs(a + "\tHEAD\n" + a + "\trefs/heads/main\n" + b + "\trefs/tags/v1\n" + a + "\trefs/tags/v1^{}\n") |
| + if len(got) != 2 || got["refs/heads/main"] != a || got["refs/tags/v1"] != b { |
| + t.Fatalf("lsRefs = %v", got) |
| + } |
| +} |
diff --git a/internal/runner/thin/state.go b/internal/runner/thin/state.go| index 304b6de2..e215ddc2 100644 |
| --- a/internal/runner/thin/state.go |
| +++ b/internal/runner/thin/state.go |
| @@ -303,7 +303,9 @@ type run struct { |
| } |
| // creation is how far a create_project call got: "" (not started), |
| -// "created" (the repository exists) or "done" (the instance has it). |
| +// "made" (the hub answered that this call created it, so it is ours to |
| +// start), "created" (the repository exists, started) or "done" (the |
| +// instance has it). |
| func (s *State) creation(ctx context.Context, callID, repo string) (string, error) { |
| var state, got string |
| err := s.db.QueryRowContext(ctx, "SELECT repo, state FROM creations WHERE call_id=?", callID).Scan(&got, &state) |
diff --git a/internal/thintest/batching_contract_test.go b/internal/thintest/batching_contract_test.go| index ef5e7a36..3d6849fd 100644 |
| --- a/internal/thintest/batching_contract_test.go |
| +++ b/internal/thintest/batching_contract_test.go |
| @@ -3,6 +3,7 @@ package thintest |
| import ( |
| "context" |
| "fmt" |
| + "strconv" |
| "strings" |
| "testing" |
| "time" |
| @@ -71,6 +72,14 @@ func (r *rig) turnIs(id, state string) wire.Turn { |
| // batchFrame expects the next message frame to be the batch: the three |
| // messages apart and in order, and nothing else. |
| func (r *rig) batchFrame(runner *FakeRunner, batch string, texts ...string) wire.Frame { |
| + r.t.Helper() |
| + return r.batchFrameCarrying(runner, batch, nil, texts...) |
| +} |
| + |
| +// batchFrameCarrying is batchFrame for a batch after failed turns: their |
| +// person's words (carried) come first in PersonText, marked unanswered |
| +// in Text before the batch. |
| +func (r *rig) batchFrameCarrying(runner *FakeRunner, batch string, carried []string, texts ...string) wire.Frame { |
| r.t.Helper() |
| ctx, cancel := context.WithTimeout(r.ctx, 10*time.Second) |
| defer cancel() |
| @@ -79,13 +88,20 @@ func (r *rig) batchFrame(runner *FakeRunner, batch string, texts ...string) wire |
| r.t.Fatalf("no next turn: %v", err) |
| } |
| cmd := body.(*wire.MessageCommand) |
| - if cmd.TurnID != batch || len(cmd.PersonText) != len(texts) { |
| + if cmd.TurnID != batch || len(cmd.PersonText) != len(carried)+len(texts) { |
| r.t.Fatalf("next turn %s carries %q, not the batch %s", cmd.TurnID, cmd.PersonText, batch) |
| } |
| at := -1 |
| + for i, text := range carried { |
| + n := strings.Index(cmd.Text, "Not yet answered, the person's words: "+strconv.Quote(text)) |
| + if n <= at || cmd.PersonText[i] != text { |
| + r.t.Fatalf("batch lacks unanswered %q in place:\n%s", text, cmd.Text) |
| + } |
| + at = n |
| + } |
| for i, text := range texts { |
| n := strings.Index(cmd.Text, "Message "+string(rune('1'+i))+" of "+string(rune('0'+len(texts)))+":\n"+text) |
| - if n <= at || cmd.PersonText[i] != text { |
| + if n <= at || cmd.PersonText[len(carried)+i] != text { |
| r.t.Fatalf("batch lacks %q in place:\n%s", text, cmd.Text) |
| } |
| at = n |
| @@ -192,7 +208,7 @@ func TestBatchStrandedRecovers(t *testing.T) { |
| r.inst.Restart(t) |
| again := r.dial(runner.Welcome.Generation) |
| again.Send(r.ctx, "s1", wire.FrameSync, wire.Sync{Sessions: []wire.SessionState{}, Runs: []wire.Run{}}) |
| - f := r.batchFrame(again, batch, "alpha", "bravo", "charlie") |
| + f := r.batchFrameCarrying(again, batch, []string{"one"}, "alpha", "bravo", "charlie") |
| again.Send(r.ctx, "s2", wire.FrameSync, wire.Sync{Sessions: []wire.SessionState{}, Runs: []wire.Run{}}) |
| again.Send(r.ctx, "ab", wire.FrameAck, wire.Ack{ID: f.ID}) |
| r.turnIs(batch, wire.TurnRunning) |
| @@ -200,8 +216,9 @@ func TestBatchStrandedRecovers(t *testing.T) { |
| } |
| // However the running turn ends (failed, cancelled, or lost across a |
| -// runner reconnect), the batch goes next, once, and the failed turn's own |
| -// message is not answered again inside it. |
| +// runner reconnect), the batch goes next, once, and the ended turn keeps |
| +// its own message. A failed turn's words ride before the batch, marked |
| +// unanswered; a cancelled turn's do not (the person stopped it). |
| func TestBatchAfterTurnEnds(t *testing.T) { |
| for _, end := range []string{"failed", "cancelled", "interrupted"} { |
| t.Run(end, func(t *testing.T) { |
| @@ -226,7 +243,11 @@ func TestBatchAfterTurnEnds(t *testing.T) { |
| runner = r.dial(0) |
| runner.Send(r.ctx, "e1", wire.FrameSync, wire.Sync{Sessions: []wire.SessionState{}, Runs: []wire.Run{}}) |
| } |
| - r.batchFrame(runner, batch, "alpha", "bravo", "charlie") |
| + var carried []string |
| + if end != "cancelled" { |
| + carried = []string{"one"} |
| + } |
| + r.batchFrameCarrying(runner, batch, carried, "alpha", "bravo", "charlie") |
| if st, _ := r.client.Turn(r.ctx, busy.Turn.ID); !wire.Terminal(st.State) || len(st.MessageIDs) != 1 { |
| t.Fatalf("ended turn %+v", st) |
| } |
diff --git a/internal/thintest/carried_contract_test.go b/internal/thintest/carried_contract_test.go| new file mode 100644 |
| index 00000000..e0aa0c81 |
| --- /dev/null |
| +++ b/internal/thintest/carried_contract_test.go |
| @@ -0,0 +1,138 @@ |
| +package thintest |
| + |
| +import ( |
| + "slices" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// Words a failed turn carries into the next (dispatch's unanswered): |
| +// only a plain message the coordinator never saw, and in the turn that |
| +// carries them they are the person's words for team_request too. |
| + |
| +// failTurn reports id failed at attempt 1 and waits for it to end. |
| +func (r *rig) failTurn(runner *FakeRunner, id string) { |
| + r.t.Helper() |
| + if err := runner.Send(r.ctx, "e-"+id, wire.FrameTurn, wire.TurnReport{TurnID: id, Attempt: 1, State: wire.TurnFailed, Reason: "policy_rejected"}); err != nil { |
| + r.t.Fatal(err) |
| + } |
| + for deadline := time.Now().Add(10 * time.Second); time.Now().Before(deadline); time.Sleep(20 * time.Millisecond) { |
| + var state string |
| + if err := r.inst.DB.Writer().QueryRow("SELECT state FROM chat_turns WHERE id = ?", id).Scan(&state); err == nil && state == wire.TurnFailed { |
| + return |
| + } |
| + } |
| + r.t.Fatalf("turn %s did not fail", id) |
| +} |
| + |
| +// A turn that reached the model (a delta or a thinking or tool activity |
| +// was recorded for it) is not carried: its words may already be in a |
| +// resumed session's transcript. One that failed before is. |
| +func TestContractCarriedOnlyBeforeTheModel(t *testing.T) { |
| + r := newRig(t) |
| + runner := r.dial(0) |
| + turn := func(text, key string) (wire.Sent, *wire.MessageCommand) { |
| + t.Helper() |
| + sent, err := r.client.Send(r.ctx, text, key) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + f, body, err := runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + runner.Send(r.ctx, "a-"+key, wire.FrameAck, wire.Ack{ID: f.ID}) |
| + r.wait("running", func(c *Conversation) bool { return c.Turns[sent.Turn.ID].State == wire.TurnRunning }) |
| + return sent, body.(*wire.MessageCommand) |
| + } |
| + // Frames apply in order: each report lands before the failure after it. |
| + streamed, _ := turn("streamed words", "k1") |
| + runner.Send(r.ctx, "d1", wire.FrameDelta, wire.DeltaReport{TurnID: streamed.Turn.ID, Attempt: 1, Text: "Looking"}) |
| + r.failTurn(runner, streamed.Turn.ID) |
| + thought, cmd := turn("thought words", "k2") |
| + if slices.Contains(cmd.PersonText, "streamed words") { |
| + t.Fatalf("a turn that streamed was carried %q", cmd.PersonText) |
| + } |
| + runner.Send(r.ctx, "t2", wire.FrameActivity, wire.ActivityReport{TurnID: thought.Turn.ID, Attempt: 1, Kind: wire.ActivityThink}) |
| + r.failTurn(runner, thought.Turn.ID) |
| + early, cmd := turn("early words", "k3") |
| + if len(cmd.PersonText) != 1 || strings.Contains(cmd.Text, "Not yet answered") { |
| + t.Fatalf("a turn that reached the model was carried %q", cmd.PersonText) |
| + } |
| + r.failTurn(runner, early.Turn.ID) |
| + last, cmd := turn("last", "k4") |
| + if strings.Join(cmd.PersonText, "|") != "early words|last" { |
| + t.Fatalf("a turn that failed before the model was not carried %q", cmd.PersonText) |
| + } |
| + // The turn that carried them reached the model: they are in its |
| + // transcript now, and ride no further. |
| + runner.Send(r.ctx, "d4", wire.FrameDelta, wire.DeltaReport{TurnID: last.Turn.ID, Attempt: 1, Text: "On it"}) |
| + r.failTurn(runner, last.Turn.ID) |
| + if _, cmd = turn("final", "k5"); len(cmd.PersonText) != 1 { |
| + t.Fatalf("carried past a turn that reached the model %q", cmd.PersonText) |
| + } |
| +} |
| + |
| +// A typed answer to a card is not carried as a plain message: bare, |
| +// "the second one" means nothing without the question it answers. |
| +func TestContractCarriedSkipsCardAnswers(t *testing.T) { |
| + r := newToolRig(t) |
| + if res := r.call("q1", wire.ToolAskPerson, map[string]any{"question": "Which one do you mean?"}); res.Code != "asked" { |
| + t.Fatalf("ask_person %+v", res) |
| + } |
| + r.runner.Send(r.ctx, "rep1", wire.FrameReply, wire.Reply{TurnID: r.turn, Attempt: 1, Text: "Which day suits?"}) |
| + var card wire.Card |
| + r.wait("question card", func(c *Conversation) bool { |
| + for _, k := range c.Cards { |
| + if k.Kind == wire.CardQuestion && k.State == wire.CardOpen { |
| + card = k |
| + return true |
| + } |
| + } |
| + return false |
| + }) |
| + answered, err := r.client.Answer(r.ctx, card.ID, "the second one", card.Revision) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + f, _, err := r.runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + r.runner.Send(r.ctx, "a-ans", wire.FrameAck, wire.Ack{ID: f.ID}) |
| + r.failTurn(r.runner, answered.Turn.ID) |
| + if _, err = r.client.Send(r.ctx, "next", "k-next"); err != nil { |
| + t.Fatal(err) |
| + } |
| + _, body, err := r.runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if cmd := body.(*wire.MessageCommand); len(cmd.PersonText) != 1 || strings.Contains(cmd.Text, "Not yet answered") { |
| + t.Fatalf("a card answer was carried bare %q %q", cmd.PersonText, cmd.Text) |
| + } |
| +} |
| + |
| +// Words a failed Assistant turn left unanswered ride in the next turn, |
| +// and there team_request takes them as the person's: the hand-off is |
| +// their message, as written. Words from no message of theirs still are |
| +// not theirs. |
| +func TestContractCarriedWordsHandOver(t *testing.T) { |
| + o := newTeamRig(t) |
| + lost := o.ask("Can we fix a bug in Tito? Login is broken") |
| + o.failTurn(o.runner, lost) |
| + o.ask("Please continue") |
| + if res := o.use("tr-not", "team_request", map[string]any{"words": "The checkout page is broken"}); !res.IsError || res.Code != "not_their_words" { |
| + t.Fatalf("words from no message %+v", res) |
| + } |
| + request, cmd := o.handoff("tr1", "Login is broken", "") |
| + if !strings.HasPrefix(cmd.Text, "Login is broken") { |
| + t.Fatalf("thread frame %q", cmd.Text) |
| + } |
| + if thread := o.thread(request); len(thread) != 1 || thread[0].Text != "Login is broken" || thread[0].Role != wire.RolePerson { |
| + t.Fatalf("thread %+v", thread) |
| + } |
| +} |
diff --git a/internal/thintest/empty_state_browser_test.go b/internal/thintest/empty_state_browser_test.go| new file mode 100644 |
| index 00000000..b55a88da |
| --- /dev/null |
| +++ b/internal/thintest/empty_state_browser_test.go |
| @@ -0,0 +1,108 @@ |
| +//go:build browser |
| + |
| +package thintest |
| + |
| +import ( |
| + "fmt" |
| + "testing" |
| + "time" |
| + |
| + "github.com/chromedp/chromedp" |
| +) |
| + |
| +// TestBrowserEmptyConversation: Paul, 2026-11-20, on the empty |
| +// conversation's one stern line: "it probably doesn't need to be |
| +// conversational. It can be maybe an illustration or something that |
| +// just entices you to type a first message." An empty conversation |
| +// shows a quiet drawing, a short line and three starters. A starter is a |
| +// real, named button reached by keyboard; tapping one (or Enter on it) |
| +// fills the composer with its opening words and puts the cursor after |
| +// them; it never sends. The starters fit a phone and leave with the |
| +// first message. EQUIPO_BROWSER_ARTIFACTS, when set, gets |
| +// empty-<width>-<scheme>.png for 1280 dark and light and 390 dark and |
| +// light. |
| +func TestBrowserEmptyConversation(t *testing.T) { |
| + r, _ := instantRig(t) |
| + for _, tc := range []struct { |
| + width, height int64 |
| + touch bool |
| + scheme string |
| + }{{1280, 860, false, "dark"}, {1280, 860, false, "light"}, {390, 844, true, "dark"}, {390, 844, true, "light"}} { |
| + t.Run(fmt.Sprintf("%d-%s", tc.width, tc.scheme), func(t *testing.T) { |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), tc.width, tc.height, tc.touch, tc.scheme, "reduce") |
| + defer p.stop() |
| + p.open("/conversation") |
| + p.wait(`document.querySelector('[data-chat-stream]') && document.querySelector('[equipo-offline]').hidden`, "the conversation, online") |
| + p.check(`(()=>{document.documentElement.dataset.theme=`+jsString(tc.scheme)+`;return true})()`, "theme") |
| + // Every POST the page makes is counted: a starter sends nothing. |
| + p.check(`(()=>{const f=window.fetch.bind(window);window.__posts=0;window.fetch=(u,o)=>{if(o&&o.method==='POST')window.__posts++;return f(u,o)};return true})()`, "count posts") |
| + p.wait(`document.querySelector('[data-empty-state="conversation.empty"] svg[aria-hidden="true"]')`, "the drawing, hidden from screen readers") |
| + p.check(`(()=>{const h=document.querySelector('[data-empty-state="conversation.empty"] h2');return !!h && h.textContent.trim()==='What needs doing?'})()`, "the short line is a heading") |
| + p.check(`(()=>{const g=document.querySelector('[equipo-starters]');return !!g && g.getAttribute('aria-label')==='Ways to start'})()`, "the starters are a named group") |
| + p.check(`(()=>{const b=[...document.querySelectorAll('[equipo-starters] button')];return b.length===3 && b.every(x=>x.type==='submit' && x.name==='start' && x.value && x.textContent.trim() && !x.disabled && x.tabIndex===0)})()`, "three real, named buttons") |
| + p.check(`[...document.querySelectorAll('[equipo-starters] button')].map(b=>b.textContent.trim()).join('|')==='Fix a bug|Plan a feature|Ask about a project'`, "starter labels") |
| + min := 32.0 |
| + if tc.touch { |
| + min = 44 |
| + } |
| + p.check(fmt.Sprintf(`[...document.querySelectorAll('[equipo-starters] button')].every(b=>{const r=b.getBoundingClientRect();return r.height>=%v-0.5 && r.right<=innerWidth && r.left>=0})`, min), "starters meet the target floor and fit") |
| + // The empty state sits in the scroll area, above the composer, |
| + // and nothing in it overlaps the composer. |
| + p.check(`(()=>{const e=document.querySelector('[data-empty-state]').getBoundingClientRect(),c=document.querySelector('#chat-composer').getBoundingClientRect();return e.bottom<=c.top+1 && e.top>=0})()`, "the empty state clears the composer") |
| + p.fits("the empty conversation") |
| + p.shot(fmt.Sprintf("empty-%d-%s", tc.width, tc.scheme)) |
| + |
| + // Keyboard: from the conversation's scroll region, Tab reaches |
| + // the first starter, and Enter on it fills the composer. |
| + p.check(`(()=>{document.querySelector('[equipo-scroll]').focus();return document.activeElement===document.querySelector('[equipo-scroll]')})()`, "focus the region") |
| + p.do(chromedp.KeyEvent("\t")) |
| + p.wait(`document.activeElement===document.querySelector('[equipo-starters] button')`, "Tab to the first starter") |
| + p.check(`getComputedStyle(document.activeElement).outlineStyle!=='none'`, "the focused starter shows a ring") |
| + p.do(chromedp.KeyEvent("\r")) |
| + p.wait(`document.activeElement===document.querySelector('#chat-body') && document.querySelector('#chat-body').value==='Fix a bug where '`, "Enter fills the composer") |
| + p.check(`(()=>{const b=document.querySelector('#chat-body');return b.selectionStart===b.value.length && b.selectionEnd===b.value.length})()`, "the cursor is after the words") |
| + p.check(`document.querySelector('#composer').hasAttribute('data-has-content')`, "the send arrow shows") |
| + // A form submission navigates a moment after the click: wait it out. |
| + time.Sleep(400 * time.Millisecond) |
| + p.stayed("a starter") |
| + // Space on a starter does the same. |
| + p.check(`(()=>{const b=document.querySelector('#chat-body');b.value='';b.dispatchEvent(new Event('input'));document.querySelectorAll('[equipo-starters] button')[1].focus();return true})()`, "clear and focus the second starter") |
| + p.do(chromedp.KeyEvent(" ")) |
| + p.wait(`document.activeElement===document.querySelector('#chat-body') && document.querySelector('#chat-body').value==='Plan a feature that '`, "Space fills the composer") |
| + |
| + // A tap on another starter replaces the words it put there. |
| + pick := func(i int) { |
| + t.Helper() |
| + xy := eval[[]float64](p, fmt.Sprintf(`(()=>{const r=document.querySelectorAll('[equipo-starters] button')[%d].getBoundingClientRect();return [r.x+r.width/2,r.y+r.height/2]})()`, i)) |
| + if tc.touch { |
| + p.do(chromedp.TapXY(xy[0], xy[1])) |
| + } else { |
| + p.do(chromedp.MouseClickXY(xy[0], xy[1])) |
| + } |
| + } |
| + pick(2) |
| + p.wait(`document.activeElement===document.querySelector('#chat-body') && document.querySelector('#chat-body').value==='What’s the latest on '`, "a tap fills the composer") |
| + pick(1) |
| + p.wait(`document.querySelector('#chat-body').value==='Plan a feature that '`, "another starter replaces it") |
| + // Words the person typed are theirs: a starter does not wipe them. |
| + p.check(`(()=>{const b=document.querySelector('#chat-body');b.value='Mine';b.dispatchEvent(new Event('input'));return true})()`, "type") |
| + pick(0) |
| + p.wait(`document.activeElement===document.querySelector('#chat-body')`, "focus after a tap") |
| + p.check(`document.querySelector('#chat-body').value==='Mine'`, "typed words kept") |
| + p.check(`window.__posts===0 && !document.querySelector('[equipo-message="own"][data-message]:not(template *)')`, "a starter sent something") |
| + time.Sleep(400 * time.Millisecond) |
| + p.stayed("starters") |
| + p.check(`!!document.querySelector('[data-empty-state]')`, "the empty state stays until a message goes") |
| + }) |
| + } |
| + // The first message takes the empty state and its starters away. |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 860, false, "light", "reduce") |
| + defer p.stop() |
| + p.open("/conversation") |
| + p.wait(`document.querySelector('[equipo-starters] button')`, "starters") |
| + p.check(`(()=>{document.querySelectorAll('[equipo-starters] button')[0].click();return true})()`, "pick") |
| + p.wait(`document.querySelector('#chat-body').value==='Fix a bug where '`, "filled") |
| + p.check(`(()=>{const b=document.querySelector('#chat-body');b.focus();b.setSelectionRange(b.value.length,b.value.length);return true})()`, "cursor at the end") |
| + p.do(chromedp.KeyEvent("the menu sticks"), chromedp.KeyEvent("\r")) |
| + p.wait(`!document.querySelector('[data-empty-state]') && !document.querySelector('[equipo-starters]')`, "the empty state gone after the first message") |
| +} |
diff --git a/internal/thintest/empty_state_pages_test.go b/internal/thintest/empty_state_pages_test.go| new file mode 100644 |
| index 00000000..9a8e5c6b |
| --- /dev/null |
| +++ b/internal/thintest/empty_state_pages_test.go |
| @@ -0,0 +1,50 @@ |
| +package thintest |
| + |
| +import ( |
| + "net/url" |
| + "regexp" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +// TestPagesEmptyConversationStarters: the empty conversation is a drawing |
| +// hidden from screen readers, a heading and a named group of three real |
| +// buttons (Paul, 2026-11-20: "something that just entices you to type a |
| +// first message"). Without script a starter is a GET that opens the |
| +// conversation with its words in the composer; any other value drafts |
| +// nothing. |
| +func TestPagesEmptyConversationStarters(t *testing.T) { |
| + // A rig with no message sent: the conversation is empty. |
| + r := &toolRig{rig: newRig(t)} |
| + owner := r.inst.Cookie() |
| + page := r.get(owner, "/conversation", 200) |
| + welcome := regexp.MustCompile(`(?s)<li equipo-welcome data-empty-state="conversation.empty">.*?</li>`).FindString(page) |
| + for _, want := range []string{ |
| + `<svg equipo-welcome-art viewBox="0 0 112 70" aria-hidden="true" focusable="false">`, |
| + `<h2 equipo-welcome-title>What needs doing?</h2>`, |
| + `<form equipo-starters method="get" action="/conversation" aria-label="Ways to start">`, |
| + `<button type="submit" rst-btn name="start" value="bug" data-draft="Fix a bug where ">`, |
| + `<span>Fix a bug</span></button>`, |
| + `<button type="submit" rst-btn name="start" value="feature" data-draft="Plan a feature that ">`, |
| + `<span>Plan a feature</span></button>`, |
| + `<button type="submit" rst-btn name="start" value="project" data-draft="What’s the latest on ">`, |
| + `<span>Ask about a project</span></button>`, |
| + } { |
| + if !strings.Contains(welcome, want) { |
| + t.Fatalf("empty conversation lacks %q:\n%s", want, welcome) |
| + } |
| + } |
| + if strings.Contains(page, "Your coordinator picks the project") { |
| + t.Fatal("the old empty line is still there") |
| + } |
| + for k, draft := range map[string]string{"bug": "Fix a bug where ", "feature": "Plan a feature that ", "project": "What’s the latest on "} { |
| + if c := r.get(owner, "/conversation?start="+k, 200); !strings.Contains(c, `autofocus>`+draft+`</textarea>`) { |
| + t.Fatalf("start=%s composer:\n%s", k, regexp.MustCompile(`(?s)<textarea id="chat-body".*?</textarea>`).FindString(c)) |
| + } |
| + } |
| + for _, k := range []string{"", "label", "bug_draft", "<script>", "../empty"} { |
| + if c := r.get(owner, "/conversation?start="+url.QueryEscape(k), 200); strings.Contains(c, `autofocus>`) { |
| + t.Fatalf("start=%q drafted something", k) |
| + } |
| + } |
| +} |
diff --git a/internal/thintest/instance_contract_test.go b/internal/thintest/instance_contract_test.go| index a26ba7dc..ca6505c4 100644 |
| --- a/internal/thintest/instance_contract_test.go |
| +++ b/internal/thintest/instance_contract_test.go |
| @@ -4,9 +4,11 @@ import ( |
| "amadan.net/oficina/equipo/internal/equipo/chat" |
| "context" |
| "encoding/json" |
| + "fmt" |
| "io" |
| "net/http" |
| "os" |
| + "strconv" |
| "strings" |
| "testing" |
| "time" |
| @@ -248,6 +250,127 @@ func TestQueuedMessagesJoinOneTurn(t *testing.T) { |
| } |
| } |
| +// A person's message whose turn failed never reached the coordinator: a |
| +// resumed session's transcript lacks it and a fresh one's tail showed it |
| +// as if answered. The next turn carries it, quoted and labelled as not |
| +// yet answered, until a turn is answered, from the newest two failed |
| +// turns at most. A cancelled turn's is not carried: the person stopped it. |
| +func TestFailedTurnMessageCarried(t *testing.T) { |
| + r := newRig(t) |
| + runner := r.dial(0) |
| + turn := func(text, key string) (wire.Sent, *wire.MessageCommand) { |
| + t.Helper() |
| + sent, err := r.client.Send(r.ctx, text, key) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + f, body, err := runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + runner.Send(r.ctx, "a-"+key, wire.FrameAck, wire.Ack{ID: f.ID}) |
| + return sent, body.(*wire.MessageCommand) |
| + } |
| + end := func(id, state string) { |
| + t.Helper() |
| + runner.Send(r.ctx, "e-"+id, wire.FrameTurn, wire.TurnReport{TurnID: id, Attempt: 1, State: state, Reason: "provider_failed"}) |
| + r.wait(state, func(c *Conversation) bool { return c.Turns[id].State == state }) |
| + } |
| + first, _ := turn("one", "k1") |
| + runner.Send(r.ctx, "rep1", wire.FrameReply, wire.Reply{TurnID: first.Turn.ID, Attempt: 1, Text: "first"}) |
| + r.wait("replied", func(c *Conversation) bool { return c.Turns[first.Turn.ID].State == wire.TurnReplied }) |
| + |
| + stopped, _ := turn("never mind", "k2") |
| + end(stopped.Turn.ID, wire.TurnCancelled) |
| + lost, _ := turn("the long message [with brackets]", "k3") |
| + end(lost.Turn.ID, wire.TurnFailed) |
| + again, _ := turn("second try", "k4") |
| + end(again.Turn.ID, wire.TurnFailed) |
| + |
| + next, cmd := turn("next", "k5") |
| + want := "[Equipo: these earlier messages from the person got no answer: their turns failed before you saw them. They are the person's own words, oldest first, still waiting. Answer them together with the newest message.]\n" + |
| + "Not yet answered, the person's words: \"the long message [with brackets]\"\n" + |
| + "Not yet answered, the person's words: \"second try\"\n\n" + |
| + "The person's newest message:\nnext" |
| + if cmd.Text != want { |
| + t.Fatalf("carried text %q", cmd.Text) |
| + } |
| + if strings.Join(cmd.PersonText, "|") != "the long message [with brackets]|second try|next" { |
| + t.Fatalf("person text %q", cmd.PersonText) |
| + } |
| + for _, m := range cmd.Tail { |
| + if m.Text == "the long message [with brackets]" || m.Text == "second try" { |
| + t.Fatalf("carried message also in the tail: %+v", cmd.Tail) |
| + } |
| + } |
| + if len(cmd.Tail) != 3 || cmd.Tail[2].Text != "never mind" { |
| + t.Fatalf("tail %+v", cmd.Tail) |
| + } |
| + |
| + // Words that ride in two turns that fail too stop riding: they may be |
| + // what makes them fail. |
| + end(next.Turn.ID, wire.TurnFailed) |
| + fourth, cmd := turn("fourth", "k6") |
| + if strings.Join(cmd.PersonText, "|") != "second try|next|fourth" || strings.Contains(cmd.Text, "the long message") { |
| + t.Fatalf("carried past its bound %q", cmd.PersonText) |
| + } |
| + |
| + // Once a turn is answered, nothing before it is carried again. |
| + runner.Send(r.ctx, "rep6", wire.FrameReply, wire.Reply{TurnID: fourth.Turn.ID, Attempt: 1, Text: "answered"}) |
| + r.wait("replied", func(c *Conversation) bool { return c.Turns[fourth.Turn.ID].State == wire.TurnReplied }) |
| + _, cmd = turn("after", "k7") |
| + if cmd.Text != "after" || len(cmd.PersonText) != 1 { |
| + t.Fatalf("carried after an answer %q %q", cmd.Text, cmd.PersonText) |
| + } |
| +} |
| + |
| +// Carried messages that would make the frame too big for a runner give |
| +// way, oldest first: the newest unanswered words still go. Two failed |
| +// batches, each as big as a batch gets, cannot both ride with a third. |
| +func TestFailedTurnMessagesFitOneFrame(t *testing.T) { |
| + r := newRig(t) |
| + runner := r.dial(0) |
| + big := func(i int) string { return fmt.Sprintf("%02d", i) + strings.Repeat("x", wire.MaxMessageBytes-2) } |
| + first, err := r.client.Send(r.ctx, "a", "k-a") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + turns := []string{first.Turn.ID} |
| + for i := range 10 { |
| + sent, err := r.client.Send(r.ctx, big(i), "k"+strconv.Itoa(i)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if turns[len(turns)-1] != sent.Turn.ID { |
| + turns = append(turns, sent.Turn.ID) |
| + } |
| + } |
| + if len(turns) != 3 { |
| + t.Fatalf("batches %v", turns) |
| + } |
| + var cmd *wire.MessageCommand |
| + for i, id := range turns { |
| + f, body, err := runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + runner.Send(r.ctx, "a-"+id, wire.FrameAck, wire.Ack{ID: f.ID}) |
| + if cmd = body.(*wire.MessageCommand); cmd.TurnID != id { |
| + t.Fatalf("turn %s, want %s", cmd.TurnID, id) |
| + } |
| + if i < 2 { |
| + runner.Send(r.ctx, "e-"+id, wire.FrameTurn, wire.TurnReport{TurnID: id, Attempt: 1, State: wire.TurnFailed, Reason: "provider_failed"}) |
| + } |
| + } |
| + if raw, _ := json.Marshal(cmd); len(raw) > wire.MaxFrameBytes-1<<10 { |
| + t.Fatalf("frame %d bytes", len(raw)) |
| + } |
| + n := len(cmd.PersonText) |
| + if n < 6 || n >= 11 || cmd.PersonText[0] == "a" || cmd.PersonText[n-6] != big(4) || cmd.PersonText[n-1] != big(9) { |
| + t.Fatalf("carried %d messages", n) |
| + } |
| +} |
| + |
| func TestCancel(t *testing.T) { |
| r := newRig(t) |
| runner := r.dial(0) |
diff --git a/internal/thintest/thinking_browser_test.go b/internal/thintest/thinking_browser_test.go| index ff921bfc..8ea337d5 100644 |
| --- a/internal/thintest/thinking_browser_test.go |
| +++ b/internal/thintest/thinking_browser_test.go |
| @@ -7,6 +7,7 @@ import ( |
| "encoding/json" |
| "fmt" |
| "testing" |
| + "time" |
| "amadan.net/oficina/equipo/internal/wire" |
| "github.com/chromedp/cdproto/cdp" |
| @@ -97,7 +98,8 @@ func TestBrowserThinkingWords(t *testing.T) { |
| // phrases come from a shuffled deck, none again until all have shown, |
| // across two turns (a reload keeps only localStorage); after the deck runs |
| // out the next is none of the last three; a tool shows its plain label |
| -// at once; under reduced motion the thinking words still change. |
| +// once the phrase before has had its 1.5 s; under reduced motion the |
| +// thinking words still change. |
| // |
| // The page's clock stands still but for the test (clock below): each |
| // phrase is held to just under its minimum while the phrase timer looks, |
| @@ -217,11 +219,11 @@ func TestBrowserThinkingCycles(t *testing.T) { |
| } |
| } |
| dwelt(from) |
| - // A tool activity: its plain label at once. |
| + // A tool activity: its plain label, after the phrase's dwell. |
| if err := r.runner.Send(r.ctx, "cyc-read-"+motion, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityTool, Tool: wire.ToolReadFile}); err != nil { |
| t.Fatal(err) |
| } |
| - p.wait(phrase+`==='Reading the code…'`, "a plain reading label at once") |
| + p.wait(phrase+`==='Reading the code…'`, "a plain reading label after the dwell") |
| if motion == "reduce" { |
| p.check(`getComputedStyle(document.querySelector('[equipo-sparkle] path')).animationName==='none'`, "the mark moves under reduced motion") |
| } |
| @@ -231,3 +233,105 @@ func TestBrowserThinkingCycles(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// TestBrowserThinkingSteady: Paul on staging, 2026-11-20: "When it was |
| +// responding, the thinking kept flashing quite quickly." A turn's first |
| +// moments bring a burst: thinking, the runner's tool label and then the |
| +// instance's named one, and cards whose refreshes re-rendered the feed. |
| +// Every activity drew a phrase at once over the ones still fading, and |
| +// each refresh took the line out and put it back, so every fading phrase |
| +// started its animation again on top of the new one. Now each phrase |
| +// stays at least 1.5 s and the latest waiting one follows, one phrase |
| +// shows at a time, a refresh leaves the line where it is, and the timer |
| +// counts the whole turn. |
| +func TestBrowserThinkingSteady(t *testing.T) { |
| + r := newToolRig(t) |
| + if err := r.runner.Send(r.ctx, "r-first", wire.FrameReply, wire.Reply{TurnID: r.turn, Attempt: 1, Text: "First."}); err != nil { |
| + t.Fatal(err) |
| + } |
| + r.wait("replied", func(c *Conversation) bool { return c.Turns[r.turn].State == wire.TurnReplied }) |
| + // The page's record: each phrase drawn, the most phrases visible at |
| + // once (letters a new phrase keeps from the old one are the old |
| + // ones'), how often a phrase's animation started again, and the timer |
| + // each frame. |
| + const watch = `(()=>{window.__drawn=[];window.__most=0;window.__again=0;window.__timer=[];const once=new WeakSet(),began=new WeakMap();` + |
| + `new MutationObserver(()=>{for(const e of document.querySelectorAll('[equipo-phrase] > [data-in]'))if(!once.has(e)&&once.add(e))__drawn.push({text:e.textContent,at:performance.now()})}).observe(document,{childList:true,subtree:true});` + |
| + `const frame=()=>{const layers=[...document.querySelectorAll('[equipo-phrase] > [data-in], [equipo-phrase] > [data-out]')];__most=Math.max(__most,layers.filter(l=>[...l.children].some(c=>{const s=getComputedStyle(c);return !c.hasAttribute('data-keep')&&s.visibility!=='hidden'&&Number(s.opacity)>.1})).length);` + |
| + `for(const l of layers){const w=l.firstElementChild?.getAnimations().find(a=>a.animationName==='equipo-wave');if(!w||w.startTime===null)continue;if(!began.has(l))began.set(l,w.startTime);else if(began.get(l)!==w.startTime){began.set(l,w.startTime);__again++}}` + |
| + `const e=document.querySelector('[equipo-elapsed]');if(e&&e.textContent)__timer.push(parseInt(e.textContent));requestAnimationFrame(frame)};requestAnimationFrame(frame)})()` |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "no-preference") |
| + defer p.stop() |
| + p.do(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| + _, err := cdp.Call(ctx, target, page.AddScriptToEvaluateOnNewDocument, page.AddScriptToEvaluateOnNewDocumentParams{Source: watch}) |
| + return err |
| + })) |
| + p.open("/conversation") |
| + p.wait(`document.querySelector('#composer textarea')`, "the composer") |
| + sent := time.Now() |
| + p.check(`(()=>{const box=document.querySelector('#composer textarea');box.value='Fix the swipe';box.dispatchEvent(new Event('input'));document.querySelector('#composer').requestSubmit();return true})()`, "send") |
| + f, body, err := r.runner.Expect(r.ctx, wire.FrameMessage) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := r.runner.Send(r.ctx, "a-fix", wire.FrameAck, wire.Ack{ID: f.ID}); err != nil { |
| + t.Fatal(err) |
| + } |
| + r.turn = body.(*wire.MessageCommand).TurnID |
| + p.wait(`document.querySelector('[equipo-thinking][data-turn=`+jsString(r.turn)+`]')`, "the turn's line") |
| + act := func(id, kind, tool string) { |
| + t.Helper() |
| + if err := r.runner.Send(r.ctx, id, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: kind, Tool: tool}); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + from := eval[int](p, `__drawn.length`) |
| + burst := time.Now() |
| + act("s1", wire.ActivityThink, "") |
| + act("s2", wire.ActivityTool, wire.ToolRecordTask) |
| + task := taskID(t, r.call("s-rec", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Swipe back", "brief": "x"})) |
| + act("s3", wire.ActivityThink, "") |
| + act("s4", wire.ActivityTool, wire.ToolStartTask) |
| + r.call("s-start", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"}) |
| + r.expect(wire.FrameDispatch) |
| + act("s5", wire.ActivityThink, "") |
| + took := time.Since(burst) |
| + words, _ := r.client.Thinking(r.ctx) |
| + var think []string |
| + for _, s := range words.Sets { |
| + if s.ID == wire.DefaultThinking { |
| + think = s.Phrases["think"] |
| + } |
| + } |
| + thinks, _ := json.Marshal(think) |
| + line := `document.querySelector('[equipo-thinking][data-turn=` + jsString(r.turn) + `]')` |
| + p.wait(line+`?.querySelector('[equipo-activity]').textContent==='Thinking' && document.querySelector('[data-card]')`, "the latest activity for screen readers, and the task's card") |
| + // The latest waiting phrase comes once the one before has had its time. |
| + p.wait(`(()=>{const d=__drawn.slice(`+fmt.Sprint(from)+`);return d.length>0 && performance.now()-d[d.length-1].at>1700 && `+string(thinks)+`.includes(d[d.length-1].text)})()`, "the burst settles on a thinking phrase") |
| + drawn := eval[[]map[string]any](p, `__drawn.slice(`+fmt.Sprint(from)+`)`) |
| + if most := 2 + int(took/(1500*time.Millisecond)); len(drawn) > most { |
| + t.Fatalf("%d phrases for a burst of %s, want at most %d: %v", len(drawn), took, most, drawn) |
| + } |
| + all := eval[[]map[string]any](p, `__drawn`) |
| + for i := 1; i < len(all); i++ { |
| + if gap := all[i]["at"].(float64) - all[i-1]["at"].(float64); gap < 1450 { |
| + t.Fatalf("%q came %.0f ms after %q: %v", all[i]["text"], gap, all[i-1]["text"], all) |
| + } |
| + } |
| + if most := eval[int](p, `__most`); most > 1 { |
| + t.Fatalf("%d phrases visible at once", most) |
| + } |
| + if again := eval[int](p, `__again`); again > 0 { |
| + t.Fatalf("a phrase's animation started again %d times while the turn ran", again) |
| + } |
| + timer := eval[[]int](p, `__timer`) |
| + for i := 1; i < len(timer); i++ { |
| + if timer[i] < timer[i-1] { |
| + t.Fatalf("the timer went from %ds to %ds", timer[i-1], timer[i]) |
| + } |
| + } |
| + // It shows whole seconds, a tick a second: up to two behind. |
| + if got, since := timer[len(timer)-1], time.Since(sent); got < int(since.Seconds())-2 { |
| + t.Fatalf("the timer shows %ds, %s after the send", got, since) |
| + } |
| + p.stayed("the burst") |
| +} |
diff --git a/internal/thintest/track_pulse_browser_test.go b/internal/thintest/track_pulse_browser_test.go| new file mode 100644 |
| index 00000000..fbc4bc74 |
| --- /dev/null |
| +++ b/internal/thintest/track_pulse_browser_test.go |
| @@ -0,0 +1,143 @@ |
| +//go:build browser |
| + |
| +package thintest |
| + |
| +import ( |
| + "context" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "github.com/chromedp/chromedp" |
| +) |
| + |
| +// TestBrowserTrackPulse: the stage track's current stop pulses while a |
| +// specialist works on it, on the conversation's report card and on the |
| +// task page, and is still while the task waits or nothing runs. Reduced |
| +// motion keeps a still ring. A step starting and stopping starts and |
| +// stops the pulse live, with no reload. |
| +func TestBrowserTrackPulse(t *testing.T) { |
| + g := newGallery(t) |
| + a := g.a |
| + report := func(id string) string { |
| + return `document.querySelector('[equipo-roster-report] [data-track-task="` + id + `"]')` |
| + } |
| + cur := func(track string) string { return track + `?.querySelector('[aria-current="step"]')` } |
| + ring := func(track string) string { |
| + return `getComputedStyle(` + cur(track) + `.querySelector('[equipo-dot]'),'::before')` |
| + } |
| + cue := func(track string) string { |
| + return `getComputedStyle(` + cur(track) + `.querySelector('[data-working-cue]')).display` |
| + } |
| + for _, motion := range []string{"no-preference", "reduce"} { |
| + for _, scheme := range []string{"light", "dark"} { |
| + t.Run(motion+"-"+scheme, func(t *testing.T) { |
| + p := openInner(t, a.inst.URL, a.inst.Cookie(), 1280, 900, false, scheme, motion) |
| + defer p.stop() |
| + p.open("/conversation") |
| + run := report(g.running) |
| + p.wait(cur(run), "the running task's report") |
| + p.check(cur(run)+`.hasAttribute('data-working') && `+cue(run)+`!=='none'`, "the running stop is not working") |
| + p.check(`(()=>{const w=[...document.querySelectorAll('[equipo-roster-report] [data-track] [data-working]')];return w.length>0 && w.every(li=>li.matches('[aria-current="step"]') && ['`+g.running+`','`+g.merging+`'].includes(li.parentElement.dataset.trackTask))})()`, "a stop with nobody at work pulses") |
| + p.check(`[...document.querySelectorAll('[equipo-roster-report] [data-track] [aria-current="step"]:not([data-working])')].every(li=>getComputedStyle(li.querySelector('[equipo-dot]'),'::before').content==='none' && getComputedStyle(li.querySelector('[data-working-cue]')).display==='none')`, "an idle stop draws the ring or the cue") |
| + if motion == "reduce" { |
| + p.check(ring(run)+`.animationName==='none' && `+ring(run)+`.opacity==='0.6' && `+ring(run)+`.transform!=='none'`, "reduced motion lost the still ring") |
| + p.check(`getComputedStyle(`+cur(run)+`.previousElementSibling,'::before').animationName==='none'`, "the line moves under reduced motion") |
| + } else { |
| + p.check(ring(run)+`.animationName==='equipo-tl-ring' && `+ring(run)+`.animationDuration==='2.4s'`, "the working stop does not pulse") |
| + p.check(`getComputedStyle(`+cur(run)+`.previousElementSibling,'::before').animationName==='equipo-tl-flow'`, "the line into the working stop is still") |
| + p.check(`document.getAnimations().filter(x=>x.animationName==='equipo-tl-ring').every(x=>x.startTime===0)`, "pulses out of phase") |
| + } |
| + // The task page's track: the living mark, and the ring. |
| + p.open("/tasks/" + g.running) |
| + full := `document.querySelector('[equipo-track-full]')` |
| + p.check(cur(full)+`.hasAttribute('data-working') && !!`+cur(full)+`.querySelector('[equipo-mark]') && `+cue(full)+`!=='none'`, "the task page's stop is not working") |
| + if motion == "reduce" { |
| + p.check(ring(full)+`.animationName==='none' && `+ring(full)+`.opacity==='0.6'`, "task page: reduced motion lost the still ring") |
| + } else { |
| + p.check(ring(full)+`.animationName==='equipo-tl-ring'`, "task page: the working stop does not pulse") |
| + } |
| + |
| + }) |
| + } |
| + } |
| + |
| + // Live, light and dark side by side: a new task's step queues, runs |
| + // and stops, and its card's pulse follows with no reload. |
| + pages := map[string]*innerPage{} |
| + for _, scheme := range []string{"light", "dark"} { |
| + p := openInner(t, a.inst.URL, a.inst.Cookie(), 1280, 900, false, scheme, "no-preference") |
| + defer p.stop() |
| + pages[scheme] = p |
| + } |
| + each := func(f func(scheme string, p *innerPage)) { |
| + for _, scheme := range []string{"light", "dark"} { |
| + f(scheme, pages[scheme]) |
| + } |
| + } |
| + task := taskID(t, a.call("tp-rec", wire.ToolRecordTask, map[string]any{"repo": "oficina/equipo", "title": "Keep the filter when the list refreshes", "brief": "The task filter resets when the list refreshes itself.", "separate": true})) |
| + track := report(task) |
| + card := `[data-card]:has([data-track-task="` + task + `"])` |
| + show := `(()=>{` + cur(track) + `.closest('[data-card]').scrollIntoView({block:'center'});return true})()` |
| + each(func(_ string, p *innerPage) { |
| + p.open("/conversation") |
| + p.wait(cur(track), "the new task's report") |
| + p.check(`!`+cur(track)+`.hasAttribute('data-working') && `+ring(track)+`.content==='none'`, "a noted task pulses") |
| + }) |
| + a.call("tp-start", wire.ToolStartTask, map[string]string{"task": task, "brief": "Keep the filter."}) |
| + _, body := a.expect(wire.FrameDispatch) |
| + d := body.(*wire.DispatchCommand) |
| + each(func(_ string, p *innerPage) { |
| + p.wait(cur(track)+`?.hasAttribute('data-working')`, "the queued step's pulse") |
| + }) |
| + a.step("tp-run", wire.StepReport{TaskID: task, StepID: d.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: strings.Repeat("8", 40), Family: "claude", Account: "claude-a"}) |
| + each(func(scheme string, p *innerPage) { |
| + p.wait(cur(track)+`?.hasAttribute('data-working') && `+cur(track)+`.textContent.startsWith('In progress')`, "the running step's pulse") |
| + p.check(ring(track)+`.animationName==='equipo-tl-ring'`, "the running card does not pulse") |
| + p.check(show, "show the card") |
| + p.cardShot(card, "track-pulse-running-"+scheme) |
| + }) |
| + a.step("tp-fail", wire.StepReport{TaskID: task, StepID: d.StepID, Attempt: 1, State: wire.StepFailed, Reason: "provider_failed", Termination: true}) |
| + each(func(scheme string, p *innerPage) { |
| + p.wait(cur(track)+` && !`+cur(track)+`.hasAttribute('data-working') && `+ring(track)+`.content==='none' && `+cue(track)+`==='none'`, "the pulse stopped") |
| + p.stayed("conversation") |
| + p.check(show, "show the card") |
| + p.cardShot(card, "track-pulse-idle-"+scheme) |
| + }) |
| +} |
| + |
| +// cardShot saves the element sel at twice its size when |
| +// EQUIPO_BROWSER_ARTIFACTS names a directory. |
| +func (p *innerPage) cardShot(sel, name string) { |
| + p.t.Helper() |
| + dir := os.Getenv("EQUIPO_BROWSER_ARTIFACTS") |
| + if dir == "" { |
| + return |
| + } |
| + // A live refresh may swap the card mid-capture: settle, then retry. |
| + var buf []byte |
| + var err error |
| + for try := 0; try < 4; try++ { |
| + time.Sleep(700 * time.Millisecond) |
| + err = chromedp.Do(p.ctx, chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| + var err error |
| + buf, err = chromedp.ScreenshotScale(chromedp.CSS(sel), 2)(ctx, target) |
| + return err |
| + })) |
| + if err == nil { |
| + break |
| + } |
| + } |
| + if err != nil { |
| + p.t.Fatal(err) |
| + } |
| + if err := os.MkdirAll(dir, 0700); err != nil { |
| + p.t.Fatal(err) |
| + } |
| + if err := os.WriteFile(filepath.Join(dir, name+".png"), buf, 0600); err != nil { |
| + p.t.Fatal(err) |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoKit/Presentation/Roster.swift b/native/apple/Sources/EquipoKit/Presentation/Roster.swift| index a95bc769..15fdf353 100644 |
| --- a/native/apple/Sources/EquipoKit/Presentation/Roster.swift |
| +++ b/native/apple/Sources/EquipoKit/Presentation/Roster.swift |
| @@ -255,3 +255,84 @@ public enum Feed { |
| card.kind == "project" || (card.kind == "home" && card.state != "ask") |
| } |
| } |
| + |
| +// MARK: - Decisions answered here |
| + |
| +/// A decision card the device answers itself: merges and "Does main ship?", |
| +/// laid out exactly as the web's chat_page.go cardView and chat.html do |
| +/// (parity row R-02, must_match). Labels and outcome lines use the web's own |
| +/// copy keys (`chat.card.*`, `work.tl.*`); native/scripts/check-parity.py |
| +/// fails if their words differ from copy.go. |
| +public struct DecisionView: Sendable, Equatable { |
| + public struct Choice: Sendable, Equatable, Identifiable { |
| + public var value: String |
| + public var label: String |
| + public var primary: Bool |
| + public var id: String { value } |
| + } |
| + public var line: String |
| + public var open: Bool |
| + public var choices: [Choice] |
| + /// What was decided, once it was; the web's note. |
| + public var note: String? |
| + /// The candidate has a preview. It opens through the web's own page |
| + /// (Feed.previewURL), never at the address the card carries. |
| + public var hasPreview: Bool |
| + /// A closed card with an outcome shows only that line, as chat.html's |
| + /// equipo-card-done does: no question, no link. |
| + public var showsOnlyNote: Bool { !open && note != nil } |
| +} |
| + |
| +/// A conflict's "This item has changed" stays until the card moves past |
| +/// the revision the conflict returned, so a stale tap is never followed by |
| +/// a silent second one. |
| +public enum AnswerFeedback { |
| + public static func stillChanged(conflictAt: Int64, now: Int64) -> Bool { now <= conflictAt } |
| +} |
| + |
| +extension Feed { |
| + /// nil sends the card to the web: any other kind, or a choice with no words. |
| + public static func decision(_ card: ThinCard, task: ThinTask?) -> DecisionView? { |
| + let primary: String, chose: String, resolved: String |
| + var open = card.state == "open" |
| + switch card.kind { |
| + case "merge": |
| + primary = "merge"; chose = "chat.card.merge_chose_"; resolved = "chat.card.merge_resolved" |
| + case "merge_ships": |
| + primary = "not_ships"; chose = "chat.card.ships_chose_"; resolved = "chat.card.merge_policy_stale" |
| + open = open && !(card.options ?? []).isEmpty |
| + default: |
| + return nil |
| + } |
| + var choices: [DecisionView.Choice] = [] |
| + for value in card.options ?? [] { |
| + guard let label = webText("chat.card." + value) else { return nil } |
| + choices.append(.init(value: value, label: label, primary: value == primary)) |
| + } |
| + var note: String? |
| + if card.kind == "merge", task?.kind == "explore" { |
| + // From before the task became an exploration: it never merges. |
| + open = false; note = webText("work.tl.merge_dropped") |
| + } else if card.state == "answered" { |
| + note = webText(chose + card.choice) |
| + } else if card.state == "resolved" { |
| + note = webText(resolved) |
| + } |
| + // chat_page.go links a preview only on an open merge card, and always |
| + // through /tasks/<id>/preview (the sandboxed, checked wrapper). |
| + let preview = card.kind == "merge" && open && !(card.previewUrl ?? "").isEmpty |
| + return DecisionView(line: card.question, open: open, choices: open ? choices : [], note: note, hasPreview: preview) |
| + } |
| + |
| + /// The web's preview page for a card's task: Equipo's own wrapper, which |
| + /// refuses unsafe addresses and expired candidates. |
| + public static func previewURL(_ card: ThinCard, origin: URL) -> URL { |
| + origin.appendingPathComponent("tasks").appendingPathComponent(card.taskId).appendingPathComponent("preview") |
| + } |
| + |
| + /// A web copy key's words in the catalog, or nil when the catalog has none. |
| + static func webText(_ key: String) -> String? { |
| + let text = EquipoStrings.text(.init(key)) |
| + return text == key ? nil : text |
| + } |
| +} |
diff --git a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings| index 81ab2ab6..415c5a7b 100644 |
| --- a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings |
| +++ b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings |
| @@ -244,6 +244,171 @@ |
| } |
| } |
| }, |
| + "chat.card.merge": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Merge" |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.merge_chose_merge": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Merging without checks." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.merge_chose_not_now": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Not now." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.merge_chose_wait": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Waiting for checks." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.merge_chose_wait_mac": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Waiting for a Mac." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.merge_policy_stale": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "The merge rules changed since I asked, so nothing was saved." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.merge_resolved": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Nothing to decide any more." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.not_now": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Not now" |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.not_ships": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "It doesn't" |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.preview_link": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open the preview" |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.ships": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "It ships" |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.ships_chose_not_ships": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Main isn't a release, so I can merge small changes on my own when the other rules allow." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.ships_chose_ships": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Merging to main ships to users, so I'll ask before merging without checks." |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.wait": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Wait for checks" |
| + } |
| + } |
| + } |
| + }, |
| + "chat.card.wait_mac": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Wait for a Mac" |
| + } |
| + } |
| + } |
| + }, |
| "checks.cannot_run": { |
| "extractionState": "manual", |
| "localizations": { |
| @@ -1574,6 +1739,17 @@ |
| } |
| } |
| } |
| + }, |
| + "work.tl.merge_dropped": { |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "An earlier attempt to add this change was dropped when the task became an exploration." |
| + } |
| + } |
| + } |
| } |
| } |
| } |
diff --git a/native/apple/Sources/EquipoKit/UI/LiveCards.swift b/native/apple/Sources/EquipoKit/UI/LiveCards.swift| index 4538cddc..0e9e052e 100644 |
| --- a/native/apple/Sources/EquipoKit/UI/LiveCards.swift |
| +++ b/native/apple/Sources/EquipoKit/UI/LiveCards.swift |
| @@ -10,7 +10,7 @@ struct LiveQuestionCard: View { |
| let session: EquipoSession |
| @State private var phase: Phase = .open |
| - enum Phase: Equatable { case open, sending(String), changed, offline, failed } |
| + enum Phase: Equatable { case open, sending(String), changed(at: Int64), offline, failed } |
| var body: some View { |
| RaisedCard(flat: !card.isOpen) { |
| @@ -29,7 +29,9 @@ struct LiveQuestionCard: View { |
| } |
| } |
| .accessibilityElement(children: .contain) |
| - .onChange(of: card.revision) { _, _ in if phase == .changed { phase = .open } } |
| + .onChange(of: card.revision) { _, now in |
| + if case .changed(let at) = phase, !AnswerFeedback.stillChanged(conflictAt: at, now: now) { phase = .open } |
| + } |
| } |
| private var isSending: Bool { if case .sending = phase { return true }; return false } |
| @@ -66,39 +68,110 @@ struct LiveQuestionCard: View { |
| phase = .sending(choice) |
| switch await session.answer(card, choice: choice) { |
| case .answered: phase = .open |
| - case .changed: phase = .changed |
| + case .changed: phase = .changed(at: session.cards.first { $0.id == card.id }?.revision ?? card.revision) |
| case .offline: phase = .offline |
| case .failed: phase = .failed |
| } |
| } |
| } |
| -/// A decision this slice does not take natively: merges, approvals and the |
| -/// rest open the web app, where the full context and the must-match |
| -/// behaviour already are (sync proposal, parity rows R-02 and R-03). |
| +/// A decision card. Merges and "Does main ship?" are answered here, in the |
| +/// web's words (Feed.decision); every other decision opens the web app, |
| +/// where its full context is. |
| struct LiveDecisionCard: View { |
| let card: ThinCard |
| let taskTitle: String? |
| - let origin: URL |
| + let session: EquipoSession |
| + @State private var phase: Phase = .open |
| @Environment(\.openURL) private var openURL |
| + |
| + enum Phase: Equatable { case open, sending(String), changed(at: Int64), offline, failed } |
| + |
| var body: some View { |
| - RaisedCard(flat: !card.isOpen) { |
| - if let taskTitle, !card.question.contains(taskTitle) { |
| + let view = Feed.decision(card, task: session.task(card.taskId)) |
| + RaisedCard(flat: !(view?.open ?? card.isOpen)) { |
| + if let taskTitle, !card.question.isEmpty, !card.question.contains(taskTitle) { |
| Text(taskTitle).font(Typo.caption).foregroundStyle(Palette.secondary) |
| } |
| - CardHead(text: card.question.isEmpty ? (taskTitle ?? String(localized: "decision.untitled", bundle: .module)) : card.question) |
| - if card.isOpen { |
| - Text(String(localized: "decision.on_web", bundle: .module)).font(Typo.secondary).foregroundStyle(Palette.secondary) |
| - .fixedSize(horizontal: false, vertical: true) |
| - RosterButton(title: String(localized: "card.open_on_web", bundle: .module), primary: true) { |
| - openURL(Feed.webURL(for: card, origin: origin)) |
| - } |
| + if let view, view.showsOnlyNote, let note = view.note { |
| + // As the web's equipo-card-done: the outcome alone. |
| + Label { Text(note) } icon: { Image(systemName: "checkmark") } |
| + .font(Typo.secondaryStrong).foregroundStyle(Palette.positive) |
| } else { |
| - QuietLink(title: String(localized: "card.open_on_web", bundle: .module), icon: "arrow.up.right") { |
| - openURL(Feed.webURL(for: card, origin: origin)) |
| + CardHead(text: card.question.isEmpty ? (taskTitle ?? String(localized: "decision.untitled", bundle: .module)) : card.question) |
| + if let view { |
| + answerable(view) |
| + } else if card.isOpen { |
| + Text(String(localized: "decision.on_web", bundle: .module)).font(Typo.secondary).foregroundStyle(Palette.secondary) |
| + .fixedSize(horizontal: false, vertical: true) |
| + RosterButton(title: String(localized: "card.open_on_web", bundle: .module), primary: true) { |
| + openURL(Feed.webURL(for: card, origin: session.origin)) |
| + } |
| + } else { |
| + QuietLink(title: String(localized: "card.open_on_web", bundle: .module), icon: "arrow.up.right") { |
| + openURL(Feed.webURL(for: card, origin: session.origin)) |
| + } |
| } |
| } |
| } |
| + .accessibilityElement(children: .contain) |
| + .onChange(of: card.revision) { _, now in |
| + if case .changed(let at) = phase, !AnswerFeedback.stillChanged(conflictAt: at, now: now) { phase = .open } |
| + } |
| + } |
| + |
| + @ViewBuilder private func answerable(_ view: DecisionView) -> some View { |
| + if view.hasPreview { |
| + QuietLink(title: String(localized: "chat.card.preview_link", bundle: .module), icon: "arrow.up.right") { |
| + openURL(Feed.previewURL(card, origin: session.origin)) |
| + } |
| + } |
| + if view.open { |
| + let sending: String? = { if case .sending(let v) = phase { return v }; return nil }() |
| + ViewThatFits(in: .horizontal) { |
| + HStack(spacing: 10) { buttons(view, sending: sending) } |
| + VStack(spacing: 10) { buttons(view, sending: sending) } |
| + } |
| + feedback |
| + } |
| + } |
| + |
| + @ViewBuilder private func buttons(_ view: DecisionView, sending: String?) -> some View { |
| + ForEach(view.choices) { choice in |
| + RosterButton(title: choice.label, primary: choice.primary, expanded: true, |
| + busy: sending == choice.value ? String(localized: "action.sending", bundle: .module) : nil) { |
| + Task { await submit(choice.value) } |
| + } |
| + .disabled(sending != nil) |
| + } |
| + } |
| + |
| + @ViewBuilder private var feedback: some View { |
| + switch phase { |
| + case .changed: Text(String(localized: "card.changed", bundle: .module)).font(Typo.secondary).foregroundStyle(Palette.negative) |
| + case .offline: Text(String(localized: "card.offline", bundle: .module)).font(Typo.secondary).foregroundStyle(Palette.negative) |
| + case .failed: Text(String(localized: "card.failed", bundle: .module)).font(Typo.secondary).foregroundStyle(Palette.negative) |
| + default: EmptyView() |
| + } |
| + } |
| + |
| + private func submit(_ choice: String) async { |
| + if case .sending = phase { return } |
| + phase = .sending(choice) |
| + let outcome = await session.answer(card, choice: choice) |
| + switch outcome { |
| + case .answered: phase = .open |
| + case .changed: |
| + // The card as it is now, after the conflict: the message stays until it moves past it. |
| + phase = .changed(at: session.cards.first { $0.id == card.id }?.revision ?? card.revision) |
| + announce(String(localized: "card.changed", bundle: .module)) |
| + case .offline: phase = .offline; announce(String(localized: "card.offline", bundle: .module)) |
| + case .failed: phase = .failed; announce(String(localized: "card.failed", bundle: .module)) |
| + } |
| + } |
| + |
| + private func announce(_ text: String) { |
| + AccessibilityNotification.Announcement(text).post() |
| } |
| } |
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift b/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift| index d3a73bfe..eaf354e0 100644 |
| --- a/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift |
| +++ b/native/apple/Sources/EquipoKit/UI/Screens/ConversationScreen.swift |
| @@ -58,7 +58,7 @@ public struct ConversationScreen: View { |
| case .decision(let card, let byline): |
| VStack(alignment: .leading, spacing: 8) { |
| Byline(byline: byline) |
| - LiveDecisionCard(card: card, taskTitle: session.task(card.taskId)?.title, origin: session.origin) |
| + LiveDecisionCard(card: card, taskTitle: session.task(card.taskId)?.title, session: session) |
| } |
| case .receipt(let card, _): |
| LiveReceipt(card: card) |
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/TaskScreens.swift b/native/apple/Sources/EquipoKit/UI/Screens/TaskScreens.swift| index 146c6db8..fd349991 100644 |
| --- a/native/apple/Sources/EquipoKit/UI/Screens/TaskScreens.swift |
| +++ b/native/apple/Sources/EquipoKit/UI/Screens/TaskScreens.swift |
| @@ -102,7 +102,7 @@ struct TaskCards: View { |
| if card.kind == "question" { |
| LiveQuestionCard(card: card, taskTitle: nil, session: session) |
| } else { |
| - LiveDecisionCard(card: card, taskTitle: task.title, origin: session.origin) |
| + LiveDecisionCard(card: card, taskTitle: task.title, session: session) |
| } |
| } |
| } |
diff --git a/native/apple/Sources/EquipoMac/LiveTranscript.swift b/native/apple/Sources/EquipoMac/LiveTranscript.swift| index 8532e04d..7043e9ea 100644 |
| --- a/native/apple/Sources/EquipoMac/LiveTranscript.swift |
| +++ b/native/apple/Sources/EquipoMac/LiveTranscript.swift |
| @@ -210,7 +210,7 @@ final class LiveTranscript: NSView { |
| } |
| private func questionCard(_ card: ThinCard, taskTitle: String?, width: CGFloat) -> RaisedPlate { |
| - if let seen = answeredRevision[card.id], seen != card.revision { |
| + if let seen = answeredRevision[card.id], !AnswerFeedback.stillChanged(conflictAt: seen, now: card.revision) { |
| if case .sending = answers[card.id] {} else { answers[card.id] = nil; answeredRevision[card.id] = nil } |
| } |
| let state = answers[card.id] |
| @@ -277,7 +277,10 @@ final class LiveTranscript: NSView { |
| guard let self else { return } |
| switch outcome { |
| case .answered: self.answers[card.id] = nil |
| - case .changed: self.answers[card.id] = .changed |
| + case .changed: |
| + self.answers[card.id] = .changed |
| + // The card as it is now: the message stays until it moves past it. |
| + self.answeredRevision[card.id] = session.cards.first { $0.id == card.id }?.revision ?? card.revision |
| case .offline: self.answers[card.id] = .offline |
| case .failed: self.answers[card.id] = .failed |
| } |
| @@ -286,7 +289,8 @@ final class LiveTranscript: NSView { |
| } |
| private func decisionCard(_ card: ThinCard, taskTitle: String?, width: CGFloat) -> RaisedPlate { |
| - let plate = RaisedPlate(width: width, height: 0, flat: !card.isOpen) |
| + let open = Feed.decision(card, task: session.task(card.taskId))?.open ?? card.isOpen |
| + let plate = RaisedPlate(width: width, height: 0, flat: !open) |
| let inner = width - 2 * MacMetric.pad |
| var y = MacMetric.pad |
| func add(_ view: NSView, gap: CGFloat = MacMetric.gap) { |
| @@ -295,8 +299,56 @@ final class LiveTranscript: NSView { |
| if let taskTitle, !card.question.isEmpty, !card.question.contains(taskTitle) { |
| add(makeText(taskTitle, MacType.caption, .webSecondary, width: inner), gap: 4) |
| } |
| + let decision = Feed.decision(card, task: session.task(card.taskId)) |
| + if let decision, decision.showsOnlyNote, let note = decision.note { |
| + // As the web's equipo-card-done: the outcome alone. |
| + add(outcome(note, width: inner)) |
| + return finish(plate, height: y - MacMetric.gap + MacMetric.pad) |
| + } |
| let head = card.question.isEmpty ? (taskTitle ?? EquipoStrings.text("decision.untitled")) : card.question |
| add(makeText(head, MacType.line, .webText, width: inner, lineSpacing: 2, selectable: true), gap: 4) |
| + // Merges and "Does main ship?" are answered here, in the web's words. |
| + if let view = decision { |
| + if view.hasPreview { |
| + let preview = Feed.previewURL(card, origin: session.origin) |
| + add(button(EquipoStrings.text("chat.card.preview_link"), .link) { NSWorkspace.shared.open(preview) }) |
| + } |
| + if view.open { |
| + if let seen = answeredRevision[card.id], !AnswerFeedback.stillChanged(conflictAt: seen, now: card.revision) { |
| + if case .sending = answers[card.id] {} else { answers[card.id] = nil; answeredRevision[card.id] = nil } |
| + } |
| + let state = answers[card.id] |
| + let sending: String? = { if case .sending(let v) = state { return v }; return nil }() |
| + let gap: CGFloat = 10 |
| + let w = floor((inner - gap * CGFloat(max(view.choices.count - 1, 0))) / CGFloat(max(view.choices.count, 1))) |
| + for (index, choice) in view.choices.enumerated() { |
| + let busy = sending == choice.value ? EquipoStrings.text("action.sending") : nil |
| + let b = button(choice.label, choice.primary ? .primary : .choice, busy: busy) { [weak self] in |
| + self?.submit(card: card, choice: choice.value) |
| + } |
| + if sending != nil && sending != choice.value { b.isEnabled = false } |
| + b.frame = NSRect(x: MacMetric.pad + CGFloat(index) * (w + gap), y: y, width: w, height: 32) |
| + b.setAccessibilityLabel(busy ?? choice.label) |
| + plate.content.addSubview(b) |
| + } |
| + y += 32 + MacMetric.gap |
| + let feedback: String? = { |
| + switch state { |
| + case .changed: return EquipoStrings.text("card.changed") |
| + case .offline: return EquipoStrings.text("card.offline") |
| + case .failed: return EquipoStrings.text("card.failed") |
| + default: return nil |
| + } |
| + }() |
| + if let feedback { |
| + let line = makeText(feedback, MacType.small, .webNegative, width: inner) |
| + line.setAccessibilityRole(.staticText) |
| + add(line) |
| + NSAccessibility.post(element: line, notification: .announcementRequested, userInfo: [.announcement: feedback]) |
| + } |
| + } |
| + return finish(plate, height: y - MacMetric.gap + MacMetric.pad) |
| + } |
| if card.isOpen { |
| add(makeText(EquipoStrings.text("decision.on_web"), MacType.small, .webSecondary, width: inner)) |
| } |
diff --git a/native/apple/Tests/EquipoKitTests/MergeCardTests.swift b/native/apple/Tests/EquipoKitTests/MergeCardTests.swift| new file mode 100644 |
| index 00000000..49f640db |
| --- /dev/null |
| +++ b/native/apple/Tests/EquipoKitTests/MergeCardTests.swift |
| @@ -0,0 +1,95 @@ |
| +import Foundation |
| +import Testing |
| +@testable import EquipoKit |
| + |
| +/// Merges answered on the device must match the web (parity row R-02, |
| +/// must_match): the server's question, the same choices in the same order |
| +/// with the same words, the same primary, and the same outcome line. |
| +@MainActor @Suite struct MergeCardTests { |
| + private func cards() throws -> [ThinCard] { |
| + let snapshot: Snapshot = try Fixture.decode("thin/snapshot") |
| + return snapshot.cards ?? [] |
| + } |
| + |
| + @Test func anOpenMergeIsAnsweredHereInTheWebsWords() throws { |
| + let card = try #require(try cards().first { $0.kind == "merge" && $0.state == "open" }) |
| + let view = try #require(Feed.decision(card, task: nil)) |
| + #expect(view.open) |
| + #expect(view.line == card.question, "the server's question, as the web shows it") |
| + #expect(view.choices.map(\.value) == ["merge", "wait_mac"], "the server's choices, in its order") |
| + #expect(view.choices.map(\.label) == ["Merge", "Wait for a Mac"]) |
| + #expect(view.choices.filter(\.primary).map(\.value) == ["merge"], "Merge is primary, as on the web") |
| + #expect(view.note == nil) |
| + } |
| + |
| + @Test func anAnsweredMergeSaysWhatWasChosen() throws { |
| + let card = try #require(try cards().first { $0.kind == "merge" && $0.state == "answered" }) |
| + let view = try #require(Feed.decision(card, task: nil)) |
| + #expect(!view.open) |
| + #expect(view.note == "Merging without checks.") |
| + var resolved = card; resolved.state = "resolved" |
| + #expect(Feed.decision(resolved, task: nil)?.note == "Nothing to decide any more.") |
| + } |
| + |
| + @Test func doesMainShipHasItsOwnPrimaryAndOutcome() throws { |
| + var card = try #require(try cards().first { $0.kind == "merge_ships" }) |
| + let view = try #require(Feed.decision(card, task: nil)) |
| + #expect(view.choices.map(\.label) == ["It ships", "It doesn't"]) |
| + #expect(view.choices.filter(\.primary).map(\.value) == ["not_ships"]) |
| + card.state = "answered"; card.choice = "ships" |
| + #expect(Feed.decision(card, task: nil)?.note == "Merging to main ships to users, so I'll ask before merging without checks.") |
| + } |
| + |
| + @Test func aMergeFromBeforeAnExplorationIsClosed() throws { |
| + let card = try #require(try cards().first { $0.kind == "merge" && $0.state == "open" }) |
| + let tasks: ThinList<ThinTask> = try Fixture.decode("thin/tasks") |
| + var task = try #require(tasks.items?.first); task.kind = "explore" |
| + let view = try #require(Feed.decision(card, task: task)) |
| + #expect(!view.open) |
| + #expect(view.note == "An earlier attempt to add this change was dropped when the task became an exploration.") |
| + } |
| + |
| + @Test func anUnknownChoiceSendsYouToTheWeb() throws { |
| + var card = try #require(try cards().first { $0.kind == "merge" && $0.state == "open" }) |
| + card.options = ["merge", "something_new"] |
| + #expect(Feed.decision(card, task: nil) == nil, "a choice with no words is never guessed at") |
| + for kind in ["publish", "direction", "merge_policy", "specialist", "question"] { |
| + var other = try #require(try cards().first { $0.kind == "merge" && $0.state == "open" }) |
| + other.kind = kind |
| + #expect(Feed.decision(other, task: nil) == nil, "\(kind) still opens the web, even with choices that have words") |
| + } |
| + } |
| + |
| + @Test func thePreviewOpensThroughTheWebsWrapperOnly() throws { |
| + let origin = URL(string: "https://team.example.test")! |
| + var card = try #require(try cards().first { $0.kind == "merge" && $0.state == "open" }) |
| + #expect(Feed.decision(card, task: nil)?.hasPreview == false, "no preview yet, no link") |
| + // Whatever the candidate's own address, the device opens Equipo's wrapper page. |
| + for raw in ["https://preview.example.test/x", "https://equipo.example@evil.test/", "javascript:alert(1)"] { |
| + card.previewUrl = raw |
| + #expect(Feed.decision(card, task: nil)?.hasPreview == true) |
| + #expect(Feed.previewURL(card, origin: origin).absoluteString == "https://team.example.test/tasks/\(card.taskId)/preview") |
| + } |
| + var ships = try #require(try cards().first { $0.kind == "merge_ships" }) |
| + ships.previewUrl = "https://preview.example.test/x" |
| + #expect(Feed.decision(ships, task: nil)?.hasPreview == false, "the web links a preview only on merge cards") |
| + } |
| + |
| + @Test func aClosedCardShowsOnlyItsOutcome() throws { |
| + var card = try #require(try cards().first { $0.kind == "merge" && $0.state == "answered" }) |
| + card.previewUrl = "https://preview.example.test/x" |
| + let view = try #require(Feed.decision(card, task: nil)) |
| + #expect(view.showsOnlyNote, "as chat.html's equipo-card-done: the note and nothing else") |
| + #expect(!view.hasPreview) |
| + var ships = try #require(try cards().first { $0.kind == "merge_ships" }) |
| + ships.options = [] |
| + let empty = try #require(Feed.decision(ships, task: nil)) |
| + #expect(!empty.open, "a ships card with no choices is not open, as on the web") |
| + } |
| + |
| + @Test func aChangedCardKeepsSayingSoUntilItMovesOn() { |
| + // The conflict returns the card at revision 7: the message stays at 7 and goes after it. |
| + #expect(AnswerFeedback.stillChanged(conflictAt: 7, now: 7)) |
| + #expect(!AnswerFeedback.stillChanged(conflictAt: 7, now: 8)) |
| + } |
| +} |
diff --git a/native/scripts/check-native.sh b/native/scripts/check-native.sh| index ffb16940..13cb067a 100755 |
| --- a/native/scripts/check-native.sh |
| +++ b/native/scripts/check-native.sh |
| @@ -7,6 +7,7 @@ cd "$(dirname "$0")/.." |
| logs=build/logs; mkdir -p "$logs" |
| python3 scripts/check-fixtures.py |
| python3 scripts/check-strings.py |
| +python3 scripts/check-parity.py |
| # The repository-wide reference scan (make ci) reads native files too. |
| python3 ../scripts/runner-dead-references.py |
| swift test --package-path apple > "$logs/swift-test.log" 2>&1 || { tail -40 "$logs/swift-test.log"; exit 1; } |
diff --git a/native/scripts/check-parity.py b/native/scripts/check-parity.py| new file mode 100755 |
| index 00000000..2d0a11c4 |
| --- /dev/null |
| +++ b/native/scripts/check-parity.py |
| @@ -0,0 +1,32 @@ |
| +#!/usr/bin/env python3 |
| +"""Keep the native apps in the web's words where they must match. |
| + |
| +Every native string whose key is one of the web's copy keys (chat.card.*, |
| +work.tl.*) must equal copy.go's text for that key, so a merge card says |
| +exactly what the web says (sync proposal, parity row R-02).""" |
| +import json, re, sys |
| +from pathlib import Path |
| + |
| +native = Path(__file__).resolve().parents[1] |
| +strings = json.loads((native / 'scripts/strings.json').read_text()) |
| +copy = (native.parent / 'internal/equipo/copy.go').read_text() |
| +problems, checked = [], 0 |
| +# Every outcome the web can show for a decision answered here needs native |
| +# words, or the answered card would silently show none. |
| +for pattern in (r'chat\.card\.merge_chose_\w+', r'chat\.card\.ships_chose_\w+'): |
| + for key in sorted(set(re.findall('"(' + pattern + ')":', copy))): |
| + if key not in strings: |
| + problems.append(f'{key}: the web has this outcome; native has no words for it') |
| +for key, text in sorted(strings.items()): |
| + if not key.startswith(('chat.card.', 'work.tl.')): |
| + continue |
| + found = re.findall(r'"' + re.escape(key) + r'":\s*"((?:[^"\\]|\\.)*)"', copy) |
| + if len(found) != 1: |
| + problems.append(f'{key}: found {len(found)} times in copy.go, expected once'); continue |
| + web = json.loads('"' + found[0] + '"') |
| + checked += 1 |
| + if web != text: |
| + problems.append(f'{key}: native says {text!r}, the web says {web!r}') |
| +for p in problems: print(p) |
| +if problems: sys.exit(1) |
| +print(f'{checked} native strings match the web') |
diff --git a/native/scripts/check-strings.py b/native/scripts/check-strings.py| index f0600a09..e81d8b18 100755 |
| --- a/native/scripts/check-strings.py |
| +++ b/native/scripts/check-strings.py |
| @@ -43,6 +43,6 @@ for p in problems: print(p) |
| if problems: sys.exit(1) |
| # Facts look their words up by a key made from the wire value |
| # (TaskReport.facts); FactWordsTests checks each one resolves. |
| -computed = {k for k in source if k.startswith(('checks.', 'review.'))} |
| +computed = {k for k in source if k.startswith(('checks.', 'review.', 'chat.card.', 'work.tl.'))} |
| unused = sorted(source.keys() - used_keys() - computed) |
| print(f'{len(source)} strings, all used keys present' + (f'; unused: {unused}' if unused else '')) |
diff --git a/native/scripts/strings.json b/native/scripts/strings.json| index b5882da5..15aff146 100644 |
| --- a/native/scripts/strings.json |
| +++ b/native/scripts/strings.json |
| @@ -21,6 +21,21 @@ |
| "card.offline": "Couldn’t reach your team. Try again.", |
| "card.open_on_web": "Open in Equipo on the web", |
| "card.question": "Question", |
| + "chat.card.merge": "Merge", |
| + "chat.card.merge_chose_merge": "Merging without checks.", |
| + "chat.card.merge_chose_not_now": "Not now.", |
| + "chat.card.merge_chose_wait": "Waiting for checks.", |
| + "chat.card.merge_chose_wait_mac": "Waiting for a Mac.", |
| + "chat.card.merge_policy_stale": "The merge rules changed since I asked, so nothing was saved.", |
| + "chat.card.merge_resolved": "Nothing to decide any more.", |
| + "chat.card.not_now": "Not now", |
| + "chat.card.not_ships": "It doesn't", |
| + "chat.card.preview_link": "Open the preview", |
| + "chat.card.ships": "It ships", |
| + "chat.card.ships_chose_not_ships": "Main isn't a release, so I can merge small changes on my own when the other rules allow.", |
| + "chat.card.ships_chose_ships": "Merging to main ships to users, so I'll ask before merging without checks.", |
| + "chat.card.wait": "Wait for checks", |
| + "chat.card.wait_mac": "Wait for a Mac", |
| "checks.cannot_run": "Can’t run here", |
| "checks.exit %@ %@": "%1$@, exit code %2$@", |
| "checks.failed": "Failed", |
| @@ -141,5 +156,6 @@ |
| "thread.reading %@": "%@ is reading", |
| "thread.sent": "Sent", |
| "track.position %@ %@": "%1$@ of %2$@", |
| - "track.spoken %@": "Stage: %@" |
| + "track.spoken %@": "Stage: %@", |
| + "work.tl.merge_dropped": "An earlier attempt to add this change was dropped when the task became an exploration." |
| } |
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json| index dada24a4..b0cb0946 100644 |
| --- a/scripts/runner-reference-allowlist.json |
| +++ b/scripts/runner-reference-allowlist.json |
| @@ -8380,7 +8380,7 @@ |
| }, |
| { |
| "path": "scripts/staging-thin.py", |
| - "line_sha256": "3c38bd4ed0d65a09156c798d5f78b20a3ea0a43de310a2858eddce2c3eecb7ed", |
| + "line_sha256": "4d7e00688f0ec2675072e83b2c2b5edd9ca7999516fcd93815ff194b5774f910", |
| "match": "equipo-runner", |
| "count": 1, |
| "reason": "Thin v1 staging gate: the staging runner unit, its state root, the production runner config it reads binary paths from, and the runner binary it builds (spec 7)." |
| @@ -10781,7 +10781,7 @@ |
| }, |
| { |
| "path": "scripts/staging-thin.py", |
| - "line_sha256": "a49ce06a450f90914fc9fe850620b0ea1b32fb6bb2eb78a25972a7689b2724f1", |
| + "line_sha256": "bd7569ed6e32776a518b356c725dc2d0d67685a7ef41de289376f53abdee2f45", |
| "match": "equipo-runner", |
| "count": 1, |
| "reason": "Retained runner executable, versioned package or user-service path in release tooling, tests or operator steps." |
| @@ -16420,5 +16420,33 @@ |
| "match": "equipo-runner", |
| "count": 1, |
| "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME." |
| + }, |
| + { |
| + "path": "scripts/staging-thin-test.py", |
| + "line_sha256": "99b79586c4d1c052acee032b83484c87e24096a161c7ec863a7e2a6af4ab6341", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Staging release test: a fake runner release's file names, to check the preview scanner is installed beside the runner and held to its digest." |
| + }, |
| + { |
| + "path": "scripts/staging-thin-test.py", |
| + "line_sha256": "e683763173a5e4463595dac49fe4c5e6f16ddf9559dff0e2aa499aefa523e6d0", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Staging release test: a fake runner release's file names, to check the preview scanner is installed beside the runner and held to its digest." |
| + }, |
| + { |
| + "path": "scripts/staging-thin-test.py", |
| + "line_sha256": "abed1ff1daded87dbb8553964c992df0bbdc7e2dc204001b66112fcf5c5bd88b", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Staging release test: a fake runner release's file names, to check the preview scanner is installed beside the runner and held to its digest." |
| + }, |
| + { |
| + "path": "scripts/staging-thin-test.py", |
| + "line_sha256": "c00578fc60a5233a8188db0cdb769fe1221da82e2a5d3e3c5558d05ef9e307df", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Staging release test: a fake runner release's file names, to check the preview scanner is installed beside the runner and held to its digest." |
| } |
| ] |
diff --git a/scripts/staging-thin-test.py b/scripts/staging-thin-test.py| index 95aab605..972ba282 100644 |
| --- a/scripts/staging-thin-test.py |
| +++ b/scripts/staging-thin-test.py |
| @@ -176,5 +176,122 @@ class SuiteTest(unittest.TestCase): |
| self.assertEqual(staging.signin_links(logs, 'a@example.com', before), [new]) |
| self.assertEqual(staging.signin_links(logs.split('\n')[0], 'a@example.com', before), []) |
| +def scratch(): |
| + return tempfile.TemporaryDirectory(dir=os.environ.get('TMPDIR', str(Path.home() / '.cache'))) |
| + |
| + |
| +class ReleaseTest(unittest.TestCase): |
| + """What the staging runner is installed with.""" |
| + |
| + def release(self, repo, sha): |
| + built = repo / 'releases' / f'equipo-runner-linux-amd64-{sha}' |
| + built.mkdir(parents=True) |
| + for name in ('equipo-runner', 'equipo-tool-proxy', 'gitleaks'): |
| + (built / name).write_bytes(name.encode() + b' bytes') |
| + (built / name).chmod(0o700) |
| + made = {k: staging.sha256(built / n) for k, n in (('runner', 'equipo-runner'), ('tool_proxy', 'equipo-tool-proxy'), ('gitleaks', 'gitleaks'))} |
| + (repo / 'releases' / f'equipo-linux-arm64-{sha}.manifest.json').write_text(json.dumps({'sha256': made})) |
| + return built |
| + |
| + def test_build_installs_the_preview_scanner_beside_the_runner(self): |
| + # The runner looks for gitleaks next to its own executable; without |
| + # it every preview fails with preview_scanner. |
| + with scratch() as folder: |
| + repo, root = Path(folder) / 'repo', Path(folder) / 'root' |
| + built = self.release(repo, 'abc1234') |
| + prod = Path(folder) / 'prod.env' |
| + prod.write_text('EQUIPO_CLAUDE_PATH="/bin/claude"\n') |
| + with patch.multiple(staging, REPO=repo, ROOT=root, PROD_ENV=prod), \ |
| + patch.object(staging, 'head', return_value='abc1234'), \ |
| + patch.object(staging, 'run', return_value=''): |
| + staging.build() |
| + scanner = root / 'releases/abc1234/gitleaks' |
| + self.assertEqual(scanner.read_bytes(), (built / 'gitleaks').read_bytes()) |
| + self.assertTrue(os.access(scanner, os.X_OK)) |
| + |
| + def test_provenance_holds_the_scanner_to_the_release(self): |
| + with scratch() as folder: |
| + repo, root = Path(folder) / 'repo', Path(folder) / 'root' |
| + built = self.release(repo, 'abc1234') |
| + installed = root / 'releases/abc1234' |
| + installed.mkdir(parents=True) |
| + for name in ('equipo-runner', 'equipo-tool-proxy', 'gitleaks'): |
| + (installed / name).write_bytes((built / name).read_bytes()) |
| + with patch.multiple(staging, REPO=repo, ROOT=root), patch.object(staging, 'run', return_value=''): |
| + self.assertIn('gitleaks', staging.provenance('abc1234')) |
| + (installed / 'gitleaks').write_bytes(b'another scanner') |
| + with self.assertRaisesRegex(RuntimeError, 'gitleaks'): |
| + staging.provenance('abc1234') |
| + (installed / 'gitleaks').unlink() |
| + with self.assertRaisesRegex(RuntimeError, 'gitleaks'): |
| + staging.provenance('abc1234') |
| + |
| + |
| +class CredentialTest(unittest.TestCase): |
| + """The owner's runner merges into repositories it creates for jobs.""" |
| + |
| + API, GIT = 'agent-bearer-not-for-print', 'agent-pat-not-for-print' |
| + |
| + def production(self, folder, repositories): |
| + path = Path(folder) / 'prod/amadan.json' |
| + staging.private(path, json.dumps({'agent': 'equipo-docs-t1~paul@example.com', 'repositories': repositories})) |
| + prod = Path(folder) / 'prod/service.env' |
| + prod.write_text(f'EQUIPO_AMADAN_CREDENTIAL_PATH="{path}"\nEQUIPO_GIT_PATH="/usr/bin/git"\n') |
| + return path, prod |
| + |
| + def test_owner_runner_gets_an_agent_wide_credential_and_production_keeps_its_own(self): |
| + with scratch() as folder: |
| + shared = {'api': self.API, 'git': self.GIT} |
| + source, prod = self.production(folder, {'amadan.net/oficina/equipo': shared, 'amadan.net/oficina/docs': shared}) |
| + before = source.read_bytes() |
| + root, home = Path(folder) / 'root', Path(folder) / 'home' |
| + release = Path(folder) / 'release' |
| + release.mkdir() |
| + for r in (root, root / 'suite'): |
| + (r / 'state').mkdir(parents=True) |
| + (r / 'state/credentials.json').write_text('{}') |
| + out = [] |
| + with patch.multiple(staging, ROOT=root, SUITE_ROOT=root / 'suite', PROD_ENV=prod), \ |
| + patch.object(staging.Path, 'home', return_value=home), \ |
| + patch.object(staging, 'run', return_value=''), \ |
| + patch.object(staging, 'instance_id', return_value='INSTANCE'), \ |
| + patch.object(staging, 'claude_a', return_value={'local_id': 'claude-a'}), \ |
| + patch.object(staging, 'added_in_app', return_value=[]), \ |
| + patch.object(staging, 'sha256', return_value='digest'), \ |
| + patch('builtins.print', side_effect=lambda *a, **k: out.append(' '.join(map(str, a)))): |
| + staging.install('abc1234', release, root, staging.UNIT, 'owner@example.com', root / 'cookie', create=True) |
| + staging.install('abc1234', release, root / 'suite', staging.SUITE_UNIT, staging.SUITE, root / 'suite/cookie', create=False) |
| + owner = Path(staging.read_env(root / 'service.env')['EQUIPO_AMADAN_CREDENTIAL_PATH']) |
| + self.assertEqual(owner, root / 'amadan.json') |
| + self.assertEqual(owner.stat().st_mode & 0o777, 0o600) |
| + self.assertEqual(json.loads(owner.read_text()), |
| + {'agent': 'equipo-docs-t1~paul@example.com', 'api': self.API, 'git': self.GIT}) |
| + self.assertEqual(staging.read_env(root / 'suite/service.env')['EQUIPO_AMADAN_CREDENTIAL_PATH'], str(source)) |
| + self.assertEqual(source.read_bytes(), before) |
| + self.assertFalse(any(self.API in line or self.GIT in line for line in out)) |
| + |
| + def test_refuses_without_one_bearer_and_one_git_pat(self): |
| + for name, repositories in (('two bearers', {'amadan.net/a/b': {'api': 'one', 'git': 'pat'}, 'amadan.net/a/c': {'api': 'two', 'git': 'pat'}}), |
| + ('legacy, no git', {'amadan.net/a/b': 'bearer-only'}), |
| + ('empty', {})): |
| + with self.subTest(name), scratch() as folder: |
| + source, _ = self.production(folder, repositories) |
| + root = Path(folder) / 'root' |
| + with patch.object(staging, 'ROOT', root): |
| + with self.assertRaisesRegex(RuntimeError, 'agent bearer'): |
| + staging.agent_credential(source) |
| + self.assertFalse((root / 'amadan.json').exists()) |
| + |
| + def test_keeps_an_agent_wide_entry_production_already_has(self): |
| + with scratch() as folder: |
| + source = Path(folder) / 'amadan.json' |
| + staging.private(source, json.dumps({'agent': 'a~p@example.com', 'api': self.API, 'git': self.GIT, |
| + 'repositories': {'amadan.net/a/b': {'api': 'old', 'git': 'old'}}})) |
| + root = Path(folder) / 'root' |
| + with patch.object(staging, 'ROOT', root): |
| + written = staging.agent_credential(source) |
| + self.assertEqual(json.loads(written.read_text()), {'agent': 'a~p@example.com', 'api': self.API, 'git': self.GIT}) |
| + |
| + |
| if __name__ == '__main__': |
| unittest.main() |
diff --git a/scripts/staging-thin.py b/scripts/staging-thin.py| index 97baf04b..b5b03b69 100755 |
| --- a/scripts/staging-thin.py |
| +++ b/scripts/staging-thin.py |
| @@ -14,9 +14,13 @@ Two people use staging. The owner (the claude-a binding's person) chats |
| there and has the owner's runner unit, which stays running. The headless |
| suite signs in as its own owner (SUITE, added by the owner's session) with |
| its own runner unit, so the suite never writes into the owner's |
| -conversation. Both runners read the production runner's forge credential |
| -file in place (never copied) for the repositories they advertise; only |
| -the owner's may create repositories. |
| +conversation. Only the owner's runner may create repositories. The |
| +suite's runner reads the production runner's forge credential file in |
| +place for the repositories it advertises. The owner's runner has its own |
| +agent-wide file, amadan.json under the staging root, made at each install |
| +from the same agent bearer and git PAT: it merges into every repository |
| +the hub lets the agent reach, including the ones it creates for jobs. |
| +Production's file is never changed. |
| Only equipo-staging in Oficina on the flagship console, and only the |
| staging runner units, are ever touched. Cookies, bearers and sign-in links |
| @@ -145,7 +149,8 @@ def build(): |
| release = REPO / 'releases' / f'equipo-runner-linux-amd64-{sha}' |
| runner = ROOT / 'releases' / sha |
| runner.mkdir(parents=True, exist_ok=True, mode=0o700) |
| - for name in ('equipo-runner', 'equipo-tool-proxy'): |
| + # The preview scanner sits beside the runner, which looks for it there. |
| + for name in ('equipo-runner', 'equipo-tool-proxy', 'gitleaks'): |
| shutil.copy2(release / name, runner / name) |
| provenance(sha) |
| print(f'built {sha}: {instance_binary(sha)} and {runner}') |
| @@ -154,12 +159,14 @@ def build(): |
| def provenance(sha): |
| """The digests the release build recorded, after checking that the |
| - release artifacts, and staging's copies of the runner and tool proxy, |
| - are still those bytes. Nothing is deployed or installed without it.""" |
| + release artifacts, and staging's copies of the runner, tool proxy and |
| + preview scanner, are still those bytes. Nothing is deployed or |
| + installed without it.""" |
| run(['python3', 'scripts/staged-artifacts.py', 'verify', sha]) |
| made = json.loads((REPO / 'releases' / f'equipo-linux-arm64-{sha}.manifest.json').read_text())['sha256'] |
| - for name, key in (('equipo-runner', 'runner'), ('equipo-tool-proxy', 'tool_proxy')): |
| - if sha256(ROOT / 'releases' / sha / name) != made[key]: |
| + for name, key in (('equipo-runner', 'runner'), ('equipo-tool-proxy', 'tool_proxy'), ('gitleaks', 'gitleaks')): |
| + path = ROOT / 'releases' / sha / name |
| + if not path.is_file() or sha256(path) != made[key]: |
| raise RuntimeError(f'staging holds another {name} than the {sha} release built') |
| return made |
| @@ -357,12 +364,16 @@ def install(sha, release, root, unit_name, person, cookie_path, create): |
| env = {k: v for k, v in source.items() if k in { |
| 'EQUIPO_CLAUDE_PATH', 'EQUIPO_CODEX_PATH', 'EQUIPO_CODEX_CODE_MODE_HOST_PATH', 'EQUIPO_BWRAP_PATH', |
| 'EQUIPO_GIT_PATH', 'EQUIPO_AMADAN_PATH', 'EQUIPO_GO_BINARY', 'EQUIPO_GO_ROOT', 'EQUIPO_CLAUDE_MODEL'}} |
| - # The forge credential file is read in place, never copied: only its |
| - # repository names and the agent's reach leave the runner. |
| + # Only the forge credential's repository names and the agent's reach |
| + # leave the runner. The suite reads production's file in place; the |
| + # owner's runner, which creates repositories, has the agent-wide one. |
| + credential = source['EQUIPO_AMADAN_CREDENTIAL_PATH'] |
| + if root == ROOT: |
| + credential = str(agent_credential(credential)) |
| env.update(EQUIPO_ORIGIN=ORIGIN, EQUIPO_INSTANCE_ID=instance_id(), EQUIPO_MACHINE_LABEL='docs-t1 staging', |
| EQUIPO_RUNNER_STATE_DIR=str(root / 'state'), EQUIPO_WORKSPACE_ROOT=str(root / 'work'), |
| EQUIPO_SCRATCH_ROOT=str(root / 'scratch'), EQUIPO_ACCOUNT_BINDINGS_PATH=str(root / 'config/bindings.json'), |
| - EQUIPO_AMADAN_CREDENTIAL_PATH=source['EQUIPO_AMADAN_CREDENTIAL_PATH'], |
| + EQUIPO_AMADAN_CREDENTIAL_PATH=credential, |
| EQUIPO_TOOL_PROXY_PATH=str(release / 'equipo-tool-proxy'), |
| EQUIPO_ACCOUNTS_ROOT=str(root / 'accounts'), |
| EQUIPO_RUNNER_CREATE_REPOS='1' if create else '0') |
| @@ -409,6 +420,28 @@ def install(sha, release, root, unit_name, person, cookie_path, create): |
| print(unit_name, sha, 'started') |
| +def agent_credential(source): |
| + """Staging's own forge credential file: production's agent, bearer and |
| + git PAT as one agent-wide entry, mode 0600. The hub decides which |
| + repositories that reaches. A file of per-repository entries only lets |
| + the runner merge into those repositories: a merge into one it created |
| + for a job was refused before it reached the hub. Values are never |
| + printed.""" |
| + data = json.loads(Path(source).read_text()) |
| + if data.get('api'): |
| + pairs = {(data.get('api'), data.get('git'))} |
| + else: |
| + pairs = {(e.get('api'), e.get('git')) if isinstance(e, dict) else (e, None) |
| + for e in (data.get('repositories') or {}).values()} |
| + agent = data.get('agent') |
| + if len(pairs) != 1 or not all(isinstance(v, str) and v for v in [agent, *next(iter(pairs))]): |
| + raise RuntimeError('the production forge credential has no single agent bearer and git PAT') |
| + api, git = next(iter(pairs)) |
| + path = ROOT / 'amadan.json' |
| + private(path, json.dumps({'agent': agent, 'api': api, 'git': git})) |
| + return path |
| + |
| + |
| def added_in_app(root, person): |
| """Connections added in the app (Connections slice 1) live in the |
| staging root's own accounts directory and survive a restage. The |
| @@ -552,7 +585,11 @@ def suite_run(only, run_id, token): |
| # real bug in a repository the agent reaches; the step pushes |
| # its own branch and nothing merges. |
| EQUIPO_STAGING_WITNESS=os.environ.get('EQUIPO_STAGING_WITNESS', 'Bug in oficina/equipo: README.md never links to the API reference, so device developers cannot find it. Add one line to the README pointing to docs/api/equipo-v1.md. Change only README.md.'), |
| - EQUIPO_STAGING_CRASH_WITNESS=os.environ.get('EQUIPO_STAGING_CRASH_WITNESS', ''), |
| + # The step crash and the step cancel each ask for their own |
| + # small, true change, so no two of a run's tasks read alike |
| + # (similar tasks are combined). The cancelled one never pushes. |
| + EQUIPO_STAGING_CRASH_WITNESS=os.environ.get('EQUIPO_STAGING_CRASH_WITNESS', 'Bug in oficina/equipo: docs/plan-3-acceptance.md has no title; its first line is the copy marker. Add the line "# Plan 3 acceptance" above that marker and keep the marker as it is. Change only docs/plan-3-acceptance.md.'), |
| + EQUIPO_STAGING_CANCEL_WITNESS=os.environ.get('EQUIPO_STAGING_CANCEL_WITNESS', 'Bug in oficina/equipo: docs/mac-runner.md has no list of its sections, so a person cannot see the steps and the troubleshooting at a glance. Add a short list of its three section headings after the opening paragraphs. Change only docs/mac-runner.md.'), |
| # Slice 4: tasks already pushed that the upgrade judges (no |
| # new message), and what the person says in the live review |
| # and checks scenario. |