oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

1# Slice 3 progress: Engineering
2
3Branch `thin-v1-slice3` from `thin-v1-slice2b` (f77a0c9). Spec:
4`docs/superpowers/specs/2026-11-06-equipo-thin-v1.md` §§0-3, 7, 8 row 3,
5plus Paul's additions of 2026-11-07 (`slice3-additions.md`: agent-wide
6forge credential, grants seen within a minute, a self-resolving grant
7card, projects as products, tasks recorded at once with stages, findings
8and a thread). Conventions and scripts as in `SLICE1-PROGRESS.md`,
9`SLICE2-PROGRESS.md` and `SLICE2B-PROGRESS.md`.
10
11## Plan
12
13Headless first, in this order, each behaviour with a test that fails
14first or a mutation shown to fail it:
15
161. Contracts (`internal/wire`): `Task`, `Step`, `Finding`, `ThreadEntry`,
17 `TaskList`, project `title` and `attachments`, card `task_id`,
18 snapshot `tasks`; events `task` and `step`; frames `dispatch`,
19 `cancel_step`, `step`, `recheck`; `sync.steps`; coordinator tools
20 `record_task`, `add_finding`, `start_task`, `read_task`, `cancel_task`.
212. Instance: task, step, thread and attachment tables; the tools
22 authorised in the runner frame's transaction; `GET /tasks`,
23 `GET /tasks/{id}`, `POST /tasks/{id}/cancel`, `POST /tasks/{id}/retry`
24 (refused until the runner confirmed termination of the current
25 attempt), `GET /steps/{id}/log`, `POST /tasks/{id}/thread`; forward-only
26 step reports; `sync` settles steps; grant card resolves itself.
273. Runner: `steps` table with a unique running index per task; one step
28 at a time; worktree from the project clone with a private git dir the
29 namespace never sees; the Engineering CLI in bubblewrap (the existing
30 `implement` action, unchanged containment); runner commit; candidate
31 SHA recorded; push through `internal/runner/forge` with
32 record-then-reconcile and a lease check right before the push;
33 cancel and crash end with a termination report; agent-wide forge
34 credential; a cheap periodic reach check and `recheck`.
354. Headless scenarios: 2 to the branch, 4 (runner killed mid-step,
36 termination, retry), cancel, grant resolves.
375. Staging with the real CLI; the Woodstar witness.
386. UI: task card (receipt style) with Retry and Cancel, Tasks page and
39 Projects page on API v1.
40
41## Done
42
431. Contracts (`internal/wire/tasks.go`, fixtures): resources `Task`
44 (project, repo, title, brief, stage, branch, base SHA, URL, creator,
45 turn, findings, steps, thread), `Step` (index, specialist, state,
46 reason, attempt, base and candidate SHA, pushed, terminated, summary,
47 log tail), `Finding` (text, repo, path, line), `ThreadEntry`,
48 `TaskList`, `TaskAccepted`, `StepLog`, `PostThread`; `Project.title`
49 and `Project.attachments` (`{kind: repo, ref, name}`); `Card.task_id`;
50 `Snapshot.tasks`; events `task` and `step`; frames `dispatch`,
51 `cancel_step`, `step`, `recheck` (all durable) and `Sync.steps`; stages
52 noted, investigated, in_progress, in_review, ready_to_merge, done,
53 cancelled (in_review and ready_to_merge defined, not reached); tools
54 `record_task`, `add_finding`, `start_task`, `read_task`,
55 `cancel_task`; `TaskBranch` is `equipo/<task-id>-<slug>`.
56
572. Instance (`internal/equipo/chat/tasks.go`, migration 0043): tasks,
58 steps, entries (findings and thread notes) and project attachments
59 are team records; every active member gets their events. The tools
60 are authorised in the runner frame's transaction like the slice 2
61 tools: `record_task` (repository from the allowlist, adds the project
62 with its receipt, task noted, a task card in the turn), `add_finding`
63 (the team's task, a repository in the catalog, a clean path; noted
64 becomes investigated), `start_task` (owner only, once per task; the
65 step, the dispatch command and the events in one transaction),
66 `read_task`, `cancel_task`. Routes: `GET /tasks`, `GET /tasks/{id}`,
67 `POST /tasks/{id}/cancel` (at once when no step runs, else a
68 `cancel_step` and the task ends on the runner's termination report),
69 `POST /tasks/{id}/retry` (409 `not_retryable` until the current
70 attempt failed with termination; a new attempt from the recorded
71 base), `GET /steps/{id}/log`, `POST /tasks/{id}/thread` (idempotent).
72 Step reports: only the current attempt, only forward, base and
73 candidate set once per attempt, done only for the attempt's own
74 pushed candidate. `sync` settles a step the primary runner no longer
75 holds (failed, `interrupted`, terminated) unless its dispatch is
76 still unacked. Projects are products: titled from the catalog
77 (woodstar is Woodstar; oficina/sample's README heading Woodstar),
78 with the repository attached.
79 Tests: `TestContractTasks`, `TestContractStepSync`,
80 `TestContractTaskToolsScope`. Mutations observed failing: Retry
81 without termination, stale attempt accepted, candidate changed,
82 cancel ending before the runner, sync settling a held step, sync
83 settling an unacked dispatch, done with another candidate.
84
853. Forge (`internal/runner/forge/branch.go`): `PushBranch`, the
86 runner's only push. Validates the repository, the task branch
87 (`equipo/...`, never the default), the candidate (a descendant of the
88 base, present and connected in the runner's private repository) and
89 the person (one of the runner's owners); writes a record before any
90 network write; confirms the lease right before the push; pushes with
91 `--force-with-lease` on the observed head; a later call for the same
92 attempt reconciles from the remote (already there is success, no
93 second push). Tests: `TestPushBranch`,
94 `TestPushBranchReconcilesACutPush`, `TestPushBranchRefuses`; each
95 guard mutated and observed failing.
96
974. Workspace (`internal/runner/workspace/task.go`): `TaskTree`. The
98 namespace sees only the files at the base (no `.git`); the runner's
99 private repository (under its state directory, never mounted)
100 borrows the clone's objects; the runner commits what changed
101 (`add -A`, `write-tree`, `commit-tree` on the base) and refuses a
102 `.git` entry at any depth or a special file. No filter, hook or
103 config from the repository runs (`TestTaskTree` plants them).
104
1055. Runner (`step.go`, `engineer.go`): a `steps` table with a unique
106 running attempt per task; dispatch, cancel (a cancel first holds the
107 attempt so a late dispatch never runs) and reports through the
108 outbox; a step engine that runs one attempt at a time; the Engineer:
109 lease, clone, base (the default branch's tip, reported), task tree,
110 the CLI in the existing `implement` profile (workspace read-write,
111 containment and policy unchanged), a permission callback with nobody
112 to ask (`claude.StepPermission`: workspace file actions under the
113 same protected-path and field checks, everything else denied), the
114 step's pinned tools answered "not needed", a per-step log and a
115 bounded tail, the runner's commit, the candidate recorded before the
116 push, `PushBranch`. Cancel kills the namespace; every final report
117 carries termination only once the namespace exit was observed. After
118 a crash, an attempt that had not committed is reported failed
119 (`runner_restarted`) with termination (namespaces verified gone at
120 start); a committed one only pushes. Tests: `TestStepState*`,
121 `TestEngineerRefusesOtherPersons`, `TestStepPermission`; mutations
122 observed failing: recovery, cancel mark, cancel-first hold, unique
123 running index, persons, permission callback, termination.
124
1256. House rule 2026-11-07.6: record the task at once, investigate, attach
126 findings, start the task, reply in two or three lines; never offer
127 to merge or open a pull request; when nothing is reachable, one short
128 line and no repeat of the grant card.
129
1307. Paul's additions: the forge credential file's agent-wide
131 `{agent, api, git}` serves every repository the hub lists for the
132 agent (per-repository entries override); `Repos` (the allowlist) is
133 the file, created and hub-listed repositories. The hub list is
134 trusted 55 s and asked conditionally (`If-None-Match`); a watcher
135 checks reach about once a minute and at once on `recheck`; a change
136 goes out in a hello and the index fetches only the new repositories
137 (`Index.Delta`). Access cards carry the namespace the name says
138 (`NamespaceGuess`: Woodstar is woodstar), the check action (`choice:
139 check`) sends `recheck`, and an open card resolves itself when a
140 hello's catalog reaches the name. Tests: `TestContractGrantCard`,
141 `TestForgeCredentialAgentWide`, headless `3_grant` (resolved 48 ms
142 after the check).
143
1448. Headless (fake CLI in real bwrap, local forge): `3_engineering`
145 (scenario 2 to the branch: noted 0.9 s after the send, stages noted,
146 investigated, in_progress, step done and pushed in about 2 s, branch
147 at the candidate in the forge, parent the base, README fixed, main
148 unmoved, log tail), `4_step_crash` (SIGKILL mid-step, Retry 409
149 while down, failed `runner_restarted` with termination after
150 restart, attempt 2 pushed), `3_step_cancel`, `3_step_contained`
151 (writes to `/etc` and the runtime home denied), `3_grant`. The whole
152 suite runs in 90 s locally.
153
1549. UI (built by a forked session on `thin-v1-slice3-ui` up to 468563c,
155 merged): the task card is a quiet receipt before its turn's
156 reply: the title (linking to `/tasks/<id>`) and its stage in plain
157 words, or "Stopped: <reason>"; once pushed "Pushed <branch> at
158 <sha7>" and Open on Amadan; Retry only after a failure with
159 termination, Cancel until the task ends; actions on hover or focus,
160 behind ⋯ on touch; `task` and `step` events refresh the feed like
161 card events. Grant card: the real `amadan agent grant <agent>
162 <namespace>` and Check now; resolved, one line "<name> is reachable
163 now." Tasks page `/tasks` (all team tasks, `?project=` filter) and
164 `/tasks/tk…` (findings, steps with summary and log tail, notes,
165 Retry, Cancel); "Tasks" in the nav. Projects page `/projects`
166 (titles, attachments, task counts, no forms or budgets) and
167 `/projects/p_…`; the old overview moved to `/projects/accounts`.
168 `TestBrowserTaskCard` at 390 px touch, `TestPages*`; mutations
169 observed failing: receipt placement, Retry before termination,
170 project filter, namespace in the command, resolved card, Cancel,
171 the task/step stream listeners.
172
17310. Person API overlap: the old engine's `GET /tasks` (browser
174 session), `GET /tasks/{id}` and `POST /tasks/{id}/cancel` (old,
175 upper-case ids) still serve the old tasks until the slice 7 sweep;
176 a device bearer and `tk` ids get the thin routes (plan3test was
177 failing on this and passes now).
178
17911. Live fix: the project clone is shallow (the index fetches with
180 depth 1), so the first live push was refused when the private
181 repository could not walk past the base. The private repository now
182 carries the clone's shallow boundary (`TestTaskTreeFromShallowClone`
183 failed first; the local forge's sample gained history and
184 `3_engineering` failed without the fix).
185
18612. Merged `thin-v1-slice2b` at 721732c (notebook UI) as the
187 coordinator asked; `thin-v1-thinking` waits for Paul's pick.
188
18913. Review round 1 (Astra at 9ad3dbb, REQUEST CHANGES, five Important
190 and one Minor), after merging `thin-v1-slice2b` at 001736f. Each fix
191 has a test that failed first and a mutation observed failing:
192 1. Execution authority: tasks and projects stay shared within the
193 team (reads, events), but only a task's creator starts, retries
194 or cancels it, onto their own runner, through API v1 (403), the
195 pages (no Retry or Cancel for a teammate; 403 on post) and the
196 coordinator tools (`not_yours` for start_task, cancel_task and
197 add_finding; read_task allowed). Removed members read nothing.
198 `TestContractTaskAuthority` (two owners, two runners).
199 2. Termination needs the containment's verified exit: Wait's error
200 is kept, and an unverified exit is no termination (no commit,
201 publish or Retry), its namespace record kept (`TestStopStep...`).
202 3. A push replaces only its recorded predecessor (no branch, or a
203 commit an earlier attempt pushed), fixed before the first push; a
204 reconcile that finds another head is a conflict, never a force
205 (`TestPushBranchNeverOverwritesOthers`: lost answer, then the
206 person advances; `TestPushBranchLeaseHolds`: the branch moves
207 mid-push).
208 4. A step's private repository is kept until its final report is
209 acked, then swept; a recorded push already on the remote
210 reconciles as published before any local check
211 (`TestPushBranchReconcilesWithoutTheRepository`,
212 `TestStepFilesKeptUntilAcked`).
213 5. Unproven terminations stay `pending` (with their namespace id)
214 through acks and restarts; startup and every sync re-probe them
215 through the containment, and a verified exit sends a follow-up
216 report with termination, so Retry becomes possible; startup
217 recovery claims termination only for namespaces it verified
218 (`TestStepPendingTermination`, `TestStepRecoverWithoutProof`).
219 6. Minor: a grant card resolves only for its intended namespace or a
220 repository named after it, never on a fuzzy hit.
221 7. Paul: a click anywhere in the compose box focuses the message
222 (`chat-compose.js`, its own file so the thinking-line branch
223 merges cleanly); `TestBrowserComposerFocus` at 1280 with a mouse
224 and 390 with touch, Send keeps its click.
225
226## Decisions
227
228- Tool set: `record_task`, `add_finding`, `start_task(task, brief)`,
229 `read_task`, `cancel_task` instead of one `start_task(project, kind,
230 brief, steps[])`: Paul asked for the task to exist before any code,
231 and findings to attach to it. One Engineering step per task in slice
232 3; Review is slice 4.
233- After its step pushes, a task stays `in_progress` (slice 4 moves it to
234 review). The card shows the branch, the SHA and Open on Amadan.
235- Open on Amadan is `https://amadan.net/<ns>/<repo>?branch=<branch>`
236 (the hub routes `?branch=` on the repository page; `/tree/...` is not
237 a route).
238- The Engineering step runs the existing `implement` profile unchanged
239 (its policy, mounts and init check), so containment is exactly as in
240 §5; its pinned tools (`submit_candidate`, `ask_person`,
241 `submit_render`) are served and answer that the runner commits.
242- The model never runs git on the task: the working copy has no `.git`,
243 and the runner commits after the namespace has exited.
244- Commit identity: `Equipo Engineering <engineering@equipo.invalid>`.
245- Retry starts the step again from the recorded base, on the same task
246 branch (`--force-with-lease` on the observed head).
247- Thread notes are recorded and shown; they do not start a coordinator
248 turn yet (the coordinator reads them with `read_task`).
249- The person check in `stepReport` is defence in depth: the primary
250 runner check that follows already refuses another person's runner, so
251 no test can observe it alone. Likewise `StepPermission`'s protected
252 path check (the allow path repeats it).
253- `internal/runner/thin` is over the 5,000-line ceiling (5,686): a
254 recorded exemption to 6,000 until the slice 7 sweep.
255
256## Live runs (budget: 12 coordinator turns, 4 Engineering steps)
257
258Used: 1 coordinator turn, 2 Engineering steps. No automatic move-in or
259explore turn ran on the suite runner (its turns today: only the one).
260
2611. Release 0b54b1b (deployed with `--swap hold`, both staging runner
262 units installed), suite person, scripted message "Fix the Woodstar
263 iOS swipe-back bug." (1 counted turn, Engineering step 1):
264 - task `tklkbx5vid3y` noted 4.0 s after the send, under the
265 woodstar/woodstar project (Working in card), stages noted,
266 investigated, in_progress;
267 - finding: the outer navigation controller hides its bar, which
268 turns off the edge swipe (`ios/Woodstar/AccountNavigationHost.swift:15`);
269 - the reply: "I found the cause and Engineering is fixing it now in
270 woodstar. ..." (no question, no merge offer);
271 - step 1 ran the real CLI in containment (read three Swift files,
272 edited the host, the compact navigation and a UI test), the runner
273 committed `e971eb4`; the push was refused: shallow clone (item 11).
274 Failed `push_failed` with termination, so Retry was allowed.
2752. Release 3d3dba3 (the fix), Retry through `POST /api/v1/tasks/
276 tklkbx5vid3y/retry` (202, attempt 2; Engineering step 2): started
277 13:59:45, done 14:00:29 (44 s), candidate `82a4a0cc643155fb7e3e1f6a3a1dbd66cf8d44c3`
278 on base `0194d925`, pushed, terminated. `git ls-remote` on
279 amadan.net/woodstar/woodstar shows
280 `equipo/tklkbx5vid3y-ios-edge-swipe-to-go-back-doesn-t-work-o` at
281 that SHA; Woodstar's main untouched by Equipo; no PR opened. The
282 card's URL: https://amadan.net/woodstar/woodstar?branch=equipo/tklkbx5vid3y-ios-edge-swipe-to-go-back-doesn-t-work-o
283 The step's summary says it could not build or run the iOS UI test on
284 Linux and asks for that before merging.
285
286## Copy for review
287
288Accepted for now with the existing marker in `copy.go` (and listed in
289the plan 3 inventory):
290- `nav.tasks` "Tasks"
291- `chat.card.access_resolved` "%s is reachable now."
292- `chat.card.grant_check` "Check now"
293- `work.stage.noted` "Noted", `work.stage.investigated` "Looking into
294 it", `work.stage.in_progress` "In progress", `work.stage.in_review`
295 "In review", `work.stage.ready_to_merge` "Ready to merge",
296 `work.stage.done` "Done", `work.stage.cancelled` "Cancelled"
297- `work.stopped` "Stopped: %s"
298- `work.reason.runner_restarted` "the runner restarted",
299 `no_changes` "nothing needed changing", `push_failed` "the push to
300 Amadan failed", `push_conflict` "the branch changed on Amadan",
301 `step_timeout` "it ran out of time", `interrupted` "the runner lost
302 track of it", `other` "something went wrong"
303- `work.pushed` "Pushed %s at %s", `work.open` "Open on Amadan",
304 `work.retry` "Retry", `work.cancel` "Cancel"
305- `work.step` "Engineering, attempt %d: %s"; `work.step.queued`
306 "waiting", `running` "working", `done` "done", `failed` "stopped",
307 `cancelled` "cancelled"
308- `work.findings` "Findings", `work.steps` "Engineering", `work.notes`
309 "Notes", `work.note_add` "Add a note", `work.notes_empty` "No notes
310 yet.", `work.noted_by` "Noted by %s"
311- `work.tasks_empty` "No tasks yet. Tell the coordinator what needs
312 doing.", `work.all_tasks` "All tasks", `work.projects_empty` "No
313 projects yet. They appear here when the coordinator adds them.",
314 `work.task_count` "Tasks: %d"
315- `chat.activity.record_task` "Noting the task…"
316- `chat.activity.add_finding` "Noting what I found…"
317- `chat.activity.start_task` "Handing it to Engineering…"
318- `chat.activity.read_task` "Checking the task…"
319- `chat.activity.cancel_task` "Cancelling the task…"
320
321## Open issues
322
323- Staging is shared with the 2b review session, which restaged 721732c
324 at 14:00:56; the final slice 3 build is restaged after CI.
325- The hub sends no ETag for `/api/v1/repos`, so the minute check is a
326 plain small GET per runner.
327- Engineering cannot build or test iOS on the Linux runner; the step
328 says so in its summary. Review and checks are slice 4.
329- `TestBrowserMoveIn` waits 5 s for the move-in line; under a load of
330 30+ on this box it timed out once in a full browser run (passes
331 alone and in later full runs). Browser tests are not in CI.
332- `internal/headless` measured 158 to 207 s locally under load (budget
333 180 s; CI measured 98 s before the merges).
334- Retry of a step whose push failed runs the specialist again (a new
335 attempt); re-publishing the earlier candidate alone is not offered.
336- A recorded task branch keeps attempt 1's slug from the coordinator's
337 title (`...-doesn-t-work-o`, cut at 40 characters).
338
339## Blockers
340
341None yet.
342