| 1 | # Slice 4 progress: Review and checks |
| 2 | |
| 3 | Branch `thin-v1-slice4` from `thin-v1-slice3` (8d87205), with |
| 4 | `thin-v1-thinking` merged at 71ce51b (a fast-forward: it already held |
| 5 | slice 3). Spec: `docs/superpowers/specs/2026-11-06-equipo-thin-v1.md` |
| 6 | §§0-5, 7, 8 row 4, plus the coordinator's additions of 2026-11-07 (Paul's |
| 7 | staging feedback): task links in replies, a live receipt line, the |
| 8 | sidebar on API v1, the outcome-level coordinator voice, and a details |
| 9 | view with "ask the implementer". Conventions and scripts as in |
| 10 | `SLICE1-PROGRESS.md` to `SLICE3-PROGRESS.md`. |
| 11 | |
| 12 | ## Done |
| 13 | |
| 14 | 1. Contracts (`internal/wire/tasks.go`, fixtures): specialists |
| 15 | `checks` and `review`; checks outcomes `passed`, `failed`, `none` |
| 16 | ("No checks found", not a failure) and `cannot_run` (with a reason: |
| 17 | `needs_macos`, `needs_network`, `checks_timeout`, |
| 18 | `checks_unavailable`; never a pass); verdicts `approve` and |
| 19 | `changes_requested`; review labels `other_family`, `same_family`, |
| 20 | `same_account`; `Task.NeedsYou` (`merge`, `fix_rounds`, |
| 21 | `review_blocked`, `retry`); `wire.MaxFixRounds` 2. `Step` gained |
| 22 | `round`, `family`, `account`, `verdict`, `review_label`, `findings`, |
| 23 | `checks`, `gate`, `exit_code`; `Task` gained `candidate_sha`, |
| 24 | `checks`, `checks_reason`, `verdict`, `review_label`, `needs_you`, |
| 25 | `fix_rounds`, all computed from the steps beside the newest pushed |
| 26 | SHA. Dispatch gained `candidate_sha` (the SHA a checks or review step |
| 27 | judges, or the commit a republish pushes), `republish`, |
| 28 | `from_attempt`, `avoid_account`, `round`; step reports gained the |
| 29 | results and `output` (the checks' last 200 lines). Frames |
| 30 | `watch_merge` (instance to runner, durable) and `merged` (runner to |
| 31 | instance, durable). `GET /api/v1/needs-you` (`TaskList`). New |
| 32 | fixtures: `api/task-ready.json`, `api/needs-you.json`, |
| 33 | `frames/watch_merge.json`, `frames/merged.json`; the native apps |
| 34 | build against them. |
| 35 | |
| 36 | 2. Instance (`internal/equipo/chat/review.go`, migration 0044): |
| 37 | `advance` runs after every step report and on every sync. A pushed |
| 38 | candidate gets a checks step, then a review step, each dispatched |
| 39 | with the exact SHA; a judgement counts only for the SHA it was asked |
| 40 | to judge and only when whole (checks: outcome, gate and exit agree; |
| 41 | review: verdict and label). Checks that fail or review that asks for |
| 42 | changes send an automatic Engineering fix round on top of the |
| 43 | candidate (same branch, base the candidate) with the output tail or |
| 44 | the findings, at most two; then Needs you. Ready to merge only when |
| 45 | branch, SHA, checks (or an honest "not run, reason") and approval |
| 46 | refer to one SHA; a new candidate leaves the old judgements behind |
| 47 | (`progressOf` resets them). The runner is asked to watch every newest |
| 48 | pushed candidate; a `merged` report for it makes the task Done (an |
| 49 | older candidate's is ignored; a cancel stops the watch). Retry of a |
| 50 | failed review or checks step judges the same SHA again; Retry of a |
| 51 | failed push republishes the recorded commit (`republish`, chained to |
| 52 | the attempt that made it) instead of running Engineering again. Task |
| 53 | slugs are cut at a word boundary. Tests: `TestContractReviewAndChecks`, |
| 54 | `TestContractFixRoundsCap`, `TestContractReviewBlockedAndRetry`, |
| 55 | `TestContractSyncJudgesOldCandidates`; `TestTaskBranch` gained the |
| 56 | word-boundary cases. |
| 57 | |
| 58 | 3. Runner (`internal/runner/thin/judge.go`, `merge.go`): |
| 59 | - Checks: a fresh task tree of the exact SHA; the gate in Amadan's |
| 60 | own order (`.amadan/ci.d/` steps in order, else `.amadan/ci`, else |
| 61 | a `make ci` target, else "No checks found"), read without following |
| 62 | links out of the tree; a change touching Swift, Objective-C or Xcode |
| 63 | files (or a gate calling Xcode's tools) on a Linux runner is |
| 64 | `cannot_run`/`needs_macos` without running anything; otherwise the |
| 65 | tree gets a `.git` of its own at exactly the SHA (shallow, one |
| 66 | commit, no remote, no hooks) and the gate runs in the containment's |
| 67 | check profile (no network, no provider home, private `/tmp`, the Go |
| 68 | toolchain and module cache read-only, `GOPROXY=off`), with exit code |
| 69 | and last 200 lines recorded. A failure that is the network missing |
| 70 | is `needs_network`, a timeout `checks_timeout`; neither is a pass or |
| 71 | a fail. `BuildCheckPolicy` takes the Codex binary and the Go trees |
| 72 | as optional. |
| 73 | - Review: a fresh read-only tree of the exact SHA, action `inspect` |
| 74 | (specialist Reviewer: Read, Glob and Grep only, no shell or write |
| 75 | tools; the read-only mount and `ReadPermission` behind it), fresh |
| 76 | session, the diff from the task's base in the prompt, the verdict |
| 77 | through `submit_review` (verdict, summary, findings with file and |
| 78 | line). No verdict is `no_verdict`. Account: another family when |
| 79 | the runner can run one (none yet: the Codex step path is slice 5), |
| 80 | else another Claude account (`same_family`), else a fresh session on |
| 81 | Engineering's account (`same_account`). |
| 82 | - Engineering, Review and checks share one launch path |
| 83 | (`specialistRun`); the step reports family and account. |
| 84 | - Merge watch: `watch_merge` is recorded per task; about once a |
| 85 | minute the runner reads each watched repository's default branch |
| 86 | tip (one `ls-remote --symref`), and only when it moved fetches and |
| 87 | checks the candidate is an ancestor of the tip, or (a squash) that |
| 88 | every path the task changed reads at the tip as at the candidate. |
| 89 | - A failed push keeps its private repository until an attempt of that |
| 90 | step publishes, so a republish finds the commit. |
| 91 | Tests: `TestFindGate`, `TestNeedsMacOS`, |
| 92 | `TestLineTailKeepsTheLast200Lines`, `TestVerdictOf`, |
| 93 | `TestReviewerAccount`. |
| 94 | |
| 95 | 4. Fake CLI: `[Equipo: review]` steps call `submit_review` |
| 96 | (`review:approve`, `review:changes:`, `review:need:`, `review:silent`, |
| 97 | `review:write:`, `reviewsleep:`). |
| 98 | |
| 99 | 5. Headless (fake CLI in real bwrap, local forge; the sample repository |
| 100 | has a `make ci` gate and an iOS file): `4_review` (scenario 2 |
| 101 | complete: Engineering pushes, the repository's checks fail on that |
| 102 | SHA, a fix round mends it from their output, review asks for one more |
| 103 | change, a second round makes it, checks pass and review approves the |
| 104 | newest SHA: ready to merge, Needs you; the checks' log holds the SHA |
| 105 | from `git rev-parse HEAD` inside the namespace; the person updates |
| 106 | main in the forge and the task is Done about a second later) and |
| 107 | `4_checks_honest` (an iOS change: checks `cannot_run`/`needs_macos`, |
| 108 | no exit code; review approves and its attempt to write was denied; |
| 109 | ready to merge, honest about the checks). `4_witness` is staging |
| 110 | only. |
| 111 | |
| 112 | 6. Coordinator voice and task links (Paul, 2026-11-07): `record_task`, |
| 113 | `start_task` and `read_task` results carry the task's title and its |
| 114 | link (`/tasks/<id>`); the standing prompt (house rule 2026-11-07.7) |
| 115 | asks for outcome-level replies ("Got it, I've logged [Swipe back |
| 116 | doesn't work](/tasks/tk...) and Engineering is on it."), no file |
| 117 | paths, line numbers or code mechanics unless asked, the diagnosis on |
| 118 | the task with `add_finding`, and a task always named as a markdown |
| 119 | link, never "the task card". The chat renderer allows only task and |
| 120 | project pages as same-origin links (`TestSiteLinksOnlyTasksAndProjects`); |
| 121 | `TestOpeningOutcomeLevelVoice`; the contract test checks the links in |
| 122 | the tool results. |
| 123 | |
| 124 | 7. UI: |
| 125 | - Task card (receipt): the stage moves live (In progress, Pushed |
| 126 | branch at SHA, In review with "Running checks…" and "Reviewing…", |
| 127 | then Ready to merge with "Checks passed (make ci)" or the honest |
| 128 | "Checks can't run here (needs macOS)", "Approved (same family, same |
| 129 | account)", and one prominent button "Open on Amadan to merge" for |
| 130 | the task's creator only); Needs you lines for the fix-round cap and |
| 131 | a blocked review; Retry and Cancel stay behind hover, focus or ⋯. |
| 132 | - Task page: each step by specialist and attempt (fix rounds named), |
| 133 | its result, summary, review findings with file and line, and log |
| 134 | tail; the checks' 200 lines through `GET /api/v1/steps/{id}/log`. |
| 135 | - Tasks page `?needs=you` is Needs you. |
| 136 | - Sidebar on API v1 (`rail.go`, `nav-stream.js`): Conversation, Tasks |
| 137 | (active count), Projects, Needs you, then Specialists: Engineering |
| 138 | and Review (checks show under Review) say "working" with the task's |
| 139 | title linked while a step runs, else "idle"; Product, Design and |
| 140 | Copy are hidden; Team: People. Counts are quiet (nothing at zero). |
| 141 | Journey, Playbooks, Templates, Preferences, the old "Your |
| 142 | coordinator", Connections and Settings (old accounts and budgets) |
| 143 | are out of the nav. It follows the event stream on every page and |
| 144 | swaps in `GET /nav/rail` on task, step and project events. |
| 145 | Tests: `TestPagesTasksAndProjects` (judged card, merge decision only |
| 146 | for the creator, Needs you page, steps on the task page), |
| 147 | `TestPagesRail` (no old page linked from any page's sidebar; |
| 148 | Engineering working on a linked task with the count), |
| 149 | `TestChatNavigationStatus`; browser `TestBrowserReceiptFollowsReview` |
| 150 | (390 touch: In progress, pushed, In review, checks and review lines, |
| 151 | Ready to merge and the button, no reload) and |
| 152 | `TestBrowserRailFollowsWork` (1280 and 390: Engineering working with |
| 153 | the title and Tasks 1, then Review, then idle and Needs you 1, no |
| 154 | reload). |
| 155 | |
| 156 | 8. Mutation checks (five, risky paths): candidate reset on a new SHA, |
| 157 | the judged-SHA check, the fix-round cap and the macOS rule were each |
| 158 | observed failing a test. `ReadPermission` replaced by the Engineering |
| 159 | callback survived: the Reviewer policy has no Write or Edit tool, so |
| 160 | the permission layer refuses it first; `ReadPermission` is defence in |
| 161 | depth. |
| 162 | |
| 163 | 9. Staging (releases 2e53061, then fe298b5; built by `make release`, |
| 164 | deployed with `--swap hold`, both staging runner units installed, |
| 165 | about a minute of change-over each time), real Claude CLI 2.1.312: |
| 166 | - Woodstar witness, suite task `tklkbx5vid3y` (branch |
| 167 | `equipo/tklkbx5vid3y-ios-edge-swipe-to-go-back-doesn-t-work-o`, no |
| 168 | new message): judged on its own after the upgrade's first sync. |
| 169 | Checks on 82a4a0cc: `cannot_run`/`needs_macos` ("Checks can't run |
| 170 | here (needs macOS)", nothing run, never a pass), at once. Review on |
| 171 | 82a4a0cc (claude-a, `same_account`, 29.6 s): approve ("The |
| 172 | Coordinator now acts as the outer controller's pop-gesture delegate |
| 173 | and allows the swipe only when the timeline is pushed..."). Ready to |
| 174 | merge, Needs you `merge`, everything on 82a4a0cc; about 40 s after |
| 175 | the runner restarted. |
| 176 | - Paul's task `tks6kwzzdngr` (his runner): checks `needs_macos` on |
| 177 | ad2432e2; review asked for changes; the automatic fix round pushed |
| 178 | 4f0cfe4a in about 10 s; its checks then failed `clone_failed` (the |
| 179 | hub refused the fetch while both restarted runners re-indexed; the |
| 180 | fetch now retries with backoff, in fe298b5). It waits at Needs you |
| 181 | `retry` for Paul's Retry; I did not act on his task. |
| 182 | - `oficina/suite` scenario (`4_review` live, suite person, one |
| 183 | message: "In the oficina/suite README, the paragraph under "What is |
| 184 | built, and what is not" breaks mid-sentence after "S6 is step 4,". |
| 185 | Please fix that line break."): task `tk2jhc6z46ar`, branch |
| 186 | `equipo/tk2jhc6z46ar-fix-line-break-in-readme-what-is-built` (cut at |
| 187 | a word). Engineering 8.5 s, candidate b9bc2406; checks ran the |
| 188 | repository's own `.amadan/ci.d` gate (gofmt, vet, build, test) in |
| 189 | the containment on b9bc2406: passed, exit 0, 9.5 s; review 7.7 s |
| 190 | (`same_account`): approve. Ready to merge 38.9 s after the send, all |
| 191 | on b9bc2406. The reply: "I've logged [Fix line break in README "What |
| 192 | is built" paragraph](/tasks/tk2jhc6z46ar) in suite, and Engineering |
| 193 | is fixing it now. You were right: "step 4," sits alone on its own |
| 194 | line, so they're rejoining the paragraph without changing any |
| 195 | words." (outcome level, linked, no path or line). |
| 196 | - Nothing was merged and no pull request opened; the person merges on |
| 197 | Amadan. |
| 198 | |
| 199 | CI: green at fe298b5 (the code; this log's commit changes docs only), |
| 200 | after two red runs fixed on the way: the old engine suites asserted the |
| 201 | old sidebar, then a variable left unused. |
| 202 | |
| 203 | 10. Review round 1 (Astra, REQUEST CHANGES, six Important). Each fix has |
| 204 | a test that failed first: |
| 205 | 1. Readiness holds only while the task branch is at the judged SHA. |
| 206 | The runner's watch reads the task branch's head with the default |
| 207 | branch's tip (one `ls-remote`), on the minute check and after every |
| 208 | sync, and reports any change (`branch` frame, durable). Away from |
| 209 | the newest candidate (or gone), the task leaves Ready to merge, its |
| 210 | checks, verdict and label are empty, `branch_head` names the new |
| 211 | head and Needs you is `branch_moved` ("Needs you: the branch moved |
| 212 | on Amadan after it was checked"); the card shows none of the old |
| 213 | judgements beside the branch's link. Back at the SHA, it is ready |
| 214 | again. A report about an older candidate is ignored. |
| 215 | `TestContractBranchMovedInvalidatesReadiness`; headless `4_review` |
| 216 | pushes over the approved SHA in the forge and back. |
| 217 | 2, 3. The squash check reads paths NUL-delimited and compares whole |
| 218 | tree entries (`diff-tree` of the candidate against the tip: mode, |
| 219 | type, object, or absence); any git failure is unknown, never |
| 220 | merged. `TestMergedSquashCheckIsConservative` (Astra's `café.txt` |
| 221 | and executable-bit reproductions, squashed and unmerged deletes, |
| 222 | an unreadable base). |
| 223 | 4. `needs_network` is a known step reason. `TestRunnerReasonsAreKnown` |
| 224 | reads every reason literal the step code emits (fail, done, |
| 225 | reason fields, `reasonFor`) from the source and checks it against |
| 226 | `wire.StepReasons` (observed failing without `needs_network`). |
| 227 | Fallback (decided): a reason the instance does not know is recorded |
| 228 | as `unknown`, never refused, so a newer runner's durable report is |
| 229 | acked once instead of closing the connection on every replay. |
| 230 | `TestContractCannotRunReasonsAreDelivered` (delivery, ack, review |
| 231 | follows, for `needs_network` and an unknown reason). |
| 232 | 5. Fetches have deadlines: two minutes per attempt (four attempts with |
| 233 | backoff), ten minutes for a judge's preparation as a whole and for |
| 234 | Engineering's fetch; git and its remote helper run in their own |
| 235 | process group, killed together, with a bounded wait. |
| 236 | `TestJudgeFetchHasDeadlines` (a remote that accepts and never |
| 237 | answers: `clone_failed` in under a second instead of hanging). |
| 238 | 6. The review diff is read through a bound (the command is stopped |
| 239 | past 48 KiB), and the checks tree's objects stream `rev-list | |
| 240 | pack-objects | index-pack` with a 2 GiB bound; `ls-remote` and the |
| 241 | merge check's git output are bounded too. |
| 242 | `TestOversizedCandidateStaysOutOfMemory` (a 16 MiB candidate: under |
| 243 | 8 MiB allocated for each; before, the diff alone allocated 642 MiB |
| 244 | for 96 MiB), and the pack bound refuses an oversized candidate. |
| 245 | Size exemptions: `internal/runner/thin` 7200, `internal/equipo/chat` |
| 246 | 5300; time record for `internal/runner/thin` 30s. |
| 247 | |
| 248 | ## Live runs (budget: 10 coordinator turns, 4 Engineering steps, 6 Review steps) |
| 249 | |
| 250 | Used: 1 coordinator turn (the suite scenario), 2 Engineering steps (the |
| 251 | automatic fix round on Paul's `tks6kwzzdngr`, the suite's |
| 252 | `tk2jhc6z46ar`), 3 Review steps (`tklkbx5vid3y`, `tks6kwzzdngr`, |
| 253 | `tk2jhc6z46ar`). No automatic move-in or explore turn ran. |
| 254 | |
| 255 | ## Decisions |
| 256 | |
| 257 | - The automatic fix round is sent by the instance, not by a coordinator |
| 258 | model turn: deterministic, no turn spent; the coordinator sees it with |
| 259 | `read_task`. Checks run before review; failed checks go straight to a |
| 260 | fix round (no review spent on a failing SHA). |
| 261 | - Checks that cannot run here still lead to review, and a task may be |
| 262 | ready to merge with "Checks can't run here (needs macOS)": the person |
| 263 | decides. It never shows as a pass. |
| 264 | - Gate order follows Amadan (`.amadan/ci.d/`, `.amadan/ci`, `make ci`): |
| 265 | several Oficina repositories (suite, sheets, home, docs, estilo) have |
| 266 | only `ci.d`, which the brief's two-item list would call "No checks |
| 267 | found". |
| 268 | - The checks tree carries its own `.git` at the exact SHA because gates |
| 269 | ask git (`git ls-files` in oficina/suite's gate); the namespace may |
| 270 | change it, and the tree is thrown away after. |
| 271 | - Checks output is recorded raw (last 200 lines): it comes only from |
| 272 | inside the namespace, which sees no credential or host path. |
| 273 | - Another family: the thin runner runs Claude only until slice 5 builds |
| 274 | the Codex step path and proves a live Codex refresh, so Review labels |
| 275 | are `same_family` or `same_account` for now. |
| 276 | - Needs you is computed from the stage and the steps, so every client |
| 277 | derives the same; `merge` (ready) is a Needs you item. |
| 278 | - The rail's Review line also covers checks. |
| 279 | - Merge detection watches every newest pushed candidate (not only ready |
| 280 | ones), so a merge at Needs you also ends the task. |
| 281 | - Size exemptions raised: `internal/runner/thin` to 7000 (judge and |
| 282 | merge share the Engineer's launch internals), `internal/equipo` to |
| 283 | 12000 (sidebar and card lines), until the slice 7 sweep. |
| 284 | |
| 285 | ## Open issues |
| 286 | |
| 287 | - Version skew at deploy: for about a minute between the instance |
| 288 | deploy and the runner install, the old runners refused the new |
| 289 | `watch_merge` frame and reconnected in a loop (the frame stays |
| 290 | durable and is delivered once the new runner connects). The |
| 291 | production cutover installs the runner right after the instance, as |
| 292 | it does; a runner that skips unknown durable frames would remove the |
| 293 | loop. |
| 294 | - The hub refuses bursts of git requests from one agent; both staging |
| 295 | runners re-index every repository after a restart, and checks or |
| 296 | review fetching then can fail. The judge fetch retries four times |
| 297 | with backoff; Paul's `tks6kwzzdngr` needs his Retry. |
| 298 | |
| 299 | - Ask the implementer (Paul, 2026-11-07): the task page shows the |
| 300 | findings, each step's summary, review findings and checks output. A |
| 301 | question from the task thread that resumes the step's own session |
| 302 | read-only is not built: it needs step sessions kept per task (today a |
| 303 | step's session is a fresh `--session-id` per attempt, its runtime home |
| 304 | deleted on exit), a read-only resume action, and thread replies as a |
| 305 | new runner frame. First item for the next slice. |
| 306 | - Squash merges are detected by comparing the changed paths at the tip; |
| 307 | a later commit that touches the same files before the minute check can |
| 308 | hide it until the next change of the tip. |
| 309 | - A gate needing modules the runner's module cache lacks reports |
| 310 | `needs_network`, not a result. |
| 311 | |
| 312 | ## Copy for review |
| 313 | |
| 314 | Accepted for now with the existing marker in `copy.go` and listed in |
| 315 | the plan 3 inventory: |
| 316 | - `nav.working` "working", `nav.more` "+%d more" |
| 317 | - `work.specialist.engineering` "Engineering", `.checks` "Checks", |
| 318 | `.review` "Review" |
| 319 | - `work.step` "%s, attempt %d: %s" (was "Engineering, attempt %d: %s"), |
| 320 | `work.steps` "Steps" (was "Engineering"), `work.round` "fix round %d" |
| 321 | - `work.checks.passed` "Checks passed (%s)", `.failed` "Checks failed |
| 322 | (%s, exit %d)", `.none` "No checks found", `.needs_macos` "Checks |
| 323 | can't run here (needs macOS)", `.needs_network` "Checks can't run here |
| 324 | (they need the network)", `.checks_timeout` "Checks didn't finish in |
| 325 | time", `.checks_unavailable` "Checks can't run on this runner", |
| 326 | `.running` "Running checks…" |
| 327 | - `work.review.approve` "Approved (%s)", `.changes_requested` "Changes |
| 328 | requested (%s)", `.running` "Reviewing…", `.other_family` "another |
| 329 | model family", `.same_family` "same family", `.same_account` "same |
| 330 | family, same account" |
| 331 | - `work.merge` "Open on Amadan to merge" |
| 332 | - `work.needs.fix_rounds` "Needs you: still not approved after two fix |
| 333 | rounds", `work.needs.review_blocked` "Needs you: the review ended |
| 334 | without a verdict" |
| 335 | - `work.reason.no_verdict` "the review gave no verdict", |
| 336 | `.candidate_unavailable` "the commit was not on Amadan", |
| 337 | `.account_unavailable` "no model account was ready" |
| 338 | - `work.needs.branch_moved` "Needs you: the branch moved on Amadan |
| 339 | after it was checked" (review round 1) |
| 340 | - `work.review_findings` "Review found", `work.needs_empty` "Nothing |
| 341 | needs you right now." |
| 342 | |
| 343 | ## Blockers |
| 344 | |
| 345 | None. |
| 346 | |