oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Slice 4b progress: ask the implementer
2
3Branch `thin-v1-slice4b` from `thin-v1-slice4` (ca0a65c). Spec:
4`docs/superpowers/specs/2026-11-06-equipo-thin-v1.md` §§1-5, 7, 8, and
5Paul's ruling of 2026-11-07: "The co-ordinator should be dealing with
6the highest-level. If I want specifics I should be able to go in and ask
7the implementing agent." First open issue of `SLICE4-PROGRESS.md`.
8Conventions and scripts as in `SLICE1-PROGRESS.md` to `SLICE4-PROGRESS.md`.
9
10## Done
11
121. Contracts (`internal/wire/questions.go`, fixtures): resource
13 `Question` (task, step, specialist, asker, text, state `queued |
14 running | answered | failed | cancelled`, reason, attempt, answer,
15 timing); `POST /api/v1/tasks/{id}/questions` `{text,
16 idempotency_key, specialist}` (202 with the Question; same key and
17 another body 409; `not_askable`, `task_ended`, 403 for anyone but the
18 creator), `GET /api/v1/questions/{id}`, `POST
19 /api/v1/questions/{id}/cancel` (202 `{attempt}`, 409
20 `question_ended`); event `question` to every active member;
21 `Task.questions`, `Step.askable`. The answer streams as the chat's
22 `delta` and `activity` events with resource `question` and the
23 question's id as `turn_id`; the answered question replaces the
24 draft. Frames `ask`, `cancel_ask`, `forget_task` (to the runner),
25 `answer` (back), all durable; `Sync.asks`, `StepReport.askable`.
26 `AddressesReview` (whole word review, reviewer, reviewed...). New
27 fixtures `api/question.json`, `api/ask-request.json`,
28 `api/event-question.json`, `frames/ask.json`, `cancel_ask.json`,
29 `answer.json`, `forget_task.json`; task, step, sync fixtures gained
30 the new fields.
31
322. Instance (`internal/equipo/chat/questions.go`, migration 0045):
33 questions are team records; only the task's creator (an owner) asks
34 or cancels. Target: the specialist chosen, else Review when the text
35 addresses it and Review can answer, else the newest askable
36 Engineering step. Question, event and `ask` command in one
37 transaction; one question of a task with the runner at a time, the
38 next dispatched when it ends. Answer reports only from the step
39 person's primary runner, current attempt, forward only; deltas and
40 activity go to every member under resource `question` (labels:
41 reading the code, searching the code, "Looking at the change…").
42 Cancel: at once if never dispatched, else `cancel_ask` and the
43 runner's report ends it. A sync that no longer holds an acked
44 question fails it (`interrupted`). A task becoming done or cancelled
45 stops its questions and sends `forget_task`. `read_task` leaves the
46 questions out (the coordinator never relays them). The thin `GET
47 /questions/{id}` hands the old engine's question ids to its handler
48 until the slice 7 sweep.
49 Tests: `TestContractAskImplementer`, `TestPagesTaskThread`.
50
513. Runner (`internal/runner/thin/ask.go`, provider action `answer`):
52 - Keep sessions: Engineering and Review copy their transcript (only
53 `projects/-workspace/<session>.jsonl`, never a credential) into
54 `sessions/<person>/steps/<step key>/` once the namespace's exit is
55 verified, record it (`kept_sessions`: step, attempt, task,
56 account, session id, commit, bytes) and report `askable` (Engineering
57 when pushed, Review with its verdict). The worktree is recreated
58 from the commit on demand, not kept.
59 - Asking: the step's own session `--resume`d on its own account in
60 the same containment, profile `answer`: a fresh read-only tree of
61 the exact commit (bwrap read-only mount and settings `denyWrite`
62 /workspace), native tools Read, Glob, Grep only (permission
63 callback `ReadPermission`), and three read-only git tools the runner
64 runs on its private repository (`git_log` base..commit, `git_diff`
65 optionally one path, `git_show` of a commit in that history only);
66 no Bash, Write, Edit, push or forge. `--include-partial-messages`:
67 text and activity stream as `delta`/`activity`. The transcript is
68 kept again after, so a follow-up continues the session. The prompt
69 tells it to say plainly it can't change anything from here.
70 - Questions share the step engine's one queue (arrival order), so a
71 question waits for a running step and never runs beside one; a
72 cancel that comes first holds the question; a restart ends running
73 questions (`runner_restarted`), never runs one twice.
74 - Retention: `forget_task` deletes the task's kept sessions; any kept
75 session unused for 14 days goes, and any directory no record names;
76 the sweep runs on every engine wake and hourly, and logs the count
77 and bytes kept.
78 Tests: `TestAnswerPolicyIsReadOnly`, `TestAnswerGitIsReadOnly`,
79 `TestKeptSessionsForgetAndExpire`,
80 `TestSweepKeptStaysUnderTheSessionRoot`, `TestAskQueuesWithSteps`,
81 `TestRecoverAsks`.
82
834. Fake CLI: `[Equipo: question]` answers "From my session: <the last
84 reply in its transcript>", `ask:git` (git_diff), `ask:read:<path>`,
85 `ask:write:<path>`, `asksleep:<ms>`.
86
875. Headless `4b_ask` (fake CLI in real bwrap, local forge): a task to
88 ready to merge keeps two sessions; Engineering answers from its own
89 session (its step summary), reads the change through git and a file
90 through Read; Review, addressed by name, answers from its own and its
91 write is denied ("I can't change anything from here."); a follow-up
92 continues Engineering's session; the answer streams (first activity
93 and text seen before the answer); the branch is unchanged; a long
94 question is cancelled; after the person merges the task is done, the
95 kept sessions are gone and asking is 409. `4b_witness` is staging
96 only (`EQUIPO_STAGING_ASK_TASK`).
97
986. Coordinator: house rule 2026-11-07.8. No file paths, line numbers or
99 code mechanics in replies, even on request; for specifics it points
100 at the task ("You can ask Engineering on [title](link).", or Review
101 about the review). `TestOpeningPointsToAskTheImplementer`.
102
1037. UI: the task page's thread (`work_task.html`) holds the creator's
104 questions and answers, and notes, oldest first, rendered like the
105 chat (own bubble, answer with the specialist's name and markdown,
106 the thinking line while waiting or running, a quiet line when one
107 ended). The composer is the chat's (`#chat-composer`, click anywhere
108 to focus, docked sticky on the page's own colour) with a quiet
109 "Asking Engineering · change" line (`ask-target.js`): it follows the
110 text (Review when addressed) and change switches explicitly; one
111 specialist only, no change. For a teammate, or before anyone can
112 answer, the composer adds a note as before. `chat-stream.js` follows
113 the thread with the chat's pieces (`[data-chat-stream][data-task]`):
114 question streams only, background send reconciled by id, the
115 answered question settles into its draft element; the conversation
116 ignores question streams. `TestBrowserTaskThread` (1280 mouse, 390
117 touch; no reload).
118
1198. Mutation checks (risky paths; each observed failing a test unless
120 noted): creator check (with the target-person check behind it), one
121 question at a time, the task's end and forget, answer after the
122 question ended, resume of the kept session, the read-only profile
123 and its native tools, `git_show` outside the change, the kept-session
124 path guard, Engineering `askable`, the question event listener and
125 the Review routing in the page. Survived, as defence in depth: the
126 ask's permission callback swapped for Engineering's (the read-only
127 policy refuses the write first); removing either the forget frame's
128 directory removal or its row deletion alone (the orphan sweep, or the
129 removal, covers the other).
130
1319. Merged `thin-v1-slice4` round-1 fixes at e7a1b52 (cb7a890): both
132 sides kept (branch head and answer frames, `Task.branch_head` then
133 `questions`, the link's `Synced` and `Forget`); budgets merged. The
134 questions migration keeps its id `0045_thin_questions`, which staging
135 applied on cfc790f; it sorts after slice 4's `0045_thin_branch_head`,
136 so a fresh database runs both and staging runs only the new one. The
137 runner's reason scan accepts answer reasons (the launch path serves
138 questions).
139
14010. Astra round 2 on slice 4 (3cede55): a failed or stalled index-pack
141 while streaming the candidate into the checks tree's `.git` held the
142 serial step worker (pack-objects blocked on an undrained pipe). Any
143 downstream failure now cancels every command's process group and
144 closes both pipes before each started command is reaped; a start
145 failure reaps what started; the whole preparation has the judge
146 tree's deadline. `TestCheckRepositoryPackFailureNeverHangs` (injected
147 index-pack failure, and a stall) hung before the fix; after it they
148 end in 0.2 s and at the 3 s test deadline, leaving no process.
149
15011. Astra round 1 on slice 4b (REQUEST CHANGES, three Important, one
151 Minor), each with a test that failed first:
152 1. Git output in the answering session is bounded while read: at
153 most MaxDiffBytes is read, then git's process group is stopped and
154 reaped and the answer is cut (`TestAnswerGitOutputBoundedWhileRead`:
155 a 16 MiB patch and commit allocated 80 MiB before, under 4 MiB now).
156 2. A question is complete only once its namespace's exit is verified:
157 the run records the namespace against the question's own attempt
158 (`asks.ns_id`, not the steps table); an unverified exit holds the
159 answer (`pending`, the report kept in `asks.final`), listed in
160 sync, released by the probe at start and on every sync once
161 verified; a restart holds a running question whose namespace is
162 unproven (`TestAskHeldUntilTerminationVerified` failed and stalled,
163 `TestRecoverAsksHoldsUnprovenNamespaces`; headless `4b_ask` checks
164 the namespace is recorded, a mutation routing it to the steps
165 table fails it).
166 3. A question is marked started durably before its provider runs and
167 is never picked again; its result stays in memory and its final
168 write is retried with backoff, never the provider
169 (`TestAskReportPersistedWithoutRerun`, three injected write
170 failures: the provider ran once and the answer was sent).
171 4. Minor: `git_show` takes only base..candidate, as `git_log` shows
172 (`TestAnswerGitShowKeepsToTheChange`: the base and older history
173 are refused).
174 Mutations: the retry loop (killed), the held release (killed), the
175 namespace hook (killed in headless); the started filter alone
176 survives behind the retry loop (defence in depth). Time budget
177 `internal/runner/thin` 45s.
178
179## Decisions
180
181- Sessions are kept as transcripts, like the coordinator's; the tree
182 is recreated from the commit on demand (cheap, and nothing in it can
183 drift). Disk: one transcript per Engineering or Review attempt,
184 about 100 to 160 KB each on staging.
185- A question resumes the step on the account that ran it. If that
186 account is unhealthy the question fails `account_unavailable`.
187- The answering session gets read-only git as runner-side tools rather
188 than a shell: no shell in the namespace can modify anything because
189 there is no shell.
190- Questions run in the one step queue: simplest way to never run beside
191 a write step; a question may wait behind another task's step.
192- Thread notes stay: a teammate's composer adds notes, and the creator's
193 does until a specialist can answer.
194- `read_task` returns no questions; the coordinator points to the task.
195- Default target is the newest askable Engineering step (after a fix
196 round, the fix round's session).
197
198## Staging
199
200Release d976251 (built by `scripts/staging-thin.py build`, deployed with
201`--swap hold` at 20:54:26, both runner units installed by 20:55:22,
202about a minute), no live run:
203- `tk2jhc6z46ar` (suite, ready to merge on b9bc2406): its steps ran on
204 slice 4, which deleted each step's session with its runtime home, so
205 none is askable (`askable: false` on all three steps). `POST
206 .../questions` answers `409 not_askable` and the page shows the note
207 composer, not the ask line. Nothing can resume those sessions.
208
209Witness (approved by the controller: 1 coordinator turn, 1 Engineering
210step, 1 Review step, 3 ask turns), on release cfc790f (restaged 21:04 to
21121:05, CI green), real Claude CLI 2.1.312, suite person:
212- Task (`4_review` live, one message): "In the oficina/suite README, the
213 bold line under "How an app uses it" says "Not yet — see Status:".
214 Please replace that em dash with a full stop so it reads "Not yet. See
215 Status:". Change nothing else." Task `tkgzy4ioeoh7`, candidate
216 d51e14fe; checks `.amadan/ci.d` passed (9.4 s); review approved
217 (`same_account`, 9.3 s); ready to merge 40 s after the send.
218- `4b_witness` (`EQUIPO_STAGING_ASK_TASK=tkgzy4ioeoh7`), each from the
219 step's own resumed session, cold (process start 1.4 to 2.0 s):
220 - Engineering, "What did you change and why?": one line, README line
221 34, the em dash became a full stop and "See" a capital; nothing else
222 because the person asked for exactly that; "the diff for the commit
223 confirms it". First activity 2.8 s, first text 5.3 s, answered 5.8 s.
224 - Review, "Anything you were unsure about?": "No, not really"; the
225 brief listed only some of the other em dashes; when it reviewed it
226 had the diff the coordinator gave it and had not checked against
227 git, "I've now looked at the actual diff"; it did not render the
228 Markdown. First activity 2.7 s, first text 8.3 s, answered 8.8 s.
229 - Engineering, "Please fix the typo "teh" in the README yourself.": "I
230 can't change anything from here, because this session is read-only.
231 If you want something changed, the coordinator can set that up."
232 (and it found no "teh"). Answered 6.4 s. Candidate unchanged.
233- Disk: two kept sessions, 242,656 bytes after the three questions (108
234 and 160 KB on disk).
235
236## Live runs (budget: 8 ask turns, 2 coordinator turns)
237
238Used: 1 coordinator turn, 1 Engineering step, 1 Review step (task
239`tkgzy4ioeoh7`), 3 ask turns. No fix round, move-in or explore ran.
240
241## Open issues
242
243- Slice 4 round-1 fixes are to be merged and restaged; the witness ran
244 on cfc790f and is not repeated after the merge (controller's call).
245- Version skew as in slice 4: an old runner refuses `ask` and
246 `forget_task`; install runners right after the instance.
247- A question waits behind any running step on the runner, including
248 another task's.
249
250## Copy for review
251
252Accepted for now with the existing marker in `copy.go` and listed in
253the plan 3 inventory:
254- `work.thread` "Questions and notes", `work.thread_empty` "No
255 questions or notes yet."
256- `work.ask.target` "Asking %s", `work.ask.change` "change",
257 `work.ask.placeholder` "Ask %s about this work"
258- `work.ask.queued` "Waiting for its turn…"
259- `work.ask.failed` "%s couldn't answer: %s.", `work.ask.cancelled`
260 "Question cancelled.", `work.ask.reason.session_gone` "its session for
261 this work is no longer kept", `work.ask.reason.task_ended` "the task
262 has ended"
263- `chat.activity.read_change` "Looking at the change…"
264
265## Blockers
266
267None.
268