Run a preview again on a merged task, and say why a retry is refused
Production, 2026-11-26: "Retry the Neary's preview" was refused. Both
tasks were done after their merge; one preview failed (preview_scanner),
the other ended unconfirmed (preview_headers), which did not count as a
failure.
- A preview runs again on a done task, by the person's Retry or the
coordinator's retry_step: a new preview step of the merged commit (the
approved candidate when Equipo did not merge it), published only
through previewRefusal's checks. Stage, merge and earlier steps stay
as they are; the timeline shows the new step. Cancelled tasks never.
- A preview counts as retryable when it ended failed, cancelled,
unconfirmed (any reason), expired, or as a devbox link gone with its
task; refused while its link is up. Checks/review: a done one is a
result; review without a verdict is already a failure.
- Refusals carry fixed reasons (task_cancelled, task_done, not_ended,
completed, not_newest, commit_changed, not_approved, no_runner,
preview_public_disabled, ...) in retry_step's result as JSON
{reason, note}, and read_task gains "retry" per step kind.
- Once per task and step kind per turn: the existing mutation ledger.
- A devbox link deployed after its task ended gets an expiry (7 days,
a temporary site's TTL) and the hourly sweep takes it down once
(chat_steps.preview_down_at, migration 0111). Before, a preview that
finished after the merge stayed up with nothing to take it down.
- No new user-facing copy: Retry, the timeline and preview lines reuse
existing keys; the new texts are model-facing.
Tests first: preview_retry_done_contract_test.go (5 contracts) failed
before the change for the reasons named (no Retry offered; unconfirmed
not retryable; task_ended without a reason; card_stale fixed in the
helper).
Mutation checks (each made the named test fail, then restored):
M1 previewMayBuild without merged commit: RetryPreviewOnMergedTask,
start refused "withdrawn"
M2 personRetry refusing done tasks: RetryPreviewOnMergedTask, 409
M3 done task retried in place: RetryPreviewOnMergedTask, no dispatch
of the merged commit
M4 only failed previews retryable: CoordinatorRetryUnconfirmed...,
read_task "not_ended"
M5 a preview that is up retryable: RetryRefusalReasons, "retrying"
M6 host check dropped: RetryRefusalReasons, public previews off ran
M7 refusal without reason: RetryRefusalReasons
M8 done-task guards for checks/review off: RetryRefusalReasons
M9 task_retry out of the ledger: CoordinatorRetryUnconfirmed..., pu2
M10 devbox re-run not bounded: RetryDevboxPreview..., link not shown
M11 sweep not clearing its mark: RetryDevboxPreview..., 3 forgets
M12 preview page refusing merged commit: RetryPreviewOnMergedTask, 404
M13 devbox link on any done task with an expiry:
TestReviewStateChangesBetweenWrapperReads/final
M14 Retry not offered on done task: RetryPreviewOnMergedTask
M15 rerun touching the stage: RetryPreviewOnMergedTask
Runs: go test ./internal/thintest -run 'Retry|Preview|Stuck|Publish|
Merge|Devbox|Explore|ReadTask|Tool'; ./internal/equipo/chat;
./internal/equipo; ./internal/wire; runner/thin mcp tests; make vet
fmt-check staticcheck migration-check runner-dead-references
copy-release-check; ci-test.py check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 files changed,
+954
−92
internal/equipo/chat/change_files_exposure_test.go+1 −1internal/equipo/chat/preview.go+3 −1internal/equipo/chat/preview_retry.go+363 −0internal/equipo/chat/publish.go+4 −2internal/equipo/chat/store.go+5 −0internal/equipo/chat/stuck.go+53 −58internal/equipo/chat/tasks.go+47 −19internal/equipo/migrations/0111_preview_down_at.sql+3 −0internal/equipo/migrations/schema.sql+4 −0internal/equipo/preview_pass_store.go+7 −2internal/equipo/work_views.go+48 −8internal/runner/thin/mcp.go+1 −1internal/thintest/preview_retry_done_contract_test.go+415 −0
CI failed — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/preview-retry-done: 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.4s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 10.2s
ci-box: pi: installed and verified in 7.6s
ci-box: opencode: installed and verified in 2.1s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.7s
ci-box: clone deepened in 4.6s
ci-box: file times set from content: 3129 files, 200 directories
ci-box: ready in 18.1s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok amadan.net/oficina/equipo/internal/equipotest 0.150s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
4.1s
+ go list -export -test -tags testbuild -f ./...
4.1s
+ go list -export -test -tags browser,testbuild -f ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
3.4s
rastrillo: budget size: 3 problem(s)
exit status 1
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-24 15:56:00 +0000 UTC
go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless
receipt: test step 1m15.258s 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.569s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m13.57s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 55.95, cpu waiting 37.10%, memory waiting 0.00%, io waiting 0.45%
--- 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 1m16.007s 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 1m14.383s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m14.38s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 55.95, cpu waiting 37.22%, memory waiting 0.00%, io waiting 0.43%
--- 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 1m17.095s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m15.049s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m5.71s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.09s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.25s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 55.95, cpu waiting 37.22%, memory waiting 0.00%, io waiting 0.43%
--- 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 1m13.734s 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 1m11.856s amadan.net/oficina/equipo/internal/headless
receipt: slow test 35.12s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 19.04s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.98s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
receipt: slow test 8.71s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
machine: 32 CPUs, load 53.69, cpu waiting 36.83%, memory waiting 0.00%, io waiting 0.46%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 1m32.282s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m30.635s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m1.5s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.22s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8.06s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 6.91s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.94s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 56.58, cpu waiting 37.10%, memory waiting 0.00%, io waiting 0.33%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 2m44.238s 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 2m42.214s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m35.86s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 18.66s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.8s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 6.64s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
receipt: slow test 6.52s amadan.net/oficina/equipo/internal/headless TestHeadlessBatchAfterRefusedReply
machine: 32 CPUs, load 24.30, cpu waiting 12.64%, memory waiting 0.00%, io waiting 0.09%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest
receipt: test step 2m16.644s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m14.517s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 10.92s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.74s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 3.95s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.86s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.53s amadan.net/oficina/equipo/internal/thintest TestResearchDoneFallsBack
machine: 32 CPUs, load 33.53, cpu waiting 19.97%, memory waiting 0.00%, io waiting 0.15%
--- 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 1m48.063s 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 1m46.607s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.17s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.03s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.54s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 3.01s amadan.net/oficina/equipo/internal/thintest TestContractPausedJob
receipt: slow test 2.56s amadan.net/oficina/equipo/internal/thintest TestContractRetryRefusalReasons
machine: 32 CPUs, load 49.12, cpu waiting 31.11%, memory waiting 0.00%, io waiting 0.25%
--- 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 5m3.948s, over the 45s its record on line 44 allows; reported only, timing fails on CI
receipt: test step 5m9.372s 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 5m3.948s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.93s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.82s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.48s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 9.96s amadan.net/oficina/equipo/internal/runner/thin TestTimeoutKeepsNothingForAnOlderInstance
machine: 32 CPUs, load 2.85, cpu waiting 1.14%, 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
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed
receipt: test step 51.03s 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.824s amadan.net/oficina/equipo/internal/runner
receipt: slow test 29.79s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 45.16, cpu waiting 31.25%, memory waiting 0.00%, io waiting 0.68%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed
receipt: test step 1m1.224s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 59.175s amadan.net/oficina/equipo/internal/runner
receipt: slow test 49.07s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 46.4s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.39s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.69s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 52.78, cpu waiting 36.57%, memory waiting 0.00%, io waiting 0.57%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed
receipt: test step 36.037s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 35.085s 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.12s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.42s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.62s amadan.net/oficina/equipo/internal/runner TestCoordinatorTransientRefusalKeepsServing
machine: 32 CPUs, load 30.20, cpu waiting 21.15%, memory waiting 0.00%, io waiting 0.86%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 41.5%, load 22.39
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 1m9.447s 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 1m7.511s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 28.69s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 28.61s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 26.28s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 23.72s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 23.53s amadan.net/oficina/equipo/internal/equipotest TestBudgetLoweringBelowUsage
machine: 32 CPUs, load 54.45, cpu waiting 35.93%, memory waiting 0.00%, io waiting 0.30%
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 40.0%, load 22.39
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 1m19.452s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.649s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 21.03s amadan.net/oficina/equipo/internal/equipotest TestProjectBindingUniqueness
receipt: slow test 21.02s amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
receipt: slow test 21.02s amadan.net/oficina/equipo/internal/equipotest TestProjectConcurrentRetry
receipt: slow test 21s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 20.93s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
machine: 32 CPUs, load 46.63, cpu waiting 30.19%, memory waiting 0.00%, io waiting 0.24%
--- 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 40.0%, load 22.39
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 1m16.032s 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 1m10.79s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 16.23s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 13.59s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 10.68s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 10.65s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 7.55s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 49.12, cpu waiting 32.10%, memory waiting 0.00%, io waiting 0.26%
--- 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 40.0%, load 22.39
test lane equipotest-rest: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test[A-D]|^TestQ|^Test[E-P]|^TestR' ./internal/equipotest
receipt: test step 1m10.032s 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.09s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.85s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 25.75s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 25.68s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.84s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedOnce
receipt: slow test 23.76s amadan.net/oficina/equipo/internal/equipotest TestSigninCSRF
machine: 32 CPUs, load 52.18, cpu waiting 34.95%, memory waiting 0.00%, io waiting 0.29%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 40.0%, load 22.39
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 54.559s 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 52.6s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.8s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.53s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.62s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.6s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.31s amadan.net/oficina/equipo/internal/plan3test TestInviteMigration
machine: 32 CPUs, load 58.38, cpu waiting 36.64%, memory waiting 0.00%, io waiting 0.38%
--- 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 40.0%, load 22.39
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/door ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude/realcli: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: 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/runnerproto: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/wire/wireschema: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
--- FAIL amadan.net/oficina/equipo/internal/runner/webread TestTimeouts
=== RUN TestTimeouts
fetch_test.go:537: s1: {Source:s1 Origin:paul Parent: URL:https://shop.example.com/slow-body Hops:[{URL:https://shop.example.com/slow-body Address:151.101.1.1 Status:200}] Address:151.101.1.1 Status:200 Type:text/plain Bytes:5 SHA256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 Millis:301 Reason: File:s001.txt}
--- FAIL: TestTimeouts (0.61s)
--- FAIL amadan.net/oficina/equipo/internal/runner/webread (package output)
FAIL
rastrillo-budget/v1 ran 1.144s
FAIL amadan.net/oficina/equipo/internal/runner/webread 1.150s
budget note: internal/equipo took 2m18.547s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 16.622s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/setup took 11.367s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 1m55.18s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 41.44s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/runner/containment took 47.465s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 10.282s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 2m32.043s against a 60s target (the gate's other steps are not in this figure)
receipt: 21 packages ran, 44 cached, 17 without tests, 1 failed
receipt: slow package 2m18.547s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 1m55.18s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m5.472s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 53.079s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 50.884s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 54.5s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 45.75s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 45.14s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
receipt: slow test 44.91s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
receipt: slow test 44.33s amadan.net/oficina/equipo/internal/idtest TestDoorNeverJudgesANativeSession
rastrillo: budget test: go test failed
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestTimeouts$' -count=1 ./internal/runner/webread (retry, once)
##############################################################################
FLAKE ./internal/runner/webread:TestTimeouts rest 7ce5cfbc16dbe1766d951318c2d74aca35045857 0.61s 18.30
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 18.30, cpu waiting 9.06%, memory waiting 0.00%, io waiting 0.06%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
receipt: test step 1m23.94s 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.513s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.45s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.99s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.24s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.17s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.29s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 58.38, cpu waiting 36.81%, memory waiting 0.00%, io waiting 0.37%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
receipt: test step 1m29.631s 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.079s amadan.net/oficina/equipo/internal/headless
receipt: slow test 27.8s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 20.3s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 12.85s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.5s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 9.15s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 56.58, cpu waiting 37.24%, memory waiting 0.00%, io waiting 0.34%
--- 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 1m52.856s 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 1m51.425s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.51s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 13.48s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 12.9s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.44s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsSignInEmail
receipt: slow test 11.13s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
machine: 32 CPUs, load 43.45, cpu waiting 28.31%, memory waiting 0.00%, io waiting 0.22%
--- 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|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN TestBrowserCopyContinue
time=2026-11-26T21:37:40.011Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-26T21:37:40.011Z level=INFO msg="startup phase done" phase=state_lock took=247µs
time=2026-11-26T21:37:40.011Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-26T21:37:40.012Z level=INFO msg="startup phase done" phase=claim_roots took=234µs
time=2026-11-26T21:37:40.012Z level=INFO msg="startup phase" phase=sweep
time=2026-11-26T21:37:40.064Z level=INFO msg="startup phase done" phase=sweep took=52.824ms
time=2026-11-26T21:37:40.065Z level=INFO msg="startup phase" phase=credentials
time=2026-11-26T21:37:40.065Z level=INFO msg="startup phase done" phase=credentials took=133µs
time=2026-11-26T21:37:40.065Z level=INFO msg="startup phase" phase=open_state
time=2026-11-26T21:37:40.128Z level=INFO msg="startup phase done" phase=open_state took=63.473ms
time=2026-11-26T21:37:40.129Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-26T21:37:40.129Z level=INFO msg=connecting host=127.0.0.1:43379 protocol=32
time=2026-11-26T21:37:40.134Z level=INFO msg=connected host=127.0.0.1:43379 took=4.562ms
time=2026-11-26T21:37:40.134Z level=INFO msg="capabilities gathering"
time=2026-11-26T21:37:40.135Z level=INFO msg="capabilities gathered" took=1.423ms tags=linux,claude,go
time=2026-11-26T21:37:40.138Z level=INFO msg="hello sent" protocol=32
time=2026-11-26T21:37:40.153Z level=INFO msg=welcome protocol=32 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.45s)
--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m32.303s
FAIL amadan.net/oficina/equipo/internal/headless 92.503s
receipt: test step 1m33.895s 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 1m32.303s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.78s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 11s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 10.41s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 9.62s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.72s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' -v -run '^TestBrowserCopyContinue$' -count=1 ./internal/headless (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest 7ce5cfbc16dbe1766d951318c2d74aca35045857 6.45s 54.45
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 54.45, cpu waiting 35.93%, memory waiting 0.00%, io waiting 0.30%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation|TestBrowserPreviewPassExchange)$' ./internal/equipo
receipt: test step 3.976s 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.351s amadan.net/oficina/equipo/internal/equipo
receipt: slow test 1.74s amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewPassExchange
receipt: slow test 610ms 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|TestBrowserSmartDoor)$' ./internal/idtest
budget note: internal/idtest took 10.904s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 12.339s 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 10.904s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 8.76s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.14s 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.896s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.192s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.19s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPausedWork|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRhythm|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest
receipt: test step 3m39.437s 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 3m37.737s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 23.52s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.44s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.04s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.76s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 9.34s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 7.48, cpu waiting 3.56%, memory waiting 0.00%, io waiting 0.02%
--- 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 (53s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.55s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.28s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.50s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 8.83s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 26.68s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless (61s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 22.44s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 11.25s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 9.59s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 15.71s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless (20s)
ok ./internal/headless TestMixedVersions 18.83s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks (1s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.78s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin (1s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 52.78, cpu waiting 36.84%, memory waiting 0.00%, io waiting 0.55%
--- 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 12.833s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 4 without tests, 0 failed
receipt: slow package 8.932s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 255ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 95ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 5ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 5.46s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 2.82s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 530ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 250ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment
receipt: test step 3.49s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3.098s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 330ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 210ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 140ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryReusedPID
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
machine: 32 CPUs, load 13.70, cpu waiting 10.36%, memory waiting 0.00%, io waiting 1.16%
--- 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 40.0%, load 22.39
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2841 text files, 3229 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 tool fiesta spacing -skip tokens.css internal/equipo/static
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
internal/equipo/chat: 35456 source lines, over the 35061 its exemption (line 59) allows
internal/equipo: 23293 source lines, over the 23248 its exemption (line 17) allows
internal/thintest: 35859 test lines, over the 35444 its exemption (line 74) allows
rastrillo: budget size: 3 problem(s)
exit status 1
make[1]: *** [Makefile:75: budget] Error 1
machine: 32 CPUs, load 53.92, cpu waiting 37.08%, memory waiting 0.00%, io waiting 0.53%
make: *** [Makefile:113: ci-shard] Error 2
amadan: step check shard 25 of 29 failed: exit status 2
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 40.0%, load 22.39
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 40.21, cpu waiting 28.62%, memory waiting 0.00%, io waiting 0.72%
--- 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 40.0%, load 22.39
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 10
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 30.20, cpu waiting 23.05%, memory waiting 0.00%, io waiting 0.83%
--- 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 41.5%, load 22.39
shard 28: make gitleaks
[90m9:37PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net
[90m9:37PM[0m [32mINF[0m [1m1204 commits scanned.[0m
[90m9:37PM[0m [32mINF[0m [1mscanned ~67094835 bytes (67.09 MB) in 22s[0m
[90m9:37PM[0m [32mINF[0m [1mno leaks found[0m
machine: 32 CPUs, load 45.16, cpu waiting 32.75%, memory waiting 0.00%, io waiting 0.65%
amadan: job failed at step check shard 25 of 29 — its output is above, not at the tail of this log
diff --git a/internal/equipo/chat/change_files_exposure_test.go b/internal/equipo/chat/change_files_exposure_test.go| index adc40573..7d7b0f1b 100644 |
| --- a/internal/equipo/chat/change_files_exposure_test.go |
| +++ b/internal/equipo/chat/change_files_exposure_test.go |
| @@ -61,7 +61,7 @@ func TestChangeFilesStayOutOfCoordinatorListsSnapshotAndEvents(t *testing.T) { |
| must(err) |
| noFacts("snapshot", snapshot) |
| must(r.s.tx(ctx, func(tx *txn) error { |
| - result, err := tx.readTask(k.ID) |
| + result, err := tx.readTask(hkOwner, k.ID) |
| if err != nil { |
| return err |
| } |
diff --git a/internal/equipo/chat/preview.go b/internal/equipo/chat/preview.go| index 0e2b0ad6..21ec1fbd 100644 |
| --- a/internal/equipo/chat/preview.go |
| +++ b/internal/equipo/chat/preview.go |
| @@ -138,7 +138,9 @@ func (t *txn) previewRefusal(l Lease, s *stepRecord, purpose, digest string) (st |
| return "", err |
| } |
| p := progressFor(k, steps) |
| - if p.moved || p.candidate != s.CandidateSHA || p.review == nil || p.review.State != wire.StepDone || p.review.Verdict != wire.VerdictApprove { |
| + // The approved candidate while the branch is at it, or once the task |
| + // is done the commit a preview of it builds (its merged commit). |
| + if !previewMayBuild(k, p, s.CandidateSHA) { |
| return "withdrawn", nil |
| } |
| grant := previewGrant(*s) |
diff --git a/internal/equipo/chat/preview_retry.go b/internal/equipo/chat/preview_retry.go| new file mode 100644 |
| index 00000000..9c48f93f |
| --- /dev/null |
| +++ b/internal/equipo/chat/preview_retry.go |
| @@ -0,0 +1,363 @@ |
| +package chat |
| + |
| +import ( |
| + "encoding/json" |
| + "errors" |
| + "strings" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// Previews on finished tasks (Paul, 2026-11-26: "Retry the Neary's |
| +// preview" was refused because both tasks were merged and done). A |
| +// preview is ancillary, so it may run again after its task ended: on a |
| +// task Equipo merged it builds the merged commit, otherwise the approved |
| +// candidate, as a new preview step; the task's stage, merge and other |
| +// steps stay as they are. It is published only through the preview's own |
| +// checks (previewRefusal). A preview that ended unconfirmed, or whose link |
| +// is gone, counts as one to run again, like a failed one. |
| + |
| +// Why a retry is refused, in fixed words: retry_step's result and |
| +// read_task's retry say them; people see the conflict, never these. |
| +const ( |
| + retryTaskCancelled = "task_cancelled" |
| + retryTaskDone = "task_done" |
| + retryNotEnded = "not_ended" |
| + retryCompleted = "completed" |
| + retryNotFailed = "not_failed" |
| + retryNotNewest = "not_newest" |
| + retryCommitChanged = "commit_changed" |
| + retryNotApproved = "not_approved" |
| + retryNoRunner = "no_runner" |
| + retryNotYours = "not_yours" |
| + retryNotOwner = "not_owner" |
| + retryNoStep = "no_step" |
| + // previewHostAuthority's reasons are used as they are: |
| + // wire.ReasonRunnerOutdated, preview_host, preview_public_disabled. |
| +) |
| + |
| +// retryNotes is what the model reads back for each reason. |
| +var retryNotes = map[string]string{ |
| + retryTaskCancelled: "The task was cancelled: nothing of it runs again.", |
| + retryTaskDone: "The task is done: only its preview can run again (step: preview). Its checks, review and merge stay as they are.", |
| + retryNotEnded: "That step has not ended yet (queued or running, or its end is not proven). Wait for it; read_task shows it.", |
| + retryCompleted: "That step did its work (its checks or review finished, or its preview link is up). There is nothing to run again.", |
| + retryNotFailed: "That step was stopped, not failed: there is nothing to run again.", |
| + retryNotNewest: "A newer step of that kind came after it: only the newest runs again.", |
| + retryCommitChanged: "The commit it would judge or show is no longer the task's (the branch moved, or a new candidate came). read_task shows where it stands.", |
| + retryNotApproved: "Review has not approved the task's commit, so no preview of it runs.", |
| + retryNoRunner: "The person has no primary runner connected to run it on.", |
| + retryNotYours: "That task is another person's: only the person who asked for it can run its steps again.", |
| + retryNotOwner: "Only an owner's runner can run work.", |
| + retryNoStep: "That task has no step of that kind yet.", |
| + wire.ReasonRunnerOutdated: "The person's primary runner is too old to make previews: it needs an update first.", |
| + "preview_host": "The person's primary runner has no preview host now.", |
| + "preview_public_disabled": "This project does not allow public previews now; an owner can turn them on in Settings.", |
| + "not_retryable": toolStepNotRetried, |
| +} |
| + |
| +// retryRefusal is a refused retry with its fixed reason: errors.Is |
| +// matches its kind (ErrNotRetryable, ErrTaskEnded or ErrForbidden). |
| +type retryRefusal struct { |
| + kind error |
| + reason string |
| +} |
| + |
| +func (e retryRefusal) Error() string { return e.kind.Error() + ": " + e.reason } |
| +func (e retryRefusal) Unwrap() error { return e.kind } |
| +func refuseRetry(kind error, reason string) error { return retryRefusal{kind, reason} } |
| + |
| +// retryReasonOf is err's fixed reason, fallback when it has none. |
| +func retryReasonOf(err error, fallback string) string { |
| + var r retryRefusal |
| + if errors.As(err, &r) { |
| + return r.reason |
| + } |
| + return fallback |
| +} |
| + |
| +// refusedRetry is retry_step's refusal: the code, and the reason with |
| +// what it means. |
| +func refusedRetry(code, reason string) wire.ToolResult { |
| + note, ok := retryNotes[reason] |
| + if !ok { |
| + reason, note = "not_retryable", toolStepNotRetried |
| + } |
| + raw, _ := json.Marshal(map[string]string{"reason": reason, "note": note}) |
| + return refused(code, string(raw)) |
| +} |
| + |
| +// previewRerunUp is how long a devbox link a preview brought up after its |
| +// task ended stays up: as long as a temporary site lives (the runner's |
| +// previewTTL). A devbox link has no expiry of its own and otherwise |
| +// comes down when its task ends, which this one already did. |
| +const previewRerunUp = 7 * 24 * time.Hour |
| + |
| +// approvedCandidate reports whether Review approved the task's candidate. |
| +func approvedCandidate(p progress) bool { |
| + return p.candidate != "" && p.review != nil && p.review.State == wire.StepDone && p.review.Verdict == wire.VerdictApprove |
| +} |
| + |
| +// previewTarget is the commit a new preview of the task builds now: on a |
| +// done task Equipo merged, the merged commit of its approved candidate; |
| +// otherwise the approved candidate while the branch is at it. "" when |
| +// there is none. |
| +func previewTarget(k taskRecord, p progress) string { |
| + if !approvedCandidate(p) { |
| + return "" |
| + } |
| + if k.Stage == wire.StageDone && k.MergedSHA != "" { |
| + if p.merge != nil && p.merge.State == wire.StepDone && p.merge.MergeSHA == k.MergedSHA { |
| + return k.MergedSHA |
| + } |
| + return "" |
| + } |
| + if p.moved { |
| + return "" |
| + } |
| + return p.candidate |
| +} |
| + |
| +// previewMayBuild reports whether a preview of sha may run and publish |
| +// for the task now: the approved candidate while the branch is at it, |
| +// or, once the task is done, previewTarget. |
| +func previewMayBuild(k taskRecord, p progress, sha string) bool { |
| + if sha == "" || !approvedCandidate(p) { |
| + return false |
| + } |
| + return sha == p.candidate && !p.moved || k.Stage == wire.StageDone && sha == previewTarget(k, p) |
| +} |
| + |
| +// previewOfTask reports whether a preview of sha stands for the task: of |
| +// its candidate cand, or of its merged commit once done. |
| +func previewOfTask(k taskRecord, cand, sha string) bool { |
| + return sha != "" && (sha == cand || k.Stage == wire.StageDone && k.MergedSHA != "" && sha == k.MergedSHA) |
| +} |
| + |
| +// previewUp reports whether a preview step's link is served now: |
| +// deployed, before any expiry, and a devbox link only while its task runs |
| +// or is held for Publish (previewHeld), or, one that came up after its |
| +// task was done, until the expiry the instance gave it |
| +// (boundDevboxPreview). |
| +func previewUp(k taskRecord, s stepRecord, now time.Time, held bool) bool { |
| + r := decodePreview(s.Preview) |
| + if s.State != wire.StepDone || r == nil || r.Outcome != wire.PreviewDeployed || r.URL == "" { |
| + return false |
| + } |
| + if r.ExpiresAt != nil && !r.ExpiresAt.After(now) { |
| + return false |
| + } |
| + if strings.HasPrefix(r.App, "eq-") && wire.FinalStage(k.Stage) && !held { |
| + return r.ExpiresAt != nil && k.Stage == wire.StageDone && k.DoneAt != nil && s.FinishedAt != nil && s.FinishedAt.After(*k.DoneAt) |
| + } |
| + return true |
| +} |
| + |
| +// previewRetryCheck is why a preview step cannot run again for person |
| +// now ("" when it can), and the commit it would build: the person's, on a |
| +// task not cancelled, the task's newest preview, ended and not up (failed, |
| +// cancelled, unconfirmed, expired, or a devbox link gone with its task), |
| +// a commit previewTarget names, on a primary whose preview host the |
| +// project allows now. |
| +func (t *txn) previewRetryCheck(k taskRecord, st stepRecord, person string) (reason, target string, err error) { |
| + if st.Person != person { |
| + return retryNotYours, "", nil |
| + } |
| + if k.CancelRequested || k.Stage == wire.StageCancelled { |
| + return retryTaskCancelled, "", nil |
| + } |
| + steps, err := t.steps(k.ID) |
| + if err != nil { |
| + return "", "", err |
| + } |
| + for _, s := range steps { |
| + if s.Specialist == wire.SpecialistPreview && s.Idx > st.Idx { |
| + return retryNotNewest, "", nil |
| + } |
| + } |
| + if !wire.StepTerminal(st.State) || !st.Terminated { |
| + return retryNotEnded, "", nil |
| + } |
| + held := false |
| + if wire.FinalStage(k.Stage) { |
| + if held, err = t.previewHeld(k, steps); err != nil { |
| + return "", "", err |
| + } |
| + } |
| + if previewUp(k, st, t.now(), held) { |
| + return retryCompleted, "", nil |
| + } |
| + p := progressFor(k, steps) |
| + if !approvedCandidate(p) { |
| + return retryNotApproved, "", nil |
| + } |
| + target = previewTarget(k, p) |
| + if target == "" || k.Stage != wire.StageDone && st.CandidateSHA != target { |
| + return retryCommitChanged, "", nil |
| + } |
| + primary, err := t.s.authority.PrimaryRunner(t.db, st.Person) |
| + if err != nil || primary == "" { |
| + return retryNoRunner, "", err |
| + } |
| + rs, err := t.runners(st.Person) |
| + if err != nil { |
| + return "", "", err |
| + } |
| + for _, r := range rs { |
| + if r.ID == primary { |
| + reason, err := t.previewHostAuthority(k.ProjectID, r) |
| + return reason, target, err |
| + } |
| + } |
| + return retryNoRunner, "", nil |
| +} |
| + |
| +// endedReason is why a step other than a preview cannot run again for |
| +// its state ("" when it failed and ended). |
| +func endedReason(st stepRecord, found bool) string { |
| + switch { |
| + case !found: |
| + return retryNoStep |
| + case !wire.StepTerminal(st.State) || !st.Terminated: |
| + return retryNotEnded |
| + case st.State == wire.StepDone: |
| + return retryCompleted |
| + case st.State == wire.StepCancelled: |
| + return retryNotFailed |
| + } |
| + return "" |
| +} |
| + |
| +// retryReason is why person cannot run st again now ("" when they can), |
| +// as personRetry would decide for the coordinator: read_task's retry. |
| +func (t *txn) retryReason(k taskRecord, st stepRecord, person string) (string, error) { |
| + if err := t.isOwner(person); errors.Is(err, ErrForbidden) { |
| + return retryNotOwner, nil |
| + } else if err != nil { |
| + return "", err |
| + } |
| + if k.Creator != person { |
| + return retryNotYours, nil |
| + } |
| + if k.CancelRequested || k.Stage == wire.StageCancelled { |
| + return retryTaskCancelled, nil |
| + } |
| + if st.Specialist == wire.SpecialistPreview { |
| + reason, _, err := t.previewRetryCheck(k, st, person) |
| + return reason, err |
| + } |
| + if k.Stage == wire.StageDone { |
| + return retryTaskDone, nil |
| + } |
| + latest, found, err := t.latestStep(k.ID) |
| + if err != nil { |
| + return "", err |
| + } |
| + if !found || latest.ID != st.ID { |
| + return retryNotNewest, nil |
| + } |
| + if r := endedReason(st, true); r != "" { |
| + return r, nil |
| + } |
| + if st.Person != person { |
| + return retryNotYours, nil |
| + } |
| + primary, err := t.s.authority.PrimaryRunner(t.db, st.Person) |
| + if err != nil || primary == "" { |
| + return retryNoRunner, err |
| + } |
| + return "", nil |
| +} |
| + |
| +// retryView is read_task's word on running the task's newest step of a |
| +// kind again (wire.RetryStepKinds): Reason is "" when it can run. |
| +type retryView struct { |
| + Step string `json:"step"` |
| + StepID string `json:"step_id"` |
| + Retryable bool `json:"retryable"` |
| + Reason string `json:"reason,omitempty"` |
| +} |
| + |
| +func (t *txn) retryViews(k taskRecord, person string) ([]retryView, error) { |
| + var out []retryView |
| + for _, kind := range wire.RetryStepKinds { |
| + var st stepRecord |
| + res := t.db.Where("task_id = ? AND specialist = ? AND coalesce(retired, 0) = 0", k.ID, kind).Order("idx DESC").Limit(1).Find(&st) |
| + if res.Error != nil { |
| + return nil, res.Error |
| + } |
| + if res.RowsAffected == 0 { |
| + continue |
| + } |
| + reason, err := t.retryReason(k, st, person) |
| + if err != nil { |
| + return nil, err |
| + } |
| + out = append(out, retryView{Step: kind, StepID: st.ID, Retryable: reason == "", Reason: reason}) |
| + } |
| + return out, nil |
| +} |
| + |
| +// rerunPreview places a new preview step of target on a finished task, |
| +// beside its other steps (the timeline shows it after them); the task's |
| +// stage and its merge are untouched. |
| +func (t *txn) rerunPreview(k *taskRecord, st *stepRecord, target string, coordinator bool) (int64, error) { |
| + steps, err := t.steps(k.ID) |
| + if err != nil { |
| + return 0, err |
| + } |
| + s := stepRecord{Specialist: wire.SpecialistPreview, Person: st.Person, Round: st.Round, BaseSHA: st.BaseSHA, CandidateSHA: target} |
| + if coordinator { |
| + s.CoordinatorAttempt = 1 |
| + } |
| + if err := t.nextStep(k, steps, s); err != nil { |
| + return 0, err |
| + } |
| + return 1, nil |
| +} |
| + |
| +// boundDevboxPreview: a devbox link deployed after its task ended (a |
| +// re-run, or a preview that finished after the merge) would stay up with |
| +// nothing to take it down. It gets an expiry, previewRerunUp from now, and |
| +// the sweep takes it down then (sweepPreviews); any earlier such link of |
| +// the task is the same link, so only this one's time counts. |
| +func (t *txn) boundDevboxPreview(k taskRecord, s *stepRecord) error { |
| + r := decodePreview(s.Preview) |
| + if !wire.FinalStage(k.Stage) || r == nil || r.Outcome != wire.PreviewDeployed || !strings.HasPrefix(r.App, "eq-") { |
| + return nil |
| + } |
| + at := t.now().Add(previewRerunUp).UTC() |
| + r.ExpiresAt = &at |
| + raw, _ := json.Marshal(r) |
| + s.Preview, s.PreviewDownAt = string(raw), &at |
| + return t.db.Model(&stepRecord{}).Where("task_id = ? AND id <> ? AND preview_down_at IS NOT NULL", k.ID, s.ID).Update("preview_down_at", nil).Error |
| +} |
| + |
| +// sweepPreviews takes down each devbox link boundDevboxPreview bounded |
| +// once its time came: the task's forget_task again (releasePreview), once. |
| +func (t *txn) sweepPreviews() error { |
| + var due []stepRecord |
| + if err := t.db.Where("preview_down_at IS NOT NULL AND preview_down_at <= ?", t.now()).Find(&due).Error; err != nil { |
| + return err |
| + } |
| + for _, s := range due { |
| + if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Update("preview_down_at", nil).Error; err != nil { |
| + return err |
| + } |
| + k, err := t.loadTask(s.TaskID) |
| + if errors.Is(err, ErrNotFound) { |
| + continue |
| + } |
| + if err != nil { |
| + return err |
| + } |
| + if !wire.FinalStage(k.Stage) { |
| + continue |
| + } |
| + if err := t.releasePreview(k); err != nil { |
| + return err |
| + } |
| + } |
| + return nil |
| +} |
diff --git a/internal/equipo/chat/publish.go b/internal/equipo/chat/publish.go| index 70b68635..08349b69 100644 |
| --- a/internal/equipo/chat/publish.go |
| +++ b/internal/equipo/chat/publish.go |
| @@ -660,14 +660,16 @@ func previewLink(k taskRecord, steps []stepRecord, cand string, now time.Time, h |
| } |
| for i := len(steps) - 1; i >= 0; i-- { |
| s := steps[i] |
| - if s.Specialist != wire.SpecialistPreview || s.CandidateSHA != cand || s.State != wire.StepDone { |
| + // Of the candidate, or of the merged commit once done (a preview |
| + // run again after the merge). |
| + if s.Specialist != wire.SpecialistPreview || !previewOfTask(k, cand, s.CandidateSHA) || s.State != wire.StepDone { |
| continue |
| } |
| r := decodePreview(s.Preview) |
| if r == nil || r.Outcome != wire.PreviewDeployed || r.URL == "" { |
| continue |
| } |
| - if strings.HasPrefix(r.App, "eq-") && wire.FinalStage(k.Stage) && !held || r.ExpiresAt != nil && !r.ExpiresAt.After(now) { |
| + if !previewUp(k, s, now, held) { |
| return "" |
| } |
| return r.URL |
diff --git a/internal/equipo/chat/store.go b/internal/equipo/chat/store.go| index 7baa640e..498b4327 100644 |
| --- a/internal/equipo/chat/store.go |
| +++ b/internal/equipo/chat/store.go |
| @@ -1126,6 +1126,11 @@ func (s *Store) Cursor(ctx context.Context) (top int64, err error) { |
| // Sweep removes events past retention, keeping the newest row so ids are |
| // never reused, and old acked commands and inbox records. |
| func (s *Store) Sweep(ctx context.Context) error { |
| + // Devbox links brought up after their task ended, past their time: in |
| + // a transaction of its own, so the runners hear it at once. |
| + if err := s.tx(ctx, func(t *txn) error { return t.sweepPreviews() }); err != nil { |
| + return err |
| + } |
| cut := s.now().Add(-wire.EventRetention) |
| return s.db.G.WithContext(ctx).Clauses(dbresolver.Write).Transaction(func(tx *gorm.DB) error { |
| if err := tx.Exec("DELETE FROM chat_events WHERE created_at < ? AND id < (SELECT max(id) FROM chat_events)", cut).Error; err != nil { |
diff --git a/internal/equipo/chat/stuck.go b/internal/equipo/chat/stuck.go| index 6742300b..422e77c3 100644 |
| --- a/internal/equipo/chat/stuck.go |
| +++ b/internal/equipo/chat/stuck.go |
| @@ -5,6 +5,7 @@ import ( |
| "errors" |
| "fmt" |
| "slices" |
| + "strings" |
| "gorm.io/gorm" |
| @@ -99,59 +100,35 @@ func (t *txn) offerRetry(r turnRecord, args json.RawMessage) (wire.ToolResult, e |
| return wire.ToolResult{Code: "offered", Text: toolRetryOffered}, nil |
| } |
| -// retryPreview runs a failed preview again as its next attempt, also when a |
| -// merge step came after it (the person's Retry on it, or retry_step): only |
| -// the task's newest preview, ended, of the candidate the task stands on |
| -// (approved, the branch at it), on a primary whose preview host the |
| -// project allows now. It is recomputed: the export is built and scanned |
| -// afresh and every publish is decided for that export (authorizePreview), |
| -// a public one only under the project's own setting. A preview is |
| -// ancillary, so the task's stage and its other steps are untouched. |
| +// retryPreview runs a preview again (the person's Retry on it, or |
| +// retry_step), also when a merge step came after it or the task is done: |
| +// only the task's newest preview, ended and not up, as previewRetryCheck |
| +// says. On a task still open it is the step's next attempt, of the |
| +// candidate the task stands on; on a done task a new preview step of |
| +// previewTarget (rerunPreview). It is recomputed: the export is built and |
| +// scanned afresh and every publish is decided for that export |
| +// (authorizePreview), a public one only under the project's own setting. |
| +// A preview is ancillary, so the task's stage and its other steps are |
| +// untouched. |
| func (t *txn) retryPreview(k *taskRecord, st *stepRecord, person string, coordinator bool) (int64, error) { |
| - if st.State != wire.StepFailed || !st.Terminated { |
| - return 0, ErrNotRetryable |
| - } |
| - if st.Person != person { |
| - return 0, ErrForbidden |
| - } |
| - steps, err := t.steps(k.ID) |
| - if err != nil { |
| - return 0, err |
| - } |
| - for _, s := range steps { |
| - if s.Specialist == wire.SpecialistPreview && s.Idx > st.Idx { |
| - return 0, ErrNotRetryable |
| - } |
| - } |
| - p := progressFor(*k, steps) |
| - if p.moved || p.candidate == "" || p.candidate != st.CandidateSHA || p.review == nil || p.review.State != wire.StepDone || p.review.Verdict != wire.VerdictApprove { |
| - return 0, ErrNotRetryable |
| - } |
| - primary, err := t.s.authority.PrimaryRunner(t.db, st.Person) |
| - if err != nil { |
| - return 0, err |
| - } |
| - rs, err := t.runners(st.Person) |
| - if err != nil { |
| + reason, target, err := t.previewRetryCheck(*k, *st, person) |
| + switch { |
| + case err != nil: |
| return 0, err |
| + case reason == retryNotYours: |
| + return 0, refuseRetry(ErrForbidden, reason) |
| + case reason == retryTaskCancelled: |
| + return 0, refuseRetry(ErrTaskEnded, reason) |
| + case reason != "": |
| + return 0, refuseRetry(ErrNotRetryable, reason) |
| } |
| - allowed := false |
| - for _, r := range rs { |
| - if r.ID == primary && primary != "" { |
| - reason, err := t.previewHostAuthority(k.ProjectID, r) |
| - if err != nil { |
| - return 0, err |
| - } |
| - allowed = reason == "" |
| - } |
| - } |
| - if !allowed { |
| - return 0, ErrNotRetryable |
| + if k.Stage == wire.StageDone { |
| + return t.rerunPreview(k, st, target, coordinator) |
| } |
| st.Attempt++ |
| st.State, st.Reason, st.Terminated, st.Summary, st.LogTail, st.StartedAt, st.FinishedAt, st.Headline, st.Activity = wire.StepQueued, "", false, "", "", nil, nil, "", "" |
| // Recomputed: no export recorded until this attempt reports one. |
| - st.Preview, st.Withdrawn, st.RefusedBy = "", false, "" |
| + st.Preview, st.Withdrawn, st.RefusedBy, st.PreviewDownAt = "", false, "", nil |
| if coordinator { |
| st.CoordinatorAttempt = st.Attempt |
| } |
| @@ -163,15 +140,19 @@ func (t *txn) retryPreview(k *taskRecord, st *stepRecord, person string, coordin |
| // More of what the model reads back for retry_step. |
| const ( |
| - toolRetryKinds = "retry_step runs again only a failed preview, checks or review (step: preview, checks or review). A merge is the person's: use offer_retry. Engineering's work is theirs to ask for." |
| - toolRetryStarted = "Started again as attempt %d. Tell the person in one line; the task shows it." |
| - toolStepNotRetried = "Not started: that step has not failed and ended, is not the task's newest (a preview may be behind a merge), or its candidate is no longer the one to judge. read_task shows where it stands." |
| + toolRetryKinds = "retry_step runs again only a failed preview, checks or review (step: preview, checks or review). A merge is the person's: use offer_retry. Engineering's work is theirs to ask for." |
| + toolRetryStarted = "Started again as attempt %d. Tell the person in one line; the task shows it." |
| + // A done task's preview runs again as a new step. |
| + toolRetryNewPreview = "Started a new preview of the task's merged commit (or its approved commit when Equipo did not merge it); the task stays done and merged. Tell the person in one line; the task shows it." |
| + toolStepNotRetried = "Not started: that step has not failed and ended, is not the task's newest (a preview may be behind a merge), or its candidate is no longer the one to judge. read_task shows where it stands." |
| ) |
| // retryStepTool is the coordinator's retry_step: the person's Retry |
| // (personRetry, its checks for the turn's person), for the task's newest |
| // step of a kind in wire.RetryStepKinds, recorded as the coordinator's |
| // (CoordinatorAttempt) and audited. It never runs a merge or a publish. |
| +// On a done task only a preview runs again, as a new step of the merged |
| +// commit. A refusal says why in a fixed reason (retryNotes). |
| func (t *txn) retryStepTool(r turnRecord, args json.RawMessage) (wire.ToolResult, error) { |
| var in struct { |
| Task string `json:"task"` |
| @@ -183,31 +164,45 @@ func (t *txn) retryStepTool(r turnRecord, args json.RawMessage) (wire.ToolResult |
| if !slices.Contains(wire.RetryStepKinds, in.Step) { |
| return refused("invalid", toolRetryKinds), nil |
| } |
| - k, res, err := t.ownTask(r.Person, in.Task) |
| - if res != nil || err != nil { |
| - return deref(res), err |
| + k, err := t.loadTask(strings.TrimSpace(in.Task)) |
| + if errors.Is(err, ErrNotFound) { |
| + return refused("not_found", toolNoTask), nil |
| + } else if err != nil { |
| + return wire.ToolResult{}, err |
| + } |
| + if k.Creator != r.Person { |
| + return refusedRetry("not_yours", retryNotYours), nil |
| } |
| var st stepRecord |
| if err := t.db.Where("task_id = ? AND specialist = ? AND coalesce(retired, 0) = 0", k.ID, in.Step).Order("idx DESC").First(&st).Error; errors.Is(err, gorm.ErrRecordNotFound) { |
| - return refused("not_retryable", toolStepNotRetried), nil |
| + return refusedRetry("not_retryable", retryNoStep), nil |
| } else if err != nil { |
| return wire.ToolResult{}, err |
| } |
| attempt, err := t.personRetry(r.Person, k.ID, st.ID, true) |
| switch { |
| case errors.Is(err, ErrNotRetryable): |
| - return refused("not_retryable", toolStepNotRetried), nil |
| + return refusedRetry("not_retryable", retryReasonOf(err, "not_retryable")), nil |
| case errors.Is(err, ErrTaskEnded): |
| - return refused("task_ended", toolTaskEnded), nil |
| + return refusedRetry("task_ended", retryReasonOf(err, retryTaskCancelled)), nil |
| case errors.Is(err, ErrForbidden): |
| - return refused("not_yours", toolNotYours), nil |
| + return refusedRetry("not_yours", retryReasonOf(err, retryNotYours)), nil |
| case err != nil: |
| return wire.ToolResult{}, err |
| } |
| + text := fmt.Sprintf(toolRetryStarted, attempt) |
| + var now stepRecord |
| + if err := t.db.Where("task_id = ? AND specialist = ? AND coalesce(retired, 0) = 0", k.ID, in.Step).Order("idx DESC").First(&now).Error; err != nil { |
| + return wire.ToolResult{}, err |
| + } |
| + if now.ID != st.ID { |
| + // A done task's preview: a new step of the merged commit. |
| + text = toolRetryNewPreview |
| + } |
| if t.s.authority.Audit != nil { |
| - if err := t.s.authority.Audit(t.db, "coordinator:"+r.Person, "task.retry", k.ID+"/"+st.ID+"/"+itoa64(attempt)); err != nil { |
| + if err := t.s.authority.Audit(t.db, "coordinator:"+r.Person, "task.retry", k.ID+"/"+now.ID+"/"+itoa64(attempt)); err != nil { |
| return wire.ToolResult{}, err |
| } |
| } |
| - return wire.ToolResult{Code: "retrying", Text: fmt.Sprintf(toolRetryStarted, attempt)}, nil |
| + return wire.ToolResult{Code: "retrying", Text: text}, nil |
| } |
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go| index 3eba769f..f5019926 100644 |
| --- a/internal/equipo/chat/tasks.go |
| +++ b/internal/equipo/chat/tasks.go |
| @@ -285,6 +285,10 @@ type stepRecord struct { |
| // HeldAt is when the runner first held the step without a break (nil |
| // while it is not held): advice's "waited a week". |
| HeldAt *time.Time |
| + // PreviewDownAt is when the sweep takes down a devbox link this |
| + // preview brought up after its task ended (boundDevboxPreview); nil |
| + // when there is none, or once it was taken down. |
| + PreviewDownAt *time.Time |
| } |
| func (stepRecord) TableName() string { return "chat_steps" } |
| @@ -791,7 +795,7 @@ func (t *txn) writeStep(s *stepRecord) error { |
| } |
| s.Revision++ |
| s.UpdatedAt = t.now() |
| - if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("base_checks", "base_checks_sha", "copy_owner", "copy_revision", "copy_result", "failure_signature", "state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "headline", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "switched", "activity", "runner_id", "needs", "placement", "waiting_since", "refused_by", "withdrawn", "termination_kind", "publication", "publication_id", "apple", "checks_sandbox", "change_files", "change_facts", "decided_by", "merge_source", "merge_parents", "hosted_ci", "kind", "note", "sandbox_runner", "unsandboxed_by", "unsandboxed_at", "unsandboxed_attempt", "unsandboxed_runner", "has_preview", "preview", "boundary", "question", "request_turn", "sources_card", "sources_hash", "research_grant", "research_grant_revision", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model").Updates(s).Error; err != nil { |
| + if err := t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Select("base_checks", "base_checks_sha", "copy_owner", "copy_revision", "copy_result", "failure_signature", "state", "reason", "attempt", "base_sha", "candidate_sha", "pushed", "terminated", "summary", "log_tail", "started_at", "finished_at", "revision", "updated_at", "headline", "family", "account", "verdict", "review_label", "findings", "checks", "gate", "exit_code", "output", "republish", "from_attempt", "askable", "rebase", "from_base", "from_candidate", "merge_sha", "merge_into", "merge_strategy", "without_checks", "switched", "activity", "runner_id", "needs", "placement", "waiting_since", "refused_by", "withdrawn", "termination_kind", "publication", "publication_id", "apple", "checks_sandbox", "change_files", "change_facts", "decided_by", "merge_source", "merge_parents", "hosted_ci", "kind", "note", "sandbox_runner", "unsandboxed_by", "unsandboxed_at", "unsandboxed_attempt", "unsandboxed_runner", "has_preview", "preview", "boundary", "question", "request_turn", "sources_card", "sources_hash", "research_grant", "research_grant_revision", "hold", "housekeeping_attempt", "coordinator_attempt", "held_at", "publish", "model", "preview_down_at").Updates(s).Error; err != nil { |
| return err |
| } |
| if s.Retired { |
| @@ -1233,7 +1237,7 @@ func (t *txn) dispatchStep(k *taskRecord, s *stepRecord) error { |
| } |
| // readTask is what the coordinator sees of a task. |
| -func (t *txn) readTask(id string) (wire.ToolResult, error) { |
| +func (t *txn) readTask(person, id string) (wire.ToolResult, error) { |
| k, err := t.loadTask(strings.TrimSpace(id)) |
| if errors.Is(err, ErrNotFound) { |
| return refused("not_found", toolNoTask), nil |
| @@ -1251,10 +1255,17 @@ func (t *txn) readTask(id string) (wire.ToolResult, error) { |
| // The questions and answers are the person's with the specialists; |
| // the coordinator points people there and never relays them. |
| v.Questions = []wire.Question{} |
| + // Whether each step retry_step may run again can run now, and if not |
| + // why (a fixed reason), for this turn's person. |
| + retry, err := t.retryViews(k, person) |
| + if err != nil { |
| + return wire.ToolResult{}, err |
| + } |
| raw, _ := json.Marshal(struct { |
| - Link string `json:"link"` |
| + Link string `json:"link"` |
| + Retry []retryView `json:"retry,omitempty"` |
| wire.Task |
| - }{TaskLink(v.ID), v}) |
| + }{TaskLink(v.ID), retry, v}) |
| return wire.ToolResult{Code: "task", Text: clipText(string(raw), 16<<10)}, nil |
| } |
| @@ -1401,6 +1412,9 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error { |
| if err := t.auditPreview(l.Runner.RunnerID, "preview."+decodePreview(done).Outcome, &s, "withdrawn"); err != nil { |
| return err |
| } |
| + if err := t.boundDevboxPreview(k, &s); err != nil { |
| + return err |
| + } |
| if err := t.saveStep(&s, &k); err != nil { |
| return err |
| } |
| @@ -1548,6 +1562,9 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error { |
| if err := t.auditPreview(l.Runner.RunnerID, kind, &s, s.Reason); err != nil { |
| return err |
| } |
| + if err := t.boundDevboxPreview(k, &s); err != nil { |
| + return err |
| + } |
| previewed = kind == "preview.deployed" |
| case wire.SpecialistPublish: |
| // Done only for the step's app and the export recorded as |
| @@ -2028,11 +2045,14 @@ func (s *Store) retryTask(ctx context.Context, person, id, step string) (attempt |
| } |
| // personRetry is the person's Retry of the task's step ("" for its newest |
| -// step): an owner, the task's creator, a task that has not ended. The |
| -// coordinator's retry_step makes exactly these checks for its person |
| -// (coordinator), on RetryStepKinds only. |
| +// step): an owner, the task's creator, a task not cancelled; on a done |
| +// task only its preview (retryStepOf). The coordinator's retry_step makes |
| +// exactly these checks for its person (coordinator), on RetryStepKinds |
| +// only. A refusal carries its fixed reason (retryRefusal). |
| func (t *txn) personRetry(person, id, step string, coordinator bool) (int64, error) { |
| - if err := t.isOwner(person); err != nil { |
| + if err := t.isOwner(person); errors.Is(err, ErrForbidden) { |
| + return 0, refuseRetry(ErrForbidden, retryNotOwner) |
| + } else if err != nil { |
| return 0, err |
| } |
| k, err := t.loadTask(id) |
| @@ -2041,10 +2061,10 @@ func (t *txn) personRetry(person, id, step string, coordinator bool) (int64, err |
| } |
| // Only the task's creator retries it, onto their own runner. |
| if k.Creator != person { |
| - return 0, ErrForbidden |
| + return 0, refuseRetry(ErrForbidden, retryNotYours) |
| } |
| - if wire.FinalStage(k.Stage) || k.CancelRequested { |
| - return 0, ErrTaskEnded |
| + if k.Stage == wire.StageCancelled || k.CancelRequested { |
| + return 0, refuseRetry(ErrTaskEnded, retryTaskCancelled) |
| } |
| return t.retryStepOf(&k, person, step, coordinator) |
| } |
| @@ -2072,12 +2092,15 @@ func (t *txn) retryStepOf(k *taskRecord, person, step string, coordinator bool) |
| if step != "" { |
| var named stepRecord |
| if err := t.db.Where("id = ? AND task_id = ? AND coalesce(retired, 0) = 0", step, k.ID).First(&named).Error; errors.Is(err, gorm.ErrRecordNotFound) { |
| - return 0, ErrNotRetryable |
| + return 0, refuseRetry(ErrNotRetryable, retryNoStep) |
| } else if err != nil { |
| return 0, err |
| } |
| if named.Specialist != wire.SpecialistPreview && (!found || named.ID != st.ID) { |
| - return 0, ErrNotRetryable |
| + if k.Stage == wire.StageDone { |
| + return 0, refuseRetry(ErrTaskEnded, retryTaskDone) |
| + } |
| + return 0, refuseRetry(ErrNotRetryable, retryNotNewest) |
| } |
| st, found = named, true |
| } |
| @@ -2087,6 +2110,11 @@ func (t *txn) retryStepOf(k *taskRecord, person, step string, coordinator bool) |
| if found && st.Specialist == wire.SpecialistPreview { |
| return t.retryPreview(k, &st, person, coordinator) |
| } |
| + if wire.FinalStage(k.Stage) { |
| + // A done task runs only its preview again; its merge, checks and |
| + // review stay as they are. |
| + return 0, refuseRetry(ErrTaskEnded, retryTaskDone) |
| + } |
| if found && st.Specialist == wire.SpecialistEngineering && st.State == wire.StepDone && st.Publication == wire.PublicationFailed { |
| // A worker's commit the primary could not push: publish the |
| // recorded commit again, without running Engineering. |
| @@ -2102,11 +2130,11 @@ func (t *txn) retryStepOf(k *taskRecord, person, step string, coordinator bool) |
| attempt = st.Attempt |
| return attempt, t.saveTask(k) |
| } |
| - if !found || st.State != wire.StepFailed || !st.Terminated { |
| - return 0, ErrNotRetryable |
| + if reason := endedReason(st, found); reason != "" { |
| + return 0, refuseRetry(ErrNotRetryable, reason) |
| } |
| if st.Person != person { |
| - return 0, ErrForbidden |
| + return 0, refuseRetry(ErrForbidden, retryNotYours) |
| } |
| if st.Specialist == wire.SpecialistMerge { |
| // Never merge a SHA that is not the judged one, as it stands; a |
| @@ -2120,7 +2148,7 @@ func (t *txn) retryStepOf(k *taskRecord, person, step string, coordinator bool) |
| } |
| p := progressFor(*k, steps) |
| if p.candidate != st.CandidateSHA || !p.mergeAllowed(st.WithoutChecks) { |
| - return 0, ErrNotRetryable |
| + return 0, refuseRetry(ErrNotRetryable, retryCommitChanged) |
| } |
| _, protocol, err := t.primaryState(st.Person) |
| if err != nil { |
| @@ -2138,7 +2166,7 @@ func (t *txn) retryStepOf(k *taskRecord, person, step string, coordinator bool) |
| return 0, err |
| } |
| if primary == "" { |
| - return 0, ErrNotRetryable |
| + return 0, refuseRetry(ErrNotRetryable, retryNoRunner) |
| } |
| from := st.Attempt |
| st.Attempt++ |
| @@ -2359,7 +2387,7 @@ func (t *txn) runTaskTool(r turnRecord, v *wire.ToolCall) (wire.ToolResult, erro |
| if wire.Strict(v.Args, &in) != nil { |
| return refused("invalid", toolBadInput), nil |
| } |
| - return t.readTask(in.Task) |
| + return t.readTask(r.Person, in.Task) |
| case wire.ToolCancelTask: |
| var in struct { |
| Task string `json:"task"` |
diff --git a/internal/equipo/migrations/0111_preview_down_at.sql b/internal/equipo/migrations/0111_preview_down_at.sql| new file mode 100644 |
| index 00000000..242dfa6b |
| --- /dev/null |
| +++ b/internal/equipo/migrations/0111_preview_down_at.sql |
| @@ -0,0 +1,3 @@ |
| +-- When the sweep takes down a devbox preview link brought up after its |
| +-- task ended (a preview run again on a merged task); NULL is none. |
| +ALTER TABLE chat_steps ADD COLUMN preview_down_at datetime; |
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql| index fdf32512..272dcaa0 100644 |
| --- a/internal/equipo/migrations/schema.sql |
| +++ b/internal/equipo/migrations/schema.sql |
| @@ -799,3 +799,7 @@ CREATE INDEX preview_grant_expiry ON preview_grants(expires_at); |
| -- Replace pending passes and active grants by indexed device/task identity. |
| CREATE INDEX idx_preview_passes_device_task ON preview_passes(credential, task_id); |
| CREATE INDEX idx_preview_grants_device_task ON preview_grants(credential, task_id); |
| + |
| +-- When the sweep takes down a devbox preview link brought up after its |
| +-- task ended (a preview run again on a merged task); NULL is none. |
| +ALTER TABLE chat_steps ADD COLUMN preview_down_at datetime; |
diff --git a/internal/equipo/preview_pass_store.go b/internal/equipo/preview_pass_store.go| index 0286de4f..dbcbc5a4 100644 |
| --- a/internal/equipo/preview_pass_store.go |
| +++ b/internal/equipo/preview_pass_store.go |
| @@ -114,10 +114,15 @@ func (s *Store) previewDeployment(task wire.Task) (wire.Step, string, error) { |
| } |
| func (s *Store) validatePreview(task wire.Task, b previewBinding) error { |
| step, fingerprint, err := s.previewDeployment(task) |
| - if task.CandidateSHA != b.Candidate || err != nil || step.CandidateSHA != b.Candidate || step.ID != b.StepID || step.Attempt != b.Attempt || fingerprint != b.Fingerprint { |
| + // Of the task's candidate, or, once it is done, of its merged commit |
| + // (a preview run again after the merge). |
| + merged := task.Stage == wire.StageDone && task.Merged != nil && task.Merged.SHA != "" && step.CandidateSHA == task.Merged.SHA |
| + if task.CandidateSHA != b.Candidate || err != nil || step.CandidateSHA != b.Candidate && !merged || step.ID != b.StepID || step.Attempt != b.Attempt || fingerprint != b.Fingerprint { |
| return ErrPreviewChanged |
| } |
| - if (step.Preview.ExpiresAt != nil && !s.runnerClock.Now().Before(*step.Preview.ExpiresAt)) || (strings.HasPrefix(step.Preview.App, "eq-") && wire.FinalStage(task.Stage)) { |
| + // A devbox link comes down with its task, unless it came up after the |
| + // task was done, with the expiry the instance gave it. |
| + if (step.Preview.ExpiresAt != nil && !s.runnerClock.Now().Before(*step.Preview.ExpiresAt)) || (strings.HasPrefix(step.Preview.App, "eq-") && wire.FinalStage(task.Stage) && !devboxAfterDone(task, step)) { |
| return ErrPreviewExpired |
| } |
| return nil |
diff --git a/internal/equipo/work_views.go b/internal/equipo/work_views.go| index 562eb714..a35944e5 100644 |
| --- a/internal/equipo/work_views.go |
| +++ b/internal/equipo/work_views.go |
| @@ -1148,7 +1148,11 @@ func timelineOf(t wire.Task, v taskLine) []timelineItem { |
| out = append(out, it) |
| continue |
| case wire.StepCancelled: |
| - out = append(out, timelineItem{Kind: "stopped", What: fmt.Sprintf(copyText("work.tl.cancelled"), title), At: s.FinishedAt}) |
| + it := timelineItem{Kind: "stopped", What: fmt.Sprintf(copyText("work.tl.cancelled"), title), At: s.FinishedAt} |
| + if previewRetry(t, s, v.Mine) { |
| + it.RetryPost, it.RetryStep = "/conversation/tasks/"+t.ID+"/retry", s.ID |
| + } |
| + out = append(out, it) |
| continue |
| } |
| switch s.Specialist { |
| @@ -1199,6 +1203,10 @@ func timelineOf(t wire.Task, v taskLine) []timelineItem { |
| if s.Preview.Outcome == wire.PreviewDeployed && s.Preview.URL != "" { |
| it.What, it.Markdown = copyText("work.tl.preview_ready"), "["+previewHostLabel(s.Preview.URL)+"](/tasks/"+t.ID+"/preview)" |
| } |
| + if previewRetry(t, s, v.Mine) { |
| + // Unconfirmed, or its link is gone: Retry, as for a failed one. |
| + it.RetryPost, it.RetryStep = "/conversation/tasks/"+t.ID+"/retry", s.ID |
| + } |
| out = append(out, it) |
| case wire.SpecialistReview: |
| one := t |
| @@ -1265,12 +1273,17 @@ func timelineOf(t wire.Task, v taskLine) []timelineItem { |
| return out |
| } |
| -// previewRetry reports whether the person may run a failed preview again |
| -// from its own entry: theirs, ended, the task's newest preview, of the |
| -// candidate the task stands on, the task not ended. The store decides |
| -// again (retryPreview). |
| +// previewRetry reports whether the person may run a preview again from |
| +// its own entry: theirs, ended without a link up now (failed, cancelled, |
| +// unconfirmed, expired, or a devbox link gone with its task), the task's |
| +// newest preview, of the candidate the task stands on, or on a done task |
| +// any (it builds the merged commit), the task not cancelled. The store |
| +// decides again (previewRetryCheck). |
| func previewRetry(t wire.Task, s wire.Step, mine bool) bool { |
| - if !mine || s.Specialist != wire.SpecialistPreview || s.State != wire.StepFailed || !s.Terminated || wire.FinalStage(t.Stage) || t.CandidateSHA == "" || s.CandidateSHA != t.CandidateSHA { |
| + if !mine || s.Specialist != wire.SpecialistPreview || !wire.StepTerminal(s.State) || !s.Terminated || t.Stage == wire.StageCancelled || previewShown(t, s, time.Now()) { |
| + return false |
| + } |
| + if t.Stage != wire.StageDone && (t.CandidateSHA == "" || s.CandidateSHA != t.CandidateSHA) { |
| return false |
| } |
| for _, o := range t.Steps { |
| @@ -1281,6 +1294,32 @@ func previewRetry(t wire.Task, s wire.Step, mine bool) bool { |
| return true |
| } |
| +// previewShown reports whether a preview step's link is up now: deployed, |
| +// before any expiry, and a devbox link only while its task runs or, one |
| +// that came up after its task was done, until the expiry the instance |
| +// gave it (the store's previewUp, without a Publish hold, which only |
| +// keeps a link up longer). |
| +func previewShown(t wire.Task, s wire.Step, now time.Time) bool { |
| + p := s.Preview |
| + if s.State != wire.StepDone || p == nil || p.Outcome != wire.PreviewDeployed || p.URL == "" { |
| + return false |
| + } |
| + if p.ExpiresAt != nil && !p.ExpiresAt.After(now) { |
| + return false |
| + } |
| + if strings.HasPrefix(p.App, "eq-") && wire.FinalStage(t.Stage) { |
| + return devboxAfterDone(t, s) |
| + } |
| + return true |
| +} |
| + |
| +// devboxAfterDone: a devbox link that came up after its task was done, |
| +// with the expiry the instance gave it; any other comes down with the |
| +// task. |
| +func devboxAfterDone(t wire.Task, s wire.Step) bool { |
| + return s.Preview != nil && s.Preview.ExpiresAt != nil && t.Stage == wire.StageDone && t.DoneAt != nil && s.FinishedAt != nil && s.FinishedAt.After(*t.DoneAt) |
| +} |
| + |
| // sentenceCase capitalises a reason fragment for a line of its own. |
| func sentenceCase(s string) string { |
| if s == "" { |
| @@ -1545,8 +1584,9 @@ func previewCard(t wire.Task, now time.Time) (url, line string) { |
| p := s.Preview |
| if strings.HasPrefix(p.App, "eq-") { |
| // A CARLOS devbox link: no expiry; it comes down when the task |
| - // ends, and so does the line. |
| - if wire.FinalStage(t.Stage) { |
| + // ends, and so does the line. One run again after the task |
| + // ended has an expiry the instance gave it. |
| + if wire.FinalStage(t.Stage) && (!devboxAfterDone(t, s) || !p.ExpiresAt.After(now)) { |
| return "", "" |
| } |
| return "/tasks/" + t.ID + "/preview", fmt.Sprintf(copyText("work.card.preview_tailnet"), previewHostLabel(p.URL)) |
diff --git a/internal/runner/thin/mcp.go b/internal/runner/thin/mcp.go| index a37cd600..9bec432b 100644 |
| --- a/internal/runner/thin/mcp.go |
| +++ b/internal/runner/thin/mcp.go |
| @@ -172,7 +172,7 @@ var converseTools = []any{ |
| map[string]any{"name": "propose_specialist", "description": "Ask the person to add a specialist to their team, from Equipo's fixed menu. Only when the person wants something researched on the public web. The one profile is research-v1: it reads public web pages Equipo fetches for a task and reports what they say; it never reaches repositories. Pass profile research-v1, a short name (for example Research), a brief of at most 2 KB on what it should look for, capabilities [\"web.research\"] and tools [\"submit_findings\", \"keep_image\"], exactly those. Nothing is added until an owner taps Add on the card it raises; do not ask again in your reply. If they tap Not now, propose it again only when they ask.", "inputSchema": toolSchema(map[string]any{"profile": map[string]any{"type": "string", "enum": []string{"research-v1"}}, "name": str, "brief": str, "capabilities": map[string]any{"type": "array", "items": str}, "tools": map[string]any{"type": "array", "items": str}}, "profile", "name", "brief", "capabilities", "tools")}, |
| map[string]any{"name": "research", "description": "Ask Research (once it is on the team; see propose_specialist) to read public web pages for one of the person's tasks. Use it when an exploration or change names an outside site, brand, API or docs, or the person asking (their business, their own site), and the work needs what those pages say. task is the task id; question (at most 1,000 bytes) is what to look for, for example colours, logo, fonts, opening hours and services; urls are pages you propose (https or http, no query string, a path of at most 100 characters, at most 10), or []. URLs and bare domains the person typed on the task are read without asking; your urls are shown to the person in full on a card and read only if they tap Allow, so propose only pages the task needs and never put anything from a repository in them. This only requests a run: Equipo starts it only at the task's start (call it before start_task) or after a review round, before Engineering's next round, and Engineering waits until Research ends. At most one run per start or round and 3 per task, and Equipo never retries a run for you. Research's findings reach Engineering and Review; do not wait for them in your reply.", "inputSchema": toolSchema(map[string]any{"task": str, "question": str, "urls": map[string]any{"type": "array", "items": str, "maxItems": 10}}, "task", "question", "urls")}, |
| map[string]any{"name": wire.ToolOfferRetry, "description": "When a task's merge failed and it waits at Ready to merge (read_task shows the failed merge step), put a card in front of the person asking whether to try the merge again. You cannot merge: only their tap merges, through Equipo's merge rules, and it is offered only when that tap could merge now. One card per task; do not ask again in your reply, and never say it is merged.", "inputSchema": toolSchema(map[string]any{"task": str}, "task")}, |
| - map[string]any{"name": wire.ToolRetryStep, "description": "Run a task's failed preview, checks or review again, as the person's own Retry would (step: preview, checks or review). Only when read_task shows that step failed and why, and another try could help: a preview that failed for its scanner (status runner.tools) needs the runner fixed first. Never a merge (use offer_retry: only the person's tap merges) and never Engineering's work. The task shows that you started it. Call it once per step.", "inputSchema": toolSchema(map[string]any{"task": str, "step": map[string]any{"type": "string", "enum": wire.RetryStepKinds}}, "task", "step")}, |
| + map[string]any{"name": wire.ToolRetryStep, "description": "Run a task's preview, checks or review again, as the person's own Retry would (step: preview, checks or review). read_task's retry says for each whether it can run again now, and if not why, in a fixed reason; a refusal says it too. A failed step runs again as its next attempt. A preview also runs again when it ended unconfirmed or its link is gone, and on a done (merged) task as a new preview of the merged commit, the task staying done and merged. Only when another try could help: a preview that failed for its scanner (status runner.tools) needs the runner fixed first. Never a merge (use offer_retry: only the person's tap merges) and never Engineering's work. The task shows that you started it. Call it once per step.", "inputSchema": toolSchema(map[string]any{"task": str, "step": map[string]any{"type": "string", "enum": wire.RetryStepKinds}}, "task", "step")}, |
| } |
| // stepTools are the tools the implement profile pins for an Engineering |
diff --git a/internal/thintest/preview_retry_done_contract_test.go b/internal/thintest/preview_retry_done_contract_test.go| new file mode 100644 |
| index 00000000..8e01c9d4 |
| --- /dev/null |
| +++ b/internal/thintest/preview_retry_done_contract_test.go |
| @@ -0,0 +1,415 @@ |
| +package thintest |
| + |
| +import ( |
| + "encoding/json" |
| + "net/http" |
| + "net/url" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// Previews on finished tasks (Paul, 2026-11-26, production): "Retry the |
| +// Neary's preview" was refused because both tasks were merged and done, |
| +// one preview failed for its scanner and the other ended unconfirmed |
| +// (preview_headers), which did not count as a failure. A preview runs |
| +// again on a merged task from its merged commit, by the person's Retry or |
| +// the coordinator's retry_step, through the preview's own checks; the |
| +// task's stage, merge and other steps stay as they are. An unconfirmed |
| +// preview, or one whose link is gone, counts as one to run again. A |
| +// refusal says why in a fixed reason, in the tool's result and in |
| +// read_task. |
| + |
| +var mergedSHA = strings.Repeat("9", 40) |
| + |
| +// previewedThenMerged is previewedAndMerging with the preview ended by |
| +// end and the merge confirmed as mergedSHA: the task is done. |
| +func (r *toolRig) previewedThenMerged(key, base, cand string, end func(id string, pv *wire.DispatchCommand)) (string, *wire.DispatchCommand, *wire.DispatchCommand) { |
| + r.t.Helper() |
| + r.asksBeforeMerging() |
| + id, _ := r.pushed(key, "Barber mockups", base, cand) |
| + r.expect(wire.FrameWatchMerge) |
| + c := r.dispatched(wire.SpecialistChecks, base, cand, 0) |
| + r.checks(key+"-c", c, wire.ChecksPassed, exit(0), "", "ok\n") |
| + rv := r.dispatched(wire.SpecialistReview, base, cand, 0) |
| + r.step(key+"-r", wire.StepReport{TaskID: rv.TaskID, StepID: rv.StepID, Attempt: rv.Attempt, State: wire.StepDone, BaseSHA: base, CandidateSHA: cand, Termination: true, Family: "codex", Account: "codex-a", Verdict: wire.VerdictApprove, ReviewLabel: wire.ReviewOtherFamily, Findings: []wire.Finding{}, Summary: "Read it.", HasPreview: true, Change: facts(rv)}) |
| + pv := r.previewDispatch(cand) |
| + if pv == nil { |
| + r.t.Fatal("no preview dispatched") |
| + } |
| + r.built(key+"-pv-built", pv, digestA) |
| + end(id, pv) |
| + // The preview's outcome may give the merge card a new revision. |
| + var seen int64 |
| + for { |
| + var card wire.Card |
| + r.wait("merge card", func(c *Conversation) bool { |
| + for _, k := range c.Cards { |
| + if k.Kind == wire.CardMerge && k.TaskID == id && k.State == wire.CardOpen && k.Revision > seen { |
| + card = k |
| + } |
| + } |
| + return card.ID != "" |
| + }) |
| + _, err := r.client.Answer(r.ctx, card.ID, wire.ChoiceMerge, card.Revision) |
| + if err == nil { |
| + break |
| + } |
| + if Status(err) != http.StatusConflict || seen > 5 { |
| + r.t.Fatal(err) |
| + } |
| + seen = card.Revision |
| + } |
| + m := r.dispatched(wire.SpecialistMerge, base, cand, 0) |
| + r.mergedStep(key+"-m", m, mergedSHA) |
| + r.wait("done", func(c *Conversation) bool { return c.Tasks[id].Stage == wire.StageDone }) |
| + return id, pv, m |
| +} |
| + |
| +// failedPreview ends a preview the way tkbstr6cjl7h's did. |
| +func (r *toolRig) failedPreview(reason string) func(string, *wire.DispatchCommand) { |
| + return func(id string, pv *wire.DispatchCommand) { |
| + r.step(id+"-pv-fail", wire.StepReport{TaskID: id, StepID: pv.StepID, Attempt: pv.Attempt, State: wire.StepFailed, Reason: reason, BaseSHA: pv.BaseSHA, CandidateSHA: pv.CandidateSHA, Termination: true, Findings: []wire.Finding{}}) |
| + } |
| +} |
| + |
| +// unconfirmedPreview ends a preview the way tkzmnycab3ml's did: done, its |
| +// link not confirmed, for reason. |
| +func (r *toolRig) unconfirmedPreview(reason, app string) func(string, *wire.DispatchCommand) { |
| + return func(id string, pv *wire.DispatchCommand) { |
| + r.step(id+"-pv-unconfirmed", wire.StepReport{TaskID: id, StepID: pv.StepID, Attempt: pv.Attempt, State: wire.StepDone, Reason: reason, BaseSHA: pv.BaseSHA, CandidateSHA: pv.CandidateSHA, Termination: true, Findings: []wire.Finding{}, Preview: &wire.PreviewResult{Phase: wire.PreviewDone, App: app + id, Digest: digestA, Outcome: wire.PreviewUnconfirmed}}) |
| + } |
| +} |
| + |
| +// refusal is a refused retry_step's fixed reason. |
| +func refusal(t *testing.T, res wire.ToolResult) string { |
| + t.Helper() |
| + var out struct { |
| + Reason string `json:"reason"` |
| + Note string `json:"note"` |
| + } |
| + if !res.IsError || json.Unmarshal([]byte(res.Text), &out) != nil || out.Reason == "" || out.Note == "" { |
| + t.Fatalf("not a refusal with a reason: %+v", res) |
| + } |
| + return out.Reason |
| +} |
| + |
| +// retryOf is read_task's word on running the task's newest step of kind |
| +// again: "" when it can run, else the fixed reason it cannot. |
| +func (r *toolRig) retryOf(key, id, kind string) (string, bool) { |
| + r.t.Helper() |
| + res := r.call(key, wire.ToolReadTask, map[string]string{"task": id}) |
| + var out struct { |
| + Retry []struct { |
| + Step string `json:"step"` |
| + StepID string `json:"step_id"` |
| + Retryable bool `json:"retryable"` |
| + Reason string `json:"reason"` |
| + } `json:"retry"` |
| + } |
| + if res.IsError || json.Unmarshal([]byte(res.Text), &out) != nil { |
| + r.t.Fatalf("read_task %+v", res) |
| + } |
| + for _, x := range out.Retry { |
| + if x.Step == kind { |
| + if x.Retryable == (x.Reason != "") || x.StepID == "" { |
| + r.t.Fatalf("read_task retry %+v", x) |
| + } |
| + return x.Reason, true |
| + } |
| + } |
| + return "", false |
| +} |
| + |
| +// TestContractRetryPreviewOnMergedTask (tkbstr6cjl7h): the person's Retry |
| +// on a done task's failed preview builds the merged commit as a new |
| +// preview step, published only through the preview's checks; the task |
| +// stays done, merged as it was, and its earlier steps are untouched. |
| +func TestContractRetryPreviewOnMergedTask(t *testing.T) { |
| + r := publicPreviewRig(t) |
| + base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40) |
| + id, pv, m := r.previewedThenMerged("pd", base, cand, r.failedPreview("preview_scanner")) |
| + before, _ := r.client.Task(r.ctx, id) |
| + if before.Stage != wire.StageDone || before.Merged == nil || before.Merged.SHA != mergedSHA { |
| + t.Fatalf("not merged %+v", before) |
| + } |
| + page := r.get(r.inst.Cookie(), "/tasks/"+id, 200) |
| + if !strings.Contains(page, `<input type="hidden" name="step" value="`+pv.StepID+`">`) || !strings.Contains(page, "data-step-retry") { |
| + t.Fatal("the done task's failed preview offers no Retry") |
| + } |
| + if p := r.get(r.memberCookie(), "/tasks/"+id, 200); strings.Contains(p, "data-step-retry") { |
| + t.Fatal("a teammate is offered the preview's Retry") |
| + } |
| + // Retry with no step means the newest step, the merge: never run again. |
| + if _, err := r.client.RetryTask(r.ctx, id); Status(err) != http.StatusConflict { |
| + t.Fatalf("Retry of the done task's merge: %v", err) |
| + } |
| + if status, at := r.post(r.inst.Cookie(), "/conversation/tasks/"+id+"/retry", url.Values{"from": {"task"}, "step": {pv.StepID}}); status != http.StatusSeeOther || at != "/tasks/"+id { |
| + t.Fatalf("Retry the preview: %d %s", status, at) |
| + } |
| + again := r.previewDispatch(mergedSHA) |
| + if again == nil || again.StepID == pv.StepID || again.Attempt != 1 || again.CandidateSHA != mergedSHA { |
| + t.Fatalf("the preview of the merged commit %+v", again) |
| + } |
| + k, _ := r.client.Task(r.ctx, id) |
| + if k.Stage != wire.StageDone || k.Merged == nil || *k.Merged != *before.Merged || k.DoneAt == nil || !k.DoneAt.Equal(*before.DoneAt) || len(k.Steps) != len(before.Steps)+1 { |
| + t.Fatalf("the re-run moved the task %+v", k) |
| + } |
| + for i, s := range before.Steps { |
| + got := k.Steps[i] |
| + if got.ID != s.ID || got.State != s.State || got.Attempt != s.Attempt || got.Reason != s.Reason || got.CandidateSHA != s.CandidateSHA || got.MergeSHA != s.MergeSHA { |
| + t.Fatalf("step %d changed: %+v to %+v", i, s, got) |
| + } |
| + } |
| + if s := k.Steps[len(k.Steps)-1]; s.ID != again.StepID || s.Specialist != wire.SpecialistPreview || s.State != wire.StepQueued || s.CandidateSHA != mergedSHA || s.RetriedBy != "" { |
| + t.Fatalf("the new preview step %+v", s) |
| + } |
| + if s := k.Steps[len(k.Steps)-2]; s.ID != m.StepID || s.State != wire.StepDone || s.MergeSHA != mergedSHA { |
| + t.Fatalf("the merge %+v", s) |
| + } |
| + // Asked again while it runs: nothing more. |
| + r.post(r.inst.Cookie(), "/conversation/tasks/"+id+"/retry", url.Values{"from": {"task"}, "step": {again.StepID}}) |
| + if extra := r.previewDispatch(mergedSHA); extra != nil { |
| + t.Fatalf("a second preview %+v", extra) |
| + } |
| + // Published only through the preview's own checks, for its export. |
| + if refused := r.lease(r.runner, "pd-start", wire.LeaseCheck{StepID: again.StepID, Attempt: 1}); refused != "" { |
| + t.Fatalf("start refused %q", refused) |
| + } |
| + if refused := r.lease(r.runner, "pd-early", wire.LeaseCheck{StepID: again.StepID, Attempt: 1, Purpose: wire.LeasePurposePreview, Digest: digestB}); refused != wire.RefusedPreviewNotBuilt { |
| + t.Fatalf("publish before built: %q", refused) |
| + } |
| + r.built("pd-built", again, digestB) |
| + if refused := r.lease(r.runner, "pd-wrong", wire.LeaseCheck{StepID: again.StepID, Attempt: 1, Purpose: wire.LeasePurposePreview, Digest: digestA}); refused != "withdrawn" { |
| + t.Fatalf("publish of another export: %q", refused) |
| + } |
| + if refused := r.lease(r.runner, "pd-pub", wire.LeaseCheck{StepID: again.StepID, Attempt: 1, Purpose: wire.LeasePurposePreview, Digest: digestB}); refused != "" { |
| + t.Fatalf("publish refused %q", refused) |
| + } |
| + expires := time.Now().Add(7 * 24 * time.Hour).UTC().Truncate(time.Second) |
| + link := "https://tmp-" + id + ".bds.oncarlos.com/" |
| + r.previewDone("pd-up", again, wire.PreviewResult{Phase: wire.PreviewDone, App: "tmp-" + id, URL: link, Digest: digestB, ExpiresAt: &expires, Outcome: wire.PreviewDeployed}) |
| + k, _ = r.client.Task(r.ctx, id) |
| + if k.Stage != wire.StageDone || *k.Merged != *before.Merged || !strings.HasSuffix(k.PreviewURL, "/tasks/"+id+"/preview") { |
| + t.Fatalf("after the re-run: %s %+v %q", k.Stage, k.Merged, k.PreviewURL) |
| + } |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+id, 200); !strings.Contains(page, "data-preview") || strings.Contains(page, "data-step-retry") { |
| + t.Fatal("the re-run's link is not shown, or Retry is still offered while it is up") |
| + } |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+id+"/preview", 200); !strings.Contains(page, `src="`+link+`"`) { |
| + t.Fatal("the preview page does not open the re-run") |
| + } |
| +} |
| + |
| +// TestContractCoordinatorRetryUnconfirmedPreviewOnMergedTask |
| +// (tkzmnycab3ml): a done task's preview that ended unconfirmed |
| +// (preview_headers) is the coordinator's to run again, once per task in |
| +// a turn, from the merged commit; the page credits the coordinator. |
| +func TestContractCoordinatorRetryUnconfirmedPreviewOnMergedTask(t *testing.T) { |
| + r := publicPreviewRig(t) |
| + base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40) |
| + id, pv, _ := r.previewedThenMerged("pu", base, cand, r.unconfirmedPreview("preview_headers", "tmp-")) |
| + if reason, ok := r.retryOf("pu-read", id, wire.SpecialistPreview); !ok || reason != "" { |
| + t.Fatalf("read_task: the unconfirmed preview is not retryable (%q)", reason) |
| + } |
| + res := r.call("pu1", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}) |
| + if res.IsError || res.Code != "retrying" { |
| + t.Fatalf("retry_step %+v", res) |
| + } |
| + again := r.previewDispatch(mergedSHA) |
| + if again == nil || again.StepID == pv.StepID || again.Attempt != 1 { |
| + t.Fatalf("the preview of the merged commit %+v", again) |
| + } |
| + k, _ := r.client.Task(r.ctx, id) |
| + if s := k.Steps[len(k.Steps)-1]; s.ID != again.StepID || s.RetriedBy != wire.RetriedByCoordinator || k.Stage != wire.StageDone { |
| + t.Fatalf("the coordinator's preview %+v (%s)", s, k.Stage) |
| + } |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+id, 200); !strings.Contains(page, "The coordinator started Preview again.") { |
| + t.Fatal("the timeline does not say the coordinator started it") |
| + } |
| + if r.audits("task.retry") != 1 { |
| + t.Fatalf("audits %d", r.audits("task.retry")) |
| + } |
| + if reason, _ := r.retryOf("pu-read2", id, wire.SpecialistPreview); reason != "not_ended" { |
| + t.Fatalf("read_task while it runs: %q", reason) |
| + } |
| + // Once per task in a turn: a fresh call while it runs, and again once |
| + // it failed and ended, is answered by the ledger; nothing more runs. |
| + if res := r.call("pu2", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}); res.IsError || !res.Replayed { |
| + t.Fatalf("second retry_step %+v", res) |
| + } |
| + r.step("pu-again-fail", wire.StepReport{TaskID: id, StepID: again.StepID, Attempt: 1, State: wire.StepFailed, Reason: "preview_failed", BaseSHA: again.BaseSHA, CandidateSHA: mergedSHA, Termination: true, Findings: []wire.Finding{}}) |
| + if res := r.call("pu3", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}); res.IsError || !res.Replayed { |
| + t.Fatalf("retry_step after the re-run failed %+v", res) |
| + } |
| + if extra := r.previewDispatch(mergedSHA); extra != nil || r.audits("task.retry") != 1 { |
| + t.Fatalf("a second preview in the turn %+v", extra) |
| + } |
| + if k2, _ := r.client.Task(r.ctx, id); len(k2.Steps) != len(k.Steps) || k2.Stage != wire.StageDone { |
| + t.Fatalf("steps %d to %d, stage %s", len(k.Steps), len(k2.Steps), k2.Stage) |
| + } |
| +} |
| + |
| +// TestContractRetryUnconfirmedPreview: on a task still open, a preview |
| +// that ended unconfirmed is offered and run again as its next attempt. |
| +func TestContractRetryUnconfirmedPreview(t *testing.T) { |
| + r := publicPreviewRig(t) |
| + r.asksBeforeMerging() |
| + base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40) |
| + id, d := r.approvedWithPreview("uc", base, cand, true) |
| + if d == nil { |
| + t.Fatal("no preview") |
| + } |
| + r.built("uc-built", d, digestA) |
| + r.unconfirmedPreview("preview_failed", "tmp-")(id, d) |
| + page := r.get(r.inst.Cookie(), "/tasks/"+id, 200) |
| + if !strings.Contains(page, `<input type="hidden" name="step" value="`+d.StepID+`">`) { |
| + t.Fatal("an unconfirmed preview offers no Retry") |
| + } |
| + if status, _ := r.post(r.inst.Cookie(), "/conversation/tasks/"+id+"/retry", url.Values{"from": {"task"}, "step": {d.StepID}}); status != http.StatusSeeOther { |
| + t.Fatalf("Retry %d", status) |
| + } |
| + again := r.previewDispatch(cand) |
| + if again == nil || again.StepID != d.StepID || again.Attempt != 2 { |
| + t.Fatalf("the preview again %+v", again) |
| + } |
| + if k, _ := r.client.Task(r.ctx, id); k.Stage != wire.StageReadyToMerge { |
| + t.Fatalf("stage %s", k.Stage) |
| + } |
| +} |
| + |
| +// TestContractRetryRefusalReasons: a retry that is still refused says |
| +// why, in a fixed reason, in retry_step's result and in read_task. |
| +func TestContractRetryRefusalReasons(t *testing.T) { |
| + r := publicPreviewRig(t) |
| + base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40) |
| + expires := time.Now().Add(7 * 24 * time.Hour).UTC().Truncate(time.Second) |
| + id, pv, _ := r.previewedThenMerged("rr", base, cand, func(id string, pv *wire.DispatchCommand) { |
| + r.previewDone("rr-up", pv, wire.PreviewResult{Phase: wire.PreviewDone, App: "tmp-" + id, URL: "https://tmp-" + id + ".bds.oncarlos.com/", Digest: digestA, ExpiresAt: &expires, Outcome: wire.PreviewDeployed}) |
| + }) |
| + // Deployed and still up: nothing to run again. |
| + if res := r.call("rr1", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}); res.Code != "not_retryable" || refusal(t, res) != "completed" { |
| + t.Fatalf("retry of a preview that is up %+v", res) |
| + } |
| + if reason, _ := r.retryOf("rr-read", id, wire.SpecialistPreview); reason != "completed" { |
| + t.Fatalf("read_task %q", reason) |
| + } |
| + // A finished task's checks and review are not run again. |
| + for _, kind := range []string{wire.SpecialistChecks, wire.SpecialistReview} { |
| + if res := r.call("rr-"+kind, wire.ToolRetryStep, map[string]string{"task": id, "step": kind}); res.Code != "task_ended" || refusal(t, res) != "task_done" { |
| + t.Fatalf("retry of a done task's %s %+v", kind, res) |
| + } |
| + if reason, _ := r.retryOf("rr-read-"+kind, id, kind); reason != "task_done" { |
| + t.Fatalf("read_task %s %q", kind, reason) |
| + } |
| + } |
| + // A cancelled task runs nothing again. |
| + b2, c2 := strings.Repeat("3", 40), strings.Repeat("4", 40) |
| + other, _ := r.pushed("rc", "Fix the README typo", b2, c2) |
| + r.expect(wire.FrameWatchMerge) |
| + r.checks("rc-c", r.dispatched(wire.SpecialistChecks, b2, c2, 0), wire.ChecksPassed, exit(0), "", "ok\n") |
| + rv := r.dispatched(wire.SpecialistReview, b2, c2, 0) |
| + r.step("rc-r", wire.StepReport{TaskID: rv.TaskID, StepID: rv.StepID, Attempt: rv.Attempt, State: wire.StepDone, BaseSHA: b2, CandidateSHA: c2, Termination: true, Family: "codex", Account: "codex-a", Verdict: wire.VerdictApprove, ReviewLabel: wire.ReviewOtherFamily, Findings: []wire.Finding{}, Summary: "Read it.", HasPreview: true}) |
| + d := r.previewDispatch(c2) |
| + if d == nil { |
| + t.Fatal("no preview of the second task") |
| + } |
| + if reason, _ := r.retryOf("rc-read", other, wire.SpecialistPreview); reason != "not_ended" { |
| + t.Fatalf("read_task of a queued preview %q", reason) |
| + } |
| + if res := r.call("rc-cancel", wire.ToolCancelTask, map[string]string{"task": other}); res.IsError { |
| + t.Fatalf("cancel %+v", res) |
| + } |
| + r.failedPreview("cancelled")(other, d) |
| + if res := r.call("rc1", wire.ToolRetryStep, map[string]string{"task": other, "step": wire.SpecialistPreview}); res.Code != "task_ended" || refusal(t, res) != "task_cancelled" { |
| + t.Fatalf("retry on a cancelled task %+v", res) |
| + } |
| + // Its link expired: it runs again, unless the project stopped |
| + // allowing public previews since. |
| + if err := r.inst.DB.G.Exec("UPDATE chat_steps SET preview = replace(preview, ?, ?) WHERE id = ?", expires.Format(time.RFC3339), time.Now().Add(-time.Hour).UTC().Format(time.RFC3339), pv.StepID).Error; err != nil { |
| + t.Fatal(err) |
| + } |
| + if reason, _ := r.retryOf("rr-read-expired", id, wire.SpecialistPreview); reason != "" { |
| + t.Fatalf("an expired preview: %q", reason) |
| + } |
| + project := r.project() |
| + var revision int |
| + if err := r.inst.DB.G.Raw("SELECT coalesce(autonomy_revision, 0) FROM chat_projects WHERE id = ?", project).Scan(&revision).Error; err != nil { |
| + t.Fatal(err) |
| + } |
| + if code, _ := r.post(r.inst.Cookie(), "/settings/autonomy", url.Values{"project": {project}, "revision": {itoa(revision)}}); code != http.StatusSeeOther { |
| + t.Fatalf("turn public previews off: %d", code) |
| + } |
| + if res := r.call("rr2", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}); res.Code != "not_retryable" || refusal(t, res) != "preview_public_disabled" { |
| + t.Fatalf("retry with public previews off %+v", res) |
| + } |
| + if extra := r.previewDispatch(mergedSHA); extra != nil { |
| + t.Fatalf("a refused retry dispatched %+v", extra) |
| + } |
| +} |
| + |
| +// TestContractRetryDevboxPreviewOnMergedTask: a devbox link comes down |
| +// when its task ends, so a done task's deployed devbox preview counts as |
| +// one to run again. The re-run's link shows for a bounded time, and the |
| +// hourly sweep then takes it down, once. |
| +func TestContractRetryDevboxPreviewOnMergedTask(t *testing.T) { |
| + r := newToolRigAt(t, wire.ProtocolCurrent) |
| + r.pairedWith(&wire.PreviewHost{Kind: wire.PreviewHostDevbox, Domain: "devbox.dev.example"}) |
| + base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40) |
| + id, _, _ := r.previewedThenMerged("dd", base, cand, func(id string, pv *wire.DispatchCommand) { |
| + r.previewDone("dd-up", pv, wire.PreviewResult{Phase: wire.PreviewDone, App: "eq-" + id, URL: "https://eq-" + id + ".devbox.dev.example/", Digest: digestA, Outcome: wire.PreviewDeployed}) |
| + }) |
| + line := "Preview: eq-" + id + ".devbox.dev.example (on your tailnet)" |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+id, 200); strings.Contains(page, line) || !strings.Contains(page, "data-step-retry") { |
| + t.Fatal("the done task still shows its devbox link, or offers no Retry") |
| + } |
| + if res := r.call("dd1", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}); res.IsError { |
| + t.Fatalf("retry_step %+v", res) |
| + } |
| + again := r.previewDispatch(mergedSHA) |
| + if again == nil { |
| + t.Fatal("no preview of the merged commit") |
| + } |
| + r.built("dd-built", again, digestB) |
| + r.previewDone("dd-again", again, wire.PreviewResult{Phase: wire.PreviewDone, App: "eq-" + id, URL: "https://eq-" + id + ".devbox.dev.example/", Digest: digestB, Outcome: wire.PreviewDeployed}) |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+id, 200); !strings.Contains(page, line) { |
| + t.Fatal("the re-run's devbox link is not shown") |
| + } |
| + if page := r.get(r.inst.Cookie(), "/tasks/"+id+"/preview", 200); !strings.Contains(page, "<iframe") { |
| + t.Fatal("the preview page does not open the re-run") |
| + } |
| + k, _ := r.client.Task(r.ctx, id) |
| + up := k.Steps[len(k.Steps)-1].Preview |
| + if up == nil || up.ExpiresAt == nil || up.ExpiresAt.Before(time.Now().Add(6*24*time.Hour)) || up.ExpiresAt.After(time.Now().Add(8*24*time.Hour)) { |
| + t.Fatalf("the re-run's link is not bounded %+v", up) |
| + } |
| + if res := r.call("dd2", wire.ToolRetryStep, map[string]string{"task": id, "step": wire.SpecialistPreview}); !res.Replayed { |
| + t.Fatalf("a second retry in the turn %+v", res) |
| + } |
| + forgets := r.commandsLike(wire.FrameForgetTask, `"task_id":"`+id+`"`) |
| + if err := r.inst.Store.Chat().Sweep(r.ctx); err != nil { |
| + t.Fatal(err) |
| + } |
| + if n := r.commandsLike(wire.FrameForgetTask, `"task_id":"`+id+`"`); n != forgets { |
| + t.Fatal("the sweep took the link down early") |
| + } |
| + if err := r.inst.DB.G.Exec("UPDATE chat_steps SET preview_down_at = ? WHERE id = ?", time.Now().Add(-time.Minute).UTC(), again.StepID).Error; err != nil { |
| + t.Fatal(err) |
| + } |
| + for range 2 { |
| + if err := r.inst.Store.Chat().Sweep(r.ctx); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if n := r.commandsLike(wire.FrameForgetTask, `"task_id":"`+id+`"`); n != forgets+1 { |
| + t.Fatalf("forget_task %d times after the link's time (was %d)", n, forgets) |
| + } |
| + if n := r.commandsLike(wire.FrameForgetTask, `"keep_preview":true`); n != 0 { |
| + t.Fatal("the sweep kept the preview") |
| + } |
| + if k2, _ := r.client.Task(r.ctx, id); k2.Stage != wire.StageDone || *k2.Merged != *k.Merged { |
| + t.Fatalf("the sweep moved the task %+v", k2) |
| + } |
| +} |