oficina / equipo Public

spec: Needs you triage, rev 1 (Astra round 1: NOT READY)

Needs you holds only decisions only Paul can make: deterministic triage
into transient, mechanical, judgement and genuine; one automatic retry;
an Engineering round for conflicts; a hosted re-check for stale checks;
a bounded coordinator hand-off turn (protocol 7) that retries, re-plans,
splits or asks one question. Staging's six items are diagnosed from the
replica in section 0.

Astra round 1 returned NOT READY (1 Critical, 9 Important), recorded in
section 11. Not built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude pushed by paul@keymail.dev 3ab0e85ec95d4dd7211b8e730ef7bc135642e861 parent 4e51bcd
1 file changed, +322 −0
  • docs/superpowers/specs/2026-11-11-equipo-needs-you-triage.md +322 −0

CI passed — run details

diff --git a/docs/superpowers/specs/2026-11-11-equipo-needs-you-triage.md b/docs/superpowers/specs/2026-11-11-equipo-needs-you-triage.md
new file mode 100644
index 00000000..2ef60272
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-11-equipo-needs-you-triage.md
@@ -0,0 +1,322 @@
+# Equipo: Needs you holds only real decisions
+
+Status: 2026-11-11, revision 1, **NOT READY** after Astra round 1 (§11).
+Not built. Drafted by Claude (Opus 5.5) on `needs-you-triage` from main
+4e51bcd. Builds on thin v1 (task lifecycle),
+housekeeping (§§3-4: classes, the ledger, the day budget, the principal),
+merge authority (the gate, unchanged) and release slice 1 (hosted checks).
+
+## 0. Why
+
+Paul, on staging's six Needs you items: "I feel like a bunch of this stuff
+doesn't actually need me." His rulings (2026-11-11):
+
+- Needs you holds only decisions only Paul can make.
+- A failed step is never one of them by itself: Equipo retries a stopped
+ step once, within the retry budget.
+- If it fails again, the coordinator reads what happened and fixes the
+ cause, re-plans, or asks Paul one plain question. Only that question
+ reaches Needs you. Meanwhile the task says "The coordinator is looking
+ into it".
+- The coordinator stays high-level; specialists hold the details.
+- Spend is first-class: a coordinator turn costs about 17k input tokens.
+
+Staging, read from its replica at 20:37 UTC:
+
+| Task | Needs you today | What the rows say |
+|---|---|---|
+| Swipe from the edge (`tks6kwzzdngr`) | `fix_rounds` | round 2 approved, then a Mac re-run's checks failed outside the sandbox |
+| Centre the star (`tk3pi43fqzjj`) | `merge_conflict` | the one rebase round passed hosted checks and review; the merge conflicted again |
+| Rename control (`tkataquuxfrw`) | `fix_rounds` | round 2's hosted checks failed (units named) |
+| Thinking indicators (`tkplvk6zce6q`), Done to recheck (`tknitqeua7yy`) | `retry` | round 1 Engineering `runner_restarted`, never pushed, termination proven |
+| Private repository storage (`tkynbqvn3ypm`) | `merge` | approved; checks `needs_network` from 12:45, before hosted checks; the card has no merge audit row, so it predates merge authority. No project has a merge policy row: `main_ships` is unknown everywhere and never asked |
+
+So item 6 asked because its checks predate hosted checks, not because of
+the ships question. (The ships card exists and is already its own
+project card; merge authority raises it when a decision fails on it.)
+
+## 1. Triage: one pure function
+
+`internal/equipo/triage.Classify(Facts) Verdict`, no store or clock. Facts
+are the task's `NeedsYou` (as `progress.needsYou` computes it today), the
+newest step (specialist, reason, pushed, terminated), the newest checks
+(outcome, reason, hosted), and the task's spent counts (§4). Verdict is a
+class and an action:
+
+| `NeedsYou` and facts | Class | Action |
+|---|---|---|
+| `retry`: a step (not merge) failed with a transient reason (`runner_restarted`, `interrupted`, `provider_failed`, `clone_failed`, `candidate_unavailable`, `checks_timeout`, `no_runner`, `step_timeout`), termination proven, not yet retried automatically | transient | `retry` |
+| `review_blocked`: as above for a review | transient | `retry` |
+| `merge_conflict` | mechanical | `rebase`: one more Engineering rebase round on the default branch's tip |
+| `merge`, the judged checks `cannot_run` with `needs_network`, `checks_unavailable` or `checks_timeout`, not re-checked on this SHA | mechanical | `recheck`: checks again on the exact SHA on the primary, which takes hosted CI when the repository has it |
+| `retry` or `review_blocked` otherwise (a second failure, or a reason that is not transient), `fix_rounds` | judgement | `handoff` |
+| `merge` otherwise, `branch_moved`, `machine_removed`, `runner_offline`, a coordinator question (§3) | genuine | none |
+
+Only `handoff`'s outcome uses a model. Everything else is deterministic.
+A verdict whose budget (§4) is spent becomes genuine, with a
+recommendation (§5).
+
+**Never touched:** a task that is cancelled, ended, cancel-requested,
+folded, merging, or held (`merge_hold` set), a task whose creator's
+housekeeping is paused, and a task whose creator is not a current member.
+Triage acts only while the creator's primary is online at protocol 7
+(§7); otherwise nothing changes and Needs you shows what it shows today.
+
+## 2. Automatic actions
+
+Each action is a row in housekeeping's ledger (`chat_housekeeping`),
+detector `triage_<action>`, subject the task, keyed so it acts once:
+
+| Action | Key | What it does |
+|---|---|---|
+| `retry` | `retry:<step>` | the ordinary Retry of that step (a new attempt; merge steps are never retried here) |
+| `rebase` | `rebase:<failed merge step>` | an Engineering rebase step, exactly as `mergeFailed` makes the first |
+| `recheck` | `recheck:<task>:<candidate>` | a checks step on the candidate, `recheck_by = hosted`, stage back to In review |
+| `handoff` | `handoff:<task>:<newest step>:<attempt>` | queues a hand-off turn (§3) |
+
+The action is claimed and taken in the transaction that noticed it, under
+the housekeeping principal with one new permission, `dispatch`, valid only
+for its own row's person. The principal still refuses every merge, merge
+card, `merge_asked`, `merge_eligible`, `ready_sha`, ending and setting
+(`hkForbid`, `hkTaskWrite`), so a recheck never clears `merge_asked`: an
+asked SHA stays asked and the re-run only refreshes the card's words, as a
+Mac re-run does today. Merge authority, Review and the sandbox rules are
+untouched; every merge still goes through `authorizeMerge`.
+
+When triage runs: at the end of `advance` (every step report, sync and
+merge refusal), when a hand-off turn ends, at start-up (§6) and on the
+housekeeping tick for held rows. Inside the principal it never runs.
+
+**Receipts.** Each action is an action row on the Housekeeping view
+(newest first, with its task) and a `housekeeping` event: quiet, no
+conversation card. Undo: not offered for `retry`, `rebase` and `recheck`
+(a dispatched step may already be running; the reversal is the task's
+own Cancel). A queued hand-off is undone by cancelling its turn, which
+returns the task to Needs you and vetoes the key.
+
+## 3. The hand-off turn
+
+A coordinator turn of new kind `handoff`, for the task's creator, queued
+after the person's own turns and yielding to them as a move-in does.
+`chat_turns.task_id` names its task. The instance writes its whole prompt
+(`MessageCommand.Text`), at most 6 KiB, high-level only:
+
+- the task's title, link, project and brief (clipped to 1,500 bytes);
+- what stopped it, in one line (the `NeedsYou` reason, the stopped step and
+ its reason, rounds and rebases used);
+- the newest checks in one line, with hosted CI's failing unit names;
+- the newest review: verdict, summary (500 bytes) and up to five finding
+ headlines;
+- after a question (below), the question and the person's answer;
+- the choices still open, from the budgets.
+
+**Tools** (both ends allowlist them for this kind): `read_task` (for
+detail if it must), `read_notes`, and `resolve_task{task, action, ...}`,
+which accepts only the turn's own task, once per turn:
+
+- `retry`: the ordinary Retry, if the step is retryable.
+- `round{approach}`: another Engineering round on the candidate with the
+ coordinator's approach (<= 1,000 bytes) beside the feedback, stored on
+ the step (`chat_steps.approach`). Checks, Review and the gate follow as
+ for any round.
+- `split{parts[2..3]{title, brief}}`: records each part as a task of the
+ creator in the same project (task cards in the conversation are the
+ receipt), starts each, and cancels the original through the ordinary
+ cancel path (it is at rest by construction).
+- `ask{question, options[2..3], recommend}`: a `task_question` card in the
+ creator's conversation, bound to the task, with Equipo's pick. The task
+ shows `NeedsYou: question`. The answer (the creator only, current card
+ revision) queues one follow-up hand-off with the answer in its prompt;
+ the person's tap pays for it, so it is never refused for budget, but it
+ is recorded.
+
+The turn's reply is never posted (the receipt, the cards and the task
+status say what happened). At most 8 tool calls. A turn that ends without
+`resolve_task`, fails, or is cancelled marks the row `failed`; the task
+goes back to Needs you as it was, with "The coordinator couldn't settle
+this" and a recommendation, and the key never hands off again.
+
+This is not a housekeeping judgement turn: the coordinator acts for the
+creator on the creator's own task, with the narrow tool set above, as it
+already may in a person turn. Housekeeping's "model judgement is never an
+action" stays true for housekeeping detectors.
+
+## 4. Budgets
+
+Per person per day, in the one ledger housekeeping already sums
+(`hkUsed`), so automatic work of both loops shares one day:
+
+| Unit | Day limit | Reserved by |
+|---|---|---|
+| retries | 3 (housekeeping's) | `retry`, and `resolve_task` retry |
+| automatic rounds | 3 (new, `Limits.Rounds`) | `rebase`, `round`, each `split` part |
+| coordinator turns | 4 (housekeeping's) | `handoff` |
+| tokens | 150,000 (housekeeping's) | `handoff`, 37,500 reserved, charged with the turn's usage |
+
+Per task: one automatic retry per step; two automatic rounds (rebases
+after the first, rounds and split parts together); two hand-offs. A
+recheck is free and once per SHA. Steps an action starts are bounded by
+count, not tokens: their usage is on their own usage rows as for any step,
+and the row's `attempt` names them. A hand-off is settled when its turn
+ends: charged its usage rows' input plus output tokens, or the whole
+reservation when no figure came (unknown is never zero). Headroom
+stand-down does not apply (this is the person's own work, which their own
+tap would dispatch); the connection choice still refuses limited ones.
+
+Day budget spent: the row is `held` (reason `budget`) and the task stays
+in Needs you with the recommendation; the next day's tick claims it again
+if the task is still there. Task cap spent: `refused` (reason `cap`),
+genuine for good.
+
+## 5. What the person sees
+
+`wire.Task` gains `triage {kind, reason, since, question, card_id,
+recommend}` (omitempty). While an action is in flight, `NeedsYou` is
+empty and the task sits in the normal list with an honest line:
+
+| `kind` | Task line |
+|---|---|
+| `retrying` | "Retrying after the runner restarted" (the step's reason) |
+| `rebasing` | "Engineering is resolving a conflict with main" |
+| `rechecking` | "Running the checks again on hosted CI" |
+| `looking` | "The coordinator is looking into it" (existing copy; `coordinator` activity `looking` too) |
+| `question` | `NeedsYou` `question`: "Needs you: <the question>" with the card |
+| `waiting` | `NeedsYou` unchanged, plus why it waits (budget, tries used, runner needs an update, the coordinator couldn't settle it) and Equipo's recommendation |
+
+## 6. Existing tasks
+
+At start-up, after housekeeping's claim recovery, `Retriage` passes once
+over every open task with a non-empty `NeedsYou`, in its own transaction
+per task. The ledger keys make it idempotent: a second start or a sync
+afterwards finds the keys and does nothing.
+
+## 7. Wire: protocol 7
+
+`wire.ProtocolHandoff` (7) becomes `ProtocolCurrent`. It adds
+`TurnHandoff`, `ToolResolveTask` and `HandoffTools`. `Encode` refuses a
+`message` frame of kind `handoff` below 7 (`ErrProtocol`, never sent), its
+own downgrade step, first in the chain. The instance queues a hand-off
+only for a primary online at 7, and a hand-off dispatched before the
+runner reconnected lower is ended `failed` at that connection (§3's
+fallback).
+
+| Combination | Behaviour |
+|---|---|
+| new instance, runner below 7 | no triage; Needs you as today |
+| old instance, new runner | spoken 6: no hand-off frames exist; nothing changes |
+| runner reconnects below 7 holding a hand-off | the turn fails, the task returns to Needs you once |
+
+Runner: the hand-off prompt is the frame's text (no "Newest message"
+header, no desk settling), the call bound is 8, `resolve_task` is in the
+MCP list, the launcher allowlist and `provider` actions.
+
+Migration 0064 (additive): `chat_housekeeping.reserved_rounds`,
+`charged_rounds`; `chat_turns.task_id`; `chat_steps.approach`;
+`chat_cards.recommend`.
+
+## 8. Tests, failing first
+
+Contracts in `internal/thintest`, a protocol 7 rig, each seen failing
+before the code:
+
+- `TestTriageRetriesTransient` (items 4 and 5): `runner_restarted` before
+ any push is retried once with a receipt and "Retrying after ..."; a
+ second `runner_restarted` hands off.
+- `TestTriageRebasesConflict` (item 2): a second conflict starts an
+ Engineering rebase round; its candidate goes to checks, Review and the
+ gate, which still asks for a hosted pass.
+- `TestTriageHandsOffFixRounds` (items 1 and 3): rounds used up queue one
+ hand-off with the failing unit names and the review's headlines; the
+ task says the coordinator is looking; `resolve_task round` starts round
+ 3 with the approach; `ask` gives a `question` card and Needs you shows
+ only that; the answer queues the follow-up.
+- `TestTriageRechecksStaleChecks` (item 6): `needs_network` at Ready to
+ merge re-runs checks on the exact SHA with the hosted offer; the asked
+ SHA stays asked; a hosted pass refreshes the card's words; nothing merges.
+- `TestTriageBudgetExhausted`: the fourth retry of the day is held with the
+ recommendation; the per-task cap refuses; the next day claims the held
+ row.
+- `TestTriageIdempotentRetriage`: `Retriage` twice and a sync act once.
+- `TestTriageNeverTouches`: cancelled, cancel-requested, held, paused,
+ merging tasks and a removed member: nothing changes.
+- `TestTriageOldRunner`: protocol 6 primary, nothing changes; a hand-off
+ held by a runner that reconnects at 6 fails back to Needs you.
+- `resolve_task` refusals: another task, a person turn, a second call.
+
+Unit: `triage.Classify` table; `Encode` refuses the hand-off below 7.
+Headless scenario 4 and Mac M4 now expect the automatic retry. Each guard
+(the transient list, termination, once per step, never-touched, protocol,
+budget, cap, principal `dispatch` scope, resolve's own-task check) is
+broken once and its test watched failing.
+
+## 9. Copy
+
+New strings in `copy.go`, each through a delegated Astra copy pass: the
+four task lines of §5, the question stage line, the waiting reasons and
+recommendations, the question card's pick line, and the Housekeeping
+view's action names for the six `triage_*` detectors.
+
+## 10. Out of scope
+
+Hosted passes still ask (merge authority; amadan#136 lifts it). The Mac
+checks gate. A same-SHA checks re-run for anything but a stale network
+reason. Undo for dispatched steps.
+
+## 11. Astra round 1: NOT READY
+
+`gpt-6-astra`, effort high, read-only, against this revision and main
+4e51bcd. Findings as given, shortened; revision 2 must answer each.
+
+1. **Critical, §3.** `resolve_task` retry can reach `RetryTask`'s merge
+ path, which calls `authorizeMerge` as the person and records
+ `decided_by: person`. §2 excludes merge steps; §3 does not, and the
+ hand-off runs outside the principal. Fix: refuse merge steps in
+ `resolve_task`; no coordinator action ever carries a person's merge
+ authority.
+2. **Important, §§1-3.** Hand-offs and questions are not bound to the
+ situation that raised them: a person's Retry, Cancel or a hold in the
+ meantime does not invalidate them. Fix: bind to the source step,
+ attempt and candidate; revalidate at dispatch, resolution and answer.
+3. **Important, §§2-3.** A yielded hand-off re-queued through
+ `kindEnded`/`queueKind` loses its task and ledger link and can
+ replenish the budget; and §3's fallback restores the old Needs you
+ even after `resolve_task` committed a round or question. Fix: persist
+ the resolution apart from the reply; continue a yielded hand-off under
+ the same row and reservation; never restore after a committed effect.
+4. **Important, §§2-4.** The answer follow-up has no usable key (the
+ `ask` changes no step, so it collides with `handoff:<task>:<step>:
+ <attempt>`) and no clear bound against the two-hand-off cap. Fix: a
+ dedicated answer path, a card-keyed follow-up, at most one question
+ and one follow-up per episode, and say exactly which limit the
+ person's tap is exempt from.
+5. **Important, §§2, 3, 6.** `reclaimable` re-opens `failed` rows once
+ and `vetoed` rows after 30 days, and `hkRun` clears earlier charges.
+ Fix: failed and undone triage keys are consumed for good; charges are
+ kept; dispatched failures count toward the lifetime caps.
+6. **Important, §4.** A 37,500-token reservation does not stop a turn
+ spending more: nothing carries a remaining allowance to the runner
+ across attempts (housekeeping §4's `max_tokens`). Fix: carry and
+ enforce the remainder; charge overruns without a fresh allowance.
+7. **Important, §4.** "Input plus output" undercounts Claude, whose cache
+ reads and writes `rowSpend` counts separately; rows can be partial or
+ null. Fix: provider-aware totals across attempts, at least the
+ reservation for incomplete usage, later reports reconciled once.
+8. **Important, §§2-4.** Split does not fit the caps (three parts against
+ two rounds), and new tasks get fresh caps, so splitting replenishes
+ them; no lineage is stored. Fix: a shared allowance for the original
+ work, child lineage, all parts reserved at once, durable keys for
+ `round` and `split`.
+9. **Important, §7.** A hand-off queued behind a person's turn can be
+ dispatched after the runner reconnects below 7; `send` drops it on
+ `ErrProtocol` and the turn blocks the queue. Fix: check the protocol
+ at dispatch and retire the turn in the same transaction; say what a
+ new runner holding a hand-off does with an old instance.
+10. **Important, §§1, 3-5.** Non-transient failures skip the first retry
+ Paul ruled for every stopped step, and spent budgets or an unsettled
+ hand-off leave raw `retry` or `fix_rounds` in Needs you, which a
+ recommendation does not turn into a decision only Paul can make.
+ Fix: reconcile retry eligibility with the ruling, keep operational
+ waiting out of Needs you, and escalate only with a concrete question.
+ (The brief asked for "a plain Needs you question with a
+ recommendation" when a budget runs out, so the second half needs a
+ ruling.)