oficina / base Public

Jobs plan: Astra round 1 fixes (6 P1, 11 P2)

- Capability header on the event stream too; Base withholds it while
  any of the member's apps can't draw the controls.
- One words rule (optionless, open_words, fallback; never placement).
- The Assistant builds only from a live first look; merge retry runs
  inside the action's transaction; machinery words checked in every
  Assistant-written field.
- honest-merge-refusals is a prerequisite of the merge fault reasons.
- Addendum parts required of team_ask and rendered on outcome cards.
- First look wired through the runner; O1 provenance; one scheduling
  path for note turns; receipts for the Assistant's answers; replace
  binding; phase 2 before phase 3; missing copy; expanded tasks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 361b8834d82c9533e12f170d168b273d557c6a96 parent c7ac50c
1 file changed, +181 −102
  • docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md +181 −102

CI passed — run details

CI log
=== build ===
CGO_ENABLED=0 go build ./...
=== vet ===
go vet ./...
=== fmt-check ===
=== staticcheck ===
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
=== govulncheck ===
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
No vulnerabilities found.
=== gitleaks ===
7:33PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
7:33PM INF 1 commits scanned.
7:33PM INF scanned ~2481126 bytes (2.48 MB) in 338ms
7:33PM INF no leaks found
=== budget ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 22 directories within budget
=== script-test ===
scripts/prepare-apps_test.sh
ok   releases lookup failure stops before ship
ok   app owned elsewhere stops the script
ok   apps listing failure stops before create
ok   ambiguous release dir is refused
ok   explicit version resolves the ambiguity
ok   releases match is exact, not substring
ok   shipped version is only promoted, existing app not created
ok   fresh account creates, ships, promotes to edge, enables
ok   failing promote stops the script
ok   ship is retried while uploads are rate limited
all passed
hack/fonts_test.sh
fonts_test: ok
=== test ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./...

receipt: test step 10.429s against a 60s target (the gate's other steps are not in this figure)
receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed
receipt: slow package 8.896s amadan.net/oficina/base/internal/webtest
receipt: slow package 1.266s amadan.net/oficina/base/internal/issuer
receipt: slow package 693ms amadan.net/oficina/base/internal/operations
receipt: slow package 339ms amadan.net/oficina/base/internal/consumer
receipt: slow package 241ms amadan.net/oficina/base/internal/e2e
receipt: slow test 1.53s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot
receipt: slow test 1.2s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce
receipt: slow test 660ms amadan.net/oficina/base/internal/issuer TestAuthorizeSignsForInstalledApp
receipt: slow test 540ms amadan.net/oficina/base/internal/issuer TestAuthorizeRefusals
receipt: slow test 530ms amadan.net/oficina/base/internal/operations TestOperationsRefusals
=== native ===
strings: copy review's strings.json is not here (git-ignored); its comparison skipped
strings: 119 in the catalog, 116 used
worktree-lib_test: ok
diff --git a/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md b/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md
index 0459822..cd48349 100644
--- a/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md
+++ b/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md
@@ -20,15 +20,15 @@
| Spec item | Status | Where |
|---|---|---|
-| Phase 0.1: staging runner forge credential for repositories it creates | **Done** | Equipo `8757df09`, merged `14496879` (11-20): owner's staging runner gets its own agent-wide credential file |
-| Phase 0.2: `gitleaks` in the installed runner release | **Done** | same commit: staging build copies pinned gitleaks, provenance checks it |
+| Phase 0.1: staging runner forge credential for repositories it creates | **Done in code; staging check pending** | Equipo `8757df09`, merged `14496879` (11-20): owner's staging runner gets its own agent-wide credential file at each install. Task 0.1 confirms the installed runner has it |
+| Phase 0.2: `gitleaks` in the installed runner release | **Done in code; staging check pending** | same commit: staging build copies pinned gitleaks, provenance checks it. Task 0.1 confirms |
| (related) new job repositories start with `main` | **Done** | Equipo `c8c4b82d` (11-20): runner pushes an empty-commit `main` into a repository it created |
| (related) preview refusals reach the step (`preview_headers`) | **Done** | Equipo `8dc096b4` (11-21): runner reads carlos's stderr |
| (related) carry on after connecting Oficina | **Done** | Equipo `9f7e04a6` (11-19); Base `f42602f` |
| (related) local merge refusals become final with a no-access reason | **In flight elsewhere** | Equipo branch `honest-merge-refusals` (no commits beyond main yet). Not planned here; Task 2.3 consumes its reason |
| (related) stopped-jobs audit | **Not landed** | report expected at `.superpowers/sdd/2026-11-13-assistant-jobs/stopped-jobs-audit-2026-11-25.md`; placeholder Task 0.2 |
| Addendum: decision cards carry context, link, recommendation, option detail (Equipo) | **Partly** | Equipo branch `decision-cards-context` `cf0614ec`, **not merged**; based on `c8c4b82d`, 154 commits behind; its protocol 29 and migration `0095` both collide with main (see PD1, PD2); its 34 strings are marked `COPY REVIEW PENDING`, which the release copy check does not catch. Landed by Task 1.1 |
-| Addendum: Base renders the decision parts | Not started | Tasks 1.18 to 1.21 |
+| Addendum: Base renders the decision parts | Not started | Tasks 1.18 to 1.20 (job asks and outcome cards, web and native) |
| K1 job card fields, decision identity, receipts | Not started | |
| K2 act endpoint | Not started | Pattern to copy: Carry on now (Equipo `dce7c015`, `31cdb35d`: `Store.CarryOn`, a `handoffActionRecord` ledger per card and key, 409 `AssistantConflict` with the card; Base `02e4f8d` relay `POST /ask/cards/{id}/carry_on`) |
| K3 `team_ask`, K4 words mode, K5 person-acted block | Not started | |
@@ -44,17 +44,17 @@
## Plan decisions
-- **PD1 Protocol numbers.** Main has `ProtocolPinnedRelease = Protocol29 = ProtocolCurrent` (paused work). So: `ProtocolDecisions = Protocol30` (Task 1.1), `ProtocolJobsMoving = Protocol31` (phase 2: `ask_person` `open`/`about`/`default`, merge fault reasons), `ProtocolFirstLook = Protocol32` (phase 3: `record_task` `first_look`, review mode, Engineering's first-look note). The spec's single "protocol 29" is split so phases 2 and 3 can ship in either order; whichever merges first takes the lower number, and `TestSpokenIs*` in `internal/wire` pins the result.
+- **PD1 Protocol numbers.** Main has `ProtocolPinnedRelease = Protocol29 = ProtocolCurrent` (paused work). So: `ProtocolDecisions = Protocol30` (Task 1.1), `ProtocolJobsMoving = Protocol31` (phase 2: `ask_person` `open`/`about`/`default`, merge fault reasons), `ProtocolFirstLook = Protocol32` (phase 3: `record_task` `first_look`, review mode, Engineering's first-look note). The spec's single "protocol 29" is split so each phase's runner changes ship with their phase. Phases 2 and 3 may be built side by side (spec), but **phase 2 merges and deploys before phase 3**: phase 3's Coordinator rules mark later questions `about: taste`, which phase 2 adds, and `jobsMovingPhase` is cumulative. `TestSpokenIs31` and `TestSpokenIs32` pin the numbers.
- **PD2 Migration numbers.** Main's newest is `0106_release_connection.sql` (`0102` is unused; leave it). The spec's single `0095_jobs_moving.sql` is split per phase, each taking the next free number when its branch is rebased for merge: decision cards `0107_decision_cards.sql`, phase 1 `0108_jobs_act.sql`, phase 2 `0109_jobs_sweep.sql`, phase 3 `0110_first_look.sql`, phase 4 `0111_jobs_replace.sql`. `schema.sql` follows each; `make migration-check` passes.
- **PD3 Decision cards land first** (Task 1.1), rebased, renumbered (PD1, PD2) and with their strings marked `COPY REVIEW REQUIRED` (the marker `make copy-release-check` refuses), so the job ask can carry the same parts.
- **PD4 Where the addendum's parts sit on a job card.** A job card with an `ask` uses the top-level `context`, `link` and `recommended` fields that decision cards add to `wire.AssistantCard`, and each `options[i].detail`; Base has one renderer for outcome and job cards. For a direction ask, `recommended.option` names an action (`build`, `again`, `drop`); otherwise an option value. Every part shown in Base is instance copy or the Assistant's words (K3), never the Coordinator's or Review's prose: a direction's context and why are instance copy keyed by Review's recommendation.
- **PD5 The act request** follows Carry on now: `idempotency_key` in the body (required, at most 128 bytes) and the `Idempotency-Key` header every Base mutation already sends; replay of a key answers the card as it is now. The 409 codes are `card_stale` and `decision_gone`.
- **PD6 Offline runners read paused.** K6's `NeedsRunnerOffline` and `NeedsMachineRemoved` rows: to a client that asked for `job_states=paused` (Base since `02e4f8d`), the job shows as `paused` with the approved offline words (`assistant.job.detail.paused_offline`); to any other, the K6 row. No new copy for an offline runner.
-- **PD7 Per-request stripping and per-person capability.** Equipo strips `ask`, job `options`, `actions`, `receipts`, `hidden`, `updated_at` and job-card decision parts from any snapshot or event read without the header (like `olderJobCard` for paused), and separately records the newest header value per person in `chat_assistant_hosts.capabilities` to switch the Assistant's notes and `team_reply` rules (spec's legacy mode). Every relayed call comes from Base's server, so one person's value is stable.
+- **PD7 Per-request stripping and per-person capability.** Equipo strips `ask`, job `options`, `actions`, `receipts`, `hidden`, `updated_at` and job-card decision parts from any snapshot or event read without the header (like `olderJobCard` for paused), and separately records the newest header value per person in `chat_assistant_hosts.capabilities` to switch the Assistant's notes and `team_reply` rules (spec's legacy mode). Every relayed call comes from Base's server, so Base decides per member: it sends the header only when **every** client the member uses can draw the controls. The web client is served by Base and always can. A native client says so with its own request header to Base, `Base-Client-Capabilities: job_actions` (from Task 1.20); Base records, per member and device, the newest value seen on `/ask/*` and withholds `job_actions` while any of the member's devices used in the last 30 days last called without it (Task 1.17). So an old app with a new Base and a new Equipo keeps today's prose questions (legacy mode) for that member, on every client.
- **PD8 Note names.** The spec's `noteUnanswered` becomes `noteTasteUnanswered` (the name is taken). Notes are gated by mode and by a compiled constant `jobsMovingPhase` (1 to 4), bumped by the task that completes each phase.
- **PD9 Copy goes through copy review before code.** Each phase starts with a copy task that runs the `copy-review` skill over that phase's pending strings (the register at the end). Code tasks write only approved wording; tests assert copy keys, not wording, except where a key's approved text is pinned. Equipo strings carry `// COPY REVIEW REQUIRED` until approved; Base strings get rows in `docs/copy-pending.md`; native strings go in `Localizable.xcstrings` with the same approved text.
- **PD10 Native parity.** Not in the spec (which predates the app). Each Base phase that changes what a pill offers gets a native task, as paused work did (`64742a1`). The native gate (`make native-check`) needs a Mac with Xcode; if the executor has none, the native task is handed to whoever has one and the phase's web half still ships.
-- **PD11 Merge faults and honest refusals.** If `honest-merge-refusals` lands first, its final no-access reason *is* `merge_identity` (Task 2.3 maps it instead of adding a second code). Try again stays the person's single explicit Merge (one tap, one `MergeTask`), never automatic, so it is not the "endless try again" that branch removes. Flagged for Paul at handoff.
+- **PD11 Merge faults and honest refusals.** Today `forge.MergeBranch` deliberately wraps a local refusal (no credential) as `ErrMergeUncertain` (`internal/runner/forge/merge.go` `uncertain`), so `merge_identity` cannot be told apart in `mergestep.go` alone. Making a local refusal final with its own identity is exactly what `honest-merge-refusals` does, so **that branch is a prerequisite of Task 2.3**: its final no-access reason *is* `merge_identity` (Task 2.3 maps it, adding no second code). Try again stays the person's single explicit Merge (one tap, one `MergeTask`), never automatic, so it is not the "endless try again" that branch removes. Flagged for Paul at handoff.
- **PD12 K8 step 4 is drawing.** "Stops nobody acts on fold into Waiting on you after 3 days" needs no sweep: Base folds by `state` and `updated_at` (sent from phase 1), so it ships with the fold rows in Task 4.4, not in phase 2. Nothing is dropped automatically (O4 as proposed).
- **PD13 "Open in Equipo" is never new visible text.** The K6 rows that say "Open in Equipo" use the job view's existing title link (approved, review 8). No new string names Equipo, a runner, a task, a branch, a merge or a repository.
@@ -79,9 +79,9 @@
## Review Focus
1. **The same tap twice, or from two places** (double click, a retry after a dropped connection, the web and the phone at once): one action, one receipt; the second answers with the card as it is now, never a second answer or a 500. Test: `TestJobActReplayAndRace` (Task 1.7).
-2. **Machinery words in the Assistant's wording** ("I'll ask the Equipo team…", a label naming a runner): a reasonable person expects Base never to name them. `team_ask` refuses text or labels containing Equipo, Coordinator, runner or Amadan (whole word, any case) with `machinery_words`. Test: `TestTeamAskRefusesMachineryWords` (Task 1.10).
-3. **Hostile or odd words in "Something else" and notes** (HTML, a Markdown link, only spaces, 1001 characters, NUL, right-to-left text): refused with 422 where invalid; otherwise shown as plain text in the receipt and the pill, never as markup. Tests: `TestJobActWordsBounds` (Task 1.7), `TestAskJobWordsShownAsText` (Task 1.20).
-4. **A stale page without scripts** (the person taps an option on a page loaded before the question changed): the form post is answered 303 to `/ask` with the pill redrawn, never an error page; with scripts the 409 redraws in place and says "That changed while you were looking." only when the redraw doesn't show it. Tests: `TestAskJobActStaleScriptsOff` (Task 1.17), `TestAskJobActConflictRedraws` (Task 1.20).
+2. **Machinery words in the Assistant's wording** ("I'll ask the Equipo team…", a label naming a runner, a why that mentions a branch): a reasonable person expects Base never to name them. Every Assistant-written field Base shows (`team_ask`'s text, labels, context, why, details) is refused with `machinery_words` when it contains a word of the spec's list (Equipo, team, Coordinator, runner, task, branch, merge, check, repository) or Amadan, whole word, any case, singular or plural. Test: `TestTeamAskRefusesMachineryWords` (Task 1.10).
+3. **Hostile or odd words in "Something else" and notes** (HTML, a Markdown link, only spaces, 1001 characters, NUL, right-to-left text): refused with 422 where invalid; otherwise shown as plain text in the receipt and the pill, never as markup. Tests: `TestJobActWordsBounds` (Task 1.7), `TestAskJobWordsShownAsText` (Task 1.19).
+4. **A stale page without scripts** (the person taps an option on a page loaded before the question changed): the form post is answered 303 to `/ask` with the pill redrawn, never an error page; with scripts the 409 redraws in place and says "That changed while you were looking." only when the redraw doesn't show it. Tests: `TestAskJobActStaleScriptsOff` (Task 1.17), `TestAskJobActConflictRedraws` (Task 1.19).
5. **Quiet hours and the daily cap in the person's own zone** (Madrid, across a DST change, a person who changes zone): no sweep turn inside quiet hours as the person reckons them; the rolling 24 h cap counts the same either side of DST. Test: `TestSweepTasteQuietHoursInZone` (Task 2.8).
## Deploy order and protocols
@@ -90,9 +90,9 @@
|---|---|---|
| 1.a | Equipo instance with decision cards (protocol 30), then runners (`upgrade-thin.sh`) | `Encode` downgrades per peer, but the instance must know protocol 30 before a runner speaks it |
| 1.b | Equipo instance, phase 1 (act endpoint, capability gate, notes); runner release with the mode-independent opening (Task 1.13) | Base's controls are drawn only from fields Equipo sends; an older Base ignores them (T13) |
-| 1.c | Base web, phase 1; then native build | Base new + Equipo old is safe (header ignored, no `ask` to draw), but useless; deploy after 1.b |
-| 2 | Equipo instance (protocol 31 known), then runners | No Base change in phase 2 beyond tests |
-| 3 | Equipo instance (protocol 32 known), then runners; T12 on staging | Base already draws `first_look` links from phase 1 |
+| 1.c | Base web and native build of phase 1, together | Base new + Equipo old is safe (header ignored, no `ask` to draw), but useless; deploy after 1.b. An older native app keeps its member in legacy mode (PD7), so the app may follow the web, never block it |
+| 2 | `honest-merge-refusals` merged; Equipo instance (protocol 31 known), then runners | No Base change in phase 2 beyond tests |
+| 3 | After phase 2: Equipo instance (protocol 32 known), then runners; T12 on staging | Base already draws `first_look` links from phase 1 |
| 4 | Equipo instance, then Base web and native | Base's fold rows read `updated_at`, sent since phase 1 |
Each step goes to staging (`*.oncarlos.com`) first, then production (`*.oficina.works`) after Paul's live check. Planning only: nothing here is deployed by the planner.
@@ -112,8 +112,7 @@ Verification only; the fixes are merged (table above).
The audit was not at `/home/paulca/amadan.net/carlos/base/.superpowers/sdd/2026-11-13-assistant-jobs/stopped-jobs-audit-2026-11-25.md` when this plan was written.
-- [ ] **Step 1:** When it lands, read its top fixes and add each as a Phase 0 task here (repository, files, failing test, fix), unless a task below already covers it (then note which).
-- [ ] **Step 2:** Commit the plan change on the branch carrying this plan.
+- [ ] **Step 1:** At the start of phase 0's execution, look for the report. If it is there, add each of its top fixes as a Phase 0 task here (repository, files, failing test, run command, commit), unless a task below already covers it (then note which), and commit the plan change. If it is not there, record "audit not landed" in the phase's progress notes and go on: phase 1 does not depend on it, and the audit's fixes join the next phase not yet started.
---
@@ -189,11 +188,12 @@ ALTER TABLE chat_cards ADD COLUMN ask_parts text; -- team_ask's context, rec
ALTER TABLE chat_cards ADD COLUMN open_words boolean; -- question card (filled from phase 2)
ALTER TABLE chat_handoffs ADD COLUMN dismiss_pending boolean;
ALTER TABLE chat_assistant_hosts ADD COLUMN capabilities text;
+CREATE TABLE chat_job_sweeps (subject_kind text NOT NULL, subject_id text NOT NULL, attempt integer NOT NULL DEFAULT 0, tries integer NOT NULL DEFAULT 0, next_at datetime, claimed_at datetime, PRIMARY KEY (subject_kind, subject_id, attempt));
CREATE TABLE chat_job_receipts (id text PRIMARY KEY, handoff_id text NOT NULL, person text NOT NULL, at datetime NOT NULL, copy_key text NOT NULL, arg text);
CREATE INDEX chat_job_receipt_handoff ON chat_job_receipts(handoff_id, at);
CREATE INDEX chat_card_job_sweep ON chat_cards(kind, lane, dismissed_at, checked_at);
```
-`ask_parts` is beyond the spec's migration: it stores the addendum's parts in the Assistant's words (PD4).
+`ask_parts` is beyond the spec's migration: it stores the addendum's parts in the Assistant's words (PD4). `chat_job_sweeps` moves here from phase 2 because `noteWordIt` turns (Task 1.11) are claimed and capped from phase 1.
**Interfaces (Produces):** `receiptRecord{ID, HandoffID, Person string; At time.Time; CopyKey, Arg string}`; `(t *txn) addReceipt(h handoffRecord, key, arg string) error`; `(t *txn) jobReceipts(h handoffRecord) ([]wire.JobReceipt, error)` (newest five, oldest first, text `fmt.Sprintf(t.copy(key), arg)`).
@@ -232,7 +232,7 @@ const jobViewVersion = 1 // bumped whenever jobState or jobView change meaning
```
`jobView` returns a `jobCardParts` struct instead of its growing tuple: `{State, Result, Detail, CarryOn string; Links []wire.CardLink; Ask *wire.JobAsk; Options []wire.CardOption; Actions []wire.CardOption; Decision *jobDecision; Context string; Link *wire.DecisionLink; Recommended *wire.Recommendation}`. `jobCardView` fills `UpdatedAt` from the card's `updated_at` and `Receipts` from `jobReceipts`. `projectJob` writes `decision_card/rev/cand`, `projected = jobViewVersion`, and moves the revision when any visible field **or** the decision identity changed (finding 1).
-Ask by kind (phase 1): a question in the job lane → `AskQuestion`, text and labels from `ask_text`/`ask_labels` when `team_ask` worded this exact decision, else no ask yet (K3 step 3, Task 1.11), `Words` false; a placement question → instance text and labels "Add to {project}" / "A new site" from the project display name; an open direction card → `AskDirection` per K11's four preview cases (`taskPreview`, preview step state, `ExpiresAt`), no buttons while the preview is queued or running; an approval kind → no ask, the K6 row (Task 1.6). Context, link and recommendation per PD4.
+Ask by kind (phase 1): a question in the job lane → `AskQuestion`, text and labels from `ask_text`/`ask_labels` when `team_ask` worded this exact decision, else no ask yet (K3 step 3, Task 1.11); `Words` true when the question has no options, when the question card has `open_words` (set from phase 2), or when the ask is the K3 fallback for this exact decision, and false for a placement question always (K4). The rule is one function, `askTakesWords(q cardRecord, d jobDecision, fallback bool) bool`, used by both the projection and Task 1.7's check; a placement question → instance text and labels "Add to {project}" / "A new site" from the project display name; an open direction card → `AskDirection` per K11's four preview cases (`taskPreview`, preview step state, `ExpiresAt`), no buttons while the preview is queued or running; an approval kind → no ask, the K6 row (Task 1.6). Context, link and recommendation per PD4.
- [ ] **Step 1: Failing tests:**
- `TestJobAskQuestionWorded`: after `team_ask` storage for decision D, the card's ask has D, the Assistant's text, labels with values `o1..oN`, and `recommended.option` a token.
@@ -240,12 +240,14 @@ Ask by kind (phase 1): a question in the job lane → `AskQuestion`, text and la
- `TestJobAskPlacement`: labels are `Add to <display name>` and `A new site`, never a repository path.
- `TestJobAskDirectionCases`: deployed → status key `first_look_ready`, ask present, link rel `first_look`; queued → `making_first_look`, no ask; failed/declined → `ready_to_decide` with the can't-be-shown text; expired → `ready_to_decide` with the expired text.
- `TestJobAskNoCoordinatorWords`: the Coordinator's question text and option labels appear nowhere in the marshalled card.
+ - `TestJobAskWords`: words offered for an optionless worded question and for the fallback; not for a question with options and no `open_words`; never for placement.
+ - `TestJobAskDirectionRecommendation`: a direction ask's `recommended.option` is one of `build`, `again`, `drop`, with instance why copy for each (Review may recommend `drop`).
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobAsk' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run, then `go test ./internal/equipo/chat -count=1`. Expected: PASS.
- [ ] **Step 5:** Commit `Job cards carry the decision in front of the person`.
-**Pending copy:** placement labels; K11 statuses and ask texts; direction context/why/details; "See the first look".
+**Pending copy:** placement labels, context and whys; K11 statuses and ask texts; direction context, whys (build, again, drop) and details; Try again's field label; the expired link note; "See the first look".
### Task 1.6 (Equipo): Stops with a reason and a next step (K6, phase 1 rows)
@@ -282,14 +284,14 @@ func (s *Store) ActOnJob(ctx context.Context, person, cardID string, in wire.Job
func (h *HTTP) jobAct(w http.ResponseWriter, r *http.Request, p personapi.PersonPrincipal) // POST /jobs/{id}/act
func (t *txn) actDone(h handoffRecord, person, action string) error // audit assistant.job.<action>, handoffActionRecord kind person_<action>, cancel a queued undispatched team_update of h, clear h's digest
```
-One transaction: ledger key `act:<card>:<key>` replay → card as now; project afresh; revision check; decision check (presented `decision` equals `decisionID` of the stored identity and the source card is still open at that revision and candidate); action offered now; then the path. `answer` with `choice` → `optionChoice` → `answerQuestion` in the job lane at the decision's revision (placement through `validatePlacementAnswer`); `answer` with `words` → words mode (K4): allowed only when the card's ask has `Words` (phase 1: the K3 fallback for that exact decision), never for placement; origin stays `originComposer`. Receipt `chose` (with the label shown) or `answered` (with the words).
+One transaction: ledger key `act:<card>:<key>` replay → card as now; project afresh; revision check; decision check (presented `decision` equals `decisionID` of the stored identity and the source card is still open at that revision and candidate); action offered now; then the path. `answer` with `choice` → `optionChoice` → `answerQuestion` in the job lane at the decision's revision (placement through `validatePlacementAnswer`); `answer` with `words` → words mode (K4): allowed only when `askTakesWords` (Task 1.5) holds for the bound decision, so never for placement; `answerQuestionOrigin` gains a `words bool` mode that skips the option check and keeps `originComposer`. Receipt `chose` (with the label shown) or `answered` (with the words).
- [ ] **Step 1: Failing tests:**
- `TestJobActAnswer` (T2): an option answer reaches `answerQuestion` at the decision's revision; card goes `working` with a receipt naming the shown label; a queued `team_update` is cancelled; stale revision → `ErrCardConflict` with the card; withdrawn decision or a new question with identical words → `ErrDecisionGone`; `words` when `ask.words` is false → `ErrInvalid`.
- `TestJobActPlacement` (T3, phase 1 half): a placement tap passes `validatePlacementAnswer` and `create_project` makes exactly that repository.
- `TestJobActReplayAndRace` (Review Focus 1): same key twice → one answer, one receipt, same card; two keys racing on one revision → one 200, one `card_stale`.
- `TestJobActWordsBounds` (Review Focus 3): empty, whitespace, over `wire.MaxMessageBytes`, NUL, invalid UTF-8 → `ErrInvalid`; HTML is stored as given.
- - `TestFreeWordsMode` (T17): words against a question with options only for the bound fallback decision, never placement, origin `originComposer`.
+ - `TestFreeWordsMode` (T17): words accepted for an optionless question, for the bound fallback decision, and (with the column set directly) for `open_words`; refused against a question with options otherwise, and always for placement; origin `originComposer`.
- `TestJobActHTTP`: route codes 200/409/422/403/404; 409 body is `AssistantConflict` with the card.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobAct|TestFreeWordsMode' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
@@ -321,11 +323,13 @@ One transaction: ledger key `act:<card>:<key>` replay → card as now; project a
func (t *txn) dropJob(person string, h handoffRecord, dismiss bool) error // teamCancel's body; dismiss sets dismiss_pending
func (t *txn) jobSettled(h handoffRecord) (bool, error) // no followed task CancelRequested with unterminated steps, no merge under way, no job-lane Coordinator turn in flight
func (t *txn) settleDismiss(h handoffRecord) error // called where a termination, a merge end or a turn end is recorded; sets dismissed_at and sends the card with hidden:true
+func (t *txn) mergeTaskAs(person, id string) error // MergeTask's body (merge.go), moved: isOwner, creator, not final or cancelled, mergeOffered, personMerge
```
-`retry` by the card's `stopRow.Retry`: `retryFailedStep` → `retryFailed(h)` as the person; `retryResend` → the hand-off's words sent again as `teamNudge`'s send; `retryMerge` → `MergeTask` (its `authorizeMerge`; `MergeBranch` records an already-merged candidate as merged). `drop` → `dropJob(…, false)`, receipt `dropped`. `dismiss` is offered in every job view and on finished pills: on a finished job (done, dropped, stopped with nothing running) it sets `dismissed_at` and hides at once; on unfinished work it is `dropJob(…, true)` (drop, then hide once settled). The "Drop this job too?" confirm is Base's, before it sends `dismiss` (O2 as proposed). `restore` clears `dismissed_at` and `dismiss_pending`, never undoes a drop. A dismissed card and the cards attached to it leave the snapshot; nothing is deleted.
+`Store.MergeTask` becomes `s.tx(…, CurrentPerson; t.mergeTaskAs(person, id))`, unchanged in behaviour, so `ActOnJob` runs the merge inside its own transaction with the decision check, ledger and receipt (one rollback for all). `retry` by the card's `stopRow.Retry`: `retryFailedStep` → `retryFailed(h)` as the person; `retryResend` → the hand-off's words sent again as `teamNudge`'s send; `retryMerge` → `mergeTaskAs` for the followed task whose merge failed (`MergeBranch` on the runner records an already-merged candidate as merged). `drop` → `dropJob(…, false)`, receipt `dropped`. `dismiss` is offered in every job view and on finished pills: on a finished job (done, dropped, stopped with nothing running) it sets `dismissed_at` and hides at once; on unfinished work it is `dropJob(…, true)` (drop, then hide once settled). The "Drop this job too?" confirm is Base's, before it sends `dismiss` (O2 as proposed). `restore` clears `dismissed_at` and `dismiss_pending`, never undoes a drop. A dismissed card and the cards attached to it leave the snapshot; nothing is deleted.
- [ ] **Step 1: Failing tests:**
- - `TestJobActRetry` (T5): each K6 Try again runs its path; Try again after `merge_uncertain` where the candidate already reached the default branch records it merged and makes no merge call.
+ - `TestJobActRetry` (T5): each K6 Try again runs its path; Try again after `merge_uncertain` where the candidate already reached the default branch records it merged and makes no merge call; a merge refused by `mergeTaskAs` (not offered any more) rolls back the receipt and ledger and answers `ErrDecisionGone` with the card; two racing Try again taps make one merge step.
+ - `TestMergeTaskUnchanged`: the existing `MergeTask` tests pass unchanged after the move.
- `TestJobDropDismiss` (T6): drop cancels created tasks only; restore brings back visibility, never the work; a dismissed card is absent from the snapshot and sent once with `hidden: true`.
- `TestDropSettles` (T16): a drop-and-dismiss during a running Engineering step, during a merge, and with the runner disconnected keeps the card visible as Stopping until termination is proven; then hidden; restore after that restores visibility only; `dismiss_pending` survives a store reopen.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobActRetry|TestJobDropDismiss|TestDropSettles' -count=1`. Expected: FAIL.
@@ -340,30 +344,44 @@ func (t *txn) settleDismiss(h handoffRecord) error // called where a termin
**Files:** `internal/equipo/chat/handoff.go` (`teamReply`, team ops list, `updateWrites`), `internal/equipo/chat/team_ask.go` (new), `internal/equipo/chat/assistant_tools.go` (descriptions), `internal/equipo/chat/team_ask_test.go` (new).
**Interfaces (Produces):**
-- `opTeamAsk = "team_ask"`, input `{request, decision, text, labels []string, context?, recommended?, why?, details? []string}`: text at most 140, one label per option at most 40, context at most 600 and why at most 200 (PD4), `recommended` one of the labels' tokens; stores `ask_text`, `ask_labels`, `ask_parts` on the job card for that decision and re-projects. Refusals: `stale_decision`, `person_only` (placement, approvals), `machinery_words`, `invalid_input`. `updateWrites = {team_reply, team_nudge, team_ask}`.
-- `team_reply` gains `decision` (required for a capable person in every turn kind; optional in legacy mode) and refuses `stale_decision` when it is not the open one, and `person_only` on a placement card for a capable person (legacy mode keeps today's relay, T13).
+- `opTeamAsk = "team_ask"`, input `{request, decision, text, labels []string, context, recommended?, why?, details? []string}`: text at most 140; one label per option, at most 40; `context` **required**, at most 600; when the question has options, `recommended` (an option token) and `why` (at most 200) **required**, as decision cards require of `ask_person`; `details` optional, one per option, at most 160 (the addendum's four parts). Stores `ask_text`, `ask_labels`, `ask_parts` on the job card for that decision and re-projects. Refusals: `stale_decision`, `person_only` (placement, approvals), `machinery_words` (any field, Review Focus 2; `func machineryWord(s string) (string, bool)` in `team_ask.go`), `invalid_input`. `updateWrites = {team_reply, team_nudge, team_ask}`.
+- `team_reply` gains `decision` (required for a capable person in every turn kind; optional in legacy mode) and refuses `stale_decision` when it is not the open one, and `person_only` on a placement card for a capable person (legacy mode keeps today's relay, T13). Every `team_reply` that answers writes a receipt: with the label the pill showed when `team_ask` had worded the decision (`assistant_chose`), else without the option (`assistant_answered`), never the Coordinator's option text.
- `team_status` and `openQuestionsNote` lines carry each question's `decision`.
- [ ] **Step 1: Failing tests:**
- `TestTeamAsk` (T10): rewording keeps values; a label count different from the options → `invalid_input`; a recommended token not offered → `invalid_input`.
- - `TestTeamAskRefusesMachineryWords` (Review Focus 2): "Equipo", "coordinator", "Runner", "Amadan" in text or a label → `machinery_words`; "running shoes" passes.
+ - `TestTeamAskRefusesMachineryWords` (Review Focus 2): each of Equipo, team(s), Coordinator, runner(s), task(s), branch(es), merge(s), check(s), repository/repositories, Amadan, in any case, in text, a label, context, why or a detail → `machinery_words` naming the word; "running shoes" and "checkout page" pass (whole words only).
+ - `TestTeamAskRequiresDecisionParts`: no context → `invalid_input`; options without `recommended` or `why` → `invalid_input`; an optionless question needs only context.
- `TestTeamReplyGuards` (T10, phase 1 half): `stale_decision` from a turn that started before the person answered; placement `person_only` for a capable person, relayed for a legacy one.
-- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestTeamAsk|TestTeamReplyGuards' -count=1`. Expected: FAIL.
+ - `TestTeamReplyReceipt`: a worded decision answered by the Assistant leaves "chose" with the shown label; an unworded one leaves the receipt without an option; both survive a snapshot reload.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestTeamAsk|TestTeamReply' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run, then `go test ./internal/thintest -run 'Assistant.*Reply' -count=1`. Expected: PASS.
- [ ] **Step 5:** Commit `team_ask, and team_reply bound to the decision it answers`.
+**Pending copy:** receipts `assistant_chose` "Answered “{option}” from what you said." and `assistant_answered` "Answered from what you said."
+
### Task 1.11 (Equipo): The Assistant hears what the person did; phase 1 notes (K3 step 3, K5, K16)
**Files:** `internal/equipo/chat/tools.go` (note constants), `internal/equipo/chat/handoff.go` (`jobNote`, `openQuestionsNote`), `internal/equipo/chat/jobs.go` (`updateEnded`), `internal/equipo/chat/store.go` (person turn assembly), `internal/equipo/chat/notes_test.go` (new).
-**Interfaces (Produces):** `const jobsMovingPhase = 1`; `(t *txn) jobNoteFor(h handoffRecord, capable bool) (string, error)` (legacy: today's text word for word); new notes `noteWordIt`, `noteDirection` (phase 1: without the build clause), `notePersonActed`; `noteAnswerIt` phase 1 (no default clause; names `decision`); `noteBlocked` for an Open-in-Equipo row ends "they can see what's needed on the job"; `(t *txn) personActedNote(person string, since time.Time) (string, error)` → the K5 block after the open-questions block, each `person_<action>` once. On `updateEnded`: when the job's open question has no Assistant answer and no `team_ask` for its decision, queue one `team_update` with `noteWordIt` (ledger key `wordit:<decision>`); when that one also ends without either, the card shows the K3 fallback ask (`Words: true`, no options, text key `assistant.job.ask.fallback`).
+**Interfaces (Produces):** `const jobsMovingPhase = 1`; `(t *txn) jobNoteFor(h handoffRecord, capable bool) (string, error)` (legacy: today's text word for word); new notes `noteWordIt`, `noteDirection` (phase 1: without the build clause), `notePersonActed`; `noteAnswerIt` phase 1 (no default clause; names `decision`); `noteBlocked` for an Open-in-Equipo row ends "they can see what's needed on the job"; `(t *txn) personActedNote(person string, since time.Time) (string, error)` → the K5 block after the open-questions block, each `person_<action>` once. One scheduling path for every instance-started note turn, used by `noteWordIt` here and `noteTasteUnanswered` in Task 2.8:
+```go
+type noteTurn string // noteTurnWordIt | noteTurnTaste
+// scheduleNoteTurn claims chat_job_sweeps (subject "question", the question card id, attempt = decision revision)
+// with a 5-minute lease, and queues one team_update for h with the note, only for a capable person,
+// once per question and kind, outside the person's quiet hours (their zone), and while the person's
+// assistant.job.sweep audits in the last 24 h number fewer than 6 (both kinds count). ok false: not queued.
+func (t *txn) scheduleNoteTurn(h handoffRecord, q cardRecord, kind noteTurn) (ok bool, err error)
+```
+On `updateEnded`: when the job's open question has no Assistant answer and no `team_ask` for its decision, `scheduleNoteTurn(…, noteTurnWordIt)`. The card shows the K3 fallback ask (`Words: true`, no options, text key `assistant.job.ask.fallback`) when that turn has ended without either, **or** when `scheduleNoteTurn` declined (cap, quiet hours, already used), so a question is never held back for a turn that won't come. Task 1.14's sweep calls the same check for any asking question with no ask, so a restart between the two turns recovers.
- [ ] **Step 1: Failing tests:**
- `TestNotesByModeAndPhase` (T15): legacy notes equal today's strings; capable phase 1 notes name only `team_reply`, `team_ask`, `team_nudge` with `decision`; no note mentions `team_add`, `basis`, `replaces`.
- `TestPersonActedBlock` (K5): two actions since the last turn → two lines, once each; the next turn carries none.
- `TestWordItThenFallback`: first quiet turn → one `noteWordIt` turn; second → fallback ask with `Words` and no options; a `team_ask` in between prevents the fallback.
-- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestNotesByModeAndPhase|TestPersonActedBlock|TestWordItThenFallback' -count=1`. Expected: FAIL.
+ - `TestWordItCappedOrQuietFallsBack`: with six sweep audits in the last 24 h, or inside quiet hours, no turn is queued and the fallback shows at once; two overlapping calls queue one turn; after a store reopen between the turns, the sweep finishes the job (fallback shown).
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestNotesByModeAndPhase|TestPersonActedBlock|TestWordIt' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement (model-facing notes are not copy; the spec's wording is used).
- [ ] **Step 4:** Run, then `go test ./internal/thintest -run Assistant -count=1`. Expected: PASS.
- [ ] **Step 5:** Commit `Notes by mode and phase; the Assistant hears what the person did`.
@@ -392,7 +410,7 @@ func (t *txn) settleDismiss(h handoffRecord) error // called where a termin
**Files:** `internal/equipo/chat/job_paused.go` (`refreshJobs` → move to `internal/equipo/chat/job_sweep.go`), `internal/equipo/chat/job_sweep_test.go` (new).
-**Interfaces:** `(s *Store) refreshJobs(ctx)` selects job cards not dismissed whose `projected < jobViewVersion`, or whose `checked_at` is null or older than 10 min with the hand-off `open` or `stopping`, or which are `working`/`paused` (today's rule, kept for the clock-driven paused words); oldest `checked_at` first; at most 200; each in its own transaction; sets `checked_at` either way. The migration's `projected` default 0 makes the first ticks after deploy re-project every card.
+**Interfaces:** `(s *Store) refreshJobs(ctx)` selects job cards not dismissed whose `projected < jobViewVersion`, or whose `checked_at` is null or older than 10 min with the hand-off `open` or `stopping`, or which are `working`/`paused` (today's rule, kept for the clock-driven paused words); oldest `checked_at` first; at most 200; each in its own transaction; sets `checked_at` either way; an `asking` card whose question has no ask yet gets Task 1.11's word-it check. The migration's `projected` default 0 makes the first ticks after deploy re-project every card.
- [ ] **Step 1: Failing test** `TestSweepReprojects` (T7): the job 1 data (merge failed at Ready to merge with "merge outcome unknown", card `working/finishing`) shows "Didn't go live" with Try again after one tick; an unchanged `stopped` card is re-checked only after 10 minutes (fake clock); 250 due cards → 200 in one tick, the rest next tick; a failing card is logged and skipped.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestSweepReprojects|Paused' -count=1`. Expected: FAIL on the new test.
@@ -420,9 +438,9 @@ func (c *Client) Act(ctx context.Context, token, id string, in Act) (Card, error
type Act struct { Action, Decision, Choice, Words, Note string; Revision int64; Key string }
func (c Card) FirstLook() (Link, bool)
```
-`call` sets `Base-Capabilities: job_actions` on every request to `/api/v1/assistant/*`. `CleanAt` keeps job options, `ask`, actions, receipts, decision parts and `first_look` links within the Global Constraints' bounds; drops unknown kinds, actions and non-http(s) links; `Recommended` kept only when it names a kept option value (or, for a direction, a kept action).
+The client takes the capability per call (`WithCapabilities(ctx, bool) context.Context`; Task 1.17 decides it per member), and both `call` and `Events` (which builds its own request) set `Base-Capabilities: job_actions` when it is on. `CleanAt` keeps job options, `ask`, actions, receipts, decision parts and `first_look` links within the Global Constraints' bounds; drops unknown kinds, actions and non-http(s) links. `Recommended` is kept only when it names one of the card's **effective choices**: for a direction ask, `build`, `again` or `drop` (the ask kind's own actions, which are never listed in `actions`); for any other ask or an outcome card, a kept option value.
-- [ ] **Step 1: Failing tests** `TestCleanJobAsk`, `TestCleanJobBounds` (each bound at limit and limit+1), `TestCleanDropsUnknownActions`, `TestCleanFirstLookLink` (javascript: dropped), `TestCapabilityHeaderOnEveryCall` (snapshot, events, messages, answer, carry_on, act, time-zone; `RegisterHost` body unchanged), `TestActConflictReturnsCard`.
+- [ ] **Step 1: Failing tests** `TestCleanJobAsk`, `TestCleanJobBounds` (each bound at limit and limit+1), `TestCleanDropsUnknownActions`, `TestCleanFirstLookLink` (javascript: dropped), `TestCleanDirectionRecommendation` (a direction ask recommending `build` keeps it with `actions` empty; recommending `o9` drops it), `TestCleanOutcomeDecisionParts` (a go-ahead and a Publish card keep context, link, recommended, details), `TestCapabilityHeaderOnEveryCall` (snapshot, **events**, messages, answer, carry_on, act, time-zone, each with the capability on and off; `RegisterHost` body unchanged), `TestActConflictReturnsCard`.
- [ ] **Step 2:** Run `go test ./internal/equipo -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
@@ -440,12 +458,14 @@ func (c Card) FirstLook() (Link, bool)
### Task 1.17 (Base): `POST /ask/jobs/{id}/act` relay
-**Files:** `internal/web/ask.go` (route), `internal/web/ask_relay.go` (`askAct`), `internal/webtest/ask_test.go`, `docs/api/base-native-v1.md`.
+**Files:** `internal/web/ask.go` (route), `internal/web/ask_relay.go` (`askAct`), `internal/web/ask_caps.go` (new), `internal/store/migrations/0013_ask_clients.sql` (new), `internal/store/askclients.go` (new), `internal/webtest/ask_test.go`, `docs/api/base-native-v1.md`.
-**Interfaces (Produces):** `func (a *app) askAct(w http.ResponseWriter, r *http.Request)`: form fields `action`, `decision`, `choice`, `words`, `note`, `revision`, `key`; JSON `{card}` to scripts (`wantsJSON`), 303 `/ask` without; Equipo's 409 → JSON 409 `{card}` (redraw) or 303; a 404 or `{card: null}` → reload; a retryable failure → JSON 502 `{error: "retry"}` for the script's message; the card through `CleanAt`. Contract section added to `base-native-v1.md`.
+**Interfaces (Produces):**
+- Capability per member (PD7): `CREATE TABLE ask_clients (member_id integer NOT NULL, client text NOT NULL, caps text NOT NULL DEFAULT '', seen_at datetime NOT NULL, PRIMARY KEY (member_id, client))`, where `client` is the native session Base resolved from the app's bearer (web cookie sessions are not recorded). `func (s *Store) SeeAskClient(ctx, member int64, client, caps string) error` on every native `/ask/*` call (`Base-Client-Capabilities` header); `func (a *app) askCapable(ctx context.Context, member int64) bool`: true unless a row seen in the last 30 days has `caps` without `job_actions`. Every relayed Equipo call takes `equipo.WithCapabilities(ctx, a.askCapable(…))`.
+- `func (a *app) askAct(w http.ResponseWriter, r *http.Request)`: form fields `action`, `decision`, `choice`, `words`, `note`, `revision`, `key`; JSON `{card}` to scripts (`wantsJSON`), 303 `/ask` without; Equipo's 409 → JSON 409 `{card}` (redraw) or 303; a 404 or `{card: null}` → reload; a retryable failure → JSON 502 `{error: "retry"}` for the script's message; the card through `CleanAt`. Contract section added to `base-native-v1.md`.
-- [ ] **Step 1: Failing tests:** `TestAskJobActRelaysEachAction` (bearer, key, decision, every action), `TestAskJobActConflictPassesCard`, `TestAskJobActStaleScriptsOff` (Review Focus 4: 303 to `/ask`, no error page, pill shows the new state), `TestAskCapabilityHeaderForOldMember` (a member whose host was registered before this release).
-- [ ] **Step 2:** Run `go test ./internal/webtest -run 'TestAskJobAct|TestAskCapability' -count=1`. Expected: FAIL.
+- [ ] **Step 1: Failing tests:** `TestAskJobActRelaysEachAction` (bearer, key, decision, every action), `TestAskJobActConflictPassesCard`, `TestAskJobActStaleScriptsOff` (Review Focus 4: 303 to `/ask`, no error page, pill shows the new state), `TestAskCapabilityHeaderForOldMember` (a member whose host was registered before this release), `TestAskCapabilityWithheldForOldNative` (old native + new Base + new Equipo fake: after the app calls `/ask/state` without the client header, the member's snapshot, events and sends go without `Base-Capabilities`, and the fake keeps asking in prose; after a new app's call with it, and no old one within 30 days, the header returns), `TestAskCapabilityWebOnly` (a member with no native rows is capable).
+- [ ] **Step 2:** Run `go test ./internal/webtest ./internal/store -run 'TestAskJobAct|TestAskCapability|AskClient' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
- [ ] **Step 5:** Commit `Relay a job action from the pill, with or without scripts`.
@@ -454,47 +474,41 @@ func (c Card) FirstLook() (Link, bool)
**Files:** `internal/web/templates/partials/chat.html` (`ask-job`, `ask-jobview`, new `ask-jobask`, `ask-receipts`), `internal/web/ask.go` (view helpers), `internal/look/static/app.css`, `internal/webtest/ask_test.go`.
-What it draws (no scripts needed): while `asking`, the ask strip under the pill title: context line, the link to the thing (or its note when not ready) **before** the options, one form button per option (detail under it when set), the recommended option marked with "Recommended" and its why, and "Something else" as a nested `<details>` with a one-line field "Tell me what you'd like" and "Send" when `ask.words`; a direction's Build it / Try again (a `<details>` with "What should change?", required, maxlength 1000) / Drop it (a `<details>` confirm). While `stopped`, the detail line and its actions (Try again, Drop it, Dismiss). The job view: the same, plus receipts, Dismiss on finished jobs, and for unfinished work Drop it's confirm "Drop this job too?" with "Drop it" / "Keep it" when reached from Dismiss. Look: option buttons are the ghost buttons; Try again and Build it the solid frost primary; Drop it and Dismiss quiet text buttons; the first-look link accent teal; reduced motion respected.
+What it draws (no scripts needed): while `asking`, the ask strip under the pill title: context line, the link to the thing (or its note when not ready) **before** the options, one form button per option (detail under it when set), the recommended option marked with "Recommended" and its why, and "Something else" as a nested `<details>` with a one-line field "Tell me what you'd like" and "Send" when `ask.words`; a direction's Build it / Try again (a `<details>` whose field is labelled with the instance's `ask.note`, required, maxlength 1000) / Drop it (a `<details>` confirm). **Outcome cards too** (addendum): the existing `ask-card` (go-ahead, Publish) draws the same context, link-before-options, recommended mark and option details, through one shared partial `ask-decision` used by both. While `stopped`, the detail line and its actions (Try again, Drop it, Dismiss). The job view: the same, plus receipts, Dismiss on finished jobs, and for unfinished work Drop it's confirm "Drop this job too?" with "Drop it" / "Keep it" when reached from Dismiss. Look: option buttons are the ghost buttons; Try again and Build it the solid frost primary; Drop it and Dismiss quiet text buttons; the first-look link accent teal; reduced motion respected.
-- [ ] **Step 1: Failing tests (webtest):** `TestAskJobAskDrawn` (option forms carry `decision`, `choice`, `revision`, `key`; link before options; recommended marked), `TestAskJobStopDrawn`, `TestAskJobReceiptsDrawn`, `TestAskJobNoActionsWithoutAsk` (an older Equipo: nothing new drawn).
-- [ ] **Step 2:** Run `go test ./internal/webtest -run 'TestAskJob(Ask|Stop|Receipts|NoActions)' -count=1`. Expected: FAIL.
+- [ ] **Step 1: Failing tests (webtest):** `TestAskJobAskDrawn` (option forms carry `decision`, `choice`, `revision`, `key`; link before options; recommended marked), `TestAskJobDirectionDrawn` (note label from `ask.note`), `TestAskJobStopDrawn`, `TestAskJobReceiptsDrawn`, `TestAskJobNoActionsWithoutAsk` (an older Equipo: nothing new drawn), `TestAskOutcomeDecisionDrawn` (a go-ahead and a Publish card show context, link before options, recommended and details; one with none of them draws as today).
+- [ ] **Step 2:** Run `go test ./internal/webtest -run 'TestAsk(Job(Ask|Direction|Stop|Receipts|NoActions)|OutcomeDecision)' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement with approved copy (Task 1.0); add rows to `docs/copy-pending.md`.
- [ ] **Step 4:** Run. Expected: PASS.
- [ ] **Step 5:** Commit `Pill and job view carry the decision, drawn by the server`.
-**Pending copy (Base):** "Something else", "Tell me what you'd like", "Send", "Build it", "Try again", "What should change?", "Drop it", "Drop this job?", "Drop this job too?", "Keep it", "Dismiss", "Recommended".
+**Pending copy (Base):** "Something else", "Tell me what you'd like", "Send", "Build it", "Try again", "Drop it", "Drop this job?", "Drop this job too?", "Keep it", "Dismiss", "Recommended".
-### Task 1.19 (Base): `ask.js` draws and acts
+### Task 1.19 (Base): `ask.js` draws and acts, browser tests first
-**Files:** `internal/look/static/ask.js` (`addJob`, `jobView`, new `jobAsk`, `act`), `internal/look/static/app.css`.
+**Files:** `internal/browsertest/jobs_act_test.go` (new), `internal/look/static/ask.js` (`addJob`, `jobView`, `addCard`, new `decisionParts`, `jobAsk`, `act`), `internal/look/static/app.css`.
-Behaviour: `addJob` draws Task 1.18's markup from the card; a tap posts `/ask/jobs/{id}/act` with a fresh key kept until an answer settles it (as Carry on now); 200 redraws the pill in place; 409 redraws and announces "That changed while you were looking." only when the redrawn pill has the same state and no ask change; a retryable failure says "Couldn't do that just now. Try again." in the job view's one live region; a job whose state becomes `asking`, `stopped` or `ready` moves to the end of the thread (no slide with reduced motion); `hidden: true` removes the pill and shows "Dismissed. Undo" for 8 s (Undo posts `restore`); Something else expands a field inside the pill, focused, Escape closes it and returns focus; the focus-twins list gains the new controls.
+Behaviour: `addJob` draws Task 1.18's markup from the card; a tap posts `/ask/jobs/{id}/act` with a fresh key kept until an answer settles it (as Carry on now); 200 redraws the pill in place; 409 redraws and announces "That changed while you were looking." only when the redrawn pill has the same state and no ask change; a retryable failure says "Couldn't do that just now. Try again." in the job view's one live region; a job whose state becomes `asking`, `stopped` or `ready` moves to the end of the thread (no slide with reduced motion); `hidden: true` removes the pill and shows "Dismissed. Undo" for 8 s (Undo posts `restore`); Something else expands a field inside the pill, focused, Escape closes it and returns focus; the focus-twins list gains the new controls. `addCard` draws an outcome card's decision parts with the same `decisionParts` as the pill.
-- [ ] **Step 1:** No unit harness for `ask.js`; its tests are Task 1.20's browser tests. Implement.
-- [ ] **Step 2:** Run `go test ./internal/webtest -count=1` (pinned `ask.js` strings, if any). Expected: PASS.
-- [ ] **Step 3:** Commit `ask.js: answer, build, try again, drop and dismiss from the pill`.
+- [ ] **Step 1: Failing browser tests:** `TestAskJobAnswerFromPill` (options, keyboard only), `TestAskJobSomethingElse` (field focus, Escape, send), `TestAskJobWordsShownAsText` (Review Focus 3: `<b>` and a Markdown link in words show literally in the receipt), `TestAskJobBuildTryAgainDrop` (note required; drop confirm), `TestAskJobDismissUndo` (8 s, fake clock), `TestAskJobStoppingStaysVisible`, `TestAskJobMovesToEnd`, `TestAskJobReceiptsAfterReload`, `TestAskJobFirstLookLinkOnWorkingPill`, `TestAskJobActConflictRedraws` (Review Focus 4), `TestAskJobPhoneSheet`, `TestAskJobScriptsOffEveryAction`, `TestAskOutcomeDecisionLive` (a go-ahead arriving by event shows its parts), plus light and dark screenshots of asking, stopped, an outcome card with its parts, and the job view.
+- [ ] **Step 2:** Run `go test -tags browser ./internal/browsertest -run 'TestAsk(Job|OutcomeDecision)' -timeout 20m -count=1`. Expected: FAIL on the new tests.
+- [ ] **Step 3:** Implement in `ask.js` and `app.css` with approved copy.
+- [ ] **Step 4:** Run the same command. Expected: PASS.
+- [ ] **Step 5:** Commit `ask.js: answer, build, try again, drop and dismiss from the pill`.
**Pending copy (Base):** "That changed while you were looking.", "Couldn't do that just now. Try again.", "Dismissed.", "Undo".
-### Task 1.20 (Base): Browser tests, phase 1
-
-**Files:** `internal/browsertest/jobs_act_test.go` (new).
+### Task 1.20 (Base, native): Pill actions in the Mac and iPhone app (PD10)
-- [ ] **Step 1: Tests:** `TestAskJobAnswerFromPill` (options, keyboard only), `TestAskJobSomethingElse` (field focus, Escape, send), `TestAskJobWordsShownAsText` (Review Focus 3: `<b>` and a Markdown link in words show literally in the receipt), `TestAskJobBuildTryAgainDrop` (note required; drop confirm), `TestAskJobDismissUndo` (8 s, fake clock), `TestAskJobStoppingStaysVisible`, `TestAskJobMovesToEnd`, `TestAskJobReceiptsAfterReload`, `TestAskJobFirstLookLinkOnWorkingPill`, `TestAskJobActConflictRedraws` (Review Focus 4), `TestAskJobPhoneSheet`, `TestAskJobScriptsOffEveryAction`, plus light and dark screenshots of asking, stopped and the job view.
-- [ ] **Step 2:** Run `go test -tags browser ./internal/browsertest -run 'TestAskJob' -timeout 20m -count=1`. Expected: PASS.
-- [ ] **Step 3:** Commit `Browser tests for acting on a job from the pill`.
+**Files:** `native/apple/Sources/BaseKit/API/Models.swift` (`AskCard` gains ask, actions, receipts, decision parts, option detail, hidden, updatedAt), `API/Client.swift` (`act`; every `/ask/*` request sends `Base-Client-Capabilities: job_actions`), `Ask/AskModel.swift` (`act(card:action:…)`, key kept per revision until settled, 409 reloads `/ask/state`), `Ask/Pill.swift`, `Ask/Card.swift` (outcome cards' decision parts), the job view, `Resources/Localizable.xcstrings`, `Tests/BaseKitTests/AskModelTests.swift`, `Tests/BaseSnapshots/AskSnapshots.swift`.
-### Task 1.21 (Base, native): Pill actions in the Mac and iPhone app (PD10)
-
-**Files:** `native/apple/Sources/BaseKit/API/Models.swift` (`AskCard` gains ask, actions, receipts, decision parts, hidden, updatedAt), `API/Client.swift` (`act`), `Ask/AskModel.swift` (`act(card:action:…)`, key kept per revision until settled, 409 reloads `/ask/state`), `Ask/Pill.swift`, the job view, `Resources/Localizable.xcstrings`, `Tests/BaseKitTests/AskModelTests.swift`, `Tests/BaseSnapshots/AskSnapshots.swift`.
-
-- [ ] **Step 1: Failing tests:** `testActKeepsKeyUntilSettled`, `testActConflictReloads`, `testHiddenRemovesPillAndOffersUndo`, `testUnknownActionNotDrawn`.
+- [ ] **Step 1: Failing tests:** `testActKeepsKeyUntilSettled`, `testActConflictReloads`, `testHiddenRemovesPillAndOffersUndo`, `testUnknownActionNotDrawn`, `testClientCapabilityHeaderOnAskCalls`, `testOutcomeCardDecisionParts`.
- [ ] **Step 2:** Run `make native-check`. Expected: FAIL on the new tests.
- [ ] **Step 3:** Implement with the approved strings (same text as the web).
-- [ ] **Step 4:** Run `make native-check`; record snapshots asking, stopped, job view (Mac, iPhone, light, dark, AX3). Expected: PASS.
+- [ ] **Step 4:** Run `make native-check`; record snapshots asking, stopped, job view, a go-ahead with its parts (Mac, iPhone, light, dark, AX3). Expected: PASS.
- [ ] **Step 5:** Commit `Native: act on a job from the pill`.
-### Task 1.22 (Base): End to end, and phase 1 gates
+### Task 1.21 (Base): End to end, and phase 1 gates
**Files:** `internal/e2e/handoff_test.go`.
@@ -524,9 +538,9 @@ Behaviour: `addJob` draws Task 1.18's markup from the card; a tap posts `/ask/jo
### Task 2.2 (Equipo, runner): `ask_person` fields from the Coordinator
-**Files:** `internal/runner/thin/mcp.go` (`ask_person` schema), `internal/runner/thin/claude.go` (job-lane guidance: mark taste questions, offer a default), `internal/equipo/chat/tools.go` (store `about`, `default_option`, `open_words` on the question card), `internal/equipo/migrations/0109_jobs_sweep.sql` (adds `chat_cards.about`, `chat_cards.default_option`, and Task 2.7's sweep table).
+**Files:** `internal/runner/thin/mcp.go` (`ask_person` schema), `internal/runner/thin/claude.go` (job-lane guidance: mark taste questions, offer a default), `internal/equipo/chat/tools.go` (store `about`, `default_option`, `open_words` on the question card), `internal/equipo/migrations/0109_jobs_sweep.sql` (adds `chat_cards.about`, `chat_cards.default_option`, `chat_handoffs.source_message` for Task 2.11).
-- [ ] **Step 1: Failing tests:** `TestAskPersonAboutDefault` (instance: a `default` not among the options is refused; missing `about` is `decision`); runner `TestAskPersonSchemaJobsMoving`.
+- [ ] **Step 1: Failing tests:** `TestAskPersonAboutDefault` (instance: a `default` not among the options is refused; missing `about` is `decision`); `TestOpenWordsOnThePill` (an `open: true` question with options projects `ask.words` true and `ActOnJob` accepts words for it; placement never); runner `TestAskPersonSchemaJobsMoving`.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat ./internal/runner/thin -run 'AskPerson' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
@@ -534,12 +548,14 @@ Behaviour: `addJob` draws Task 1.18's markup from the card; a tap posts `/ask/jo
### Task 2.3 (Equipo, runner): Merge faults reported as such (PD11)
-**Files:** `internal/runner/thin/mergestep.go`, `internal/runner/thin/mergestep_test.go`, `internal/equipo/chat/job_stop.go`.
+**Prerequisite:** `honest-merge-refusals` merged (PD11). It makes `forge.MergeBranch` return a local refusal (no credential) as a final error of its own instead of `ErrMergeUncertain`. Rebase onto it first and read its error and reason names; the names below stand in for them.
-`forge.ErrMergeRefused` before contacting the hub → `ReasonMergeIdentity` (or, if `honest-merge-refusals` has landed, its no-access reason, mapped to the same row); `ErrMergeUncertain` after the runner's retries → `ReasonMergeUncertain`. `stopView` adds `stopFault` rows: `merge_identity` and `merge_uncertain` → "Didn't go live", Try again (`retryMerge`), Drop it.
+**Files:** `internal/runner/thin/mergestep.go`, `internal/runner/thin/mergestep_test.go`, `internal/equipo/chat/job_stop.go`, `internal/equipo/chat/job_stop_test.go`.
-- [ ] **Step 1: Failing tests:** runner `TestMergeStepFaultReasons`; instance `TestStopViewMergeFaults`.
-- [ ] **Step 2:** Run `go test ./internal/runner/thin ./internal/equipo/chat -run 'MergeStepFault|StopViewMergeFaults' -count=1`. Expected: FAIL.
+The final local refusal from `MergeBranch` → `ReasonMergeIdentity` (if that branch already reports its own reason code, map that code to the `merge_identity` row and add no second one); `ErrMergeUncertain` after the runner's retries → `ReasonMergeUncertain`. `stopView` adds `stopFault` rows: `merge_identity` and `merge_uncertain` → "Didn't go live", Try again (`retryMerge`), Drop it.
+
+- [ ] **Step 1: Failing tests:** runner `TestMergeStepFaultReasons`, driven **through `forge.MergeBranch`** with a fake forge that has no credential for the repository (→ `merge_identity`) and one that times out every try (→ `merge_uncertain`); instance `TestStopViewMergeFaults`.
+- [ ] **Step 2:** Run `go test ./internal/runner/thin ./internal/runner/forge ./internal/equipo/chat -run 'MergeStepFault|StopViewMergeFaults|MergeDetail' -count=1`. Expected: FAIL on the new tests.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
- [ ] **Step 5:** Commit `Merge faults say whose they are; the person's Try again stays safe`.
@@ -548,9 +564,9 @@ Behaviour: `addJob` draws Task 1.18's markup from the card; a tap posts `/ask/jo
**Files:** `internal/equipo/chat/handoff.go` (`teamReply`), `internal/equipo/chat/team_reply_test.go`.
-`team_reply` gains `basis` (`conversation` | `default`); `default` refused `person_only` unless the question's `about` is `taste`; `team_reply` answers an open direction with `build`, or `again` with a note, bound to `decision`; `drop` refused; approvals `person_only`. Receipt for a default: "Went ahead with “{option}”."; for build: "Building it from the first look."
+`team_reply` gains `basis` (`conversation` | `default`); `default` refused `person_only` unless the question's `about` is `taste`; `team_reply` answers an open direction with `build`, or `again` with a note, bound to `decision`, **only in K11's first case** (the first look deployed: `taskPreview` returns a link). While the preview is queued or running it is refused `not_yet`; when it failed, was declined, is disabled or has expired it is refused `person_only` (the person decides). `drop` is always refused; approvals `person_only`. The rule is one function, `directionOpenToAssistant(t *txn, c cardRecord) (ok bool, refusal string, err error)`, also used by `noteDirection` so the note offers build only when it would be accepted. Receipt for a default: "Went ahead with “{option}”."; for build: "Building it from the first look."
-- [ ] **Step 1: Failing test** `TestTeamReplyGuards` (T10, phase 2 half): `default` on `decision` refused; direction `build` and `again` accepted, `drop` refused; approvals refused.
+- [ ] **Step 1: Failing test** `TestTeamReplyGuards` (T10, phase 2 half): `default` on `decision` refused; direction `build` and `again` accepted with a deployed first look; refused `not_yet` while queued and running; refused `person_only` when failed, declined and expired; `drop` refused; approvals refused.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestTeamReplyGuards -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
@@ -582,9 +598,9 @@ Rows: `preview_scanner` with retries left → `working` "Retrying shortly"; retr
### Task 2.7 (Equipo): Sweep state and preview retries (K8 step 2)
-**Files:** `0109_jobs_sweep.sql` (`chat_job_sweeps` as the spec), `internal/equipo/chat/job_sweep.go`, `internal/equipo/chat/preview.go` (`retryPreview`), `internal/equipo/chat/job_sweep_test.go`.
+**Files:** `internal/equipo/chat/job_sweep.go`, `internal/equipo/chat/preview.go` (`retryPreview`), `internal/equipo/chat/job_sweep_test.go`. (`chat_job_sweeps` exists from Task 1.3.)
-**Interfaces (Produces):** `func (t *txn) claimSweep(kind, id string, attempt int64, lease time.Duration) (sweepRow, bool, error)`; `func (t *txn) retryPreview(k *taskRecord, step stepRecord, attempt int64) error` (the same preview step's next attempt for its candidate, through `authorizePreview`, `previewRefusal` and the export digest); tries at 2, 10, 30 min; a newer candidate withdraws the retry.
+**Interfaces (Produces):** `func (t *txn) claimSweep(kind, id string, attempt int64, lease time.Duration) (sweepRow, bool, error)` (Task 1.11's `scheduleNoteTurn` is refactored onto it); `func (t *txn) retryPreview(k *taskRecord, step stepRecord, attempt int64) error` (the same preview step's next attempt for its candidate, through `authorizePreview`, `previewRefusal` and the export digest); tries at 2, 10, 30 min; a newer candidate withdraws the retry.
- [ ] **Step 1: Failing test** `TestSweepPreviewRetries` (T8): job 6's data (failed `preview_scanner`, then failed merge) gets the same preview step's next attempt at 2, 10, 30 minutes through `previewRefusal`; a newer candidate withdraws; the sweep never merges (`hkForbid("merge")` asserted); two overlapping ticks act once.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestSweepPreviewRetries -count=1`. Expected: FAIL.
@@ -596,9 +612,9 @@ Rows: `preview_scanner` with retries left → `working` "Retrying shortly"; retr
**Files:** `internal/equipo/chat/job_sweep.go`, `internal/equipo/chat/handoff.go` (`tellAssistant` exception), `internal/equipo/chat/tools.go` (`noteTasteUnanswered`), `internal/equipo/chat/job_sweep_test.go`.
-A `taste` question asking 2 h with no person action → one `team_update` with `noteTasteUnanswered` (claimed, capped: per question once; per person 6 per rolling 24 h counted from `assistant.job.sweep` audits; none in quiet hours in the person's zone). Still open at 24 h with a `default_option` → instance answers through `answerQuestion` at the decision's revision (`originGenerated`, audit `assistant.job.default`, receipt `went_ahead`). Never for `decision` questions or placement. `tellAssistant`'s housekeeping guard admits only `noteWordIt` and `noteTasteUnanswered` turns from the sweep.
+A `taste` question asking 2 h with no person action → `scheduleNoteTurn(…, noteTurnTaste)` (Task 1.11: claimed, once per question, sharing the 6-per-rolling-24 h cap with `noteWordIt`, none in quiet hours in the person's zone). Still open at 24 h with a `default_option` → instance answers through `answerQuestion` at the decision's revision (`originGenerated`, audit `assistant.job.default`, receipt `went_ahead`). Never for `decision` questions or placement. `tellAssistant`'s housekeeping guard admits only `noteWordIt` and `noteTasteUnanswered` turns from the sweep.
-- [ ] **Step 1: Failing tests:** `TestSweepTaste` (T9): one turn at 2 h and none after; daily cap across ticks and a store reopen; 24 h default for `taste` with a default only; two overlapping ticks act once. `TestSweepTasteQuietHoursInZone` (Review Focus 5): person in Europe/Madrid with quiet 22–07; nothing at 23:00 local; cap identical across the March DST change.
+- [ ] **Step 1: Failing tests:** `TestSweepTaste` (T9): one turn at 2 h and none after; daily cap across ticks and a store reopen, counting `noteWordIt` and `noteTasteUnanswered` turns together; 24 h default for `taste` with a default only; two overlapping ticks act once. `TestSweepTasteQuietHoursInZone` (Review Focus 5): person in Europe/Madrid with quiet 22–07; nothing at 23:00 local; cap identical across the March DST change.
- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestSweepTaste' -count=1`. Expected: FAIL.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
@@ -628,12 +644,12 @@ A `taste` question asking 2 h with no person action → one `team_update` with `
### Task 2.11 (Equipo): O1, a new site from Base without "Where should this go?"
-**Files:** `internal/equipo/chat/placement_consent.go` (`createConsent`), `internal/equipo/chat/placement_test.go`.
+**Files:** `internal/equipo/chat/handoff.go` (`teamRequest` records provenance), `internal/equipo/chat/placement_consent.go` (`createConsent`), `internal/equipo/chat/placement_card.go` (proposal reused), `internal/thintest/assistant_o1_contract_test.go` (new).
-`createConsent` also accepts a hand-off's first message when it is the person's own words in the Assistant lane (`originComposer`, `team_request`'s quote check), named no existing project, and the proposed repository is the placement card's `new_repo`.
+Provenance: the hand-off's own message is the instance's send into the job lane (`handoffKey+h.ID`), so it is never `originComposer`. `teamRequest` already checks that `words` quote the person's Assistant-lane messages; it now stores the id of the person message the quote was found in as `chat_handoffs.source_message` (Task 2.2's migration). `createConsent(r, repo)` for a turn `r` in a job lane: find the hand-off by `r.Lane`; require that `r` is a turn of the hand-off's own first message (`h.MessageID`'s turn), that `source_message` is a person message with `Origin == originComposer` and `Lane == wire.LaneAssistant`, that its words name no existing project of the person's (the matcher `project_resolution.go` uses for the placement card), and that `repo` equals the `NewRepo` the placement proposal would offer for those words (the function that fills `placementData.NewRepo`, called without raising a card). Hand-offs made before phase 2 have no `source_message` and keep the placement card.
-- [ ] **Step 1: Failing test** `TestCreateConsentFromHandoff` (T3 extended): allowed in exactly that case; refused when the words name an existing project, when the repository differs, or when the words were not the person's.
-- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestCreateConsent|Placement' -count=1`. Expected: FAIL on the new test.
+- [ ] **Step 1: Failing tests:** `TestCreateConsentFromHandoff` (store): allowed in exactly that case; refused when the words name an existing project, when the repository differs from the proposal, when `source_message` is not `originComposer` or not in the Assistant lane, for a turn that is not the hand-off's first, and for a hand-off without `source_message`. `TestO1NewSiteWithoutPlacement` (thintest, the whole path): a person message "make me a website about Viennese pastries" → `team_request` → the job's Coordinator turn calls `create_project` with the proposed repository → the project exists, no placement card was raised; the same with words naming an existing project → a placement card is raised and nothing is created.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat ./internal/thintest -run 'TestCreateConsent|TestO1|Placement' -count=1`. Expected: FAIL on the new tests.
- [ ] **Step 3:** Implement.
- [ ] **Step 4:** Run. Expected: PASS.
- [ ] **Step 5:** Commit `O1: a new site from Base starts without asking where it goes`.
@@ -642,11 +658,13 @@ A `taste` question asking 2 h with no person action → one `team_update` with `
**Files:** `internal/equipo/chat/tools.go`, `internal/equipo/chat/handoff.go`, `internal/equipo/chat/notes_test.go`.
-`jobsMovingPhase = 2`: `noteAnswerIt` gains the default clause, `noteDirection` the build clause, plus `noteFault`, `noteTasteUnanswered` and a `team_add` line.
+`jobsMovingPhase = 2`: `noteAnswerIt` gains the default clause, `noteDirection` the build clause (only when `directionOpenToAssistant` holds), plus `noteFault`, `noteTasteUnanswered` and a `team_add` line.
-- [ ] **Step 1:** Extend `TestNotesByModeAndPhase` (T15) for phase 2; legacy unchanged.
-- [ ] **Step 2:** Run, implement, run. Expected: PASS.
-- [ ] **Step 3:** Equipo `make ci`. Commit `Phase 2 notes: defaults, build from a first look, faults`.
+- [ ] **Step 1: Failing test:** extend `TestNotesByModeAndPhase` (T15): at phase 2 a capable person's notes name `basis`, `team_add` and the build clause, never `replaces`; legacy notes unchanged word for word.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestNotesByModeAndPhase -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement; set `jobsMovingPhase = 2`.
+- [ ] **Step 4:** Run the test, then Equipo `make ci`. Expected: PASS.
+- [ ] **Step 5:** Commit `Phase 2 notes: defaults, build from a first look, faults`.
---
@@ -660,9 +678,13 @@ A `taste` question asking 2 h with no person action → one `team_update` with `
**Files:** `internal/wire/runners.go`, `internal/wire/first_look.go` (new), `internal/wire/runners_test.go`.
-`ProtocolFirstLook = Protocol32`: `record_task` gains `FirstLook bool`; a review dispatch gains `Mode string` (`"first_look"`); an Engineering dispatch gains `FirstLookNote string`. Below 32, `Encode` drops all three (`downgradeFirstLook`).
+`ProtocolFirstLook = Protocol32`: `record_task`'s tool input gains `first_look bool`; `DispatchCommand` (`internal/wire/tasks.go`) gains `ReviewMode string` (`ReviewModeFirstLook = "first_look"`, Review steps only) and `FirstLookNote string` (Engineering steps only). Below 32, `Encode` drops all three (`downgradeFirstLook`).
-- [ ] **Step 1–5:** `TestDowngradeFirstLook`, `TestSpokenIs32`; run `go test ./internal/wire -count=1`; implement; commit `Protocol 32: first look, its review mode and Engineering's note`.
+- [ ] **Step 1: Failing tests:** `TestDowngradeFirstLook` (at 31 the three fields are gone and nothing else changes; at 32 they pass), `TestSpokenIs32`.
+- [ ] **Step 2:** Run `go test ./internal/wire -run 'FirstLook|Spoken' -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement.
+- [ ] **Step 4:** Run `go test ./internal/wire -count=1`. Expected: PASS.
+- [ ] **Step 5:** Commit `Protocol 32: first look, its review mode and Engineering's note`.
### Task 3.2 (Equipo): First look on the instance
@@ -671,35 +693,48 @@ A `taste` question asking 2 h with no person action → one `team_update` with `
`first_look` honoured only in a job lane (instance-assigned marker); Engineering's dispatch gets the limits as `FirstLookNote` (one static page, plain HTML and CSS, no build step, one pass), never in the brief; review dispatched with mode `first_look`; `schedulePreview` runs on that approval; `buildThisOne`'s brief carries no first-look limits.
- [ ] **Step 1: Failing test** `TestFirstLookReview` (T14): `preview_security_test.go`'s cases run under both review modes (changed candidate, revoked owner, public-host consent, unsafe-preview grant, digest mismatch, scanner failure); `first_look` set only by `record_task` in a job lane; the build's brief has no limits.
-- [ ] **Step 2–5:** Run `go test ./internal/equipo/chat -run 'TestFirstLookReview|PreviewSecurity' -count=1` (FAIL), implement, run (PASS), commit `First looks: short safety review, preview first, limits off the brief`.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestFirstLookReview|PreviewSecurity' -count=1`. Expected: FAIL on the new cases.
+- [ ] **Step 3:** Implement.
+- [ ] **Step 4:** Run the same. Expected: PASS.
+- [ ] **Step 5:** Commit `First looks: short safety review, preview first, limits off the brief`.
-### Task 3.3 (Equipo, runner): Review mode and the Coordinator's job-lane rules (K13)
+### Task 3.3 (Equipo, runner): First look through the runner, end to end (K13)
-**Files:** `internal/runner/thin/judge.go` (Review: safety only in `first_look` mode, no quality findings, no fix rounds), `internal/runner/thin/claude.go` (job lanes only: start a new site as `record_task` kind `explore` with `first_look: true`; never ask what sort of site first; mark later questions `about: taste`), `internal/runner/thin/claude_test.go`.
+**Files:** `internal/runner/thin/mcp.go` (`record_task` schema gains `first_look`, described for job threads only), `internal/runner/thin/state.go` (the runner's step row keeps `review_mode` and `first_look_note`, so a reconnect or restart re-runs the step the same way), `internal/runner/thin/engineer.go` (`stepPrompt` appends `FirstLookNote` as a separate dispatch note after the brief, never into it), `internal/runner/thin/judge.go` (in `first_look` mode Review checks safety only: secrets, scripts that reach out, injected instructions, anything unsafe to show; no quality findings, no fix rounds), `internal/runner/thin/claude.go` (job lanes only: a new site from Base starts as `record_task` kind `explore` with `first_look: true`; never ask what sort of site first, state the likeliest reading in the assumptions; mark any later question `about: taste`), tests beside each.
-- [ ] **Step 1: Failing tests:** `TestReviewFirstLookMode`; `TestJobLaneFirstLookLines` (job threads get the lines, Equipo's own conversations do not).
-- [ ] **Step 2–5:** Run `go test ./internal/runner/thin -run 'FirstLook' -count=1` (FAIL), implement, run (PASS), `make runner-host`, commit `Coordinator builds first in job threads; Review checks first looks for safety`.
+- [ ] **Step 1: Failing tests:** `TestRecordTaskFirstLookSchema`; `TestEngineerFirstLookNote` (a dispatch with the note puts it after the brief, separately; after a runner restart mid-step, the re-run prompt still has it; without the note, the prompt is unchanged); `TestReviewFirstLookMode` (no quality findings, no fix rounds; an injected instruction or an outbound script is still refused); `TestJobLaneFirstLookLines` (job threads get the lines, Equipo's own conversations do not); thintest `TestFirstLookEndToEnd` (a `record_task` tool call with `first_look: true` in a job lane → the instance stores it → Engineering's prompt carries the note → Review is dispatched in `first_look` mode → the preview is scheduled on approval; the same call in Equipo's own conversation stores nothing).
+- [ ] **Step 2:** Run `go test ./internal/runner/thin ./internal/thintest -run 'FirstLook' -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement.
+- [ ] **Step 4:** Run the same, then `make runner-host`. Expected: PASS.
+- [ ] **Step 5:** Commit `First looks through the runner: tool, note, review mode, job-lane rules`.
### Task 3.4 (Equipo): The first look on a working pill (K14)
-**Files:** `internal/equipo/chat/jobs.go` (`jobState`/`jobView`), `internal/equipo/chat/jobs.go` (`expirePreviews` covers `first_look` links on any state), tests.
+**Files:** `internal/equipo/chat/jobs.go` (`jobState`, `jobView`, `expirePreviews`), `internal/equipo/chat/first_look_test.go` (new).
-A followed exploration's live or held preview is attached to a `working` or `asking` card with rel `first_look`; the job view's detail names what is being made from `record_task`'s title ("Making a first look at {what}.").
+A followed exploration's live or held preview is attached to a `working` or `asking` card with rel `first_look` and label "See the first look"; `expirePreviews` also re-projects any card whose `first_look` link went; the job view's detail names what is being made from `record_task`'s title ("Making a first look at {what}.").
-- [ ] **Step 1–5:** `TestFirstLookOnWorkingPill`, `TestFirstLookExpires`; run (FAIL), implement, run (PASS), commit `A first look shows on the pill while the work goes on`.
+- [ ] **Step 1: Failing tests:** `TestFirstLookOnWorkingPill` (working card gains the link once the preview deploys, with no other change to its state); `TestFirstLookExpires` (the link leaves at `ExpiresAt` within one tick); `TestMakingFirstLookDetail` (detail from the task's title, within the first projection after `record_task`).
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'FirstLook|MakingFirstLook' -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement.
+- [ ] **Step 4:** Run the same. Expected: PASS.
+- [ ] **Step 5:** Commit `A first look shows on the pill while the work goes on`.
### Task 3.5 (Base): First look drawn while working
**Files:** `internal/browsertest/jobs_act_test.go`.
-Base keeps `first_look` links since Task 1.15; this task only proves the drawing on a working pill and in the job view, light and dark.
+Base keeps `first_look` links since Task 1.15; this proves the drawing on a working pill and in the job view.
-- [ ] **Step 1–3:** `TestAskJobFirstLookWhileMaking`; run `go test -tags browser ./internal/browsertest -run TestAskJobFirstLook -timeout 20m -count=1`; commit.
+- [ ] **Step 1: Test** `TestAskJobFirstLookWhileMaking`: a working pill gets "See the first look" by event, opens in a new tab, keeps it across a reload; light and dark screenshots.
+- [ ] **Step 2:** Run `go test -tags browser ./internal/browsertest -run TestAskJobFirstLook -timeout 20m -count=1`. Expected: PASS (Task 1.19 drew `first_look` links); if it fails, fix `ask.js` and run again.
+- [ ] **Step 3:** Commit `Browser test: a first look on a working pill`.
-### Task 3.6: Two minutes on staging (T12)
+### Task 3.6: The K14 targets on staging (T12)
-- [ ] **Step 1:** After deploy step 3, five runs of "make me a website about …" from Base on staging; time from message to a first look the person can open; each under 2 minutes.
-- [ ] **Step 2:** Record the five times, commits and dates in `docs/live-check.md`; commit `Live check: first look within two minutes, five runs`.
+- [ ] **Step 1:** After deploy step 3, five runs of "make me a website about …" from Base on staging, a new subject each time. For each, from the person's message: the working pill (target 5 s), the job view naming what is being made (target 30 s), a first look the person can open (target 2 min).
+- [ ] **Step 2:** Record the fifteen times, commits and dates in `docs/live-check.md`; any miss goes to Paul with the run's job id before phase 4 starts.
+- [ ] **Step 3:** Commit `Live check: pill, title and first look times, five runs`.
---
@@ -715,20 +750,33 @@ Base keeps `first_look` links since Task 1.15; this task only proves the drawing
`withActiveJobs` also pins `done` and dropped job cards whose `updated_at` is within 7 days, not dismissed.
-- [ ] **Step 1–5:** `TestFinishedPinnedSevenDays` (60 newer cards; the 6-day-old done job stays, the 8-day-old leaves); run, implement, run, commit `Finished jobs stay in the snapshot for a week`.
+- [ ] **Step 1: Failing test** `TestFinishedPinnedSevenDays`: with 60 newer cards, a 6-day-old done job and a 6-day-old dropped job stay in the snapshot, an 8-day-old done job leaves, a dismissed one is absent.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestFinishedPinnedSevenDays -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement.
+- [ ] **Step 4:** Run, then `go test ./internal/equipo/chat -run 'Lane|Snapshot' -count=1`. Expected: PASS.
+- [ ] **Step 5:** Commit `Finished jobs stay in the snapshot for a week`.
### Task 4.2 (Equipo): Replace a repeated request (K10)
**Files:** `0111_jobs_replace.sql` (`chat_handoffs.replaced_by`), `internal/equipo/chat/handoff.go` (`teamRequest`: `replaces` in, `similar` out), `internal/equipo/chat/job_ask.go` (`AskReplace`), `internal/equipo/chat/job_act.go` (`replace`, `keep`), tests.
-`replaces` allowed only while the old job is the person's, open, no followed task beyond `investigated` and no step dispatched or running; else `replaces_busy`. `replace` drops the old job (`dropJob`) and hides its card in one transaction bound to the old card's revision; `keep` clears the ask. Receipts `replaced_by` on the old, `replaces` on the new. `similar`: the person's open jobs whose titles read alike (same normalised words, at least half shared).
+`replaces` allowed only while the old job is the person's, open, no followed task beyond `investigated` and no step dispatched or running (`replaceable(old handoffRecord) (bool, error)`); else `replaces_busy`. Binding: the new job's card stores the replace decision in its own decision columns: `decision_card` = the **old** job card's id, `decision_rev` = that card's revision when the offer was made, `decision_cand` = `"replace"`; `chat_handoffs.replaces` (new column) names the old hand-off on the new one. At the tap, in one transaction: the decision check of Task 1.7 (the old card still at `decision_rev`, else `ErrDecisionGone`), `replaceable(old)` again (else `ErrDecisionGone` and the ask is cleared, with the receipt "Kept both: the earlier one had already started."), then `dropJob(old, true)`, `old.replaced_by = new.ID`, and receipts `replaced_by` on the old and `replaces` on the new. `keep` clears the ask. Any change to the old card (it moved on, the person answered something on it) moves its revision and so withdraws the offer. `similar`: the person's open jobs whose titles read alike (same normalised words, at least half shared).
-- [ ] **Step 1: Failing test** `TestTeamRequestReplaces` (T10): offers the ask; drops only on the person's tap; `replaces_busy` past building; `keep` leaves both.
-- [ ] **Step 2–5:** run `go test ./internal/equipo/chat -run TestTeamRequestReplaces -count=1` (FAIL), implement, run (PASS), commit `Repeated requests offer to replace the earlier one`.
+- [ ] **Step 1: Failing test** `TestTeamRequestReplaces` (T10): offers the ask; drops only on the person's tap; `replaces_busy` past building; `keep` leaves both; old work starting between the offer and the tap → `ErrDecisionGone`, nothing dropped, ask cleared with its receipt; the replace survives a store reopen between offer and tap.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestTeamRequestReplaces -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement (`0111_jobs_replace.sql` adds `chat_handoffs.replaced_by` and `chat_handoffs.replaces`).
+- [ ] **Step 4:** Run the same, then `make migration-check`. Expected: PASS.
+- [ ] **Step 5:** Commit `Repeated requests offer to replace the earlier one`.
### Task 4.3 (Equipo): Phase 4 notes
-`jobsMovingPhase = 4`: notes gain `replaces`. Extend `TestNotesByModeAndPhase`; Equipo `make ci`; commit `Phase 4 notes: replace a repeat`.
+**Files:** `internal/equipo/chat/tools.go`, `internal/equipo/chat/notes_test.go`.
+
+- [ ] **Step 1: Failing test:** extend `TestNotesByModeAndPhase`: at phase 4 a capable person's notes name `replaces` and `similar`; legacy unchanged.
+- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestNotesByModeAndPhase -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement; set `jobsMovingPhase = 4`.
+- [ ] **Step 4:** Run, then Equipo `make ci`. Expected: PASS.
+- [ ] **Step 5:** Commit `Phase 4 notes: replace a repeat`.
### Task 4.4 (Base): Finished and Waiting on you rows
@@ -737,11 +785,20 @@ Base keeps `first_look` links since Task 1.15; this task only proves the drawing
A `done` job is a full pill for 24 h after `updated_at`, then drawn in the Finished row ("{n} finished", opening to them); `asking` or `stopped` jobs untouched 3 days fold into "Waiting on you ({n})", drawn above Finished and open when it has something new; the replace ask's actions "Replace it" / "Keep both".
- [ ] **Step 1: Failing tests:** `TestAskJobFoldsFinished` (fake clock 24 h), `TestAskJobWaitingOnYou` (3 days), `TestAskJobReplaceAsk`, scripts-off variants.
-- [ ] **Step 2–5:** run `go test -tags browser ./internal/browsertest -run 'TestAskJob(Folds|Waiting|Replace)' -timeout 20m -count=1` (FAIL), implement, run (PASS), commit `Finished and waiting jobs fold into rows`.
+- [ ] **Step 2:** Run `go test -tags browser ./internal/browsertest -run 'TestAskJob(Folds|Waiting|Replace)' -timeout 20m -count=1`. Expected: FAIL.
+- [ ] **Step 3:** Implement with approved copy.
+- [ ] **Step 4:** Run the same, then `go test ./internal/webtest -run 'TestAskJob' -count=1`. Expected: PASS.
+- [ ] **Step 5:** Commit `Finished and waiting jobs fold into rows`.
### Task 4.5 (Base, native): Fold rows in the app
-Mirror Task 4.4 in `Thread.swift`/`Pill.swift` and the Mac panel's `WaitingJobs` (count folded waiting jobs); snapshots; `make native-check`; commit `Native: finished and waiting rows`.
+**Files:** `native/apple/Sources/BaseKit/Ask/Thread.swift`, `Ask/Pill.swift`, `Mac/MenuPanel.swift` (`WaitingJobs` counts folded waiting jobs), `Resources/Localizable.xcstrings`, `Tests/BaseKitTests/AskModelTests.swift`, `Tests/BaseSnapshots/AskSnapshots.swift`.
+
+- [ ] **Step 1: Failing tests:** `testFinishedFoldsAfterADay`, `testWaitingFoldsAfterThreeDays`, `testReplaceAskActions` (injected clock).
+- [ ] **Step 2:** Run `make native-check`. Expected: FAIL on the new tests.
+- [ ] **Step 3:** Implement with the approved strings.
+- [ ] **Step 4:** Run `make native-check`; record snapshots of both rows (Mac, iPhone, light, dark, AX3). Expected: PASS.
+- [ ] **Step 5:** Commit `Native: finished and waiting rows`.
### Task 4.6: Hand-off
@@ -772,6 +829,9 @@ DRAFT wording from the spec, for copy review before any code writes it. Keys are
- `assistant.decision.direction_context` "A first look at {title} is ready."
- `assistant.decision.direction.why_build` "It looks right, so the full version can start."
- `assistant.decision.direction.why_again` "There are changes worth another try."
+- `assistant.decision.direction.why_drop` "It isn't heading the right way."
+- `assistant.job.ask.direction_note` (Try again's field label, sent as `ask.note`) "What should change?"
+- `assistant.decision.link_expired` (the first look's link note when it expired; `cf0614ec` has starting, failed and off only) "The first look has expired."
- `assistant.decision.direction.detail_build` "Makes the full version from this first look."
- `assistant.decision.direction.detail_again` "Makes another first look from your note."
- `assistant.decision.direction.detail_drop` "Stops here. Nothing more is made."
@@ -797,9 +857,9 @@ DRAFT wording from the spec, for copy review before any code writes it. Keys are
- stopping: "Stopping" / "Stopping what's already under way."
- cancelled, not by the person: "Stopped" / "It was stopped before it was finished."
-**Equipo receipts (Tasks 1.7 to 1.9):** "You chose “{option}”.", "You answered: “{words}”.", "You asked for another try: “{note}”.", "You chose to build it.", "Tried again.", "You dropped this."
+**Equipo receipts (Tasks 1.7 to 1.10):** "You chose “{option}”.", "You answered: “{words}”.", "You asked for another try: “{note}”.", "You chose to build it.", "Tried again.", "You dropped this.", "Answered “{option}” from what you said.", "Answered from what you said."
-**Base (web and native) (Tasks 1.18, 1.19, 1.21):** "Something else", "Tell me what you'd like", "Send", "Build it", "Try again", "What should change?", "Drop it", "Drop this job?", "Drop this job too?", "Keep it", "Dismiss", "Dismissed.", "Undo", "Recommended", "That changed while you were looking.", "Couldn't do that just now. Try again."
+**Base (web and native) (Tasks 1.18 to 1.20):** "Something else", "Tell me what you'd like", "Send", "Build it", "Try again", "Drop it", "Drop this job?", "Drop this job too?", "Keep it", "Dismiss", "Dismissed.", "Undo", "Recommended", "That changed while you were looking.", "Couldn't do that just now. Try again."
### Phase 2
@@ -814,5 +874,24 @@ DRAFT wording from the spec, for copy review before any code writes it. Keys are
### Phase 4
-- Equipo: replace ask "Replace your earlier request, “{title}”?"; receipts "Replaced by a newer request.", "Replaces an earlier request."
+- Equipo: replace ask "Replace your earlier request, “{title}”?"; its context "You asked for something like this before." and why "One job for one thing is easier to follow."; receipts "Replaced by a newer request.", "Replaces an earlier request.", "Kept both: the earlier one had already started."
- Base (web and native): "Replace it", "Keep both", "{n} finished", "Waiting on you ({n})".
+
+## Review
+
+**Astra, round 1 (2026-11-25): REVISE**, 6 P1, 11 P2, 1 P3. Changes:
+
+- P1 Events skipped the capability header: `Events` sets it too; tested on and off (Task 1.15).
+- P1 an older native app would make its member falsely capable: Base withholds the header while any of the member's apps lacks `Base-Client-Capabilities` (PD7, Tasks 1.17, 1.20; deploy step 1.c).
+- P1 optionless questions had no answer control: one `askTakesWords` rule for optionless, `open_words` and fallback, never placement (Tasks 1.5, 1.7, 2.2).
+- P1 the Assistant could build without a live first look: `directionOpenToAssistant` enforces K11's four cases in `team_reply` and the note (Tasks 2.4, 2.12).
+- P1 the merge retry left the action's transaction: `MergeTask`'s body moved to `mergeTaskAs` and called inside `ActOnJob` (Task 1.9).
+- P1 machinery words: the spec's full list, every Assistant-written field (Review Focus 2, Task 1.10).
+- P2 `merge_identity` cannot be told apart today (`uncertain()` wraps local refusals): `honest-merge-refusals` is a prerequisite; tested through `MergeBranch` (PD11, Task 2.3).
+- P2 addendum: `team_ask` requires context and, with options, a recommendation and why; outcome cards render the parts on web and native (Tasks 1.10, 1.18 to 1.20).
+- P2 direction recommendations: validated against the ask kind's own actions (Task 1.15).
+- P2 first look through the runner: tool schema, runner step persistence, Engineering's prompt, Review mode, an end-to-end test (Task 3.3).
+- P2 O1 provenance: `source_message` on the hand-off, the whole request-to-project path tested (Task 2.11).
+- P2 `noteWordIt` scheduling: one claimed, capped, quiet-hours-aware path for both note turns, fallback at once when declined, sweep recovery (Tasks 1.3, 1.11, 1.14, 2.8).
+- P2 receipts for the Assistant's answers (Task 1.10). P2 replace binding stored and rechecked at the tap (Task 4.2). P2 phase 2 before phase 3 (PD1, deploy table). P2 missing copy added (register). P2 abbreviated tasks expanded, browser tests before `ask.js`, all three K14 targets recorded (Tasks 1.19, 2.12, 3.x, 4.x).
+- P3 phase 0 marked "done in code; staging check pending".