oficina / equipo Public

Turn batching: a failed batch says these messages

The controller ruled on the three open questions: no hold between
turns, keep the one queued note, and a plural failure note.

- chat.failed_many: "The coordinator could not answer these messages."
  when a failed turn covered more than one message, on the page
  (chat_page.go) and from the event stream (chat-stream.js, the turn's
  message_ids). Delegated Astra copy pass: KEEP; marked COPY ACCEPTED
  BY DELEGATION (Astra, 2026-11-11) in copy.go and the Plan 3
  inventory.
- TestBatchFailedSaysThemAll (page) and TestBrowserInstantThinkingQueued
  (script) cover it; each dies when its half is removed.
- Design and progress notes record the rulings. Budget: internal/thintest
  tests 13630.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 7c286939fe9d28584a068536e360e12445d9907e parent 98101c9
10 files changed, +68 −14
  • .rastrillo/budgets.txt +1 −1
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +1 −0
  • docs/superpowers/plans/TURNBATCH-PROGRESS.md +11 −0
  • docs/superpowers/specs/2026-11-11-equipo-turn-batching.md +13 −10
  • internal/equipo/chat_page.go +5 −1
  • internal/equipo/copy.go +1 −0
  • internal/equipo/static/chat-stream.js +2 −1
  • internal/equipo/templates/chat.html +1 −1
  • internal/thintest/batching_contract_test.go +28 −0
  • internal/thintest/instant_browser_test.go +5 −0

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index f79f1bf9..2fa4b161 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -62,5 +62,5 @@ 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 - 8520 Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. 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 - 13600 Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing and batches split to fit one frame; about 400 lines); measured 13597 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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 - 13630 Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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.
perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 2c7fd9e6..3338f454 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5995,6 +5995,7 @@ records remain unchanged.
| `teams.undo` | Undo | Settings UX pass (Paul, 2026-11-11): Teams, after Forget | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `chat.activity.star_project` | Starring a project… | Coordinator activity (projects-ux) | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `chat.queued` | Waiting its turn | Conversation: the note under a message sent while a turn runs (thinking-stale hot fix) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.failed_many` | The coordinator could not answer these messages. | Conversation: the note when a turn that covered several messages fails (turn batching) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.reason.provider_failed` | the model connection failed | Tasks: why a step stopped (projects-ux) | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.reason.provider_rejected` | the model service declined the request | Tasks: why a step stopped (projects-ux) | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.reason.policy_rejected` | Equipo's rules blocked it | Tasks: why a step stopped (projects-ux) | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
diff --git a/docs/superpowers/plans/TURNBATCH-PROGRESS.md b/docs/superpowers/plans/TURNBATCH-PROGRESS.md
index 3a43905f..b5e2a8f1 100644
--- a/docs/superpowers/plans/TURNBATCH-PROGRESS.md
+++ b/docs/superpowers/plans/TURNBATCH-PROGRESS.md
@@ -33,6 +33,17 @@ Branch `turn-batching` from main 03f8a91. Design note:
- Queued marker on each bubble: this is a product question, left for
the controller. The branch keeps the single note from the
thinking-stale fix.
+6. **Rulings.** No hold between turns, and the single note stays.
+ `chat.failed_many` ("The coordinator could not answer these
+ messages.") is added for a failed batch, on the page and from the
+ event stream. Delegated Astra copy pass: KEEP, marked COPY ACCEPTED BY
+ DELEGATION (Astra, 2026-11-11) in copy.go and the Plan 3 inventory.
+ Mutations: drop the page's batch case and `TestBatchFailedSaysThemAll`
+ dies ("a failed batch lacks the note for its messages"); drop the
+ script's and `TestBrowserInstantThinkingQueued` dies ("waiting for the
+ failed batch's note").
+7. **Merged origin/main** 42a31cb (ship buttons). The budgets conflict
+ was resolved by keeping both reasons (internal/thintest at 13600, then 13630 with the plural note).
## Mutations
diff --git a/docs/superpowers/specs/2026-11-11-equipo-turn-batching.md b/docs/superpowers/specs/2026-11-11-equipo-turn-batching.md
index 22aebc2b..3781e591 100644
--- a/docs/superpowers/specs/2026-11-11-equipo-turn-batching.md
+++ b/docs/superpowers/specs/2026-11-11-equipo-turn-batching.md
@@ -118,13 +118,16 @@ the whole batch to the batch turn. Nothing reads usage per message.
`TestHeadlessTurnBatching` checks for one row for the batch turn and none
for any single message.
-## Open product questions
-
-1. **Bursts between turns.** A message sent while nothing runs starts at
- once. To batch those, the instance would have to hold a message for a
- short time first, which delays the first token.
-2. **One note or one per bubble.** The rules say each message shows the
- queued marker. The thinking-stale fix chose one note under the latest
- waiting message. This branch keeps the merged single note.
-3. **Failure copy for a batch.** `chat.failed` says "this message" even
- when the failed turn covered several messages.
+## Rulings (controller, 2026-11-11)
+
+1. **No hold.** A message sent while nothing runs starts its turn at
+ once. A fast first reply beats batching messages that arrive between
+ turns.
+2. **One note.** The single "Waiting its turn" note under the latest
+ waiting message stays, as the thinking-stale fix built it.
+3. **Plural failure.** A failed turn that covered more than one message
+ says `chat.failed_many`, "The coordinator could not answer these
+ messages." (Astra copy pass: KEEP). The page and the event stream
+ (`chat-stream.js`, from the turn's `message_ids`) both choose it.
+ `TestBatchFailedSaysThemAll` and `TestBrowserInstantThinkingQueued`
+ cover it.
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index f01b82fd..e7a28367 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -306,9 +306,13 @@ func (a *application) chatPage(w http.ResponseWriter, r *http.Request) {
}
if latest != nil && (latest.State == wire.TurnFailed || latest.State == wire.TurnCancelled) {
key := "chat." + latest.State
- if latest.Reason == wire.ReasonStorageFull {
+ switch {
+ case latest.Reason == wire.ReasonStorageFull:
// The runner had no room for an attachment: said in words.
key = "chat.failed_storage"
+ case latest.State == wire.TurnFailed && len(latest.MessageIDs) > 1:
+ // The turn carried a batch: messages sent while another ran.
+ key = "chat.failed_many"
}
view.Ended = &chatEnded{ID: latest.ID, Key: key}
}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index a883ea55..1dfac536 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -566,6 +566,7 @@ var pageCopy = map[string]string{
"conversation.thinking": "Thinking",
"chat.offline": "Your runner is offline. Messages wait here until it is back.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.failed": "The coordinator could not answer this message.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.failed_many": "The coordinator could not answer these messages.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"chat.cancelled": "Stopped.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.activity.thinking": "Thinking", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.activity.status": "Checking your projects…", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js
index 25886291..7ce58740 100644
--- a/internal/equipo/static/chat-stream.js
+++ b/internal/equipo/static/chat-stream.js
@@ -892,7 +892,8 @@
if (v.kind) return;
var note = template("equipo-ended-template");
note.dataset.ended = v.id;
- note.querySelector("p").textContent = v.state !== "failed" ? form.dataset.cancelled : v.reason === "runner_storage_full" && form.dataset.failedStorage ? form.dataset.failedStorage : form.dataset.failed;
+ // A batch (messages sent while another turn ran) says them all.
+ note.querySelector("p").textContent = v.state !== "failed" ? form.dataset.cancelled : v.reason === "runner_storage_full" && form.dataset.failedStorage ? form.dataset.failedStorage : (v.message_ids || []).length > 1 && form.dataset.failedMany ? form.dataset.failedMany : form.dataset.failed;
feed.append(note);
scroll();
}
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index f1919dda..9b8d8a4c 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -45,7 +45,7 @@
</div>
<div equipo-announcements role="status" aria-live="polite" aria-atomic="false"></div>
<div id="chat-composer">
-<form id="composer" equipo-form equipo-composer method="post" action="/conversation" data-failed="{{copy "chat.failed"}}" data-failed-storage="{{copy "chat.failed_storage"}}" data-retry="{{copy "conversation.retry"}}" data-cancelled="{{copy "chat.cancelled"}}" data-upload="/conversation/attachments" data-max-files="5" data-max-bytes="10485760" data-too-large="{{copy "api.attachment_too_large"}}" data-heic="{{copy "api.attachment_heic"}}" data-too-many="{{copy "chat.attach.too_many"}}" data-upload-failed="{{copy "chat.attach.failed"}}" data-uploading="{{copy "chat.attach.uploading"}}" data-remove="{{copy "chat.attach.remove"}}">
+<form id="composer" equipo-form equipo-composer method="post" action="/conversation" data-failed="{{copy "chat.failed"}}" data-failed-many="{{copy "chat.failed_many"}}" data-failed-storage="{{copy "chat.failed_storage"}}" data-retry="{{copy "conversation.retry"}}" data-cancelled="{{copy "chat.cancelled"}}" data-upload="/conversation/attachments" data-max-files="5" data-max-bytes="10485760" data-too-large="{{copy "api.attachment_too_large"}}" data-heic="{{copy "api.attachment_heic"}}" data-too-many="{{copy "chat.attach.too_many"}}" data-upload-failed="{{copy "chat.attach.failed"}}" data-uploading="{{copy "chat.attach.uploading"}}" data-remove="{{copy "chat.attach.remove"}}">
<input type="hidden" name="request_id" value="{{.RequestID}}">
<div equipo-adder hidden><button type="button" equipo-plus aria-label="{{copy "chat.attach.add"}}" title="{{copy "chat.attach.add"}}" aria-haspopup="menu" aria-expanded="false" aria-controls="attach-menu">{{icon "plus"}}</button><div equipo-add-menu id="attach-menu" role="menu" aria-label="{{copy "chat.attach.add"}}" hidden><button type="button" role="menuitem" data-pick="image">{{icon "image"}}<span>{{copy "chat.attach.image"}}</span></button><button type="button" role="menuitem" data-pick="file">{{icon "file-text"}}<span>{{copy "chat.attach.file"}}</span></button></div><input type="file" data-picker="image" accept="image/*" multiple tabindex="-1" aria-hidden="true" equipo-visually-hidden><input type="file" data-picker="file" accept=".txt,.md,.markdown,.csv,.json,.log,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf" multiple tabindex="-1" aria-hidden="true" equipo-visually-hidden></div>
<div equipo-pill>
diff --git a/internal/thintest/batching_contract_test.go b/internal/thintest/batching_contract_test.go
index adc4825b..ef5e7a36 100644
--- a/internal/thintest/batching_contract_test.go
+++ b/internal/thintest/batching_contract_test.go
@@ -399,3 +399,31 @@ func TestBatchSplitsToFitTheFrame(t *testing.T) {
}
}
}
+
+// A failed batch says the coordinator could not answer these messages; a
+// failed turn of one message still says this message.
+func TestBatchFailedSaysThemAll(t *testing.T) {
+ r := newRig(t)
+ runner := r.dial(0)
+ busy, queued := r.busyWithThree(runner)
+ batch := queued[0].Turn.ID
+ runner.Send(r.ctx, "rep", wire.FrameReply, wire.Reply{TurnID: busy.Turn.ID, Attempt: 1, Text: "first"})
+ f := r.batchFrame(runner, batch, "alpha", "bravo", "charlie")
+ runner.Send(r.ctx, "ab", wire.FrameAck, wire.Ack{ID: f.ID})
+ runner.Send(r.ctx, "fb", wire.FrameTurn, wire.TurnReport{TurnID: batch, Attempt: 1, State: wire.TurnFailed, Reason: "provider_failed"})
+ r.turnIs(batch, wire.TurnFailed)
+ if page := r.inst.Get(t, "/conversation"); !strings.Contains(page, `data-ended="`+batch+`"><p>The coordinator could not answer these messages.</p>`) {
+ t.Fatal("a failed batch lacks the note for its messages")
+ }
+ one, err := r.client.Send(r.ctx, "delta", "kq6")
+ if err != nil {
+ t.Fatal(err)
+ }
+ of, _, _ := runner.Expect(r.ctx, wire.FrameMessage)
+ runner.Send(r.ctx, "a1", wire.FrameAck, wire.Ack{ID: of.ID})
+ runner.Send(r.ctx, "f1", wire.FrameTurn, wire.TurnReport{TurnID: one.Turn.ID, Attempt: 1, State: wire.TurnFailed, Reason: "provider_failed"})
+ r.turnIs(one.Turn.ID, wire.TurnFailed)
+ if page := r.inst.Get(t, "/conversation"); !strings.Contains(page, `data-ended="`+one.Turn.ID+`"><p>The coordinator could not answer this message.</p>`) {
+ t.Fatal("a failed single message lacks its note")
+ }
+}
diff --git a/internal/thintest/instant_browser_test.go b/internal/thintest/instant_browser_test.go
index 05cbf4c2..88ad81f8 100644
--- a/internal/thintest/instant_browser_test.go
+++ b/internal/thintest/instant_browser_test.go
@@ -241,5 +241,10 @@ func TestBrowserInstantThinkingQueued(t *testing.T) {
// The first replies: the queued turn's line comes, the note goes.
runner.Send(r.ctx, "r-q1", wire.FrameReply, wire.Reply{TurnID: first, Attempt: 1, Text: "First done."})
p.wait(`document.querySelectorAll('[equipo-thinking]').length===1 && document.querySelector('[equipo-thinking]').dataset.turn===`+jsString(second)+` && !document.querySelector('[data-queued]')`, "the second turn's line, no note")
+ // The batch of two fails: its note says these messages, from the event.
+ bf := messageFrame(t, r, runner)
+ runner.Send(r.ctx, "a-q2", wire.FrameAck, wire.Ack{ID: bf.ID})
+ runner.Send(r.ctx, "f-q2", wire.FrameTurn, wire.TurnReport{TurnID: second, Attempt: 1, State: wire.TurnFailed, Reason: "provider_failed"})
+ p.wait(`(document.querySelector('[data-ended=`+jsString(second)+`] p')||{}).textContent===`+jsString("The coordinator could not answer these messages."), "the failed batch's note")
p.stayed("queued sends")
}