| index 4e04053b..b082a0ef 100644 |
| --- a/docs/superpowers/plans/2026-11-30-design-feedback-1.md |
| +++ b/docs/superpowers/plans/2026-11-30-design-feedback-1.md |
| @@ -39,7 +39,7 @@ approved). Branch `design-feedback-1`, rebased onto main after |
| 2. A Design exploration whose model never calls `submit_candidate`, or calls it with 2 options, must reach a fix round with Equipo's feedback, not Review and not a silent empty card. Task 4 tests it. |
| 3. Forget during a queued Design step: the step must not start with the forgotten note. Task 9 tests it. |
| 4. A discovery card answered twice (double tap, retry) writes its notes and continuation once. Task 10 tests it. |
| -5. `?option=` on the preview route with a forged page, a negative index, or a candidate that is not the deployed one returns 404. Task 12 tests it. |
| +5. `?step=&option=` on the preview route with a forged step, a negative index, or a round that is not the deployed one returns 404. Task 12 tests it. |
| |
| ## Facts the plan rests on (main 1755d03a) |
| |
| @@ -87,9 +87,10 @@ Order: 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14 (Task 7 uses Task 8's |
| - `DesignAsk{Kind string; Option *StepDesignOption; Current []StepDesignOption; Note string}` with `DesignAskMore = "more"`, `DesignAskLike = "like"` |
| - `AnswerCard.Option *OptionRef`, `OptionRef{Step string; Index int}`; `ChoiceMore = "more"`, `ChoiceLike = "like"`; `TaskDirection.Rounds []DirectionRound` (`DirectionRound{Step string; Candidate string; Options []StepDesignOption; Live bool}`), `TaskDirection.PreviewRefused bool` |
| - `CardDesignTaste = "design_taste"`, `ChoiceUseThese = "use"`, `ChoiceSkip = "skip"`; `AnswerCard.Taste *TasteAnswer` (`Feels []string; Other, Like, Avoid, Keep string`) |
| -- Downgrade below 39: a dispatch with `Taste`, `TasteSkipped` or `DesignAsk` set is refused (`ErrProtocol`); a report's new option and capture fields are dropped. |
| +- Downgrade below 39: a dispatch whose `Profile` is `design-v1` is refused (`ErrProtocol`) whatever its optional fields, and so is any dispatch with `Taste`, `TasteSkipped`, `DesignAsk` or `ForgetRevision` set; a report's new option and capture fields are dropped. |
| + - `DispatchCommand.ForgetRevision int64` (8.6: the runner resumes a saved session only at the same forget revision). |
| |
| -- [ ] **Step 1: Write the failing tests**: `TestValidExploreOptions` (2 options refused, 5 refused, empty direction refused, 501-byte direction refused, a `` in direction refused, duplicate page refused, `Page: "../x"` refused, 4 captures on one option refused, missing label refused, 3 valid options pass); `TestDowngradeDesignFeedback` (dispatch with `DesignAsk` at 38 is `ErrProtocol`; report fields dropped at 38); `TestProtocolCurrent39`. |
| +- [ ] **Step 1: Write the failing tests**: `TestValidExploreOptions` (2 options refused, 5 refused, empty direction refused, 501-byte direction refused, a `` in direction refused, duplicate page refused, `Page: "../x"` refused, 4 captures on one option refused, missing label refused, 3 valid options pass); `TestDowngradeDesignFeedback` (a bare `design-v1` dispatch with no taste and no ask at 38 is `ErrProtocol`; one with `DesignAsk` too; report fields dropped at 38); `TestProtocolCurrent39`. |
| - [ ] **Step 2: Run** `go test ./internal/wire/ -run 'TestValidExploreOptions|TestDowngradeDesignFeedback|TestProtocolCurrent39'`; expect compile failures, then FAIL. |
| - [ ] **Step 3: Implement** the types and functions above; bump every `ProtocolCurrent` pin. |
| - [ ] **Step 4: Run** `go test ./internal/wire/...`; PASS. |
| @@ -103,9 +104,9 @@ Order: 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14 (Task 7 uses Task 8's |
| |
| **Interfaces:** |
| - Consumes: Task 1's types and `ValidExploreOptions`. |
| -- Produces: `Attempt.Explore bool` and `Attempt.WorkPage func(page string) bool` (true when `<page>/index.html` exists in the step's latest work export); `keep` stores `Viewport`, `Path`, `FullPage` from `renderpage.Capture.Page`. |
| +- Produces: `Attempt.Explore bool` and `Attempt.WorkPages func(ctx context.Context, pages []string) (missing []string, err error)`: takes a fresh workspace snapshot with the render tool's snapshot (pause, private index, tree object; `busy` on failure) and lists the pages without `<page>/index.html` as a regular file in that tree. Never an earlier render's export (`renderpage.Tool.accepted` deletes it). `keep` stores `Viewport`, `Path`, `FullPage` from `renderpage.Capture.Page`. |
| |
| -- [ ] **Step 1: Failing tests**: `TestSubmitExploreNeedsThree` (2 options: tool error text contains `3 or 4 options` and nothing is recorded); `TestSubmitCaptureFactsFromRender` (the recorded capture's viewport and path equal the render call's, whatever the model sends); `TestSubmitPageMustExist` (a page with no `index.html` refused, text names the page); `TestSubmitChangeNoMinimum` (a change step with 1 option passes). |
| +- [ ] **Step 1: Failing tests**: `TestSubmitExploreNeedsThree` (2 options: tool error text contains `3 or 4 options` and nothing is recorded); `TestSubmitCaptureFactsFromRender` (the recorded capture's viewport and path equal the render call's, whatever the model sends); `TestSubmitPageMustExist` (a page with no `index.html` refused, text names the page); `TestSubmitPageDeletedAfterRender` (render the page, delete its folder in the workspace, submit: refused), using the real snapshot, not a stub; `TestSubmitChangeNoMinimum` (a change step with 1 option passes). |
| - [ ] **Step 2: Run** `go test ./internal/runner/designstep/ -run 'TestSubmit'`; FAIL. |
| - [ ] **Step 3: Implement.** The schema gains `direction`, `page` and captures as `{"file","label"}` objects; the fixed refusal texts name the broken rule. The thin runner sets `Explore` from the dispatch and `WorkPage` from the render export. |
| - [ ] **Step 4: Run** the same tests plus `go test ./internal/runner/thin/ -run 'Design'`; PASS. |
| @@ -114,16 +115,16 @@ Order: 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14 (Task 7 uses Task 8's |
| ### Task 3: The pack and the prompt |
| |
| **Files:** |
| -- Modify: `internal/specialist/packs/design-v1.md`, `internal/specialist/menu.go:107` (digest), `internal/runner/thin/design_step.go` (`designPrompt`, `designRules`) |
| +- Modify: `internal/specialist/packs/design-v1.md`, `internal/specialist/menu.go:107` (digest), `internal/runner/thin/design_step.go` (`designPrompt`, `designFixPrompt`, `designRules`) |
| - Test: `internal/specialist/design_test.go`, `internal/runner/thin/design_prompt_test.go` |
| |
| **Interfaces:** |
| - Consumes: Task 1's `DispatchCommand.Taste`, `TasteSkipped`, `DesignAsk`. |
| - Produces: `func tastePrompt(person string, notes []wire.TasteNote, skipped bool) string` and `func askPrompt(a *wire.DesignAsk) string` in `design_step.go`; each step's report records `PackDigest string`. |
| |
| -- [ ] **Step 1: Failing tests**: `TestPackAsksThreeOrFour` (pack contains "three or four" and not "Two committed options"); `TestTastePromptQuotesSources` (a `words` note is quoted under "<person>'s own words", a `choice` note under "<person>'s choice among options Equipo's coordinator wrote", text passed through `wire.QuotedData`); `TestAskPromptLike` (`like` names the option and its direction as Design's words and the note as the person's); `TestSkippedSaysDefaults`. |
| +- [ ] **Step 1: Failing tests**: `TestPackAsksThreeOrFour` (pack contains "three or four" and not "Two committed options"); `TestTastePromptQuotesSources` (a `words` note is quoted under "<person>'s own words", a `choice` note under "<person>'s choice among options Equipo's coordinator wrote", text passed through `wire.QuotedData`); `TestAskPromptLike` (`like` names the option and its direction as Design's words and the note as the person's); `TestSkippedSaysDefaults`; `TestFixPromptCarriesAskAndTaste` (the prompt handed to a resumed launch, through `engineer.go`'s resume path, contains the `like` option, its direction, the person's note and the current notes). |
| - [ ] **Step 2: Run** `go test ./internal/specialist/ ./internal/runner/thin/ -run 'TestPack|TestTastePrompt|TestAskPrompt|TestSkipped'`; FAIL. |
| -- [ ] **Step 3: Implement** the pack edits of spec 8.3 (sections 2 and 6, a new "Taste notes" section, a "More rounds" paragraph: keep earlier folders, new names), the new digest, the prompt lines, and `designRules`' `submit_candidate` shape. |
| +- [ ] **Step 3: Implement** the pack edits of spec 8.3 (sections 2 and 6, a new "Taste notes" section, a "More rounds" paragraph: keep earlier folders, new names), the new digest, the prompt lines in both `designPrompt` and `designFixPrompt`, and `designRules`' `submit_candidate` shape. |
| - [ ] **Step 4: Run** the tests; PASS. |
| - [ ] **Step 5: Commit** `design: pack asks for 3 or 4 described options; prompt carries taste`. |
| |
| @@ -137,9 +138,9 @@ Order: 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14 (Task 7 uses Task 8's |
| - Consumes: Task 1. |
| - Produces: `func (t *txn) designOptionsShort(p progress) (bool, error)` (true for a Design exploration attempt done with no options passing `ValidExploreOptions`); `designFeedbackOptions` fixed feedback text. |
| |
| -- [ ] **Step 1: Failing tests**: `TestExploreTwoOptionsFixRound` (an approved-shaped Design attempt with 2 options gets a fix round carrying `designFeedbackOptions`, no Review step); `TestExploreNoSubmitFixRound`; `TestExploreShortAtMaxFixRounds` (at `MaxFixRounds` the task needs `NeedsFixRounds`); `TestOldReportStillShown` (a protocol-38 report with 2 options and no directions is shown, no fix round, since its step predates 39); `TestKeptCaptureFacts` (label, viewport, path, full page reach `StepCapture`). |
| +- [ ] **Step 1: Failing tests**: `TestExploreTwoOptionsFixRound` (an approved-shaped Design attempt with 2 options gets a fix round carrying `designFeedbackOptions`, no Review step); `TestExploreNoSubmitFixRound`; `TestExploreShortAtMaxFixRounds` (at `MaxFixRounds` the task needs `NeedsFixRounds`); `TestOldReportStillShown` (a protocol-38 report with 2 options and no directions is shown, no fix round, since its step predates 39); `TestKeptCaptureFacts` (label, viewport, path, full page reach `StepCapture`); `TestDispatchProtocolPersists` (written at dispatch, survives a store reopen and a runner reconnect; legacy rows read 0). |
| - [ ] **Step 2: Run** `go test ./internal/equipo/chat/ -run 'TestExplore|TestOldReportStillShown|TestKeptCaptureFacts'`; FAIL. |
| -- [ ] **Step 3: Implement.** The check runs in `advanceExplore` before `judge`, only for steps dispatched at 39 or above (the step's recorded protocol). |
| +- [ ] **Step 3: Implement.** Add `stepRecord.DispatchProtocol int` (migration 0125, default 0 meaning before this round), set at every dispatch from the lease's protocol. The check runs in `advanceExplore` before `judge`, only when `DispatchProtocol >= 39`. |
| - [ ] **Step 4: Run**; PASS. |
| - [ ] **Step 5: Commit** `chat: a Design exploration needs 3 or 4 options before Review`. |
| |
| @@ -210,30 +211,31 @@ Sequenced after Task 8. **Interfaces:** Consumes `t.writeTaste` (Task 8). |
| ### Task 9: Taste in the dispatch and the stale-revision check |
| |
| **Files:** |
| -- Modify: `internal/equipo/chat/grants.go` (`boundDispatch`, `bindingHolds` caller), `internal/equipo/chat/runners.go` (start authorization), `internal/equipo/chat/design_routing.go` (`designCause`: runner below 39 waits as `design_runner_old`) |
| +- Modify: `internal/equipo/chat/grants.go` (`boundDispatch`, `bindingHolds` caller), `internal/equipo/chat/runners.go` (start authorization: a stale taste revision is replaced with `t.replace`, so the attempt moves on; a Design step on a lease below 39 is refused), `internal/equipo/chat/design_routing.go` (`designCause`: runner below 39 waits as `design_runner_old`), `internal/runner/thin/engineer.go`, `internal/runner/thin/state.go` (saved session forget revision) |
| - Test: `internal/equipo/chat/taste_dispatch_test.go` |
| |
| **Interfaces:** |
| - Consumes: Task 8's records. |
| -- Produces: `func (t *txn) tasteFor(person, project string) ([]wire.TasteNote, int64, bool, error)` (notes, revision, skipped); `stepRecord.TasteRevision int64` (migration column). |
| +- Produces: `func (t *txn) tasteFor(person, project string) (notes []wire.TasteNote, revision, forgetRevision int64, skipped bool, err error)`; `stepRecord.TasteRevision int64` (migration column); `tasteBookRecord.ForgetRevision int64` (bumped by forget only). |
| +- Runner: `internal/runner/thin/engineer.go` (`fixSession`) and the saved-session record store `ForgetRevision`; a resume needs the dispatch's `ForgetRevision` to equal the saved one, else the launch starts fresh (no `--resume`). |
| |
| -- [ ] **Step 1: Failing tests**: `TestTasteOrderAndCaps` (61 notes: 60 sent, project first then newest, total under 6 KiB); `TestForgetRefusesQueuedStart` (dispatched at revision 4, forget makes 5, start refused, re-dispatched with 5 and without the note); `TestForgetFreshSession` (resume refused after a forget, fresh session); `TestOldRunnerWaits` (runner at 38: `design_runner_old`). |
| +- [ ] **Step 1: Failing tests**: `TestTasteOrderAndCaps` (61 notes: 60 sent, project first then newest, total under 6 KiB); `TestForgetRefusesQueuedStart` (dispatched at revision 4, forget makes 5, start refused and the step replaced as a new attempt with 5 and without the note); `TestOldCommandFenced` (after the replacement is dispatched, authorizing the old attempt's command is refused); `TestForgetFreshSession` (runner side: a saved session at forget revision 1, dispatch at 2: the launch has no `--resume`); `TestOldRunnerWaits` (runner at 38: `design_runner_old`); `TestReconnectBelow39Refused` (placed on a 39 runner that reconnects at 38: start refused). |
| - [ ] **Step 2: Run**; FAIL. **Step 3: Implement.** **Step 4: Run**; PASS. |
| - [ ] **Step 5: Commit** `chat: Design steps carry the creator's taste, refreshed after a forget`. |
| |
| -### Task 10: Discovery: ask_design_taste, its card and continuation |
| +### Task 10: Discovery: ask_design_taste and its card |
| |
| **Files:** |
| - Create: `internal/equipo/chat/taste_ask.go` |
| -- Modify: `internal/equipo/chat/tools.go` (dispatch, `status` gains `taste: {notes, asked}` per Design specialist), `internal/equipo/chat/specialist_added.go` (allow the tool in the Add continuation for its project), `internal/runner/thin/mcp.go` (schema), the coordinator prompt's house rules, `internal/equipo/templates/chat.html` (card), `internal/equipo/migrations/0125_design_feedback.sql` (`chat_taste_asks`), `internal/equipo/copy.go` |
| +- Modify: `internal/equipo/chat/tools.go` (dispatch, `status` gains `taste: {notes, asked}` per Design specialist), `internal/equipo/chat/specialist_added.go` (allow this one card-raising tool in the Add continuation, for the card's project only), `internal/runner/thin/mcp.go` (schema), the coordinator prompt's house rules, the card-answer path that builds `Answered` today (its message and person turn), `internal/equipo/templates/chat.html` (card), `internal/equipo/migrations/0125_design_feedback.sql` (`chat_taste_asks`), `internal/equipo/copy.go` |
| - Test: `internal/equipo/chat/taste_ask_test.go`, `internal/equipo/taste_card_test.go` |
| |
| **Interfaces:** |
| -- Consumes: Task 8 `writeTaste`; the continuation machinery of `specialist_added.go`. |
| -- Produces: `func (t *txn) askDesignTaste(r turnRecord, project string, feels []string) (wire.ToolResult, error)`; `func (t *txn) answerTaste(person string, c cardRecord, in wire.AnswerCard) (wire.Card, wire.Card, error)`; turn kind `wire.TurnDesignTaste`. |
| +- Consumes: Task 8 `writeTaste`; the existing card answer's message and person turn. |
| +- Produces: `func (t *txn) askDesignTaste(r turnRecord, project string, feels []string) (wire.ToolResult, error)`; `func (t *txn) answerTaste(person string, c cardRecord, in wire.AnswerCard) (wire.Card, wire.Card, error)`. No new turn kind. |
| |
| -- [ ] **Step 1: Failing tests**: `TestAskTasteOnce` (second ask for the same person and project: refused text says start Design now); `TestAskTasteRefusedWithNotes`; `TestAskTasteFeelsBounds` (6 feels, a 31-byte feel, markup: refused); `TestAnswerWritesNotes` (two feels: two `choice` notes with Equipo's question; three boxes: three `words` notes); `TestAnswerOnce` (double tap: one set of notes, one continuation); `TestSkipQueuesDefaults` (no notes, ask recorded skipped, continuation opening says skipped, next Design dispatch has `TasteSkipped`); `TestContinuationBound` (records one task in the card's project, starts it only with Design); `TestAskInAddContinuation`; `TestTasteCardRender` (feels as checkboxes, four boxes `maxlength=300`, Use these and Skip). |
| -- [ ] **Step 2: Run** `go test ./internal/equipo/... -run 'TestAskTaste|TestAnswer|TestSkip|TestContinuationBound|TestTasteCard'`; FAIL. |
| +- [ ] **Step 1: Failing tests**: `TestAskTasteOnce` (second ask for the same person and project: refused text says start Design now); `TestAskTasteRefusedWithNotes`; `TestAskTasteFeelsBounds` (6 feels, a 31-byte feel, markup: refused); `TestAnswerWritesNotes` (two feels: two `choice` notes with Equipo's question; three boxes: three `words` notes); `TestAnswerOnce` (double tap: one set of notes, one message, one turn; the second is a card conflict); `TestAnswerFramedBySource` (the turn's prompt frames typed boxes as the person's words and feels and Skip as choices among options others wrote); `TestSkipRecorded` (no notes, ask recorded skipped, next Design dispatch has `TasteSkipped`); `TestAskInAddContinuation` (allowed for the card's project, refused for another; the person's answer then runs an ordinary turn that can record and start the task with Design); `TestTasteCardRender` (feels as checkboxes, four boxes `maxlength=300`, Use these and Skip). |
| +- [ ] **Step 2: Run** `go test ./internal/equipo/... -run 'TestAskTaste|TestAnswer|TestSkip|TestAskInAdd|TestTasteCard'`; FAIL. |
| - [ ] **Step 3: Implement.** The house rule text: before starting Design, call `status`; with no taste and no style, mood or reference in the request, ask; else start. |
| - [ ] **Step 4: Run**; PASS. |
| - [ ] **Step 5: Commit** `chat: Design asks a few taste questions once per project`. |
| @@ -249,9 +251,9 @@ Native keeps Build with a note; `TaskDetails.swift` ignores unknown keys. A test |
| - Test: `internal/equipo/preview_option_test.go` |
| |
| **Interfaces:** |
| -- Produces: `func previewWrapper(raw string, unsafe bool, page string) (string, string, error)` (page "" or a valid page; iframe src is root + page + "/"). |
| +- Produces: `func previewWrapper(raw string, unsafe bool, page string) (string, string, error)` (page "" or a valid page; iframe src is root + page + "/"). The route reads `step` and `option`; `step` must be the maker step whose candidate the deployed preview is of. |
| |
| -- [ ] **Step 1: Failing tests**: `TestPreviewOptionFrames` (`?option=2` frames `https://eq-x.example/writing-desk/`, CSP origin unchanged); `TestPreviewOptionForged` (`option=-1`, `option=9`, `option=abc`, an option of an older round: 404); `TestOpenLiveOnlyDeployed` (no deployed preview: no link); `TestHeaderRefusedLine` (`preview_header_missing`: card shows `work.preview.host_outdated`). |
| +- [ ] **Step 1: Failing tests**: `TestPreviewOptionFrames` (`?step=S&option=2` frames `https://eq-x.example/writing-desk/`, CSP origin unchanged); `TestPreviewOptionForged` (`option=-1`, `option=9`, `option=abc`, a step of another task, a missing step: 404); `TestPreviewOldLinkAfterRedeploy` (a link for round 1 after round 2's preview deployed: 404); `TestOpenLiveOnlyDeployed` (no deployed preview: no link); `TestHeaderRefusedLine` (`preview_header_missing`: card shows `work.preview.host_outdated`). |
| - [ ] **Step 2: Run**; FAIL. **Step 3: Implement.** **Step 4: Run**; PASS. |
| - [ ] **Step 5: Commit** `web: Open live per option through the preview wrapper`. |
| |
| @@ -267,6 +269,17 @@ results verbatim with the house markers. `make copy-release-check` passes. |
| |
| Astra reviews the branch (`codex exec -m gpt-6-astra -c model_reasoning_effort="high" … </dev/null`), three rounds at most; `make ci` once; push; CI green; report "say merge". |
| |
| +## Astra round 1: NOT READY (9 findings, all taken) |
| + |
| +Fenced re-dispatch after a forget (new attempt) and a runner-side forget |
| +revision for resumes (Task 9); round request and taste in |
| +`designFixPrompt` (Task 3); discovery answers use the existing card answer |
| +and an ordinary person turn instead of a new continuation kind, which |
| +also keeps the original request (Task 10, spec 8.6); preview links bound |
| +to a step (Task 12); `dispatch_protocol` on steps (Task 4); protocol 39 |
| +required for every Design dispatch and at start (Tasks 1, 9); page check |
| +on a fresh snapshot (Task 2). |
| + |
| ## Reviews and the round limit |
| |
| Astra reviews the addendum and this plan (three rounds at most each), then |