oficina / equipo Public

Merge authority: contracts, mutations, copy, headless, spec 3.1

Eleven store contracts for the gate (act, asks, the fence for old
runners, the confirmation re-check, nothing queued while offline, the
ships question, Wait, Undo, the policy tool, facts acceptance, roster),
the 4c headless scenario ending in Equipo's own merge measured by the
real runner, the coordinator's tools allowed in the Claude launch and
named in its house rules, 82 strings marked for copy review with their
inventory rows, budgets with reasons, and spec revision 3.1 with Paul's
"Refuse old runners" and the round 3 rulings. Progress and mutations in
docs/superpowers/plans/MERGEAUTH-PROGRESS.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 89faf874da3562dcb8c0989b8777e9c9963e8e92 parent cf1b5c3
16 files changed, +1,056 −105
  • .rastrillo/budgets.txt +4 −4
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +82 −0
  • docs/superpowers/plans/MERGEAUTH-PROGRESS.md +138 −0
  • docs/superpowers/specs/2026-11-11-equipo-merge-authority.md +87 −87
  • internal/equipo/chat/mergeauth.go +12 −3
  • internal/equipo/copy.go +2 −0
  • internal/headless/merge_test.go +37 −4
  • internal/plan3test/person_api_contract_test.go +1 −1
  • internal/runner/provider/claude/launcher.go +1 −1
  • internal/runner/thin/claude.go +1 −1
  • internal/runner/thin/voice_test.go +3 −1
  • internal/thintest/mergeauth_contract_test.go +671 −0
  • internal/wire/wiretest/testdata/api/needs-you.json +1 −1
  • internal/wire/wiretest/testdata/api/task-merged.json +1 −1
  • internal/wire/wiretest/testdata/api/task-ready.json +1 −1
  • scripts/runner-reference-allowlist.json +14 −0

CI failed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index ceff431a..191bbf3f 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -14,7 +14,7 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr
time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI.
time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage.
-size internal/equipo 15550 - The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here.
+size internal/equipo 15700 - Merge authority thin v1 adds the project page's "How Equipo merges" section and form (merge_policy_page.go, about 90 lines) and 85 strings; measured 15635. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here.
size internal/equipotest - 13400 Task 21 repairs historical migration and conversation fixtures after Plan 3. Measured 13024 test lines; the 300s time ceiling is unchanged.
time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); 60s gives 34 percent headroom. Shared baseline capture reduces repeated Go runs; retain the CI allowance for sandbox sentinels, timeout and child cleanup. 2026-11-07: loaded CI (host load about 24) measured 66.5s with the package unchanged by thin v1 slice 4 beyond optional check mounts; 90s keeps 35 percent headroom.
time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). Parallel plan graphs and removal of repeated progress floods reduced their local targeted run from 146.920s to 30.784s; the original bug graph retains volume coverage. Keep 330s for journal, proxy, recovery and namespace integration, with 13 percent headroom.
@@ -34,7 +34,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full
perf GET /releases/* skip Verified runner release file downloads, not browser GET screens.
perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen.
time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; niced serial reruns measured 5.773s and 5.750s. The added coordinator mount check has no repeated launches to remove; 15s leaves 38 percent headroom for namespace, process-exit and recovery assertions.
-size internal/runner/thin 15850 - Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
+size internal/runner/thin 16150 - Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16094. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
time internal/thintest 180s Mac runners slices A and B add role, scoping, migration, placement, withdrawal, transfer and publication contracts, and Astra round 1 eight transition contracts (about 15s; the package measured 126s locally under load). Housekeeping slice 1 adds six contract tests (combine, Undo round trips and the race, Pause, auto-disable, quiet hours, restart while claimed; about 6s); the package measured 67.7s beside other packages locally, so 75s. Thin v1 slice 4c adds the merge, adoption, cancel and retention contract tests (CI measured 35.7s). Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts. UX1 adds step activity, task source and duplicates, coordinator merging and project facts (four contracts, about 6s); the package measured 34s locally under load, so 40s. UX1's inner screens gallery (two owners, seven tasks, every page) adds about 3s; measured 40.9s locally under load, so 60s.
time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing a waiting test two seconds after it starts. About 6s alone; loaded CI measured 12.5s.
time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). Measured 17.8s locally under load. Slice 4b review adds a 16 MiB git output bound, an injected index-pack failure and stall (3s deadline) and held-answer tests; measured 30.3s locally under load. 45s keeps 33 percent headroom.
@@ -49,7 +49,7 @@ perf GET /api/v1/notebook skip Thin v1 person API: bearer-only JSON for devices;
perf GET /api/v1/thinking skip Thin v1 person API: bearer-only JSON for devices; the browser reads thinking words on /settings/thinking.
perf GET /api/v1/tasks skip Thin v1 person API: bearer-only JSON for devices; the browser reads tasks through /tasks.
perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads a task through /tasks/{id}.
-size internal/equipo/chat 12000 - Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep.
+size internal/equipo/chat 13300 - Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep.
perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}.
perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}.
perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections.
@@ -62,4 +62,4 @@ perf GET /conversation/attachments/{id}/preview skip Composer attachments: an im
perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section.
time cmd/equipo-runner 60s Mac runners slice B: TestReleaseRunnerHasNoFakeWorker builds the release runner exactly as make release-runner does and the thin package under the testbuild tag (measured 11.9s locally with a warm cache).
size internal/headless - 8300 Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090.
-size internal/thintest - 10000 Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness.
+size internal/thintest - 10750 Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) and the protocol-aware tool rig; measured 10678. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 69c47ab8..32afbf27 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5881,6 +5881,88 @@ records remain unchanged.
| `runner.verdict.failed` | Failed | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.verdict.skipped` | Not run | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.verdict.unavailable` | Unavailable | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.merge.stance_merge` | Merge %s? I'd merge: %s, but %s. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.stance_wait` | Merge %s? I'd wait: %s. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.why.approved` | approved by Review | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.why.small` | a small change, %d lines in %d files | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.why.not_shipping` | nothing ships until a release | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.why.exact_revert` | it exactly reverts %s | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.environment` | checks couldn't run because %s | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.no_checks` | it has no checks to run | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.protocol` | your runner needs an update before I merge on my own | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.facts` | the runner didn't say what changed | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.small` | it's bigger than I merge on my own (%d lines in %d files) | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.special` | it changes a symlink, a submodule or a file mode | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.sensitive` | it touches %s (%s) | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.signing` | it changes signing or version settings | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.ships` | merging to %s's main ships to users | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.ships_unknown` | I don't know yet whether %s's main ships to users | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.policy` | this project asks before every merge | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.revert` | it doesn't exactly revert %s | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.eligible` | it was ready before I merged on my own | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.sandbox` | its checks ran outside the sandbox | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.migrations` | the database schema | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.auth_secrets` | sign-in, keys or secrets | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.payments` | payments | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.ci_config` | the checks or CI setup | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.dependencies` | dependencies | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.release_signing` | release or signing settings | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.infrastructure` | infrastructure | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.area.project` | a path this project asks about | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.wait_mac` | Wait for a Mac | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.merge_chose_wait_mac` | Waiting for a Mac. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.ships_question` | Does merging to %s's main ship to users? | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.ships` | It ships | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.not_ships` | It doesn't | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.ships_chose_ships` | Merging to main ships, so I'll ask first. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.ships_chose_not_ships` | Main isn't a release, so I can merge small changes on my own. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.merge_policy_stale` | The policy changed since, so nothing was saved. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy_confirm` | Change how Equipo merges %s: %s? | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.save` | Save | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.cancel` | Cancel | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.policy_chose_save` | Saved. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.card.policy_chose_cancel` | Left as it was. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy.rules` | merge on its own when every rule holds, up to %d lines in %d files | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy.ask` | ask before every merge | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy.ships_unknown` | not yet told whether main ships to users | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy.ships_yes` | main ships to users | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy.ships_no` | main is not a release | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.policy.extra` | always ask about %s | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.receipt` | Merged [%s](%s) into %s without checks: %s. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.receipt_unverified` | Merged [%s](%s) into %s without checks, but I couldn't tell which commit on main it is, so I can't undo it. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.reverting` | Reverting it: [%s](%s). | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.revert_title` | Revert %s in %s | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.mode_reason_reverted` | a merge was undone (%s) | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.reason.merge_not_authorized` | Equipo's rules said to ask before merging | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.title` | How Equipo merges | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.rules` | Equipo merges on its own when Review approved it and its checks passed, or when checks couldn't run here and the change is small (up to %d lines in %d files), touches nothing sensitive and main is not a release. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ask` | Equipo asks before every merge in this project. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.reason` | It asks because %s. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships_unknown` | Nobody has said yet whether merging to main ships to users, so Equipo asks. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships_yes` | Merging to main ships to users, so Equipo asks before merging without checks. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships_no` | Main is not a release: nothing ships until one. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.extra` | It always asks about %s. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.words` | In your words: %s | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.decisions` | Recent decisions | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.decision.act` | Merged on its own | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.decision.ask` | Asked | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.decision.never` | Not ready to merge | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.mode` | How it decides | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.mode_rules` | Merge on its own when every rule holds | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.mode_ask` | Ask before every merge | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.max_lines` | Most lines changed | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.max_files` | Most files changed | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships` | Does merging to main ship to users? | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships_opt_unknown` | Not answered | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships_opt_yes` | Yes, it ships | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.ships_opt_no` | No, main is not a release | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.extra_label` | Paths that always ask, one per line | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.words_label` | In your words | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.save` | Save | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.saved` | Saved. | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `work.merge_policy.edit` | Change | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.why.small_one` | a small change, %d lines in one file | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
+| `chat.merge.not.small_one` | it's bigger than I merge on my own (%d lines in one file) | Merge authority thin v1 (2026-11-11) | Runtime; COPY REVIEW REQUIRED |
## Task 21
diff --git a/docs/superpowers/plans/MERGEAUTH-PROGRESS.md b/docs/superpowers/plans/MERGEAUTH-PROGRESS.md
new file mode 100644
index 00000000..a5b4e0d6
--- /dev/null
+++ b/docs/superpowers/plans/MERGEAUTH-PROGRESS.md
@@ -0,0 +1,138 @@
+# Merge authority thin v1: progress
+
+Branch `merge-authority` from main ac4a809. Spec:
+`docs/superpowers/specs/2026-11-11-equipo-merge-authority.md` revision
+3.1 (rev 1 7eba9c8, rev 2 4ab106f, rev 3 5d7e2c4; Astra rounds 1 to 3 all
+REQUEST CHANGES; Paul chose "Refuse old runners" for round 3's Critical
+and the controller directed the other four findings).
+
+## Done
+
+1. **The gate** (`internal/equipo/mergegate`, pure): `Decide` answers act,
+ ask or never with every criterion and Equipo's stance; `Sensitive`
+ matches the old and new path of every entry against the fixed table
+ and a project's added globs; `ValidPolicy` and `Tighter` bound a
+ policy and what the coordinator may apply alone. Every automatic merge,
+ checks passed included, needs `wire.ProtocolMergeFacts`.
+2. **Wire, protocol named by capability**: `wire.ProtocolMergeFacts`
+ (3 here; the next free number once spend-1's protocol 3 is on main, a
+ one-line change). Optional fields: `StepReport.change`,
+ `merge_source`, `merge_parents`; `LeaseCheck.purpose`
+ (`merge_request`); `DispatchCommand.revert_sha`; the refusal reason
+ `merge_not_authorized`. `Encode` drops them below the protocol (its own
+ downgrade step).
+3. **Runner**: the review measures the reviewed pair with no model
+ (`facts.go`: raw and numstat listings that must agree, both rename
+ paths, symlinks, gitlinks, mode changes and new executables as special,
+ binary files, signing lines in Xcode project files, the revert's tree
+ check against the merge commit's first parent). The merge step confirms
+ every hub request with `ConfirmMerge` and ends `merge_not_authorized`,
+ nothing sent, when refused (at the start lease too); its report says
+ where the merge SHA came from and, from the hub's own answer, the
+ merge commit's parents (`forge.MergeOutcome.Source`; the forge's tip
+ fallback is unchanged, a separate issue).
+4. **Instance** (`internal/equipo/chat/mergeauth.go`): `authorizeMerge`
+ decides every merge and writes one audit row: `autoMerge` at Ready
+ (never for a SHA already asked about; nothing decided while the
+ primary is offline), a person's Merge on the card or task page (a
+ failed, ended attempt is tried again), Retry, and every merge step
+ lease. The fence: an automatic merge step's lease from a connection
+ below the protocol is refused whatever it asks, settled failed in the
+ same transaction and asked about; a `merge_request` lease decides
+ again on every call. Change facts are kept only when exactly the
+ review attempt's, whole, from the primary. Equipo's own merge without
+ checks gets a receipt card (Undo only for a hub-named merge commit with
+ the candidate as second parent, 7 days); Undo opens an ordinary revert
+ task through the normal flow and puts the project in ask mode. The
+ ships question asks once per project and applies to later decisions
+ only. `set_merge_policy` applies only stricter changes alone (a looser
+ one is a Save card for an owner); `hold_merge` only stops.
+5. **Pages**: the merge, ships, policy and receipt cards in the
+ conversation (`chat.html`); the project page's "How Equipo merges"
+ section and owner form (`merge_policy.html`, one include line in
+ `work_project.html`; no change to the Needs you card's template, only
+ its options now include Wait for a Mac).
+6. **API**: `POST /api/v1/tasks/{id}/undo-merge`,
+ `GET/PUT /api/v1/projects/{id}/merge-policy`; `Task` gained
+ `merge_decision`, `merge_hold`, `revert_of`, `undo_offered` (all
+ omitempty). Fixtures `api/task-merged.json`, `api/task-ready.json`,
+ `api/needs-you.json` gained `merge_decision`; new frame fixtures
+ `lease-merge`, `step-review-facts`, `step-merged-hub`,
+ `dispatch-revert`.
+7. **Migration 0059** `thin_merge_authority` (projects-ux and spend-1
+ both take 0058): tables `chat_merge_policies`, `chat_merge_audit`;
+ columns `chat_steps.change_facts`, `decided_by`, `merge_source`,
+ `merge_parents`; `chat_tasks.merge_hold`, `merge_verified`,
+ `revert_of`, `revert_sha`. Additive; renumber to the next free number
+ when this rebases on main.
+8. **Coordinator**: the two tools in `wire.ConverseTools`, the runner's
+ MCP list, the provider's converse list and the Claude launcher's
+ allowlist (`TestConversePolicyCoversEveryTool`), and one house-rule
+ sentence about them.
+
+## Tests (targeted, local, niced)
+
+- `go test ./internal/equipo/mergegate` (9 tests, including a 20,000-input
+ invariant simulation against an independent oracle)
+- `go test ./internal/wire` (with `TestWireProtocol3Downgrade`)
+- `go test ./internal/runner/thin -run 'TestReviewReportsChangeFacts|TestRevertCheck|TestMergeConfirmPurpose|TestMergeSource|TestLeaseRefusalReasons|TestMerge|TestRecoverSteps|TestReview|TestLink|TestOpening'`
+- `go test ./internal/runner/provider/claude -run TestConversePolicy`
+- `go test ./internal/thintest -run` the eleven merge authority contracts
+ (`TestContractMergeAuthorityAct`, `...Asks`, `...MergeFenceOldRunner`,
+ `...ConfirmRechecks`, `...NoQueuedAutoMerge`, `...ShipsQuestion`,
+ `...WaitNeverMerges`, `...UndoMerge`, `...MergePolicyTool`,
+ `...FactsAcceptance`, `...RosterDenial`) and the slice 4c merge, review
+ and page contracts now on a `ProtocolMergeFacts` runner
+- `go test ./internal/equipo/chat -run TestHousekeeping` (the principal
+ may not write a merge policy)
+- `go test ./internal/equipo -run 'TestMigrationModels|TestConversationMigrationSnapshot|TestTemplateCopyKeys|TestRunnerCopyInventory'`
+- `go test ./internal/plan3test -run TestPlan3ReleaseBoundaries`
+- headless `TestHeadless/(4_review|4c_checks_card|4c_rebase)`: 4c now
+ ends with the owner answering the ships question and a third iOS change
+ merging on its own, measured by the real runner, with a receipt and Undo.
+ One combined run first failed in 4c_rebase (the rebase's checks still
+ queued at the wait's end, docs-t1 under load); 4c_rebase alone and the
+ three together then passed.
+- `make budget`, gofmt, `go vet ./internal/...`,
+ `scripts/runner-dead-references.py`
+- `make ci` (`CGO_ENABLED=0`) runs on hosted CI only.
+
+## Mutations (each guard broken, a test watched failing, restored)
+
+Gate: environment reason, protocol, lines, binary, sensitive paths,
+special entries, ships, policy mode, hold, exact revert, first-ready
+eligibility, sandbox, never for a person, incomplete facts (first
+survived; a case added), stance, Tighter on ships, glob depth, camel-case
+tokens, rename old path: all killed. Wire: purpose, change facts and the
+downgrade step: killed. Runner: ancestry, entry bound, mode change,
+symlink, gitlink, new executable, signing, binary, rename, revert on-top,
+revert tree: killed; ConfirmMerge replaced by the plain lease, the
+refusal ignored, the start refusal as a cancel, mislabelled hub and
+cached sources, parents for any source: killed; the refusal reason
+mapping first survived (no test), then extracted and killed by
+`TestLeaseRefusalReasons`; the launcher allowlist: killed by
+`TestConversePolicyCoversEveryTool`. Instance: the fence at the lease and
+at dispatch, the confirmation re-check, the checked-merge re-check at
+confirmation (first mutation did not loosen; the real loosening killed),
+the `merge_asked` guard, Merge retrying a failed attempt, verified
+landing, Undo's ask mode, facts acceptance, the receipt, deciding while
+offline, the ships question once (first survived; a second asking task
+added), the policy tool's tighter-only rule, the audit row, the revert
+target, a teammate's Undo: all killed. Three first runs that died only on
+a build failure were redone as valid mutations.
+
+## Copy for review
+
+82 strings in `internal/equipo/copy.go`, each `COPY REVIEW REQUIRED`, each
+in the Plan 3 copy inventory (`CONTROLLER-REPORT-plan-3.md`): the card's
+stances and phrases (`chat.merge.*`), Wait for a Mac, the ships question
+and its answers, the policy confirm card, the receipt, the revert title,
+the ask-mode reason, `work.reason.merge_not_authorized` and the project
+page section (`work.merge_policy.*`). Model-facing texts (tool results,
+the two tool descriptions, the house-rule sentence) are not runtime copy.
+
+## Not in v1
+
+Verification on the merged commit, the trust counter, automatic fix
+tasks, a revert step, a same-SHA checks retry after Wait, and the forge's
+tip fallback fix for every merge (a separate issue).
diff --git a/docs/superpowers/specs/2026-11-11-equipo-merge-authority.md b/docs/superpowers/specs/2026-11-11-equipo-merge-authority.md
index 6d59ffc0..3582e0bd 100644
--- a/docs/superpowers/specs/2026-11-11-equipo-merge-authority.md
+++ b/docs/superpowers/specs/2026-11-11-equipo-merge-authority.md
@@ -1,6 +1,9 @@
# Equipo merge authority, thin v1
-Status: spec addendum for review, 2026-11-11, revision 3 ("thin v1").
+Status: 2026-11-11, revision 3.1 ("thin v1"), being built. Revision 3
+drew REQUEST CHANGES from Astra round 3 (the last round); Paul chose
+"Refuse old runners" for its Critical, and the controller directed the
+other four findings. Those rulings are folded in (§13).
Revision 1 (7eba9c8) and revision 2 (4ab106f) drew REQUEST CHANGES from
Astra; the controller cut the scope (§11 lists what moved to v2, §12
maps the round 2 findings). Drafted by Claude (Opus 5.5) on
@@ -33,8 +36,13 @@ Invariants, each tested:
synchronously, with the hub's `expect_sha`, and each call writes one
audit row.
4. **Never retroactive.** Only a candidate whose review ran on a
- protocol 3 runner after the upgrade can merge without checks on its
- own; an open card is never re-decided automatically.
+ `wire.ProtocolMergeFacts` runner after the upgrade can merge without
+ checks on its own; an open card is never re-decided automatically.
+5. **Refuse old runners** (Paul). Every automatic merge, checks passed
+ included, needs the primary at `wire.ProtocolMergeFacts` both when the
+ step is dispatched and at every hub request. A lower protocol is
+ refused, never downgraded, and the decision becomes an ask card with a
+ recommendation. Code names the capability, never a protocol number.
## 1. Decision classes
@@ -162,20 +170,30 @@ card. Nothing is withdrawn, so `withdrawnSettle` is not involved, and
the step's first lease (which only starts the step, before any
inspection) is unchanged.
-**No queued automatic merge.** `startMerge` for `person == false`
-creates the step only when the person's primary is online (and, for a
-merge without checks, on protocol 3, which `runner_reports_facts`
-already requires). Otherwise nothing is created and the next sync's
+**No queued automatic merge.** `autoMerge` decides only when the
+person's primary is online; the gate's `runner_protocol` criterion then
+needs it at `wire.ProtocolMergeFacts` for every automatic merge, checked
+or not. Offline, nothing is decided or created and the next sync's
`advance` is the next trigger. A person's Merge may wait
for the primary as today. The runner's existing bounded wait while the
hub's CI is pending (10 minutes) holds no decision: each resumption
calls `Confirm`, which decides again.
-**Protocol 1 and 2 runners** never get an automatic merge without
-checks (`runner_reports_facts`), and an automatic merge with checks
-passed is created for them only as today; their `Confirm` cannot name
-the merge, so for those the gate runs at dispatch only. This is
-recorded in the audit row (`at: dispatch_only`).
+**Runners below `wire.ProtocolMergeFacts`** never get an automatic
+merge: at dispatch the gate asks (stance merge when only the protocol
+fails: "your runner needs an update before I merge on my own"). The
+fence: when a runner holding an automatic merge step reconnects below
+that protocol, every lease it asks for that step is refused
+`merge_not_authorized`, whatever it carries (its purpose is dropped by
+`Encode`), and the attempt is settled failed in the same transaction
+with the ask card raised. A request such a runner already sent before
+it reconnected is settled by the merge watch, which reports the
+landing as today. There is no dispatch-only path: a person's Merge is
+the only merge an older runner carries, and their decision stands.
+
+**Merge on the card after a refusal.** The card's Merge (and the task
+page's) accepts a candidate whose newest merge step failed and ended:
+it runs that step again as its next attempt, decided by the person.
### 2.4 What a person's Merge means
@@ -292,11 +310,11 @@ Options: `needs_macos`, or `runner_offline` with a macOS need:
### 4.2 Wait
Wait only waits; it is never consent. The task stays at Ready to merge
-with Merge offered (today's behaviour). If checks later pass on that SHA
-(a person's Retry of checks), the existing checks-passed path decides
-through `authorizeMerge`; if they still cannot run, the card asks again
-(a new card for that SHA: `merge_asked` is cleared when a new checks
-result arrives for the candidate).
+with Merge offered (today's behaviour), and nothing re-runs the checks
+on the same SHA in v1 (a checks retry on the same SHA is v2). The
+`merge_asked` guard stays: once Equipo asked about a SHA, only the person
+acts on it; nothing (a policy answer, a sync, a later checks result)
+re-arms the automatic merge for that SHA.
### 4.3 The coordinator: stricter only
@@ -382,8 +400,8 @@ it exactly reverts %s.").
### 7.1 Storage
-Migration **0058** (next free on main ac4a809; whichever branch lands
-second renumbers). Tables `chat_merge_policies` and `chat_merge_audit`;
+Migration **0059** on this branch (projects-ux and spend-1 both take
+0058; renumbered to the next free number when this rebases on main). Tables `chat_merge_policies` and `chat_merge_audit`;
columns `chat_steps.change_facts`, `chat_steps.decided_by`,
`chat_steps.merge_source`, `chat_steps.merge_parents`,
`chat_tasks.merge_hold`, `chat_tasks.merge_verified`,
@@ -447,83 +465,55 @@ attempt and kind).
## 9. Wire and versions
-Protocol 3, all new fields optional and `omitempty`:
+`wire.ProtocolMergeFacts` (3 on this branch; the next free number
+after spend-1's protocol 3 lands, a one-line change), all new fields
+optional and `omitempty`:
`StepReport.change`, `StepReport.merge_source`,
`StepReport.merge_parents`, `LeaseCheck.purpose`,
-`DispatchCommand.revert_sha`. The runner sends them only on a protocol 3
-connection; `wire.Encode` clears them for protocol 2 and 1 (the
-existing `downgrade`). Instance first, then runners, as today.
+`DispatchCommand.revert_sha`. `wire.Encode` clears them for any peer
+below `wire.ProtocolMergeFacts` (its own downgrade step, chained after
+the others). Instance first, then runners, as today.
| Combination | Behaviour |
|---|---|
-| new instance, protocol 1 or 2 runner | no facts: every merge without checks asks; checks-passed merges as today, gate at dispatch only |
+| new instance, runner below `ProtocolMergeFacts` | every automatic merge asks (Refuse old runners); a person's Merge works as today |
| old instance, new runner | protocol 2 welcome: the new fields are never sent |
-| a runner downgrades after review | `Protocol` is read at each decision: asks |
+| a runner reconnects below it holding an automatic merge | the fence refuses its leases for that step; settled, asked |
## 10. Tests
-Each written first and watched failing; each guard broken and a test
-watched failing; commands and results in the progress log.
-
-**Gate (`mergegate`)**: `TestDecideEachCriterion` (all pass: act; each
-failing alone: ask naming it); `TestDecideNever`;
-`TestDecideChecksPassedPath`; `TestDecidePersonMerge`;
-`TestDecideNeverLooser` (an invariant simulation over random inputs:
-act without checks and without a person implies every row of §2.2 holds,
-by an independent oracle; a hold never yields act without a person; no
-policy value waives a criterion); `TestSensitivePaths` (each class at
-root and nested, old and new rename paths, token boundaries:
-`keyboard`, `monkey`, `tokenizer`; extra globs only add).
-
-**Runner**: `TestReviewReportsChangeFacts` (raw and numstat agree,
-rename both paths, binary, symlink, gitlink, mode change, new
-executable, signing lines, a plain pbxproj file add, truncation,
-protocol 2 omits it); `TestRevertCheck` (on top and exact; on top plus
-another edit; not on top); `TestMergeConfirmPurpose` (the forge's
-`Confirm` sends `merge_request`; a refusal ends `merge_not_authorized`
-with nothing sent and the record `prepared`); `TestMergeSource` (hub
-answer, reconciled, cached; parents read).
-
-**Store contracts**: `TestContractMergeAuthorityAct` (a Woodstar-shaped
-needs_macos change, `main_ships: no`: merged, receipt with Undo, audit
-rows at dispatch and confirm); `TestContractMergeAuthorityAsks` (each
-criterion gives the card with §4.1's stance and options);
-`TestContractOneDoor` (every `startMerge` caller passes
-`authorizeMerge`; a `go/ast` scan finds no other creator of merge
-steps); `TestContractConfirmRechecks` (policy to ask, a hold, the
-runner reconnecting at protocol 2, each between dispatch and confirm:
-refused, nothing reaches the forge, the card raised);
-`TestContractNoQueuedAutoMerge` (primary offline: no step; next sync
-merges); `TestContractNoRetryLoop` (an automatic attempt refused by the
-hub is not repeated on sync); `TestContractOpenCardNotRedecided`
-(answer "It doesn't ship" while a card is open: the next sync does not
-merge; the next candidate does); `TestContractShipsQuestion` (one card
-per project, owners only, stale revision 409); `TestContractWait`
-(Wait stays Ready; a later cannot-run asks again; never merges on its
-own); `TestContractUnverifiedLanding` (reconciled or cached source, or
-wrong parents: done, no Undo, audit); `TestContractUndo` (ordinary task
-without similarity, started, project to ask, receipt revision, 403,
-404, 409, window); `TestContractRevertExact`;
-`TestContractMergePolicyTool` (tighter applies, looser makes a confirm
-card, owner Save applies, teammate refused);
-`TestContractHoldMerge` (including during Merging before the request);
-`TestContractRosterDenial` (a removed or demoted person's Merge, Save,
-ships answer and Undo are refused inside the transaction);
-`TestContractAuditRollback` (a failed effect leaves no row; a replay
-adds none); `TestContractFactsAcceptance` (worker, wrong attempt, wrong
-SHA, incomplete, mismatched counts: dropped).
-
-**Upgrade (0058 on fixtures built at 0057)**: a Ready task with an open
-card, one answered Wait, one moved away, one eligible with checks
-passed (still merges, through the gate), one merging in flight (its
-next `Confirm` from a protocol 2 runner keeps today's behaviour): none
-merges without checks; `TestWireProtocol3Downgrade` (both directions).
-
-**Pages and end to end**: `TestProjectPageMergePolicy` (section, form,
-read only for teammates); browser `TestBrowserMergePolicy` with `-run`;
-headless `ma_act` (fake CLI, local forge: an iOS change merges and
-tells; Undo opens the revert task) and `ma_ask` (the ships question,
-then the card).
+Built on this branch (targeted `-run` locally; `make ci` with
+`CGO_ENABLED=0` on hosted CI is the final gate, never on docs-t1). Each
+guard is broken in turn and a test watched failing (progress log).
+
+**Gate (`internal/equipo/mergegate`)**: `TestDecideEachCriterion`,
+`TestDecideNever`, `TestDecideChecksPassedPath` (protocol included),
+`TestDecidePersonMerge`, `TestDecideStance`, `TestDecideNeverLooser`
+(20,000 random inputs against an independent oracle),
+`TestSensitivePaths`, `TestValidPolicy`, `TestTighter`.
+
+**Wire**: `TestWireProtocol3Downgrade` (a `ProtocolMergeFacts` frame is
+unchanged there and loses every merge authority field one protocol
+below and at protocol 1).
+
+**Runner**: `TestReviewReportsChangeFacts`, `TestRevertCheck`,
+`TestMergeConfirmPurpose`, `TestMergeSource`, `TestLeaseRefusalReasons`.
+
+**Store contracts (`internal/thintest`)**:
+`TestContractMergeAuthorityAct`, `TestContractMergeAuthorityAsks`,
+`TestContractMergeFenceOldRunner` (protocol 1 at dispatch, checks passed
+included; reconnect below the protocol refused at the lease and asked;
+Merge on the card retries the failed attempt), `TestContractConfirmRechecks`
+(a hold on a checked merge, ask mode on an unchecked one, between
+dispatch and request), `TestContractNoQueuedAutoMerge`,
+`TestContractShipsQuestion`, `TestContractWaitNeverMerges`,
+`TestContractUndoMerge` (revert task, ask mode, revert target and exact
+revert on review, teammate 404, second Undo 409, an unverified landing
+has no Undo), `TestContractMergePolicyTool` (tighter, looser card,
+bounds, member read only, the project page section),
+`TestContractFactsAcceptance`, `TestContractRosterDenial`. The slice 4c
+merge contracts and the page tests that end in Equipo's merge run on a
+`ProtocolMergeFacts` runner; at protocol 1 they now ask.
Gates kept green: `make budget`, gofmt, `go vet ./internal/...`,
`scripts/runner-dead-references.py`, `TestPlan3ReleaseBoundaries`, the
@@ -550,6 +540,16 @@ the project page section's sentences; the `hold_merge` and
- A deterministic revert step (v1's Undo is an ordinary task).
- Fixing the forge's tip fallback for every merge (a separate issue).
+## 13. Round 3 findings and the rulings
+
+1. Critical, a runner reconnecting below the protocol: Paul chose
+ "Refuse old runners" (invariant 5, §2.3 fence).
+2. Clearing `merge_asked`: the guard stays; nothing re-arms (§4.2).
+3. Merge after a confirmation refusal: the card's Merge retries the
+ failed, ended attempt (§2.3).
+4. The same-SHA checks retry: removed from v1 (§4.2), v2.
+5. `make ci` with `CGO_ENABLED=0` on hosted CI is the final gate (§10).
+
## 12. Round 2 findings and where they went
1. Wait as consent: Wait never consents (§4.2).
diff --git a/internal/equipo/chat/mergeauth.go b/internal/equipo/chat/mergeauth.go
index ea901dc0..43f2aa4f 100644
--- a/internal/equipo/chat/mergeauth.go
+++ b/internal/equipo/chat/mergeauth.go
@@ -412,7 +412,7 @@ func (t *txn) mergeQuestion(k taskRecord, p progress, d mergegate.Decision) (str
case c.OK && c.Name == mergegate.CritApproved:
phrase = t.words("chat.merge.why.approved")
case c.OK && c.Name == mergegate.CritSmall && facts != nil:
- phrase = t.words("chat.merge.why.small", facts.Lines, facts.Files)
+ phrase = t.sizeWords("chat.merge.why.small", facts)
case c.OK && c.Name == mergegate.CritShips:
phrase = t.words("chat.merge.why.not_shipping")
case c.OK && c.Name == mergegate.CritRevert:
@@ -431,7 +431,7 @@ func (t *txn) mergeQuestion(k taskRecord, p progress, d mergegate.Decision) (str
case c.Name == mergegate.CritFacts:
phrase = t.words("chat.merge.not.facts")
case c.Name == mergegate.CritSmall && facts != nil:
- phrase = t.words("chat.merge.not.small", facts.Lines, facts.Files)
+ phrase = t.sizeWords("chat.merge.not.small", facts)
case c.Name == mergegate.CritSensitive && facts != nil:
phrase = t.words("chat.merge.not.special")
if len(d.Sensitive) > 0 {
@@ -479,6 +479,15 @@ func (t *txn) mergeQuestion(k taskRecord, p progress, d mergegate.Decision) (str
return question, choices, nil
}
+// sizeWords is a size phrase: key with lines and files, or key_one for
+// a change to one file.
+func (t *txn) sizeWords(key string, f *wire.ChangeFacts) string {
+ if f.Files == 1 {
+ return t.words(key+"_one", f.Lines)
+ }
+ return t.words(key, f.Lines, f.Files)
+}
+
// needsMac reports whether the candidate's checks need macOS.
func (t *txn) needsMac(p progress) bool {
if p.checks == nil {
@@ -596,7 +605,7 @@ func (t *txn) mergeReceipt(k *taskRecord, project string, s *stepRecord, verifie
case c.Name == mergegate.CritApproved:
why = append(why, t.words("chat.merge.why.approved"))
case c.Name == mergegate.CritSmall && in.Change != nil:
- why = append(why, t.words("chat.merge.why.small", in.Change.Lines, in.Change.Files))
+ why = append(why, t.sizeWords("chat.merge.why.small", in.Change))
case c.Name == mergegate.CritShips:
why = append(why, t.words("chat.merge.why.not_shipping"))
}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index c75b8963..2ee6a9d9 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -1444,6 +1444,7 @@ var pageCopy = map[string]string{
"chat.merge.stance_wait": "Merge %s? I'd wait: %s.", // COPY REVIEW REQUIRED
"chat.merge.why.approved": "approved by Review", // COPY REVIEW REQUIRED
"chat.merge.why.small": "a small change, %d lines in %d files", // COPY REVIEW REQUIRED
+ "chat.merge.why.small_one": "a small change, %d lines in one file", // COPY REVIEW REQUIRED
"chat.merge.why.not_shipping": "nothing ships until a release", // COPY REVIEW REQUIRED
"chat.merge.why.exact_revert": "it exactly reverts %s", // COPY REVIEW REQUIRED
"chat.merge.not.environment": "checks couldn't run because %s", // COPY REVIEW REQUIRED
@@ -1451,6 +1452,7 @@ var pageCopy = map[string]string{
"chat.merge.not.protocol": "your runner needs an update before I merge on my own", // COPY REVIEW REQUIRED
"chat.merge.not.facts": "the runner didn't say what changed", // COPY REVIEW REQUIRED
"chat.merge.not.small": "it's bigger than I merge on my own (%d lines in %d files)", // COPY REVIEW REQUIRED
+ "chat.merge.not.small_one": "it's bigger than I merge on my own (%d lines in one file)", // COPY REVIEW REQUIRED
"chat.merge.not.special": "it changes a symlink, a submodule or a file mode", // COPY REVIEW REQUIRED
"chat.merge.not.sensitive": "it touches %s (%s)", // COPY REVIEW REQUIRED
"chat.merge.not.signing": "it changes signing or version settings", // COPY REVIEW REQUIRED
diff --git a/internal/headless/merge_test.go b/internal/headless/merge_test.go
index 0ea87596..dff480f2 100644
--- a/internal/headless/merge_test.go
+++ b/internal/headless/merge_test.go
@@ -93,7 +93,7 @@ func scenarioChecksCard(t *testing.T, env *Env) {
id := s.taskOf(t, sent.Turn.ID)
card := s.mergeCard(t, id)
k, _ := env.Client.Task(s.ctx, id)
- if k.Stage != wire.StageReadyToMerge || k.Checks != wire.ChecksCannotRun || k.NeedsYou != wire.NeedsMerge || card.Question != "Merge iOS edge swipe without checks?" || card.State != wire.CardOpen {
+ if k.Stage != wire.StageReadyToMerge || k.Checks != wire.ChecksCannotRun || k.NeedsYou != wire.NeedsMerge || card.Question != "Merge iOS edge swipe? I'd wait: I don't know yet whether Woodstar's main ships to users." || card.State != wire.CardOpen {
t.Fatalf("asking %+v card %+v", k, card)
}
tip := forgeHead(t, bare, "main")
@@ -117,13 +117,13 @@ func scenarioChecksCard(t *testing.T, env *Env) {
return m.Stage == wire.StageReadyToMerge && m.NeedsYou == wire.NeedsMerge && m.Verdict == wire.VerdictApprove
})
// The move made the card's old revision stale (Astra 4c round 1).
- if _, err := env.Client.Answer(s.ctx, card.ID, wire.ChoiceWait, card.Revision); thintest.Status(err) != 409 {
+ if _, err := env.Client.Answer(s.ctx, card.ID, wire.ChoiceWaitMac, card.Revision); thintest.Status(err) != 409 {
t.Fatalf("an answer from before the move: %v", err)
}
s.wait(t, "refreshed card", time.Minute, func(c *thintest.Conversation) bool { return c.Cards[card.ID].Revision > card.Revision })
s.conv.Locked(func(c *thintest.Conversation) { card = c.Cards[card.ID] })
// Wait: nothing merges.
- if out, err := env.Client.Answer(s.ctx, card.ID, wire.ChoiceWait, card.Revision); err != nil || out.Card.Choice != wire.ChoiceWait {
+ if out, err := env.Client.Answer(s.ctx, card.ID, wire.ChoiceWaitMac, card.Revision); err != nil || out.Card.Choice != wire.ChoiceWaitMac {
t.Fatalf("wait %+v %v", out, err)
}
time.Sleep(2 * time.Second)
@@ -157,7 +157,40 @@ func scenarioChecksCard(t *testing.T, env *Env) {
t.Fatalf("main ios/App.swift: %s", swift)
}
s.mergedLine(t, id2, "Merged [iPad edge swipe](/tasks/"+id2+") into Woodstar without checks.")
- Witness[t.Name()] = map[string]any{"wait_task": id, "merge_task": id2, "merged": k2.Merged, "card_to_done_s": time.Since(asked).Seconds()}
+
+ // Merge authority: the owner says Woodstar's main is not a release, and
+ // the next small iOS change, measured by the real runner's review,
+ // merges on its own with a receipt whose Undo the hub's answer allows.
+ var ships wire.Card
+ s.wait(t, "ships question", time.Minute, func(c *thintest.Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergeShips {
+ ships = k
+ return true
+ }
+ }
+ return false
+ })
+ if _, err := env.Client.Answer(s.ctx, ships.ID, wire.ChoiceNotShips, ships.Revision); err != nil {
+ t.Fatal(err)
+ }
+ sent = s.send(t, "tool:record_task:oficina/sample|Haptics on iOS|No haptic on a swipe back.|separate\ntool:start_task:$task|edit:ios/App.swift|edgeSwipe = true|edgeSwipe = true // haptic")
+ id3 := s.taskOf(t, sent.Turn.ID)
+ s.wait(t, "merged on its own", 2*time.Minute, func(c *thintest.Conversation) bool { return c.Tasks[id3].Stage == wire.StageDone })
+ k3, _ := env.Client.Task(s.ctx, id3)
+ if k3.Merged == nil || !k3.Merged.WithoutChecks || !k3.UndoOffered || k3.MergeDecision == nil || k3.MergeDecision.Class != "act" {
+ t.Fatalf("Equipo's own merge %+v %+v", k3.Merged, k3.MergeDecision)
+ }
+ mergedOnForge(t, bare, k3)
+ s.wait(t, "receipt", time.Minute, func(c *thintest.Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergeReceipt && k.TaskID == id3 && len(k.Options) == 1 && k.Options[0] == wire.ChoiceUndo {
+ return true
+ }
+ }
+ return false
+ })
+ Witness[t.Name()] = map[string]any{"wait_task": id, "merge_task": id2, "merged": k2.Merged, "card_to_done_s": time.Since(asked).Seconds(), "own_merge_task": id3}
}
// 4c: the default branch moves under an approved change and the merge
diff --git a/internal/plan3test/person_api_contract_test.go b/internal/plan3test/person_api_contract_test.go
index c0189265..3408405c 100644
--- a/internal/plan3test/person_api_contract_test.go
+++ b/internal/plan3test/person_api_contract_test.go
@@ -56,7 +56,7 @@ func personAPIContractCoverage(t *testing.T) {
f := newFixture(t)
registered := map[string]bool{}
// Thin v1 conversation routes are contracted by internal/wire fixtures.
- thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/recover": true, "POST /tasks/{id}/merge": true, "POST /tasks/{id}/duplicate": true, "POST /tasks/{id}/uncombine": true, "GET /thinking": true, "PUT /thinking": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true, "POST /connections": true, "POST /connections/{id}/cancel": true, "POST /connections/{id}/secret": true, "POST /connections/{id}/forget": true, "POST /connections/{id}/check": true, "GET /connections/preference": true, "PUT /connections/preference": true, "GET /housekeeping": true, "PUT /housekeeping": true, "PUT /housekeeping/detectors/{id}": true, "GET /housekeeping/actions": true, "POST /housekeeping/actions/{id}/undo": true, "POST /attachments": true, "GET /attachments/{id}": true, "GET /attachments/{id}/preview": true}
+ thin := map[string]bool{"GET /messages": true, "POST /messages": true, "GET /turns/{id}": true, "POST /turns/{id}/cancel": true, "GET /snapshot": true, "GET /events": true, "DELETE /projects/{id}": true, "POST /cards/{id}/answer": true, "GET /notebook": true, "POST /notebook/reset": true, "POST /tasks/{id}/retry": true, "POST /tasks/{id}/recover": true, "POST /tasks/{id}/merge": true, "POST /tasks/{id}/duplicate": true, "POST /tasks/{id}/uncombine": true, "POST /tasks/{id}/undo-merge": true, "GET /projects/{id}/merge-policy": true, "PUT /projects/{id}/merge-policy": true, "GET /thinking": true, "PUT /thinking": true, "POST /tasks/{id}/thread": true, "GET /steps/{id}/log": true, "POST /tasks/{id}/questions": true, "POST /questions/{id}/cancel": true, "POST /connections": true, "POST /connections/{id}/cancel": true, "POST /connections/{id}/secret": true, "POST /connections/{id}/forget": true, "POST /connections/{id}/check": true, "GET /connections/preference": true, "PUT /connections/preference": true, "GET /housekeeping": true, "PUT /housekeeping": true, "PUT /housekeeping/detectors/{id}": true, "GET /housekeeping/actions": true, "POST /housekeeping/actions/{id}/undo": true, "POST /attachments": true, "GET /attachments/{id}": true, "GET /attachments/{id}/preview": true}
must(t, chi.Walk(f.Store.PersonAPIHandler().(chi.Routes), func(method, path string, _ http.Handler, _ ...func(http.Handler) http.Handler) error {
if thin[method+" "+path] {
return nil
diff --git a/internal/runner/provider/claude/launcher.go b/internal/runner/provider/claude/launcher.go
index 27216a74..e54d08b2 100644
--- a/internal/runner/provider/claude/launcher.go
+++ b/internal/runner/provider/claude/launcher.go
@@ -132,7 +132,7 @@ func PolicyInputs(b provider.Binding, in provider.PolicyInputs, specialist, mode
}
tools := append(append([]string{}, native...), "mcp__equipo__permission")
for _, tool := range in.Tools {
- converse := in.Action == "converse" && slices.Contains([]string{"mcp__equipo__status", "mcp__equipo__find", "mcp__equipo__search_code", "mcp__equipo__read_file", "mcp__equipo__add_project", "mcp__equipo__create_project", "mcp__equipo__set_project_home", "mcp__equipo__write_note", "mcp__equipo__read_notes", "mcp__equipo__record_task", "mcp__equipo__add_finding", "mcp__equipo__start_task", "mcp__equipo__read_task", "mcp__equipo__cancel_task", "mcp__equipo__add_report"}, tool)
+ converse := in.Action == "converse" && slices.Contains([]string{"mcp__equipo__status", "mcp__equipo__find", "mcp__equipo__search_code", "mcp__equipo__read_file", "mcp__equipo__add_project", "mcp__equipo__create_project", "mcp__equipo__set_project_home", "mcp__equipo__write_note", "mcp__equipo__read_notes", "mcp__equipo__record_task", "mcp__equipo__add_finding", "mcp__equipo__start_task", "mcp__equipo__read_task", "mcp__equipo__cancel_task", "mcp__equipo__add_report", "mcp__equipo__hold_merge", "mcp__equipo__set_merge_policy"}, tool)
answer := in.Action == "answer" && slices.Contains([]string{"mcp__equipo__git_log", "mcp__equipo__git_diff", "mcp__equipo__git_show"}, tool)
if in.Action != "coordinate" && !converse && !answer && !slices.Contains([]string{"mcp__equipo__ask_person", "mcp__equipo__submit_candidate", "mcp__equipo__submit_review", "mcp__equipo__submit_reproduction", "mcp__equipo__submit_acceptance", "mcp__equipo__submit_answer", "mcp__equipo__submit_render"}, tool) {
return in, provider.ErrPolicy
diff --git a/internal/runner/thin/claude.go b/internal/runner/thin/claude.go
index cea873b8..a4ae2502 100644
--- a/internal/runner/thin/claude.go
+++ b/internal/runner/thin/claude.go
@@ -613,7 +613,7 @@ func opening(person string, catalog []wire.RepoInfo, tail []wire.TailMessage) st
b.WriteString("You are the Equipo coordinator for " + person + ". You talk with them about their software work. Answer briefly in plain words. Do not use em dashes.\n")
b.WriteString("Decide where work goes yourself and say so in one line; the person can undo it. Never ask them to choose a repository, never list repositories for them to pick, and never mention a Set up step. Call status first when you need to know what exists.\n")
b.WriteString("Every time you name the project for a piece of work, call add_project or create_project in that turn, even if you used it before: that call shows the person the project with Change. Existing work: add_project with the repository that clearly fits, then say \"Working in <name>\". If it is ambiguous, take the best fit and give one short reason. New work that fits no repository: create_project in the related namespace when that is obvious (Oficina things go in oficina), otherwise in home from status; if home is empty or you cannot create, use the best-fitting existing repository and give one short reason. Change home with set_project_home only when the person asks.\n")
- b.WriteString("When the person reports a bug or asks for a change, call record_task at once, before investigating, with the repository it belongs to, a short title and their words as the brief. Then investigate with search_code and read_file, attach what you found with add_finding (a one-sentence headline for the person, plain words and no file paths, and the full finding with its file and line), and call start_task with a brief for Engineering. Engineering changes the code on the task's own branch and pushes it to Amadan; the change is then checked and reviewed, and Equipo merges it on its own once both pass (if checks cannot run here, the person is asked with a card). Never offer to merge or open a pull request, and never ask the person to merge. Use ask_person only for a question only the person can answer.\n")
+ b.WriteString("When the person reports a bug or asks for a change, call record_task at once, before investigating, with the repository it belongs to, a short title and their words as the brief. Then investigate with search_code and read_file, attach what you found with add_finding (a one-sentence headline for the person, plain words and no file paths, and the full finding with its file and line), and call start_task with a brief for Engineering. Engineering changes the code on the task's own branch and pushes it to Amadan; the change is then checked and reviewed, and Equipo's merge rules decide whether it merges on its own or asks the person with a card that gives Equipo's call. You cannot make it merge: when you have a concrete reason a change needs the person's look, call hold_merge with that reason. When the person says how a project should merge (\"always ask me about Suite\", \"main is not a release for Woodstar\"), call set_merge_policy with their words; a stricter rule applies at once and a looser one waits for their tap. Never offer to merge or open a pull request, and never ask the person to merge. Use ask_person only for a question only the person can answer.\n")
b.WriteString("Never file the same problem twice. If record_task returns similar open tasks and one of them is what the person is reporting, call add_report on it with their words and tell them in one line it is already logged and where it stands, naming it as a markdown link; record a separate task only when it is clearly a different problem.\n")
b.WriteString("Speak at the outcome level: what you understood, what is happening, what you need from the person. For example: \"Got it, I've logged [Swipe back doesn't work](/tasks/tk...) and Engineering is on it.\" No file paths, line numbers or code mechanics in your replies; the diagnosis goes on the task with add_finding. Always name a task as a markdown link with its title and the link from record_task, start_task or read_task, never as \"the task card\".\n")
b.WriteString("When the person wants specifics about how something was changed, do not explain them yourself: point them to the task, where they can ask the specialist who did the work, for example \"You can ask Engineering on [Swipe back doesn't work](/tasks/tk...).\" (or Review, about the review). Never relay technical detail from read_task.\n")
diff --git a/internal/runner/thin/voice_test.go b/internal/runner/thin/voice_test.go
index 9ad6815d..a34c7e69 100644
--- a/internal/runner/thin/voice_test.go
+++ b/internal/runner/thin/voice_test.go
@@ -15,7 +15,9 @@ func TestOpeningOutcomeLevelVoice(t *testing.T) {
"the diagnosis goes on the task with add_finding",
"name a task as a markdown link with its title",
`never as "the task card"`,
- "Equipo merges it on its own once both pass",
+ "Equipo's merge rules decide whether it merges on its own",
+ "call hold_merge with that reason",
+ "call set_merge_policy with their words",
"never ask the person to merge",
} {
if !strings.Contains(o, want) {
diff --git a/internal/thintest/mergeauth_contract_test.go b/internal/thintest/mergeauth_contract_test.go
new file mode 100644
index 00000000..b806ba7f
--- /dev/null
+++ b/internal/thintest/mergeauth_contract_test.go
@@ -0,0 +1,671 @@
+package thintest
+
+import (
+ "context"
+ "net/http"
+ "slices"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Merge authority, thin v1 (spec 2026-11-11): the gate decides every
+// merge before dispatch and again at each hub request; an automatic
+// merge needs wire.ProtocolMergeFacts at both moments.
+
+func (c *Client) MergePolicy(ctx context.Context, project string) (out wire.MergePolicy, err error) {
+ return out, c.do(ctx, "GET", "/api/v1/projects/"+project+"/merge-policy", nil, &out)
+}
+
+func (c *Client) SetMergePolicy(ctx context.Context, project string, in wire.SetMergePolicy) (out wire.MergePolicy, err error) {
+ return out, c.do(ctx, "PUT", "/api/v1/projects/"+project+"/merge-policy", in, &out)
+}
+
+func (c *Client) UndoMerge(ctx context.Context, id string) (out wire.Task, err error) {
+ return out, c.do(ctx, "POST", "/api/v1/tasks/"+id+"/undo-merge", nil, &out)
+}
+
+// facts is a small, ordinary change as the runner measures it for review
+// step d.
+func facts(d *wire.DispatchCommand, paths ...string) *wire.ChangeFacts {
+ if len(paths) == 0 {
+ paths = []string{"ios/Woodstar/AccountNavigationHost.swift"}
+ }
+ f := &wire.ChangeFacts{ReviewStep: d.StepID, Attempt: d.Attempt, Repo: "amadan.net/oficina/sample", Base: d.BaseSHA, SHA: d.CandidateSHA, Files: len(paths), Lines: 12, Complete: true, Entries: []wire.ChangeEntry{}}
+ for _, p := range paths {
+ f.Entries = append(f.Entries, wire.ChangeEntry{Status: "M", New: p, OldMode: "100644", NewMode: "100644"})
+ }
+ return f
+}
+
+// measured is judgedTask whose review reports change facts (nil: none).
+func (r *toolRig) measured(key, title, base, cand, outcome, reason string, f func(*wire.DispatchCommand) *wire.ChangeFacts) (string, *wire.DispatchCommand) {
+ r.t.Helper()
+ id, _ := r.pushed(key, title, base, cand)
+ r.expect(wire.FrameWatchMerge)
+ c := r.dispatched(wire.SpecialistChecks, base, cand, 0)
+ code := exit(0)
+ if outcome != wire.ChecksPassed {
+ code = nil
+ }
+ r.checks(key+"-c", c, outcome, code, reason, "")
+ rv := r.dispatched(wire.SpecialistReview, base, cand, 0)
+ var change *wire.ChangeFacts
+ if f != nil {
+ change = f(rv)
+ }
+ r.step(key+"-r", wire.StepReport{TaskID: rv.TaskID, StepID: rv.StepID, Attempt: rv.Attempt, State: wire.StepDone, BaseSHA: rv.BaseSHA, CandidateSHA: rv.CandidateSHA, Termination: true, Family: "codex", Account: "codex-a", Verdict: wire.VerdictApprove, ReviewLabel: wire.ReviewOtherFamily, Findings: []wire.Finding{}, Summary: "Read the change.", Change: change})
+ return id, rv
+}
+
+// lease sends a lease check on runner and returns "" when acked, else
+// the refusal's reason.
+func (r *toolRig) lease(runner *FakeRunner, id string, check wire.LeaseCheck) string {
+ r.t.Helper()
+ check.Generation = runner.Welcome.Generation
+ if err := runner.Send(r.ctx, id, wire.FrameLease, check); err != nil {
+ r.t.Fatal(err)
+ }
+ for {
+ f, body, err := runner.Next(r.ctx)
+ if err != nil {
+ r.t.Fatal(err)
+ }
+ switch v := body.(type) {
+ case *wire.Ack:
+ if v.ID == id {
+ return ""
+ }
+ case *wire.Refused:
+ if v.ID == id {
+ return v.Reason
+ }
+ }
+ if runner == r.runner && f.Type != wire.FrameAck {
+ r.held = append(r.held, heldFrame{f, body, runner.Received[len(runner.Received)-1]})
+ }
+ }
+}
+
+// projectOf is the task's project id.
+func (r *toolRig) projectOf(id string) string {
+ r.t.Helper()
+ k, err := r.client.Task(r.ctx, id)
+ if err != nil {
+ r.t.Fatal(err)
+ }
+ return k.ProjectID
+}
+
+// shipsNo tells Equipo, as the owner on the project page, that the
+// project's main is not a release.
+func (r *toolRig) shipsNo(project string) {
+ r.t.Helper()
+ p, err := r.client.MergePolicy(r.ctx, project)
+ if err != nil {
+ r.t.Fatal(err)
+ }
+ if _, err := r.client.SetMergePolicy(r.ctx, project, wire.SetMergePolicy{Mode: p.Mode, MaxLines: p.MaxLines, MaxFiles: p.MaxFiles, MainShips: "no", ExtraSensitive: p.ExtraSensitive, Revision: p.Revision}); err != nil {
+ r.t.Fatal(err)
+ }
+}
+
+// project is the sample project's id, added once.
+func (r *toolRig) project() string {
+ r.t.Helper()
+ p, err := r.client.AddProject(r.ctx, "oficina/sample")
+ if err != nil {
+ r.t.Fatal(err)
+ }
+ return p.ID
+}
+
+func (r *toolRig) mergeCards(id string) []wire.Card {
+ var out []wire.Card
+ r.conv.Locked(func(c *Conversation) {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMerge && k.TaskID == id {
+ out = append(out, k)
+ }
+ }
+ })
+ return out
+}
+
+func (r *toolRig) cardKind(kind string) (wire.Card, bool) {
+ var out wire.Card
+ found := false
+ r.conv.Locked(func(c *Conversation) {
+ for _, k := range c.Cards {
+ if k.Kind == kind {
+ out, found = k, true
+ }
+ }
+ })
+ return out, found
+}
+
+// TestContractMergeAuthorityAct: a Woodstar-shaped change whose checks
+// need a Mac, small, ordinary, approved, on a project whose main is not a
+// release, merges on its own: the merge step is Equipo's, its request is
+// confirmed by the gate again, and the person gets a receipt with Undo
+// (the hub named the merge commit) instead of a line, with the decision
+// on the task.
+func TestContractMergeAuthorityAct(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ ctx := r.ctx
+ r.shipsNo(r.project())
+ base, cand, merge := strings.Repeat("1", 40), strings.Repeat("2", 40), strings.Repeat("e", 40)
+ id, _ := r.measured("a", "Swipe back from the edge", base, cand, wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ m := r.dispatched(wire.SpecialistMerge, base, cand, 0)
+ if len(r.mergeCards(id)) != 0 {
+ t.Fatal("asked although every rule held")
+ }
+ if refused := r.lease(r.runner, "a-lease", wire.LeaseCheck{StepID: m.StepID, Attempt: m.Attempt}); refused != "" {
+ t.Fatalf("start refused %q", refused)
+ }
+ if refused := r.lease(r.runner, "a-confirm", wire.LeaseCheck{StepID: m.StepID, Attempt: m.Attempt, Purpose: wire.LeasePurposeMerge}); refused != "" {
+ t.Fatalf("confirmation refused %q", refused)
+ }
+ r.step("a-m-run", wire.StepReport{TaskID: id, StepID: m.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: base, CandidateSHA: cand})
+ r.step("a-m", wire.StepReport{TaskID: id, StepID: m.StepID, Attempt: 1, State: wire.StepDone, BaseSHA: base, CandidateSHA: cand, Termination: true, Findings: []wire.Finding{}, MergeSHA: merge, Into: "main", Strategy: wire.MergeCommit, MergeSource: wire.MergeSourceHub, MergeParents: []string{strings.Repeat("9", 40), cand}})
+ r.wait("done", func(c *Conversation) bool { return c.Tasks[id].Stage == wire.StageDone })
+ k, _ := r.client.Task(ctx, id)
+ if k.Merged == nil || !k.Merged.WithoutChecks || !k.UndoOffered || k.MergeDecision == nil || k.MergeDecision.Class != "act" || k.MergeDecision.DecidedBy != "policy" {
+ t.Fatalf("merged %+v decision %+v undo %v", k.Merged, k.MergeDecision, k.UndoOffered)
+ }
+ var receipt wire.Card
+ r.wait("receipt", func(c *Conversation) bool {
+ for _, card := range c.Cards {
+ if card.Kind == wire.CardMergeReceipt && card.TaskID == id {
+ receipt = card
+ return true
+ }
+ }
+ return false
+ })
+ want := "Merged [Swipe back from the edge](/tasks/" + id + ") into Woodstar without checks: approved by Review, a small change, 12 lines in one file, nothing ships until a release."
+ if receipt.Question != want || !slices.Equal(receipt.Options, []string{"undo"}) {
+ t.Fatalf("receipt %+v", receipt)
+ }
+ for _, text := range r.replies() {
+ if strings.HasPrefix(text, "Merged ") {
+ t.Fatalf("a line as well as the receipt: %q", text)
+ }
+ }
+ if page := r.get(r.inst.Cookie(), "/conversation", 200); !strings.Contains(page, "data-merge-receipt") || !strings.Contains(page, `data-merge-choice="undo"`) {
+ t.Fatalf("receipt on the page: %s", page)
+ }
+}
+
+// TestContractMergeAuthorityAsks: each failing criterion gives the merge
+// card, worded as Equipo's call, and nothing is dispatched.
+func TestContractMergeAuthorityAsks(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ project := r.project()
+ r.shipsNo(project)
+ base := strings.Repeat("1", 40)
+ cases := []struct {
+ name, reason, want string
+ f func(*wire.DispatchCommand) *wire.ChangeFacts
+ options []string
+ }{
+ {"facts", "needs_macos", "I'd wait: the runner didn't say what changed.", nil, []string{"merge", "wait_mac"}},
+ {"payments", "needs_macos", "I'd wait: it touches payments (ios/Woodstar/Billing/Checkout.swift).", func(d *wire.DispatchCommand) *wire.ChangeFacts {
+ return facts(d, "ios/Woodstar/Billing/Checkout.swift")
+ }, []string{"merge", "wait_mac"}},
+ {"lockfile", "needs_macos", "I'd wait: it touches dependencies (ios/Woodstar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved).", func(d *wire.DispatchCommand) *wire.ChangeFacts {
+ return facts(d, "ios/Woodstar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved")
+ }, []string{"merge", "wait_mac"}},
+ {"big", "needs_macos", "I'd merge: approved by Review, nothing ships until a release, but it's bigger than I merge on my own (900 lines in one file).", func(d *wire.DispatchCommand) *wire.ChangeFacts {
+ f := facts(d)
+ f.Lines = 900
+ return f
+ }, []string{"merge", "wait_mac"}},
+ {"timeout", "checks_timeout", "I'd wait: checks couldn't run because they did not finish in time.", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) }, []string{"merge", "wait"}},
+ }
+ for i, c := range cases {
+ cand := strings.Repeat(string(rune('2'+i)), 40)
+ id, _ := r.measured("k"+itoa(i), "Case "+c.name, base, cand, wire.ChecksCannotRun, c.reason, c.f)
+ var card wire.Card
+ r.wait(c.name+" card", func(conv *Conversation) bool {
+ for _, k := range conv.Cards {
+ if k.Kind == wire.CardMerge && k.TaskID == id {
+ card = k
+ return true
+ }
+ }
+ return false
+ })
+ if card.Question != "Merge Case "+c.name+"? "+c.want || !slices.Equal(card.Options, c.options) {
+ t.Errorf("%s: %q %v", c.name, card.Question, card.Options)
+ }
+ if k, _ := r.client.Task(r.ctx, id); k.MergeDecision == nil || k.MergeDecision.Class != "ask" {
+ t.Errorf("%s decision %+v", c.name, k.MergeDecision)
+ }
+ }
+ if n := r.heldKinds(wire.FrameDispatch); n != 0 {
+ t.Fatalf("%d dispatches while asking", n)
+ }
+}
+
+// TestContractMergeFenceOldRunner: Paul's "Refuse old runners". At
+// protocol 1 an automatic merge is never dispatched (checks passed
+// included): the card asks, recommending the merge. A merge dispatched to
+// a ProtocolMergeFacts runner that reconnects below it is refused at its
+// lease, whatever it asks, settled with nothing sent, and asked about; the
+// person's Merge on that card tries the failed attempt again.
+func TestContractMergeFenceOldRunner(t *testing.T) {
+ old := newToolRig(t)
+ base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40)
+ id := old.judgedTask("o", "Fix the README typo", base, cand, wire.ChecksPassed, "")
+ cards := old.mergeCardsWait(id)
+ if cards.Question != "Merge Fix the README typo? I'd merge: approved by Review, but your runner needs an update before I merge on my own." || old.heldKinds(wire.FrameDispatch) != 0 {
+ t.Fatalf("protocol 1: %+v (%d dispatches)", cards, old.heldKinds(wire.FrameDispatch))
+ }
+
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ id = r.judgedTask("f", "Fix the README typo", base, cand, wire.ChecksPassed, "")
+ m := r.dispatched(wire.SpecialistMerge, base, cand, 0)
+ // The runner comes back at protocol 2 (an older build) before the
+ // request: its lease names the attempt but cannot carry the purpose.
+ two, err := DialRunnerHello(r.ctx, r.inst.URL, r.rig.runner, primaryAt(wire.Hello{Generation: r.runner.Welcome.Generation, Repos: []string{}, Connections: []wire.HeldConnection{}, Versions: map[string]string{"runner": "test"}}, wire.Protocol2))
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(two.Close)
+ if refused := r.lease(two, "f-lease", wire.LeaseCheck{StepID: m.StepID, Attempt: m.Attempt}); refused != wire.RefusedMergeNotAuthorized {
+ t.Fatalf("an old runner's lease for an automatic merge: %q", refused)
+ }
+ r.wait("ready again, asking", func(c *Conversation) bool { return c.Tasks[id].Stage == wire.StageReadyToMerge })
+ card := r.mergeCardsWait(id)
+ if !strings.Contains(card.Question, "your runner needs an update before I merge on my own") {
+ t.Fatalf("fenced card %+v", card)
+ }
+ k, _ := r.client.Task(r.ctx, id)
+ if last := k.Steps[len(k.Steps)-1]; last.Specialist != wire.SpecialistMerge || last.State != wire.StepFailed || last.Reason != "merge_not_authorized" {
+ t.Fatalf("settled %+v", last)
+ }
+ // The person's Merge tries the failed attempt again, as theirs.
+ r.runner = two
+ if _, err := r.client.Answer(r.ctx, card.ID, wire.ChoiceMerge, card.Revision); err != nil {
+ t.Fatal(err)
+ }
+ _, body := r.expect(wire.FrameDispatch)
+ again := body.(*wire.DispatchCommand)
+ if again.StepID != m.StepID || again.Attempt != 2 || again.Specialist != wire.SpecialistMerge {
+ t.Fatalf("retried %+v", again)
+ }
+ if refused := r.lease(two, "f-lease-2", wire.LeaseCheck{StepID: again.StepID, Attempt: again.Attempt}); refused != "" {
+ t.Fatalf("the person's merge refused on an old runner: %q", refused)
+ }
+}
+
+// mergeCardsWait waits for the task's merge card.
+func (r *toolRig) mergeCardsWait(id string) wire.Card {
+ r.t.Helper()
+ 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 {
+ card = k
+ return true
+ }
+ }
+ return false
+ })
+ return card
+}
+
+// TestContractConfirmRechecks: right before the hub request the gate
+// decides again, checked merges included: a hold, or the project moving
+// to ask, refuses the request; nothing is sent and the person is asked.
+func TestContractConfirmRechecks(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ project := r.project()
+ r.shipsNo(project)
+ base := strings.Repeat("1", 40)
+ // Checks passed, held by the coordinator before the request.
+ cand := strings.Repeat("2", 40)
+ id := r.judgedTask("h", "Fix the README typo", base, cand, wire.ChecksPassed, "")
+ m := r.dispatched(wire.SpecialistMerge, base, cand, 0)
+ if res := r.call("h-hold", wire.ToolHoldMerge, map[string]string{"task": id, "reason": "the person wants to read this one first"}); res.IsError {
+ t.Fatalf("hold %+v", res)
+ }
+ if refused := r.lease(r.runner, "h-confirm", wire.LeaseCheck{StepID: m.StepID, Attempt: m.Attempt, Purpose: wire.LeasePurposeMerge}); refused != wire.RefusedMergeNotAuthorized {
+ t.Fatalf("a held merge's request: %q", refused)
+ }
+ if card := r.mergeCardsWait(id); !strings.Contains(card.Question, "I'd wait: the person wants to read this one first") {
+ t.Fatalf("held card %+v", card)
+ }
+ // Without checks: the project moves to ask between dispatch and the
+ // request.
+ cand = strings.Repeat("3", 40)
+ id = func() string {
+ id, _ := r.measured("p", "Swipe back", base, cand, wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ return id
+ }()
+ m = r.dispatched(wire.SpecialistMerge, base, cand, 0)
+ p, _ := r.client.MergePolicy(r.ctx, project)
+ if _, err := r.client.SetMergePolicy(r.ctx, project, wire.SetMergePolicy{Mode: "ask", MaxLines: p.MaxLines, MaxFiles: p.MaxFiles, MainShips: p.MainShips, ExtraSensitive: p.ExtraSensitive, Revision: p.Revision}); err != nil {
+ t.Fatal(err)
+ }
+ if refused := r.lease(r.runner, "p-confirm", wire.LeaseCheck{StepID: m.StepID, Attempt: m.Attempt, Purpose: wire.LeasePurposeMerge}); refused != wire.RefusedMergeNotAuthorized {
+ t.Fatalf("a request after the project asks: %q", refused)
+ }
+ if card := r.mergeCardsWait(id); !strings.Contains(card.Question, "this project asks before every merge") {
+ t.Fatalf("ask-mode card %+v", card)
+ }
+}
+
+// TestContractNoQueuedAutoMerge: with the primary offline nothing is
+// decided or queued; the next sync is the next trigger.
+func TestContractNoQueuedAutoMerge(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40)
+ id, _ := r.pushed("q", "Fix the README typo", base, cand)
+ r.expect(wire.FrameWatchMerge)
+ c := r.dispatched(wire.SpecialistChecks, base, cand, 0)
+ r.checks("q-c", c, wire.ChecksPassed, exit(0), "", "")
+ rv := r.dispatched(wire.SpecialistReview, base, cand, 0)
+ if _, err := r.inst.DB.Writer().Exec("UPDATE runner_sessions SET connected = 0"); err != nil {
+ t.Fatal(err)
+ }
+ r.verdict("q-r", rv, wire.VerdictApprove)
+ if k, _ := r.client.Task(r.ctx, id); k.Stage != wire.StageReadyToMerge || k.MergeDecision != nil || r.heldKinds(wire.FrameDispatch) != 0 || len(r.mergeCards(id)) != 0 {
+ t.Fatalf("decided while offline: %+v", k)
+ }
+ if _, err := r.inst.DB.Writer().Exec("UPDATE runner_sessions SET connected = 1"); err != nil {
+ t.Fatal(err)
+ }
+ r.syncNow("q-sync")
+ r.dispatched(wire.SpecialistMerge, base, cand, 0)
+}
+
+// TestContractShipsQuestion: unknown shipping asks, with the one ships
+// question per project; the answer is policy for later decisions only:
+// the open card is not re-decided, the next task merges on its own.
+func TestContractShipsQuestion(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ base := strings.Repeat("1", 40)
+ id, _ := r.measured("s", "Swipe back", base, strings.Repeat("2", 40), wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ card := r.mergeCardsWait(id)
+ if !strings.Contains(card.Question, "I don't know yet whether Woodstar's main ships to users") {
+ t.Fatalf("card %+v", card)
+ }
+ var ships wire.Card
+ r.wait("ships question", func(c *Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergeShips {
+ ships = k
+ return true
+ }
+ }
+ return false
+ })
+ if ships.Question != "Does merging to Woodstar's main ship to users?" || !slices.Equal(ships.Options, []string{"ships", "not_ships"}) {
+ t.Fatalf("ships %+v", ships)
+ }
+ // A second task asking on the same unknown: no second question.
+ other, _ := r.measured("s1", "Edge swipe on iPad", base, strings.Repeat("5", 40), wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ r.mergeCardsWait(other)
+ // Only the owner it asked answers it; a stale revision is a conflict.
+ if _, err := r.client.Answer(r.ctx, ships.ID, wire.ChoiceNotShips, ships.Revision+1); Status(err) != http.StatusConflict {
+ t.Fatalf("stale: %v", err)
+ }
+ if _, err := r.client.Answer(r.ctx, ships.ID, wire.ChoiceNotShips, ships.Revision); err != nil {
+ t.Fatal(err)
+ }
+ if p, _ := r.client.MergePolicy(r.ctx, r.projectOf(id)); p.MainShips != "no" {
+ t.Fatalf("policy %+v", p)
+ }
+ // The open card stays the person's; a sync decides nothing.
+ r.syncNow("s-sync")
+ if n := r.heldKinds(wire.FrameDispatch); n != 0 {
+ t.Fatalf("re-decided an open card: %d dispatches", n)
+ }
+ // A second task: one question only, and it merges on its own.
+ r.measured("s2", "Haptics", base, strings.Repeat("3", 40), wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ r.dispatched(wire.SpecialistMerge, base, strings.Repeat("3", 40), 0)
+ n := 0
+ r.conv.Locked(func(c *Conversation) {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergeShips {
+ n++
+ }
+ }
+ })
+ if n != 1 {
+ t.Fatalf("%d ships questions", n)
+ }
+}
+
+// TestContractWaitNeverMerges: Wait for a Mac only waits; Merge stays
+// offered, and nothing merges on its own afterwards.
+func TestContractWaitNeverMerges(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40)
+ id, _ := r.measured("w", "Swipe back", base, cand, wire.ChecksCannotRun, "needs_macos", nil)
+ card := r.mergeCardsWait(id)
+ if _, err := r.client.Answer(r.ctx, card.ID, wire.ChoiceWaitMac, card.Revision); err != nil {
+ t.Fatal(err)
+ }
+ r.shipsNo(r.projectOf(id))
+ r.syncNow("w-sync")
+ if k, _ := r.client.Task(r.ctx, id); k.Stage != wire.StageReadyToMerge || !k.MergeOffered || r.heldKinds(wire.FrameDispatch) != 0 {
+ t.Fatalf("after Wait %+v", k)
+ }
+ if len(r.mergeCards(id)) != 1 {
+ t.Fatal("asked again on a sync")
+ }
+}
+
+// TestContractUndoMerge: Undo of Equipo's own merge opens an ordinary
+// revert task (Engineering first, through the normal flow), puts the
+// project in ask mode, and is refused a second time, for a teammate, and
+// for a merge whose commit the hub did not name.
+func TestContractUndoMerge(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ project := r.project()
+ r.shipsNo(project)
+ base, cand, merge := strings.Repeat("1", 40), strings.Repeat("2", 40), strings.Repeat("e", 40)
+ id, _ := r.measured("u", "Swipe back", base, cand, wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ m := r.dispatched(wire.SpecialistMerge, base, cand, 0)
+ r.step("u-m", wire.StepReport{TaskID: id, StepID: m.StepID, Attempt: 1, State: wire.StepDone, BaseSHA: base, CandidateSHA: cand, Termination: true, Findings: []wire.Finding{}, MergeSHA: merge, Into: "main", Strategy: wire.MergeCommit, MergeSource: wire.MergeSourceHub, MergeParents: []string{strings.Repeat("9", 40), cand}})
+ receipt, _ := func() (wire.Card, bool) {
+ var out wire.Card
+ r.wait("receipt", func(c *Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergeReceipt && k.TaskID == id {
+ out = k
+ return true
+ }
+ }
+ return false
+ })
+ return out, true
+ }()
+ mate := personToolRig(t, r, "mate@example.com", equipo.RoleOwner)
+ if _, err := mate.client.UndoMerge(r.ctx, id); Status(err) != http.StatusNotFound {
+ t.Fatalf("teammate undo: %v", err)
+ }
+ out, err := r.client.Answer(r.ctx, receipt.ID, wire.ChoiceUndo, receipt.Revision)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.HasPrefix(out.Card.Question, "Reverting it: [Revert eeeeeee in Woodstar](/tasks/") {
+ t.Fatalf("receipt after undo %+v", out.Card)
+ }
+ _, body := r.expect(wire.FrameDispatch)
+ eng := body.(*wire.DispatchCommand)
+ if eng.Specialist != wire.SpecialistEngineering || !strings.Contains(eng.Brief, "git revert -m 1 "+merge) {
+ t.Fatalf("revert dispatch %+v", eng)
+ }
+ if p, _ := r.client.MergePolicy(r.ctx, project); p.Mode != "ask" || !strings.Contains(p.ModeReason, "eeeeeee") {
+ t.Fatalf("policy after undo %+v", p)
+ }
+ if _, err := r.client.UndoMerge(r.ctx, id); Status(err) != http.StatusConflict {
+ t.Fatalf("undo twice: %v", err)
+ }
+ // The revert's review measures whether it reverts exactly that commit.
+ rev := eng.TaskID
+ revCand := strings.Repeat("4", 40)
+ r.step("rv-run", wire.StepReport{TaskID: rev, StepID: eng.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: merge, Family: "claude", Account: "claude-a"})
+ r.step("rv-done", wire.StepReport{TaskID: rev, StepID: eng.StepID, Attempt: 1, State: wire.StepDone, BaseSHA: merge, CandidateSHA: revCand, Pushed: true, Termination: true, Family: "claude", Account: "claude-a"})
+ r.expect(wire.FrameWatchMerge)
+ c := r.dispatched(wire.SpecialistChecks, merge, revCand, 0)
+ r.checks("rv-c", c, wire.ChecksCannotRun, nil, "needs_macos", "")
+ rv := r.dispatched(wire.SpecialistReview, merge, revCand, 0)
+ if rv.RevertSHA != merge {
+ t.Fatalf("review of a revert without its target %+v", rv)
+ }
+ f := facts(rv)
+ f.Revert = &wire.RevertCheck{SHA: merge, OnTop: true, Exact: true}
+ r.step("rv-r", wire.StepReport{TaskID: rev, StepID: rv.StepID, Attempt: 1, State: wire.StepDone, BaseSHA: merge, CandidateSHA: revCand, Termination: true, Verdict: wire.VerdictApprove, ReviewLabel: wire.ReviewOtherFamily, Findings: []wire.Finding{}, Change: f})
+ card := r.mergeCardsWait(rev)
+ if !strings.Contains(card.Question, "I'd merge: approved by Review, a small change, 12 lines in one file, nothing ships until a release, but this project asks before every merge.") {
+ t.Fatalf("revert card %+v", card)
+ }
+
+ // A merge the forge settled from the default branch: no Undo.
+ r2 := newToolRigAt(t, wire.ProtocolMergeFacts)
+ r2.shipsNo(r2.project())
+ id2, _ := r2.measured("n", "Swipe back", base, cand, wire.ChecksCannotRun, "needs_macos", func(d *wire.DispatchCommand) *wire.ChangeFacts { return facts(d) })
+ m2 := r2.dispatched(wire.SpecialistMerge, base, cand, 0)
+ r2.step("n-m", wire.StepReport{TaskID: id2, StepID: m2.StepID, Attempt: 1, State: wire.StepDone, BaseSHA: base, CandidateSHA: cand, Termination: true, Findings: []wire.Finding{}, MergeSHA: merge, Into: "main", Strategy: wire.MergeCommit, MergeSource: wire.MergeSourceReconciled})
+ r2.wait("done", func(c *Conversation) bool { return c.Tasks[id2].Stage == wire.StageDone })
+ var unverified wire.Card
+ r2.wait("receipt", func(c *Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergeReceipt && k.TaskID == id2 {
+ unverified = k
+ return true
+ }
+ }
+ return false
+ })
+ if len(unverified.Options) != 0 || !strings.Contains(unverified.Question, "so I can't undo it") {
+ t.Fatalf("unverified receipt %+v", unverified)
+ }
+ if _, err := r2.client.UndoMerge(r2.ctx, id2); Status(err) != http.StatusConflict {
+ t.Fatalf("undo of an unverified merge: %v", err)
+ }
+}
+
+// TestContractMergePolicyTool: the coordinator's set_merge_policy applies
+// a stricter policy at once; a looser one only makes a card the person
+// saves; hold_merge only stops.
+func TestContractMergePolicyTool(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ project := r.project()
+ if res := r.call("p-tight", wire.ToolSetMergePolicy, map[string]any{"project": "oficina/sample", "words": "always ask me about Woodstar", "mode": "ask"}); res.IsError || res.Code != "policy_set" {
+ t.Fatalf("tighter %+v", res)
+ }
+ p, _ := r.client.MergePolicy(r.ctx, project)
+ if p.Mode != "ask" || p.Words != "always ask me about Woodstar" {
+ t.Fatalf("after tighter %+v", p)
+ }
+ if res := r.call("p-loose", wire.ToolSetMergePolicy, map[string]any{"project": "oficina/sample", "words": "for Woodstar, merge when Review approves", "mode": "rules", "main_ships": "no"}); res.IsError || res.Code != "policy_proposed" {
+ t.Fatalf("looser %+v", res)
+ }
+ if again, _ := r.client.MergePolicy(r.ctx, project); again.Mode != "ask" || again.MainShips != "unknown" || again.Revision != p.Revision {
+ t.Fatalf("a looser policy applied without a tap %+v", again)
+ }
+ var confirm wire.Card
+ r.wait("confirm card", func(c *Conversation) bool {
+ for _, k := range c.Cards {
+ if k.Kind == wire.CardMergePolicy {
+ confirm = k
+ return true
+ }
+ }
+ return false
+ })
+ if _, err := r.client.Answer(r.ctx, confirm.ID, wire.ChoiceSave, confirm.Revision); err != nil {
+ t.Fatal(err)
+ }
+ if after, _ := r.client.MergePolicy(r.ctx, project); after.Mode != "rules" || after.MainShips != "no" || after.Words != "for Woodstar, merge when Review approves" {
+ t.Fatalf("saved %+v", after)
+ }
+ if res := r.call("p-bad", wire.ToolSetMergePolicy, map[string]any{"project": "oficina/sample", "words": "anything", "max_lines": 5000}); !res.IsError {
+ t.Fatalf("out of bounds %+v", res)
+ }
+ // A member who is not an owner reads the policy and cannot change it.
+ member := personToolRig(t, r, "member@example.com", equipo.RoleMember)
+ mp, err := member.client.MergePolicy(r.ctx, project)
+ if err != nil || mp.Editable {
+ t.Fatalf("member reads %+v %v", mp, err)
+ }
+ if _, err := member.client.SetMergePolicy(r.ctx, project, wire.SetMergePolicy{Mode: "rules", MaxLines: 2000, MaxFiles: 100, MainShips: "no", Revision: mp.Revision}); Status(err) != http.StatusForbidden {
+ t.Fatalf("member set: %v", err)
+ }
+ // The project page shows it, editable for the owner only.
+ page := r.get(r.inst.Cookie(), "/projects/"+project, 200)
+ if !strings.Contains(page, "How Equipo merges") || !strings.Contains(page, "data-merge-policy-form") || !strings.Contains(page, "In your words: for Woodstar, merge when Review approves") {
+ t.Fatalf("project page: %s", page)
+ }
+ if mpage := r.get(r.inst.SessionFor(t, "member@example.com"), "/projects/"+project, 200); !strings.Contains(mpage, "How Equipo merges") || strings.Contains(mpage, "data-merge-policy-form") {
+ t.Fatal("member's project page")
+ }
+}
+
+// TestContractFactsAcceptance: facts are kept only when exactly the
+// review attempt's, whole: otherwise the gate asks on facts_present.
+func TestContractFactsAcceptance(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ r.shipsNo(r.project())
+ base := strings.Repeat("1", 40)
+ for i, bad := range []func(*wire.DispatchCommand) *wire.ChangeFacts{
+ func(d *wire.DispatchCommand) *wire.ChangeFacts { f := facts(d); f.Attempt = 2; return f },
+ func(d *wire.DispatchCommand) *wire.ChangeFacts { f := facts(d); f.ReviewStep = "s_other"; return f },
+ func(d *wire.DispatchCommand) *wire.ChangeFacts {
+ f := facts(d)
+ f.SHA = strings.Repeat("a", 40)
+ return f
+ },
+ func(d *wire.DispatchCommand) *wire.ChangeFacts { f := facts(d); f.Complete = false; return f },
+ func(d *wire.DispatchCommand) *wire.ChangeFacts { f := facts(d); f.Files = 3; return f },
+ func(d *wire.DispatchCommand) *wire.ChangeFacts {
+ f := facts(d)
+ f.Entries[0].New = "../escape"
+ return f
+ },
+ func(d *wire.DispatchCommand) *wire.ChangeFacts {
+ f := facts(d)
+ f.Repo = "amadan.net/oficina/other"
+ return f
+ },
+ } {
+ id, _ := r.measured("x"+itoa(i), "Case "+itoa(i), base, strings.Repeat(string(rune('2'+i)), 40), wire.ChecksCannotRun, "needs_macos", bad)
+ if card := r.mergeCardsWait(id); !strings.Contains(card.Question, "the runner didn't say what changed") {
+ t.Errorf("case %d kept: %q", i, card.Question)
+ }
+ }
+ if n := r.heldKinds(wire.FrameDispatch); n != 0 {
+ t.Fatalf("%d merges on refused facts", n)
+ }
+}
+
+// TestContractRosterDenial: a creator demoted from owner can no longer
+// have Equipo merge their task, from the card or the task page.
+func TestContractRosterDenial(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ base, cand := strings.Repeat("1", 40), strings.Repeat("2", 40)
+ id, _ := r.measured("d", "Swipe back", base, cand, wire.ChecksCannotRun, "needs_macos", nil)
+ card := r.mergeCardsWait(id)
+ personToolRig(t, r, "second@example.com", equipo.RoleOwner)
+ if _, err := r.inst.DB.Writer().Exec("UPDATE members SET role = 'member' WHERE address = ?", Owner); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := r.client.Answer(r.ctx, card.ID, wire.ChoiceMerge, card.Revision); Status(err) != http.StatusForbidden {
+ t.Fatalf("a demoted creator's Merge: %v", err)
+ }
+ if err := r.client.do(r.ctx, "POST", "/api/v1/tasks/"+id+"/merge", nil, nil); Status(err) != http.StatusForbidden {
+ t.Fatalf("a demoted creator's task-page Merge: %v", err)
+ }
+ if n := r.heldKinds(wire.FrameDispatch); n != 0 {
+ t.Fatal("dispatched for a demoted creator")
+ }
+}
diff --git a/internal/wire/wiretest/testdata/api/needs-you.json b/internal/wire/wiretest/testdata/api/needs-you.json
index c59872a4..6b3c1adc 100644
--- a/internal/wire/wiretest/testdata/api/needs-you.json
+++ b/internal/wire/wiretest/testdata/api/needs-you.json
@@ -1 +1 @@
-{"items":[{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","headline":"Found it: the edge swipe never reaches the back handler.","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","headline":"Fixed swipe-back from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","headline":"Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","headline":"One note: worth a test for swipes that start mid-screen.","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"ask_open":false,"merge_offered":false,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null,"folded":null,"combined":null,"engineering_runner":"RUNNER1","merge_decision":{"class":"ask","stance":"wait","reasons":[{"name":"approved_exact_sha","ok":true},{"name":"facts_present","ok":false}],"at":"2026-11-11T10:00:00Z"}}]}
+{"items":[{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","headline":"Found it: the edge swipe never reaches the back handler.","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","headline":"Fixed swipe-back from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","headline":"Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","headline":"One note: worth a test for swipes that start mid-screen.","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"ask_open":false,"merge_offered":false,"merge_decision":{"class":"ask","stance":"wait","reasons":[{"name":"approved_exact_sha","ok":true},{"name":"facts_present","ok":false}],"at":"2026-11-11T10:00:00Z"},"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null,"folded":null,"combined":null,"engineering_runner":"RUNNER1"}]}
diff --git a/internal/wire/wiretest/testdata/api/task-merged.json b/internal/wire/wiretest/testdata/api/task-merged.json
index 90b1c9aa..cb7c51f2 100644
--- a/internal/wire/wiretest/testdata/api/task-merged.json
+++ b/internal/wire/wiretest/testdata/api/task-merged.json
@@ -1 +1 @@
-{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"done","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","headline":"Found it: the edge swipe never reaches the back handler.","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","headline":"Fixed swipe-back from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","headline":"Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","headline":"One note: worth a test for swipes that start mid-screen.","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0009","revision":2,"task_id":"tk0001","index":4,"specialist":"merge","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":{"sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"at":"2026-11-07T12:00:00Z"},"reports":0,"ask_open":false,"merge_offered":false,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null,"folded":null,"combined":null,"engineering_runner":"RUNNER1","merge_decision":{"class":"act","decided_by":"policy","reasons":[{"name":"approved_exact_sha","ok":true}],"at":"2026-11-11T10:00:00Z"}}
+{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"done","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","headline":"Found it: the edge swipe never reaches the back handler.","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","headline":"Fixed swipe-back from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","headline":"Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","headline":"One note: worth a test for swipes that start mid-screen.","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0009","revision":2,"task_id":"tk0001","index":4,"specialist":"merge","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":{"sha":"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","into":"main","strategy":"merge","without_checks":false,"at":"2026-11-07T12:00:00Z"},"reports":0,"ask_open":false,"merge_offered":false,"merge_decision":{"class":"act","decided_by":"policy","reasons":[{"name":"approved_exact_sha","ok":true}],"at":"2026-11-11T10:00:00Z"},"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null,"folded":null,"combined":null,"engineering_runner":"RUNNER1"}
diff --git a/internal/wire/wiretest/testdata/api/task-ready.json b/internal/wire/wiretest/testdata/api/task-ready.json
index 18d89323..f4e6f2ec 100644
--- a/internal/wire/wiretest/testdata/api/task-ready.json
+++ b/internal/wire/wiretest/testdata/api/task-ready.json
@@ -1 +1 @@
-{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","headline":"Found it: the edge swipe never reaches the back handler.","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","headline":"Fixed swipe-back from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","headline":"Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","headline":"One note: worth a test for swipes that start mid-screen.","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"ask_open":false,"merge_offered":false,"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null,"folded":null,"combined":null,"engineering_runner":"RUNNER1","merge_decision":{"class":"act","decided_by":"policy","reasons":[{"name":"approved_exact_sha","ok":true}],"at":"2026-11-11T10:00:00Z"}}
+{"id":"tk0001","revision":9,"project_id":"p_0001","project":"Sample","repo":"amadan.net/oficina/sample","title":"Swipe back from the edge does nothing","brief":"Swiping from the left edge should go back a pane.","stage":"ready_to_merge","branch":"equipo/tk0001-swipe-back-from-the-edge-does-nothing","base_sha":"1111111111111111111111111111111111111111","url":"https://amadan.net/oficina/sample?branch=equipo/tk0001-swipe-back-from-the-edge-does-nothing","creator":"owner@example.com","turn_id":"t_0001","findings":[{"id":"f_0001","headline":"Found it: the edge swipe never reaches the back handler.","text":"The edge-swipe handler returns false, so back never fires.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:00:02Z"}],"steps":[{"id":"s_0001","revision":3,"task_id":"tk0001","index":1,"specialist":"engineering","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":true,"terminated":true,"summary":"EdgeSwipe now goes back on a swipe from the edge.","headline":"Fixed swipe-back from the edge.","log_tail":"Edit panes/swipe.go\nDone.","started_at":"2026-11-07T10:00:03Z","finished_at":"2026-11-07T10:01:40Z","round":0,"family":"claude","account":"claude-a","verdict":"","review_label":"","findings":[],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[{"kind":"read","subject":"panes/swipe.go","at":"2026-11-07T10:00:20Z"},{"kind":"edit","subject":"panes/swipe.go","at":"2026-11-07T10:01:02Z"},{"kind":"run","subject":"go test ./panes","at":"2026-11-07T10:01:20Z"}],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0002","revision":2,"task_id":"tk0001","index":2,"specialist":"checks","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"","headline":"","log_tail":"ok \tamadan.net/oficina/sample/panes\t0.012s","started_at":"2026-11-07T10:01:45Z","finished_at":"2026-11-07T10:02:30Z","round":0,"family":"","account":"","verdict":"","review_label":"","findings":[],"checks":"passed","gate":"make ci","exit_code":0,"askable":false,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"},{"id":"s_0003","revision":2,"task_id":"tk0001","index":3,"specialist":"review","state":"done","reason":"","attempt":1,"base_sha":"1111111111111111111111111111111111111111","candidate_sha":"2222222222222222222222222222222222222222","pushed":false,"terminated":true,"summary":"The change makes EdgeSwipe go back and keeps the pane order. Approved.","headline":"Approved.","log_tail":"Read panes/swipe.go","started_at":"2026-11-07T10:02:31Z","finished_at":"2026-11-07T10:04:10Z","round":0,"family":"claude","account":"claude-a","verdict":"approve","review_label":"same_family","findings":[{"id":"rf_0001","headline":"One note: worth a test for swipes that start mid-screen.","text":"Consider a test for a swipe that starts mid-screen.","repo":"amadan.net/oficina/sample","path":"panes/swipe.go","line":4,"at":"2026-11-07T10:04:10Z"}],"checks":"","gate":"","exit_code":null,"askable":true,"rebase":false,"merge_sha":"","into":"","strategy":"","without_checks":false,"switched":null,"activity":[],"runner_id":"RUNNER1","runner_label":"","needs":[],"placement":"","publication":"","termination_kind":"namespace"}],"thread":[{"id":"e_0001","author":"owner@example.com","text":"It happens on the iPhone only.","at":"2026-11-07T10:00:30Z"}],"created_at":"2026-11-07T10:00:01Z","updated_at":"2026-11-07T10:04:10Z","candidate_sha":"2222222222222222222222222222222222222222","checks":"passed","checks_reason":"","verdict":"approve","review_label":"same_family","needs_you":"merge","fix_rounds":0,"branch_head":"","questions":[{"id":"q_0001","revision":3,"task_id":"tk0001","step_id":"s_0001","specialist":"engineering","asker":"owner@example.com","text":"What did you change and why?","state":"answered","reason":"","attempt":1,"answer":"I made the edge swipe return true, so a swipe from the left edge goes back a pane. Before, the handler always said no.","created_at":"2026-11-07T10:05:00Z","updated_at":"2026-11-07T10:05:09Z","timing":null}],"merged":null,"reports":0,"ask_open":false,"merge_offered":false,"merge_decision":{"class":"act","decided_by":"policy","reasons":[{"name":"approved_exact_sha","ok":true}],"at":"2026-11-11T10:00:00Z"},"creator_name":"Owner","source_message_id":"m_0001","source_at":"2026-11-07T09:59:58Z","duplicate_of":null,"coordinator":null,"folded":null,"combined":null,"engineering_runner":"RUNNER1"}
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index 6ffd5b80..e71e1c11 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -10967,5 +10967,19 @@
"match": "equipo-runner",
"count": 1,
"reason": "Progress log: names the retained runner executable and its release directory."
+ },
+ {
+ "path": "internal/equipo/mergegate/sensitive.go",
+ "line_sha256": "ff60d0525941c61e970a2946a2615490c158644cc84229e8faa09e0cf2965538",
+ "match": "npm",
+ "count": 2,
+ "reason": "Lockfile names (pnpm-lock.yaml, npm-shrinkwrap.json) in merge authority's sensitive-path table, not the retired Node runner."
+ },
+ {
+ "path": "docs/superpowers/specs/2026-11-11-equipo-merge-authority.md",
+ "line_sha256": "0762095924b2a754599979fc34df8a32fc3f15c6c161fe4aeed787a62daaf0d4",
+ "match": "npm",
+ "count": 2,
+ "reason": "Lockfile names (pnpm-lock.yaml, npm-shrinkwrap.json) in merge authority's sensitive-path table, not the retired Node runner."
}
]