| index 1508ec31..fd8e028c 100644 |
| --- a/docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md |
| +++ b/docs/superpowers/plans/2026-11-28-mac-runners-slice-f.md |
| @@ -1,112 +1,118 @@ |
| # Mac runners slice F: Engineering on a Mac worker |
| |
| -Status: draft for Astra review, 2026-11-28. Spec: |
| -`docs/superpowers/specs/2026-11-07-equipo-mac-runners.md` rev 4 plus its |
| -§8 addendum (2026-11-28), which is current where they differ. Branch |
| -`mac-slice-f` from `origin/main` 8bd40ed1. Controller brief: |
| -`CONTROLLER-BRIEF-mac-slice-f.md`. |
| +Status: rev 2, 2026-11-28, after Astra round 1 (NOT READY, 20 findings, |
| +all taken). Spec: `docs/superpowers/specs/2026-11-07-equipo-mac-runners.md` |
| +rev 4 plus its §8 addendum (2026-11-28), which is current where they |
| +differ. Branch `mac-slice-f` from `origin/main` 8bd40ed1. Controller |
| +brief: `CONTROLLER-BRIEF-mac-slice-f.md`. |
| |
| Paul (2026-11-28): "Surely mac runners need to be able to do native Mac |
| and iOS development?" Slice F lets a Mac worker run Engineering steps |
| -with Claude Code, so iOS and Mac changes are made and built on a Mac. The |
| -primary still holds the forge, pushes, reviews and merges. |
| +with Claude Code, so iOS and Mac changes are made, and where the sandbox |
| +is proven built, on a Mac. The primary still holds the forge, chooses |
| +bases, pushes, reviews and merges. |
| |
| ## 0. Ground rules for every task |
| |
| -- **Tests first.** Each task writes its failing tests, runs them and |
| - sees them fail for the stated reason, then implements. Every guard |
| +- **Tests first.** Each task writes its failing tests, runs them, and |
| + sees them fail for the stated reason before implementing. Every guard |
| named in a task gets a **mutation check**: break the guarded line, |
| - watch a named test fail, restore. Record the commands and results in |
| + watch a named test fail, restore. Record commands and results in |
| `docs/superpowers/plans/MAC-SLICE-F-PROGRESS.md` (AGENTS.md). |
| -- **Targeted runs while iterating**, for example |
| +- **Targeted runs while iterating**, such as |
| `go test ./internal/runner/thin/ -run TestWorkerEngineering -count=1`. |
| - `make ci` once before the whole-branch review. Darwin code builds on |
| - Linux: `GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build ./...` and |
| - `make vet` (which vets the runner for darwin/arm64) on every task that |
| - touches darwin files. |
| + `make ci` runs once, before the whole-branch review. Darwin code is |
| + built on Linux. Every task that touches darwin files runs |
| + `GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build ./...` and |
| + `make vet` (which vets the runner for darwin/arm64). |
| - **What only a Mac can show** is unit-tested with recorded outputs and |
| - fakes, and proven by the shipped probes (task 13) once a release runs |
| - on the Studio. A recorded output is labelled with the date and the |
| - machine it came from. |
| -- **Protocol 36** (`wire.ProtocolMacEngineering`) gates every new frame |
| - field. `wire.Encode(f, p)` for p < 36 drops them, and the protocol |
| - fixture tests encode each new frame at 35 and 36. Confirm the number |
| - with the parent before code (other branches allocate numbers too). At |
| - most one migration; take the next free number at the time. |
| -- **Copy.** Every new user-facing string goes in `internal/equipo/copy.go` |
| - marked `// COPY REVIEW PENDING` and in the copy-review JSON |
| - `docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json` (task 14). |
| - No em dashes, no exclamation marks. |
| -- **Round limit.** Astra reviews this plan, the risky tasks (3, 7, 8, |
| - 9, 10, 11, 14) and the whole branch, **at most three rounds each**. |
| - After round 3, the controller fixes what is clearly right, writes down |
| - what stays open, and asks the parent. It never starts a fourth round. |
| + fakes, then proven by the shipped probes (task 14) once a release runs |
| + on the Studio. Each recorded output carries its date and the machine |
| + it came from. |
| +- **Protocol 36** (`wire.ProtocolMacEngineering`) gates every new frame, |
| + field and command. `wire.Encode(f, p)` for p < 36 drops them. The |
| + fixture tests encode each new frame at 35 and at 36. Both the primary |
| + and the worker must speak 36 before Mac Engineering is placed. Confirm |
| + the number with the parent before code, since other branches also |
| + allocate numbers. Use one migration, with the next free number at the |
| + time. |
| +- **Copy** follows AGENTS.md: new runtime strings go in |
| + `internal/equipo/copy.go`, marked pending with |
| + `python3 scripts/copy-status.py pending`. The same strings also go in |
| + the copy-review JSON `docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json` |
| + for Luna's review (task 15). Engineering never writes acceptance |
| + markers. No em dashes, no exclamation marks. |
| +- **Round limit.** Astra reviews this plan, the risky tasks (3, 4, 7, 8, |
| + 9, 10, 11, 12, 15) and the whole branch, **at most three rounds each**. |
| + After round 3 the controller fixes what is clearly right, records what |
| + stays open, and asks the parent. There is never a fourth round. |
| - **Never** merge, deploy, enrol, change Studio state, sign in to a |
| - provider, or run a live model turn. The one exception is the shipped |
| - probe turn in task 13, which runs only on the Studio after a deploy |
| - done by someone else. |
| + provider, or run a live model turn. The shipped probe turn (task 14) |
| + runs only on the Studio, after a deploy someone else does. |
| |
| ## 1. What exists and what is missing |
| |
| -Built (slices A to E, `RUNNERS-PROGRESS.md`, `DARWIN-PROGRESS.md`): per |
| -runner mailbox, roles, protocol negotiation, capability report, placement |
| -with start authorization and withdrawal, the Engineering pin column |
| -(`tasks.engineering_runner`), transfers and blob relay, the primary's |
| -`publish`/`published` path (`thin/relay.go: publishWorker`, crash and |
| -cancel tests), the darwin runner build, the srt checks profile, the |
| -process-group gate (`mac.Gate`), probes P1 to P7, the launchd agent, the |
| -installer, self-update, the taint. |
| - |
| -Missing for slice F: |
| - |
| -1. The worker refuses every step but Checks (`thin/worker.go: Exec`). |
| -2. Placement never sends Engineering to a worker. `mac-placement-wait` |
| - (unmerged) parks Mac Engineering as `waiting_mac_engineering`. |
| -3. No darwin Claude Code pin. No darwin launch policy: Linux |
| - Engineering is a bubblewrap-certified launch (`provider.BuildPolicy`, |
| - `claude.PolicyInputs`, `containment.Manager`). |
| -4. No MCP tool endpoint on a Mac (the Linux tool proxy is Linux-only and |
| - digest-certified). |
| -5. Native permission answers hard-code `/workspace` |
| - (`provider/claude/answers.go`). |
| -6. A worker has no connections, no seal key and no `Conns`. The |
| - Connections page adds only to the primary. |
| -7. Inbound transfers carry one commit. Engineering needs the base, and |
| - for a rebase round also the old base and the candidate. |
| -8. The worker never uploads an outbound pack. `PublishedReport` carries |
| - no change files, and the primary queues no change diffs for a |
| - worker's candidate. |
| -9. Ask the implementer on a worker: no kept sessions there. |
| -10. No probes for Claude's own sandbox on a Mac (F1 to F5). |
| -11. No home-permission guard for a Mac that holds a model credential. |
| -12. No M9 scenario. |
| +Built (slices A to E, `RUNNERS-PROGRESS.md`, `DARWIN-PROGRESS.md`): |
| +per-runner mailbox, roles, protocol negotiation, capability report, |
| +placement with start authorization and withdrawal, the Engineering pin |
| +column, transfers and blob relay, the primary's `publish`/`published` |
| +path (`thin/relay.go: publishWorker`), the darwin runner build, the srt |
| +checks profile, the process-group gate (`mac.Gate`, `mac.Turns`), probes |
| +P1 to P7, the launchd agent, the installer, self-update, the taint, and |
| +the user-temp cleanup (`simctl shutdown all`, then sweep). |
| + |
| +Missing, with the task that adds it: |
| + |
| +| Gap | Task | |
| +|---|---| |
| +| The worker refuses every step but Checks (`thin/worker.go`) | 12 | |
| +| Placement never sends Engineering to a worker; `mac-placement-wait` parks it | 3 | |
| +| No base resolution for a worker's first step or rebase round (the primary picks it inside `Engineer.Exec`) | 3, 4 | |
| +| No darwin Claude Code pin; Mac discovery runs an unpinned `claude` | 5 | |
| +| No darwin launch policy (Linux Engineering is a bubblewrap-certified launch) | 8 | |
| +| No MCP tool endpoint on a Mac | 6 | |
| +| `/workspace` hard-coded in answers, transcripts (`projects/-workspace`) and prompts | 7 | |
| +| Restart proof can pass with the recorded group alive (`mac/gate.go` `!ours`) | 9 | |
| +| Token check and sign-in need Linux containment (`tokencheck.go`, `signin.go`) | 10 | |
| +| No home guard; P4's `Exposed` tests only as the current user | 10 | |
| +| A worker has no connections, seal key or `Conns`; Cancel and Sign out target the primary by local ID | 11 | |
| +| `TransferHeader` has one commit; no shallow handling; no pack inventory check | 2, 4, 12 | |
| +| Change diffs are accepted only from the step's runner while running | 2, 4 | |
| +| Worker outcomes (unfinished, no-shell) survive only for primary Engineering | 4 | |
| +| `AskCommand` lacks the Engineering attempt, account and session binding | 13 | |
| +| No probes of Claude's own sandbox on a Mac; P2 never tries the token | 14 | |
| +| D1 and D2 not enforced anywhere | 10, 15 | |
| +| No M9 scenario | 16 | |
| |
| ## 2. Task order |
| |
| -| # | Task | Risk | Astra | |
| +| # | Task | Risk | Per-task Astra | |
| |---|---|---|---| |
| -| 0 | Base: merge `mac-placement-wait`, allocate protocol and migration | low | no | |
| -| 1 | Read-only probes and static reads (Studio as paulca, pinned CLI on docs-t1) | low | no | |
| -| 2 | Wire, protocol 36, fixtures | medium | whole-branch | |
| -| 3 | Instance placement, pinning, waiting reasons, switch | high | yes | |
| -| 4 | Primary: Engineering inbound packs, change files and diffs at publish | medium | whole-branch | |
| -| 5 | Darwin Claude Code pin and self-provisioning | medium | whole-branch | |
| -| 6 | Darwin MCP tool endpoint in the runner binary | medium | whole-branch | |
| -| 7 | Native permission port (workspace root as policy) | high | yes | |
| +| 0 | Base: merge `mac-placement-wait`, allocate numbers | low | no | |
| +| 1 | Read-only probes, static reads, the Studio's verdicts | low | no | |
| +| 2 | Wire, protocol 36, migration, fixtures | medium | no | |
| +| 3 | Instance: placement, base preparation, pinning, waits, switch | high | yes | |
| +| 4 | Primary: prepare base, packs, publication-bound diffs, worker outcomes | high | yes | |
| +| 5 | Darwin Claude Code pin and provisioning | medium | no | |
| +| 6 | Darwin MCP tool endpoint | medium | no | |
| +| 7 | Native permission port and workspace paths | high | yes | |
| | 8 | Darwin Engineering policy and settings | high | yes | |
| -| 9 | Darwin Engineering executor and termination | high | yes | |
| -| 10 | Worker Engineering `Exec`, secret check, outbound pack | high | yes | |
| -| 11 | Worker connections, seal key, "Add Claude to <Mac>" | high | yes | |
| -| 12 | Ask the implementer pinned on the worker | medium | whole-branch | |
| -| 13 | Shipped probes F1 to F5 and the `claude` tag | medium | whole-branch | |
| -| 14 | Home guard, D1 default, views and copy | high | yes | |
| -| 15 | M9 headless scenarios on Linux CI | medium | whole-branch | |
| -| 16 | Release, docs, `make ci`, whole-branch review | medium | yes | |
| -| 17 | Live witness on production (after someone else deploys) | n/a | no | |
| - |
| -Tasks 5, 6 and 7 do not depend on each other and may run in parallel |
| -worktrees. Task 8 needs 5 to 7. Tasks 9 and 10 need 8. Task 11 can start |
| -after 2. Tasks 12 and 13 need 10. |
| +| 9 | Darwin executor, termination, machine lock, cleanup | high | yes | |
| +| 10 | Darwin credential operations, home guard, taint gate | high | yes | |
| +| 11 | Worker connections, lifecycle routed by runner | high | yes | |
| +| 12 | Worker Engineering `Exec`, object scan, outbound pack | high | yes | |
| +| 13 | Ask the implementer, pinned exactly | medium | no | |
| +| 14 | Shipped probes F1 to F7, P2 token sources, Engineering status | medium | no | |
| +| 15 | D1 across every connection state, views, copy | high | yes | |
| +| 16 | M9 and mixed versions on Linux CI | medium | no | |
| +| 17 | Release, docs, `make ci`, whole-branch review | medium | yes | |
| +| 18 | Live witness on production (after someone else deploys) | n/a | no | |
| + |
| +Dependencies: 2 before everything else that touches the wire. 3 and 4 |
| +together (the base exchange spans both). 5, 6 and 7 are independent and |
| +may run in parallel worktrees. 8 needs 5 to 7. 9 needs 8. 10 needs 5, 8 |
| +and 9. 11 needs 2 and 10. 12 needs 4 and 8 to 11. 13 needs 7 and 12. |
| +14 needs 9, 10 and 12. 15 needs 3, 11 and 14. |
| |
| --- |
| |
| @@ -118,344 +124,419 @@ after 2. Tasks 12 and 13 need 10. |
| and `go test ./internal/equipo/ -run TestMacWait -count=1`. |
| 2. Ask the parent for the protocol number (expected 36) and the next |
| free migration number. Write both at the top of the progress file. |
| -3. Create `MAC-SLICE-F-PROGRESS.md` from the `DARWIN-PROGRESS.md` |
| - layout: Done, Decisions, Only the Mac can show, Open issues, Copy. |
| +3. Create `MAC-SLICE-F-PROGRESS.md` in the layout of `DARWIN-PROGRESS.md` |
| + (Done, Decisions, Only the Mac can show, Open issues, Copy), with D1 |
| + and D2 from spec §8.7 listed as open until Paul rules. |
| |
| -Done when the branch builds, the placement-wait tests pass, and the |
| -progress file exists. |
| - |
| -## Task 1. Read-only probes and static reads |
| +## Task 1. Read-only probes, static reads, the Studio's verdicts |
| |
| Before any Darwin code, as slice C did. Nothing on the Studio changes. |
| -SSH as `paulca` only (`ssh -o BatchMode=yes tito-studio`, sandbox off; |
| -`~/.ssh` is read-denied in the sandbox). No `sudo`. Never read |
| -`paulequipo`'s files: its home can be listed, but its contents are not |
| -ours to read. Scratch on docs-t1 in `mktemp -d` under `$TMPDIR`, removed |
| -at the end of the task. |
| +SSH as `paulca` only (`ssh -o BatchMode=yes tito-studio`, with the |
| +sandbox off, since `~/.ssh` is read-denied inside it). No `sudo`. Never |
| +read `paulequipo`'s files: its home can be listed, but its contents are |
| +not ours. Scratch on docs-t1 goes in a `mktemp -d` under `$TMPDIR`, |
| +removed at the end of the task. |
| |
| -**On the Studio, as paulca** (record the output in the progress file, |
| -dated): |
| +**On the Studio as paulca** (record output in the progress file, dated): |
| |
| - R1 `sw_vers`, `xcodebuild -version`, `xcode-select -p`, |
| - `xcrun simctl list -j runtimes`, `xcrun simctl list -j devices |
| - available | head`, `swift --version`, `sysctl hw.ncpu hw.memsize`, |
| - `uptime`. Already seen 2026-11-28: macOS 27.2, Xcode 27.2 (27B52), |
| - iOS 27.0 and 27.2 runtimes, M5 Ultra, 36 cores, 96 GB, load about 1.7. |
| -- R2 `ls -led /Users/*` (the ACL picture), `id paulequipo`, |
| - `ps -axo user,pid,etime,command | grep equipo-runner` (which binary is |
| - running and since when). |
| -- R3 `sandbox-exec -p '(version 1)(allow default)' /usr/bin/true` and the |
| - same with a nested `sandbox-exec` inside it. Record whether macOS 27.2 |
| - allows a Seatbelt profile to be applied inside another. This decides |
| - whether the CLI's own Bash sandbox could ever run under an outer |
| - profile. The spec assumes not. |
| -- R4 `ps -E -p $$` and `sysctl kern.procargs2` read of a same-user |
| - process, from a plain shell and from inside a `sandbox-exec` profile |
| - with `(deny default)(allow process-exec)(allow file-read*)`. This |
| - shows what Seatbelt's `process-info*` operations govern on 27.2, as |
| - background for F3. F3 itself is the proof. |
| + `xcrun simctl list -j runtimes`, `swift --version`, |
| + `sysctl hw.ncpu hw.memsize`, `uptime`. Seen 2026-11-28: macOS 27.2, |
| + Xcode 27.2 (27B52), iOS 27.0 and 27.2 runtimes, M5 Ultra, 36 cores, |
| + 96 GB, load about 1.7, several other users' Claude sessions running. |
| +- R2 `ls -led /Users/*` (the ACL picture; seen: `paulequipo`'s home is |
| + `drwxr-x---` group `staff`, no ACL shutting out other users), |
| + `id paulequipo`, and `ps -axo user,pid,etime,command | grep |
| + equipo-runner`. |
| +- R3 `sandbox-exec -p '(version 1)(allow default)' /usr/bin/true`, then |
| + the same with a nested `sandbox-exec` inside it. Record whether macOS |
| + 27.2 lets a Seatbelt profile be applied inside another. This is |
| + background only: the design does not nest. |
| +- R4 `ps -E -p <own pid>` and a `sysctl kern.procargs2` read of a |
| + same-user process, from a plain shell and from inside a hand-written |
| + profile `(deny default)(allow process-exec)(allow file-read*)`. This |
| + shows what `process-info*` governs on 27.2. F3 is the proof. |
| + |
| +**The Studio's current verdicts.** Ask the parent for the production |
| +Machines page line for Tito Studio: protocol, P1 to P7 verdicts, tainted |
| +or not. If P2 is not `denied`, write it in the progress file as a |
| +witness blocker (spec §8.7, D1) and go on. Slice F does not include |
| +repairing P2. If the parent has a fix branch for P2, note its name. |
| |
| **On docs-t1, static reads of the pinned CLI.** Fetch the official Claude |
| Code 2.1.312 release manifest and the `darwin-arm64` binary (about |
| -200 MB; that is within the "ask before a few GB" rule) into the scratch |
| -dir. Check the binary against the manifest digest, then read it with |
| -`strings`/`rg`, without running it. Record, citing what you matched: |
| +200 MB, within the "ask before a few GB" rule) into the scratch dir. |
| +Check the binary against the manifest digest, then read it with `rg -a` |
| +and `strings`, without running it. Record what each finding matched: |
| |
| - S1 the darwin-arm64 digest and the manifest URL. This becomes |
| - `claude.ExecutableSHA256DarwinArm64` in task 5. |
| -- S2 the sandbox settings keys this build reads: |
| - `sandbox.filesystem.allowWrite`, `allowRead`, `denyRead`, `denyWrite`; |
| - `sandbox.network.allowedDomains` (and what empty means: no network, |
| - or ask); `allowUnixSockets`, `allowLocalBinding`, `allowMachLookup`; |
| + `claude.ExecutableSHA256DarwinArm64`. |
| +- S2 the sandbox settings keys the build reads: `sandbox.filesystem. |
| + {allowWrite, allowRead, denyRead, denyWrite}`, `sandbox.network. |
| + {allowedDomains, allowUnixSockets, allowLocalBinding, allowMachLookup}`, |
| `failIfUnavailable`, `allowUnsandboxedCommands`, `excludedCommands`, |
| - `enableWeakerNestedSandbox`. A key the spec needs that is absent is a |
| - stop: write it up and ask the parent. |
| + `enableWeakerNestedSandbox`; what an empty `allowedDomains` means (no |
| + network, or ask). A key the design needs that is absent is a stop: |
| + write it up and ask the parent. |
| - S3 the version of `@anthropic-ai/sandbox-runtime` the build embeds, |
| - and that version's macOS profile generator. Read the source of that |
| - tag (`macos-sandbox-utils.ts`) for what it allows by default: |
| - `process-info*`, `mach-lookup` for `securityd`, `file-read*` breadth, |
| - `sysctl-read`. Record it. |
| + and, from that tag's source (`macos-sandbox-utils.ts`), what its |
| + generated profile allows by default: `process-info*`, `mach-lookup` |
| + (including `securityd`), the breadth of `file-read*`, `sysctl-read`. |
| - S4 whether the build reads the OAuth token from a file descriptor |
| - (for example a `*_FILE_DESCRIPTOR` variable next to |
| - `CLAUDE_CODE_OAUTH_TOKEN`), and whether `CLAUDE_CODE_OAUTH_TOKEN` set |
| - skips every Keychain read and write (`security`, |
| - `Claude Code-credentials`). |
| -- S5 how the Bash tool spawns its shell on darwin (`detached`, |
| - `setsid`, a new process group) and whether |
| - `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` removes anything beyond the provider |
| - credentials. Process-group termination (task 9) depends on this. |
| - |
| -Delete the scratch dir. Done when R1 to R4 and S1 to S5 are in the |
| -progress file, and any stop is raised. |
| - |
| -## Task 2. Wire, protocol 36, fixtures |
| - |
| -Files: `internal/wire/` (`runners.go`, `tasks.go`, a new |
| -`mac_engineering.go`), `internal/wire/testdata/frames/`, |
| -`docs/api/` fixtures if the API changes. |
| - |
| -Tests first (`internal/wire`): |
| - |
| -- `TestProtocol36Constants`: `ProtocolMacEngineering == 36`, |
| - `ProtocolCurrent == 36`, `Spoken(99) == 36`. Update the existing |
| - constant tests that pin 35. |
| -- `TestEncodeDropsMacEngineeringBelow36`: each new field is gone at 35 |
| - and present at 36. |
| -- Fixture round-trips: `frames/dispatch-mac-engineering.json`, |
| - `frames/blob-engineering.json` (a header with `commits`), |
| - `frames/published-change-files.json`, `frames/hello-worker-conns.json`, |
| - `frames/step-mac-engineering.json`. |
| + (a `*_FILE_DESCRIPTOR` variable beside `CLAUDE_CODE_OAUTH_TOKEN`), and |
| + whether a set `CLAUDE_CODE_OAUTH_TOKEN` skips every Keychain read and |
| + write (`security`, `Claude Code-credentials`). |
| +- S5 how the Bash tool starts its shell on darwin (`detached`, `setsid`, |
| + a new process group), and what `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` |
| + removes. Task 9 depends on `EQUIPO_ATTEMPT` surviving. |
| +- S6 how the build names a project's transcript directory from its cwd |
| + (the rule that gives `projects/-workspace` on Linux), so task 7 can |
| + compute it for a real Mac path. |
| + |
| +Delete the scratch dir. Done when R1 to R4, the verdicts and S1 to S6 |
| +are in the progress file, and any stop has been raised. |
| + |
| +## Task 2. Wire, protocol 36, migration, fixtures |
| + |
| +Files: `internal/wire/` (`runners.go`, `tasks.go`, `questions.go`, |
| +`capabilities` validation, a new `mac_engineering.go`), the frames |
| +testdata, the migration, `internal/equipo/chat/transfers.go` (storage |
| +only). |
| |
| Changes: |
| |
| -- `TransferHeader.Commits []string` (omitempty): the exact commits an |
| - inbound Engineering pack must yield. Checks transfers leave it empty, |
| - and the existing meaning stands. |
| -- `DispatchCommand.XcodeAccess` (`"sandboxed"` or `""`): the instance's |
| - decision. A worker refuses a value its own trusted report does not |
| - support (task 10). |
| -- `StepReport.XcodeAccess` echoes what ran; `StepReport.MadeOn` is not |
| - needed, since the instance knows the runner. |
| -- `PublishedReport.ChangeFiles *ChangeFiles` (omitempty). Change diffs |
| - travel as today's `FrameChangeDiff`, bound to the worker's task, step |
| - and attempt. |
| -- New step reasons: `secret_in_candidate`, `workspace_too_large`, |
| - `engineering_unavailable` (the worker cannot run Engineering now: |
| - CLI unpinned, probes not passed, home open). New placements: |
| - `waiting_mac_connection`, `waiting_mac_update`. New Needs-you kinds: |
| +- `TransferHeader` stays a comparable struct. Add `Kind` (`""` for |
| + checks, `engineering`) and `OldBaseSHA`. An Engineering transfer has |
| + `BaseSHA` (the tree to start from), and for a rebase round also |
| + `OldBaseSHA` and `CandidateSHA`. Add `func (h TransferHeader) |
| + Commits() []string`, the bounded, de-duplicated list the pack must |
| + yield, and `Valid()`, which checks each SHA and allows at most three. |
| + Every existing `!=` comparison keeps working. |
| +- Migration: `transfers.kind`, `transfers.old_base_sha`; |
| + `chat_steps.xcode_access`; `chat_questions.eng_attempt`, |
| + `eng_account`, `eng_session` (task 13). Additive only. |
| +- New durable command `PrepareBaseCommand{task, step, attempt, repo, |
| + rebase, from_base, candidate}` (instance to primary) and report |
| + `BaseReport{task, step, attempt, base_sha, reason}` (primary to |
| + instance). |
| +- `DispatchCommand.XcodeAccess` (`sandboxed` or `""`). |
| +- `StepReport.XcodeAccess` echoes what ran. |
| +- `PublishedReport.ChangeFiles *ChangeFiles` and `DiffCollection string`, |
| + plus `Phase` (the commit's phase: committed, unfinished, no-shell), so |
| + the instance keeps the worker's outcome through publication (task 4). |
| +- `ChangeDiffUpload` gains `Publication` (empty: today's path). |
| +- `AskCommand` gains `EngAttempt`, `EngAccount`, `EngSession`. |
| +- `Capabilities.Engineering *EngineeringStatus{state, reason}`: |
| + `ready`, `no_connection`, `signed_out`, `limited`, `probes_pending`, |
| + `probes_failed`, `cli_unpinned`, `home_open`, `tainted`, `busy` is not |
| + a state (placement counts running steps). |
| +- `ValidCapabilities` accepts probes F1 to F7, with `denied` and |
| + `passed` allowed where each probe defines them. |
| +- New reasons: `secret_in_candidate`, `workspace_too_large`, |
| + `engineering_unavailable`, `base_unavailable`. New placements: |
| + `waiting_mac_connection` (with the status reason), |
| + `waiting_mac_update`, `waiting_base`. New Needs-you kinds: |
| `mac_connection`, `mac_update`. |
| -- Worker hello: `Connections` and `SealKey` may be non-empty from a |
| - worker at 36. The instance ignores both from a worker below 36. |
| +- A worker's hello at 36 may carry `Connections` and `SealKey`. The |
| + instance ignores both from a worker below 36. |
| + |
| +Tests first (`internal/wire`): `TestProtocol36Constants` (and update the |
| +tests that pin 35); `TestEncodeDropsMacEngineeringBelow36` for every new |
| +field and frame; `TestTransferHeaderCommits` (order, de-duplication, the |
| +bound of three, invalid SHAs, kind rules); `TestValidCapabilitiesF`; |
| +fixture round-trips for `frames/prepare-base.json`, `frames/base.json`, |
| +`frames/dispatch-mac-engineering.json`, `frames/blob-engineering.json`, |
| +`frames/published-change-files.json`, `frames/hello-worker-conns.json`, |
| +`frames/ask-pinned.json`, `frames/step-mac-engineering.json`; a |
| +migration test over a database holding open checks transfers and kept |
| +questions. |
| |
| -Mutations: drop the `< 36` clear in `Encode`; mis-tag a field as always |
| -present. Both must fail a named test. |
| +Mutations: drop a `< 36` clear in `Encode`; allow four commits; accept |
| +`denied` for F4. Each must fail a named test. |
| |
| -## Task 3. Instance placement, pinning, waiting reasons, switch |
| +## Task 3. Instance: placement, base preparation, pinning, waits, switch |
| |
| Files: `internal/equipo/chat/runners.go` (`place`, `macEngineering`, |
| -`placeWaiting`), `macsandbox.go`, `transfers.go`, `tasks.go`, the store |
| -config for `EQUIPO_MAC_ENGINEERING`, `internal/thintest/` contracts. |
| - |
| -Tests first, as contracts in `internal/thintest/` |
| -(`mac_engineering_contract_test.go`), each with a primary and a fake |
| -worker at protocol 36 unless stated: |
| - |
| -1. `TestContractMacEngineeringPlacedOnWorker`: switch on, the repository |
| - needs macOS, the worker covers `macos, xcode, ios_simulator, claude`. |
| - Engineering is placed on the worker, the task is pinned to it, and an |
| - inbound transfer naming `commits: [base]` is opened in the same |
| - transaction as the dispatch. |
| -2. `TestContractMacEngineeringSwitchOff`: switch unset. The step waits |
| - `waiting_mac_engineering` exactly as on `mac-placement-wait`. |
| -3. `TestContractMacEngineeringNeedsConnection`: the worker lacks only |
| - `claude`. Placement `waiting_mac_connection`, Needs you |
| - `mac_connection` naming the Mac, no dispatch. When the worker's next |
| - hello adds `claude`, `placeWaiting` places it. |
| -4. `TestContractMacEngineeringOldWorker`: the worker speaks 35. |
| - `waiting_mac_update`, Needs you `mac_update`. It never receives a |
| - dispatch with `commits` or `xcode_access`. |
| -5. `TestContractMacEngineeringOffline`: the fitting worker is offline. |
| - `waiting_runner`; after 30 minutes Needs you `runner_offline` (spec |
| - §1.4); Cancel works; it never falls to the Linux primary. |
| -6. `TestContractMacEngineeringPinHolds`: a fix round, a Retry, a |
| - republish and a rebase round all go to the pinned worker, even when a |
| - second fitting worker exists. A rebase dispatch carries `commits: |
| - [base, from_base, candidate]`. |
| -7. `TestContractMacEngineeringPinnedRemoved`: the pinned worker is |
| - removed. The step follows the existing removal path (quarantine, |
| - Recover). After Recover, the next Engineering step re-pins to a |
| - fitting Mac, or waits `waiting_mac`. It is never placed on the Linux |
| - primary. |
| -8. `TestContractMacEngineeringXcodeAccess`: `xcode_access: sandboxed` is |
| - sent only when the instance holds the worker sandbox-proven |
| - (`sandboxProven`) **and** its probe report has F5 `denied`; otherwise |
| - empty. A tainted Mac gets empty. |
| -9. `TestContractWorkerEngineeringReports`: a worker's Engineering |
| - report with `pushed: true` is refused; `committed` with a candidate |
| - opens the outbound transfer for exactly that candidate; `done` with |
| - `pushed: false` waits for the primary's `published` (the existing |
| - `TestContractPublishedBeforeWorkerDone` extended to Engineering). |
| -10. `TestContractReviewStaysOnPrimary`: Review of a Mac-made candidate is |
| - placed on the primary after publication. Checks go to the Mac by |
| - their needs. The merge decision never auto-merges a Mac-made |
| - candidate unless base-gate certification applies (it cannot, on a |
| - worker): Ready to merge asks. |
| +`placeWaiting`), `macsandbox.go`, `transfers.go`, `tasks.go`, a new |
| +`base_prepare.go`, the store's boot config, `internal/thintest/`. |
| |
| -Changes: |
| +Behaviour: |
| |
| - `engineeringNeeds` adds `wire.TagClaude` for Mac work. |
| -- `macEngineering`: switch off, return today's waits. Switch on: pinned |
| - worker first (if enrolled, not removing, protocol ≥ 36), else the |
| - §1.4 order among workers covering the needs. When a Mac covers |
| - everything but `claude`, wait `waiting_mac_connection`. When the only |
| - covering Macs speak < 36, wait `waiting_mac_update`. |
| -- Dispatch to a worker: open the inbound transfer with `Commits`, and |
| - ask the primary for the pack with `send_pack` (as checks do). Decide |
| - `XcodeAccess`. |
| -- `needsYou` and the decision text for the two new kinds (task 14 writes |
| - the copy). |
| -- The instance setting `EQUIPO_MAC_ENGINEERING` is read at boot and |
| - shown on the Machines page to owners. |
| - |
| -Mutations: place on the primary when the pin is removed; omit `claude` |
| -from the needs; send `xcode_access` without F5; let a 35 worker get |
| -Engineering; skip the transfer in the dispatch transaction. Each must |
| -fail a named contract. |
| - |
| -## Task 4. Primary: Engineering packs, change files and diffs |
| - |
| -Files: `internal/runner/thin/relay.go` (`packCandidate`, `publishWorker`), |
| -`change_files.go`, `change_diffs.go`. |
| - |
| -Tests first (`internal/runner/thin/relay_test.go`): |
| - |
| -- `TestPackCommitsYieldsExactlyTheList`: a pack for `commits: [a, b, c]` |
| - holds those three commits with complete trees and no other commit. |
| - Index it into an empty bare repository and check `rev-list --no-walk`. |
| -- `TestPackCommitsRefusesUnknownOrForeign`: a commit not in the clone, a |
| - non-SHA, or a repository that is not `ValidHub` is refused before git |
| +- Switch: `EQUIPO_MAC_ENGINEERING=1`, read at boot. Unset, Mac |
| + Engineering waits exactly as `mac-placement-wait` left it. |
| +- Switch on. The candidate runners are, in order, the pinned worker |
| + (enrolled, not removing), then the §1.4 order among workers covering |
| + the needs. Both the worker and the primary must speak ≥ 36; otherwise |
| + wait `waiting_mac_update`, with Needs you naming which one. If a Mac |
| + covers everything but `claude`, wait `waiting_mac_connection` carrying |
| + the worker's `EngineeringStatus` reason. Never place on a different |
| + worker just because the pinned one lost its tag; wait for it. |
| +- **Base preparation**, two phases in separate transactions: |
| + 1. If the attempt has no bound base (a first step, or a rebase round |
| + whose new tip is unknown), write `prepare_base` to the primary's |
| + mailbox. The step waits `waiting_base`. |
| + 2. On the primary's `base` report for the current attempt, from the |
| + primary's connection, not withdrawn: bind `base_sha` to the |
| + attempt, then place, dispatch and open the inbound Engineering |
| + transfer in one transaction. Any other report is refused and |
| + logged. `base{reason: base_unavailable}` ends the attempt failed |
| + with that reason and Needs you `retry`. |
| + A fix round's base is the task branch's published tip, which is |
| + already known, so it skips phase 1. A Retry rebinds nothing that was |
| + bound to an earlier attempt. |
| +- `XcodeAccess: sandboxed` is sent only when the instance holds the |
| + worker sandbox-proven (`sandboxProven`) and its probe report has F5 |
| + `denied`. A tainted Mac never gets it. |
| +- A removed pinned worker follows the existing removal path (quarantine, |
| + then Recover). After Recover the next Engineering step re-pins to a |
| + fitting Mac or waits `waiting_mac`. It is never placed on the Linux |
| + primary. The protocol 1 primary exception from `mac-placement-wait` |
| + stays. |
| +- Review of a Mac-made candidate is placed on the primary after |
| + publication. Ready to merge never auto-merges a Mac-made candidate, |
| + because a worker cannot run certified base gates (injection defences). |
| + |
| +Tests first, as contracts in `internal/thintest/mac_engineering_contract_test.go`, |
| +with a primary and a fake worker both at 36 unless stated: |
| + |
| +1. `TestContractMacEngineeringPlacedOnWorker`: prepare-base first, then |
| + the dispatch with its transfer (`kind engineering`, base only) in one |
| + transaction, and the pin set. |
| +2. `TestContractMacEngineeringSwitchOff`. |
| +3. `TestContractMacEngineeringStatusWaits`: one case per |
| + `EngineeringStatus` reason. Each is its own wait and Needs-you line, |
| + and `placeWaiting` places once the status is `ready`. |
| +4. `TestContractMacEngineeringOldWorker` and `...OldPrimary`: both wait |
| + `waiting_mac_update`; neither receives a field or frame from protocol |
| + 36. |
| +5. `TestContractMacEngineeringOffline`: `waiting_runner`, then Needs you |
| + `runner_offline` after 30 minutes, Cancel works, and it never moves to |
| + Linux. |
| +6. `TestContractMacEngineeringPinHolds`: a fix round, a Retry, a |
| + republish and a rebase round all go to the pinned worker even with a |
| + second fitting worker. The rebase transfer carries base, old base and |
| + candidate. |
| +7. `TestContractMacEngineeringPinnedLostTag`: the pinned worker drops |
| + `claude` mid-task. The next round waits for it; it is never placed on |
| + the second worker. |
| +8. `TestContractMacEngineeringPinnedRemoved`. |
| +9. `TestContractPrepareBase`: a report from the worker, for an older |
| + attempt, after withdrawal, or after Cancel is refused; a second report |
| + for the same attempt is a no-op; `base_unavailable` ends it with Retry. |
| +10. `TestContractMacEngineeringXcodeAccess`. |
| +11. `TestContractWorkerEngineeringReports`: a worker's `pushed: true` is |
| + refused; `committed` opens the outbound transfer for exactly that |
| + candidate; `done` waits for the primary's `published` (extending |
| + `TestContractPublishedBeforeWorkerDone`). |
| +12. `TestContractReviewStaysOnPrimary` and |
| + `TestContractMacMadeNeverAutoMerges`. |
| + |
| +Mutations: place on the primary when the pin is removed; omit `claude`; |
| +place with an old primary; send `xcode_access` without F5; open the |
| +transfer before the base is bound; accept a base report from the |
| +worker. Each must fail a named contract. |
| + |
| +## Task 4. Primary: prepare base, packs, publication-bound diffs, worker outcomes |
| + |
| +Files: `internal/runner/thin/relay.go` (`packCandidate`, |
| +`publishWorker`, a new `prepareBase`), `change_files.go`, |
| +`change_diffs.go`, `link.go` (the new command), and on the instance |
| +`internal/equipo/chat/change_diffs.go`, `transfers.go`, `tasks.go` |
| +(`unfinishedReport` and the no-shell handling). |
| + |
| +Runner (primary): |
| + |
| +- `prepareBase`: fetch, then resolve the default tip exactly as |
| + `Engineer.Exec` does today (`defaultTip`, including the unborn case, |
| + which is refused for a worker as `base_unavailable`). Report `base`. |
| + Durable and idempotent: a restart re-reports the same SHA for the same |
| + attempt. |
| +- `packCommits(header)`: with no kind, today's one-commit pack. For an |
| + Engineering header, `rev-list --objects --no-walk` of exactly |
| + `header.Commits()` into `pack-objects`. Refuse a commit missing from |
| + the clone, a non-SHA or a repository that is not `ValidHub` before git |
| runs. |
| -- `TestPublishWorkerCarriesChangeFiles`: after a worker publication is |
| - pushed, the `published` report carries `ChangeFiles` for base to |
| - candidate, and change-diff frames are queued for the worker's task, |
| - step and attempt, leaving out the primary's known secrets. |
| -- `TestPublishWorkerOversizeDeclared`: an inbound Engineering pack over |
| - `wire.MaxTransferBytes` is declared oversize. The instance then ends |
| - the step `workspace_too_large` (contract in task 3's file). |
| - |
| -Changes: `packCandidate` becomes `packCommits(header)`. With an empty |
| -`Commits` it keeps today's single-candidate behaviour, so checks are |
| -unchanged. `publishWorker` computes change files and queues diffs at 36 |
| -after a push succeeds. A failure to compute them is a diagnostic, never a |
| -push failure. |
| - |
| -Mutations: walk history (drop `--no-walk`); attach change files before |
| -the push; include the bearer token in a diff. Each fails a named test. |
| - |
| -## Task 5. Darwin Claude Code pin and self-provisioning |
| - |
| -Files: `internal/runner/provider/claude/pins.go`, new |
| +- `publishWorker` after a successful push (at 36): compute change files |
| + for base to candidate, queue change-diff uploads bound to the |
| + publication (leaving out the primary's known secrets, as today), and |
| + report `published` with `ChangeFiles`, `DiffCollection` and the |
| + commit's `Phase` read from the worker's step report the instance put |
| + in the `publish` command. Failure to compute diffs is a diagnostic, |
| + never a push failure. |
| + |
| +Instance: |
| + |
| +- Accept change-diff uploads that name a publication only from that |
| + publication's primary connection, for the worker's task, step and |
| + attempt, while the publication is `pending` or `published`, in either |
| + order relative to the worker's `done`. Refuse stale publications, |
| + another primary and a wrong attempt. |
| +- Keep the worker's outcome. A worker's `committed` report records its |
| + phase. The `published` report carries it back, and only then does the |
| + step take `step_timeout` (unfinished) or the no-shell reason, with |
| + `Pushed` set by the primary. `unfinishedReport` must not rebuild |
| + `Pushed=true` from a worker report. Republish keeps the phase. |
| + |
| +Tests first: |
| + |
| +- `TestPrepareBaseResolvesAndIsIdempotent`, `TestPrepareBaseRefusesUnborn` |
| + (thin). |
| +- `TestPackCommitsInventory` (thin): index the pack into an empty |
| + repository, then list the commit objects **in the pack itself** |
| + (`verify-pack -v`, or `show-index` plus `cat-file --batch-check`). |
| + Exactly the named commits, each with a complete tree, and no other |
| + commit. |
| +- `TestPackCommitsRefuses` (thin). |
| +- `TestPublishWorkerChangeFilesAndDiffs` (thin): files and diffs bound to |
| + the publication; the bearer token never in a diff. |
| +- Instance contracts: `TestContractPublicationDiffs` (both orderings of |
| + worker `done` and the primary's uploads, a restart between, a stale |
| + publication, a wrong primary, a wrong attempt); |
| + `TestContractWorkerUnfinishedThroughPublication` (timeout, no-shell |
| + fix round, failed publication then republish: the phase survives and |
| + `Pushed` comes only from `published`). |
| +- `TestPackOversizeIsWorkspaceTooLarge`: declared oversize ends the step |
| + `workspace_too_large` with Needs you. |
| + |
| +Mutations: walk history (drop `--no-walk`); accept diffs from the |
| +worker; set `Pushed` from the worker's unfinished report; queue diffs |
| +before the push. Each must fail a named test. |
| + |
| +## Task 5. Darwin Claude Code pin and provisioning |
| + |
| +Files: `internal/runner/provider/claude/pins.go`, a new |
| `internal/runner/mac/claude.go`, `thin/mac.go` (`macTools`, |
| -`newMacHost`). |
| +`newMacHost`), `mac/caps.go`. |
| |
| The worker runs only the 2.1.312 darwin-arm64 binary whose digest |
| (task 1, S1) is compiled in as `claude.ExecutableSHA256DarwinArm64`. It |
| -never runs a `claude` found on `PATH`. It provisions the binary itself, |
| -so Paul has no install step. |
| +provisions that binary itself, so Paul has no install step. It never |
| +runs a `claude` from `PATH` or `EQUIPO_CLAUDE_PATH` again, not even for |
| +`--version`. The capability report states the pinned version only after |
| +verification. |
| |
| Tests first (`internal/runner/mac/claude_test.go`): |
| |
| - `TestClaudePinDarwin`: `ReleasePinFor("darwin", "arm64")` is the |
| - constant; every other darwin arch has none. |
| -- `TestProvisionChecksDigestBeforeExec`: a served binary with one byte |
| - changed is refused, never made executable, and leaves nothing behind. |
| -- `TestProvisionBoundsAndPlace`: size bound (512 MB), written only under |
| + constant; nothing else on darwin has a pin. |
| +- `TestProvisionChecksDigestBeforeExec`: one changed byte is refused, |
| + never made executable, and nothing is left behind. |
| +- `TestProvisionBoundsAndPlace`: a 512 MB bound; written only under |
| `~/.local/lib/equipo-runner/tools/claude-2.1.312/` through an |
| - `os.Root`, mode 0700, no symlink followed. An existing file with the |
| + `os.Root`, mode 0700, no symlink followed; a present file with the |
| wrong digest is replaced. |
| -- `TestProvisionOnlyFromTheOfficialURL`: the URL is built from the |
| - version and platform constants. Configuration can name a local file |
| - for tests only under the `testbuild` tag. |
| -- `TestVerifyBeforeEveryLaunch`: the launcher re-hashes the file before |
| - each launch (the cost is acceptable: once per step). A swapped file |
| - stops the launch with `engineering_unavailable`. |
| -- `TestCapabilitiesClaudeVersionOnlyWhenPinned`: `harness.claude` is |
| - reported only for a verified pinned binary. |
| +- `TestProvisionOnlyFromTheOfficialURL`: the URL comes from the version |
| + and platform constants. A local file can stand in only under the |
| + `testbuild` tag. |
| +- `TestVerifyBeforeEveryLaunch`: the launcher re-hashes before each |
| + launch; a swapped file stops it with `engineering_unavailable`. |
| +- `TestDiscoveryNeverRunsUnpinnedClaude`: the capability probe runs no |
| + binary but the verified pin. |
| |
| Env-gated (`EQUIPO_CLAUDE_DARWIN_BINARY=<path>`), run once on docs-t1 |
| with the task 1 download: the real binary matches the pin. |
| |
| -Mutations: skip the digest check; follow a symlink; accept `PATH` |
| -`claude`. Each fails a named test. |
| +Mutations: skip the digest; follow a symlink; run `PATH` `claude` in |
| +discovery. Each must fail a named test. |
| |
| ## Task 6. Darwin MCP tool endpoint |
| |
| -The Linux tool proxy stays byte-identical. Its certified digest check in |
| -`make release-runner` must stay green, so do not touch `internal/toolproxy`. |
| -On darwin, `equipo-runner tool-proxy --socket <path>` speaks the same |
| -stdio MCP protocol to the CLI and the same framing to the runner's step |
| -socket. |
| +The Linux tool proxy stays byte-identical (do not touch |
| +`internal/toolproxy`). The release check that it matches its certified |
| +digest must stay green. On darwin, `equipo-runner tool-proxy --socket |
| +<path>` speaks the same stdio MCP protocol to the CLI and the same |
| +framing to the step socket. |
| |
| -Files: `internal/runner/tool_proxy_serve_darwin.go` (now refuses), a new |
| +Files: `internal/runner/tool_proxy_serve_darwin.go` (now refuses), a |
| darwin-only command in `cmd/equipo-runner`, `thin/mcp.go` |
| (`openToolSet`), `thin/toolsocket_other.go`. |
| |
| Tests first: |
| |
| -- `TestDarwinToolProxySpeaksTheProtocol` (builds on Linux with a |
| - `darwin || testbuild` split for the shared code): the permission tool, |
| - `submit_candidate` and `ask_person` round-trip through a socket pair, |
| - with the same replies the Linux proxy gives (a recorded transcript |
| - from the Linux proxy's tests is the oracle). |
| -- `TestToolSocketPeerUID`: on darwin the socket accepts only the |
| - runner's own uid (`LOCAL_PEERCRED`, `peer_darwin.go`); the test fakes |
| - the peer check through its seam. |
| -- `TestToolSocketPathFits`: the step socket path stays under 104 bytes on |
| - a Mac (`/Users/<name>/...` paths are long; use the scratch root's short |
| - `t/` directory). |
| -- The existing release test that the Linux tool proxy is the certified |
| - build passes unchanged. |
| - |
| -Mutations: accept any peer uid; reply allow to a permission request the |
| -Linux proxy denies. Each fails a named test. |
| - |
| -## Task 7. Native permission port |
| - |
| -Spec §4.4, "Native file permissions, ported explicitly". Files: |
| -`internal/runner/provider/claude/answers.go` and its tests. |
| - |
| -Make the workspace root (and the read-only research root) a policy |
| -field. Linux keeps `/workspace` and `/research`, and its certified |
| -policy hashes must not change: assert the Linux settings bytes are |
| -identical before and after. |
| - |
| -Tests first (`answers_test.go`, new `answers_darwin_policy_test.go` |
| -running on Linux with a temp dir standing in for the Mac paths): |
| - |
| -- `TestPermissionLinuxUnchanged`: every existing answer test passes with |
| - the root `/workspace`; the generated Linux settings hash is unchanged. |
| -- `TestPermissionRootIsResolved`: a request for `<root>/a` is allowed; |
| - the same file through a symlinked alias of the root (the stand-in for |
| - `/var` to `/private/var`) is resolved with `realpath` and allowed only |
| - if it lands inside the real root. |
| -- `TestPermissionRefusesEscapes`: `..` components, a glob whose |
| - expansion leaves the root, an absolute path outside, a symlink inside |
| - the tree pointing out, and a symlink swapped between check and use |
| - (the generated native deny rules are the second layer; the test shows |
| - the deny rule matches the target). |
| -- `TestPermissionDeniedPathsGenerated`: Read, Edit, Write, Glob and Grep |
| - deny rules are generated for every §4.2 path (runner state, accounts |
| - root, session homes, `~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.config/op`, |
| - `~/Library/Keychains`, every other `/Users/*` home, `/Volumes`, the |
| - install dir), each as `Tool(/<path>)` and `Tool(/<path>/**)`. |
| -- `TestStepAndReadPermissionShareThePort`: `StepPermission` and |
| - `ReadPermission` take the same policy and refuse the same escapes. |
| -- "Nobody to ask" stays the default for anything not decided. |
| +- `TestDarwinToolProxySpeaksTheProtocol`: shared code split as |
| + `darwin || testbuild`, so it runs on Linux. The permission tool, |
| + `submit_candidate`, `ask_person`, `submit_answer` and the answer |
| + action's `git_*` tools round-trip with the same replies as the Linux |
| + proxy; a transcript recorded from the Linux proxy tests is the oracle. |
| +- `TestToolSocketPeerUID`: on darwin only the runner's own uid is |
| + accepted (`LOCAL_PEERCRED`, `peer_darwin.go`), exercised through its |
| + seam. |
| +- `TestToolSocketPathFits`: the socket path stays under 104 bytes for a |
| + long `/Users/<name>` home (use the scratch root's short `t/`). |
| +- The certified Linux tool proxy check passes unchanged. |
| + |
| +Mutations: accept any peer uid; allow a permission the Linux proxy |
| +denies. Each must fail a named test. |
| + |
| +## Task 7. Native permission port and workspace paths |
| + |
| +Spec §4.4, "Native file permissions, ported explicitly", and the |
| +transcript and prompt paths. Files: `provider/claude/answers.go`, |
| +`thin/claude.go` (`transcriptPath`, `keepTranscript`, `copyPrivate` |
| +callers), `thin/engineer.go` and `thin/ask.go` prompts. |
| + |
| +- The workspace root and the read-only research root become policy |
| + fields. Linux keeps `/workspace` and `/research`, and its certified |
| + policy hashes must not change: assert the Linux settings bytes are |
| + identical before and after. |
| +- Every requested path is resolved with `realpath` against the real root |
| + and checked against the §4.2 list before answering. Read, Edit, Write, |
| + Glob and Grep deny rules are generated for each §4.2 path. |
| + `StepPermission` and `ReadPermission` share the port. "Nobody to ask" |
| + stays the default. |
| +- `transcriptPath(home, cwd, session)` computes the project directory |
| + from the cwd with the CLI's rule (task 1, S6). Resuming a kept |
| + transcript into a new attempt's worktree moves it into the new cwd's |
| + project directory. Linux output is unchanged. |
| +- Prompts name the workspace root from the policy, not `/workspace`. |
| + |
| +Tests first (`answers_test.go`, a new `answers_darwin_policy_test.go` |
| +that runs on Linux with temp dirs standing in for Mac paths, |
| +`claude_transcript_test.go`): |
| + |
| +- `TestPermissionLinuxUnchanged`: every existing answer test passes; |
| + the Linux settings hash is unchanged. |
| +- `TestPermissionRootIsResolved`: a symlinked alias of the root (the |
| + stand-in for `/var` to `/private/var`) is allowed only when it lands |
| + inside the real root. |
| +- `TestPermissionRefusesEscapes`: `..`, a glob that expands outside the |
| + root, an absolute outside path, an inside symlink pointing out. |
| +- `TestPermissionDeniedPathsGenerated`: each §4.2 path appears as |
| + `Tool(/<path>)` and `Tool(/<path>/**)` for all five tools. |
| +- `TestTranscriptPathForRealCwd` and `TestResumeAcrossWorktrees`: keep in |
| + worktree A, resume in worktree B, then again after a runner restart. |
| + Linux paths stay `projects/-workspace`. |
| +- `TestPromptsNameTheRoot`. |
| + |
| +The symlink swap after the check cannot be proven by a unit test. Live |
| +proof is probe F6 (task 14), and Engineering stays unavailable until F6 |
| +passes. |
| |
| Mutations: compare prefixes without resolving; drop the `..` check; |
| -skip generating one deny path. Each fails a named test. |
| +skip one deny path; hard-code `-workspace` on darwin. Each must fail a |
| +named test. |
| |
| ## Task 8. Darwin Engineering policy and settings |
| |
| -Files: new `internal/runner/mac/engineering.go` (settings and policy), |
| -`internal/runner/provider/claude/launcher_darwin.go` or a |
| -`darwinPolicy` beside `PolicyInputs`, `internal/runner/mac/profile.go` |
| -(share the §4.2 path list with checks). |
| +Files: a new `internal/runner/mac/engineering.go`, a darwin policy |
| +beside `provider/claude/launcher.go` (`darwinPolicy`, `validateDarwin`), |
| +and `mac/profile.go`, which shares the §4.2 list with checks. |
| |
| The darwin policy is its own certified shape, not `provider.BuildPolicy` |
| -with bubblewrap fields faked. It records: the pinned CLI digest, the |
| -argv, the settings JSON, the MCP JSON (the darwin tool endpoint), the |
| -workspace root, the attempt scratch, the denied paths, the environment |
| -keys, and `xcode_access`. Before launch the launcher regenerates it from |
| -its inputs and requires byte equality, as `validatePolicy` does. |
| +with bubblewrap fields faked. It records the pinned CLI digest, argv, |
| +settings JSON, MCP JSON (the darwin tool endpoint), workspace root, |
| +attempt scratch, denied paths, environment keys and `xcode_access`. |
| +Before launch the launcher regenerates it from its inputs and requires |
| +byte equality, as `validatePolicy` does. |
| |
| -Settings, generated per attempt (keys confirmed by task 1, S2): |
| +Settings per attempt (keys confirmed by task 1, S2): |
| |
| - `disableAllHooks: true`, plugins off, `autoMemoryEnabled: false`, |
| - `--setting-sources ''`, `--strict-mcp-config`, `--disable-slash-commands`, |
| - `--permission-mode manual`, `--permission-prompt-tool |
| - mcp__equipo__permission`, tools `Bash,Read,Write,Edit,Glob,Grep` (as |
| - Linux Engineering). |
| + `--setting-sources ''`, `--strict-mcp-config`, |
| + `--disable-slash-commands`, `--permission-mode manual`, |
| + `--permission-prompt-tool mcp__equipo__permission`, tools |
| + `Bash,Read,Write,Edit,Glob,Grep` (as Linux Engineering). |
| - `sandbox.enabled: true`, `failIfUnavailable: true`, |
| `allowUnsandboxedCommands: false`, `excludedCommands: []`, |
| `autoAllowBashIfSandboxed: true`. |
| @@ -463,329 +544,406 @@ Settings, generated per attempt (keys confirmed by task 1, S2): |
| `xcode_access: sandboxed`, also the attempt's DerivedData under |
| scratch, the runner user's `DARWIN_USER_TEMP_DIR` (resolved as the |
| checks profile does, `mac/usertemp.go`), |
| - `~/Library/Developer/Xcode/DerivedData`, and the SwiftPM caches. |
| - `denyRead` and `denyWrite`: the §4.2 list plus the connection's |
| + `~/Library/Developer/Xcode/DerivedData` and the SwiftPM caches. |
| + `denyRead` and `denyWrite`: the §4.2 list, plus the connection's |
| dedicated home and its runtime copy. |
| -- `network.allowedDomains: []` (no network for Bash; if S2 shows empty |
| - means "ask", the permission tool answers deny, and F1 proves no |
| - connection is made), `allowUnixSockets: []`, |
| - `allowLocalBinding: false`, `allowMachLookup`: the P2 list |
| - (`mac.CheckMachServices`, narrowed by P2's record) when sandboxed |
| - Xcode access is on, else `[]`. |
| +- `network.allowedDomains: []`. If S2 shows that empty means "ask", the |
| + permission tool answers deny, and F1 proves no connection is made. |
| + `allowUnixSockets: []`, `allowLocalBinding: false`, and |
| + `allowMachLookup` set to the P2-recorded list (`mac.CheckMachServices`, |
| + narrowed by P2) only with sandboxed Xcode access, else `[]`. An empty |
| + list is not proof of no Mach access (S3 lists the runtime's defaults); |
| + F7 is the proof. |
| - `permissions.deny`: task 7's generated rules. `ask`: the native tools |
| on the workspace root. |
| - Environment from scratch: `HOME` the runner user's home (Xcode needs |
| it), `CLAUDE_CONFIG_DIR` the runtime copy, |
| `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1`, `DISABLE_AUTOUPDATER=1`, |
| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`, `TMPDIR` the attempt |
| - scratch, `DEVELOPER_DIR` from `xcode-select -p`, a fixed `PATH`, `LANG`, |
| - `EQUIPO_ATTEMPT=<marker>`. The token goes by descriptor if S4 found |
| - one; otherwise in `CLAUDE_CODE_OAUTH_TOKEN`, and F3 must prove the |
| - sandboxed shell cannot read it. |
| + scratch, `DEVELOPER_DIR` from `xcode-select -p`, a fixed `PATH`, |
| + `LANG`, `EQUIPO_ATTEMPT=<marker>`. The token goes by descriptor if S4 |
| + found one, otherwise in `CLAUDE_CODE_OAUTH_TOKEN`. Either way F3 must |
| + prove the sandboxed shell cannot read it. |
| +- A read-only variant for asks: `denyWrite` includes the worktree, and |
| + the tools are `Read,Glob,Grep`. |
| |
| Tests first (`internal/runner/mac/engineering_test.go`): |
| - |
| -- `TestEngineeringSettingsExact`: golden JSON for both Xcode modes. |
| -- `TestEngineeringSettingsRefuses`: a worktree inside a denied place; |
| - relative paths; globs; a scratch inside the worktree; a token home |
| - inside the worktree. |
| -- `TestEngineeringNoMachWithoutAccess`: `allowMachLookup` is empty unless |
| - `xcode_access` is `sandboxed`. |
| -- `TestEngineeringPolicyValidatedBeforeLaunch`: one byte changed in the |
| - stored settings, a different argv, or an extra environment key stops |
| - the launch. |
| -- `TestEngineeringEnvFromScratch`: nothing from the runner's own |
| - environment leaks through except the listed keys (the checks gate's |
| - `TestGate` inherited-environment mutation, reused). |
| -- `TestEngineeringTokenNotInArgvOrPolicy`: the token never appears in |
| - argv, the stored policy, the step log or a report. |
| +`TestEngineeringSettingsExact` (golden JSON for both Xcode modes and the |
| +read-only variant); `TestEngineeringSettingsRefuses` (a worktree inside |
| +a denied place, relative paths, globs, scratch inside the worktree, a |
| +token home inside the worktree); `TestEngineeringNoMachWithoutAccess`; |
| +`TestEngineeringPolicyValidatedBeforeLaunch` (one byte of settings, a |
| +different argv, an extra environment key: no launch); |
| +`TestEngineeringEnvFromScratch`; `TestEngineeringTokenNotInArgvOrPolicy` |
| +(the token is never in argv, the stored policy, the step log or a |
| +report). |
| |
| Mutations: allow network; drop the accounts root from `denyRead`; grant |
| -Mach lookups without access; inherit the environment. Each fails a named |
| -test. |
| +Mach lookups without access; inherit the environment. Each must fail a |
| +named test. |
| |
| -## Task 9. Darwin Engineering executor and termination |
| +## Task 9. Darwin executor, termination, machine lock, cleanup |
| |
| Spec §5. Files: `internal/runner/mac/gate.go` (pull the process-group |
| executor out so the gate and Engineering share it), a new |
| `internal/runner/mac/launch.go` implementing `thin`'s `starter` for a |
| -Mac, `thin/step.go` (`recordedStart`), `thin/state.go` recovery. |
| - |
| -The claude process starts in its own session and process group, under |
| -`caffeinate -i -w`, with the attempt marker in its environment. The |
| -record (marker, then group id) is written before the process starts, and |
| -a failed record starts nothing. Cancel or timeout: close stdin, wait for |
| -a graceful end (as `stopStep`), then `SIGTERM` to the group, 10 s, |
| -`SIGKILL`, the marked sweep (`ps -E`), `simctl shutdown` for simulators |
| -the attempt booted. Termination is proven when `kill(-pgid, 0)` is |
| -`ESRCH` and no marked process is left within 30 s. |
| -`termination_kind: process_group`. |
| - |
| -If task 1 (S5) shows the Bash tool's shell leaves the group, the sweep |
| -by marker is what catches it. That is why the marker must survive the |
| -CLI's environment scrub (S5). If it does not survive, stop and raise it: |
| -the honest limit in §5 would then cover every Bash command, which is not |
| -acceptable for Engineering. |
| +Mac, `mac/usertemp.go` (`Turns`), `thin/step.go` (`recordedStart`), |
| +`thin/state.go` (recovery). |
| + |
| +- **Record order.** Write the marker to the step row before the process |
| + starts; nothing starts if that write fails. Write the actual group id |
| + once the process exists; if that write fails, kill the group and stop. |
| +- **Stop.** Close stdin and wait for a graceful end (as `stopStep`), |
| + then `SIGTERM` to the group, 10 s, `SIGKILL`, then the marked sweep |
| + (`ps -E`). Then the user-temp cleanup protocol as it is today: |
| + `simctl shutdown all` (the mac-user-temp ruling; all simulators of the |
| + runner user are its own), then the sweep of what the attempt created. |
| +- **Proof.** Termination is proven only when `kill(-pgid, 0)` returns |
| + `ESRCH` and no marked process is left, within 30 s. **Fix the restart |
| + path** (`mac/gate.go`): today `gone := !ours || ...` passes when no |
| + marked process is found, even if the recorded group is still alive. |
| + New rule: if the recorded group is alive and holds no marked process, |
| + it is either our child that scrubbed its environment or a reused |
| + group id. Do not kill it, and do not prove termination. The step |
| + stays unterminated (no Retry) until the group is gone. Keep today's |
| + protection against killing a reused group. |
| +- **One machine lock.** Every operation that runs repository code, runs |
| + Xcode, or holds a model token takes `mac.Turns` for its whole life: |
| + checks, Engineering, asks, probes P1 to P7 and F1 to F7, the token |
| + check, the sign-in pty, and token storage. The temp-cleanup "pending" |
| + record is owned by the turn that wrote it, and only its owner or a |
| + restart may clear it. While a connection is in any state from |
| + connecting to deleted (task 11), no turn may run unsandboxed. |
| +- `termination_kind: process_group`. If task 1 (S5) shows the marker |
| + does not survive the CLI's scrub, stop and raise it: the honest limit |
| + in §5 would then cover every Bash command. |
| |
| Tests first (`internal/runner/mac/launch_test.go`, Linux-runnable with |
| -the `/proc` sweep): |
| - |
| -- `TestEngineeringLaunchRecordsBeforeStart`. |
| -- `TestEngineeringTerminationGroupAndMarker`: a fake CLI that forks a |
| - child which calls `setsid` (leaves the group) but keeps the marker. |
| - The sweep kills it, and the proof waits for it. |
| -- `TestEngineeringTerminationUnprovenKeepsRecord`: a marked process that |
| - survives SIGKILL (simulated by the seam) leaves the step unterminated. |
| - No Retry until a restart proves it. |
| -- `TestRestartKillsMarkedEngineering`: startup after a crash kills every |
| - marked process and reports `runner_restarted` with the proof. |
| -- `TestEngineeringShutsDownBootedSimulators`: only the simulators the |
| - attempt booted (recorded `simctl list` before and after). |
| - |
| -Mutations: proof without the sweep; record after start; shut down |
| -simulators that were already booted. Each fails a named test. |
| +the `/proc` sweep): `TestEngineeringLaunchRecordsMarkerThenGroup`; |
| +`TestEngineeringTerminationGroupAndMarker` (a fake CLI forks a `setsid` |
| +child that keeps the marker: the sweep ends it and the proof waits); |
| +`TestRestartUnmarkedSurvivorWithholdsProof` (an unmarked process alive |
| +in the recorded group: no kill, no proof); |
| +`TestRestartReusedGroupNotKilled` (an unrelated group reusing the id: |
| +not killed, no proof until it is gone); `TestRestartKillsMarked`; |
| +`TestTurnsCoverEveryTokenOperation` (an Engineering turn, a token check |
| +and a probe cannot overlap; checks wait while a sign-in pty is open); |
| +`TestCleanupOwnedByItsTurn` (an interrupted cleanup is finished only by |
| +its owner or a restart, never by another turn). |
| + |
| +Mutations: proof without the group check; record the group before the |
| +marker; let a token check run outside `Turns`; let one turn clear |
| +another's pending cleanup. Each must fail a named test. |
| + |
| +## Task 10. Darwin credential operations, home guard, taint gate |
| + |
| +Files: `thin/tokencheck.go`, `thin/signin.go`, `thin/token.go`, a new |
| +`mac/credentials.go`, a new `mac/homeguard.go`, and `thin/mac.go`. |
| + |
| +- **Darwin token check.** The same check as Linux (the CLI's own auth |
| + status and usage read with the token), run through the darwin |
| + launcher (tasks 8 and 9) with a check-only policy: no tools, no |
| + workspace, no network for any shell. Same outcomes, cancellation and |
| + crash recovery as Linux. No containment manager needed. |
| +- **Darwin sign-in by link.** The pinned CLI's `setup-token` in a pty |
| + under the darwin launcher, inside `Turns`, with the same prompt |
| + framing, code delivery (sealed), timeout and recovery as |
| + `thin/signin.go`. Before and after, a metadata-only Keychain check |
| + (`security find-generic-password -s 'Claude Code-credentials'`, |
| + without `-w`) records whether the CLI created an item. If it did, the |
| + connection is refused and the item is named in the log, since a |
| + Keychain copy would escape every deny rule. |
| +- **Home guard** (spec §8.3, item 1). Decide from ownership, mode bits |
| + and ACLs alone; never test by opening files as ourselves (P4's |
| + `Exposed` cannot see what another user sees). Pass only if all of |
| + these hold: |
| + - the home, state dir, config dir and accounts root are owned by the |
| + runner user; |
| + - none has group or other bits; |
| + - none has an ACL entry that allows list, search, read or readattr to |
| + anyone else; |
| + - each lies inside the home; |
| + - no ancestor between the home and each root is a symlink. |
| + Read the facts with `stat` and `ls -led` (recorded outputs), or the |
| + ACL API through the seam. On failure, name what to change. |
| +- **Taint gate** (D2 default). A runner tainted on the instance or in its |
| + own state takes no model connection, and its `EngineeringStatus` says |
| + `tainted`. |
| +- The guard and the taint are checked when a connection is stored and |
| + before every use, not only once. |
| + |
| +Tests first: `TestDarwinTokenCheck` (success, signed out, limited, |
| +cancelled, a crash then recovery), `TestDarwinSignIn` (code delivered, |
| +timeout, cancel, restart, a Keychain item created means refused), |
| +`TestHomeGuard` (0700 passes; 0750; an ACL grant to `everyone`; an ACL |
| +grant to one user; a root outside the home; a symlinked ancestor; a mode |
| +changed between store and use), `TestTaintBlocksConnections`. |
| + |
| +Mutations: accept group read; ignore ACL entries; skip the check before |
| +use; let a tainted runner store a token. Each must fail a named test. |
| + |
| +## Task 11. Worker connections, lifecycle routed by runner |
| + |
| +Files: `thin/run.go` (`runWorker`: `Conns`, the seal key, hello |
| +connections), `thin/conns.go`, `thin/connector.go`; on the instance |
| +`chat/connections.go`, `chat/runner.go` (hello processing), |
| +`chat_connections.go`, `connections_view.go` and the templates. |
| |
| -## Task 10. Worker Engineering `Exec`, secret check, outbound pack |
| - |
| -Files: `internal/runner/thin/worker.go` (split into `worker_checks.go` |
| -and `worker_engineering.go` to stay under the size budget), |
| -`engineer.go` (share `stepPrompt`, `fixPrompt`, `rebasePrompt`, |
| -`commitMessage`, `splitHeadline`, `emptyStepReason`), `relay.go` (the |
| -worker's outbound upload), `state.go` (phases). |
| - |
| -Flow for one attempt on a worker: |
| +Runner side: a worker at 36 opens `Conns` over its own accounts root, |
| +sends `Connections` and `SealKey` in hello, and accepts connect, cancel, |
| +sign-out and preference commands addressed to its runner id. It accepts |
| +only Claude token connections, by pasted token or by the darwin sign-in |
| +(task 10). Codex, API key and endpoint kinds are refused with a stated |
| +reason. |
| + |
| +Instance side: |
| + |
| +- Every connection operation is routed by the connection row's |
| + `runner_id`: start, cancel, sign out, forget, preference delivery, |
| + usage, refresh. Today Cancel and Sign out use `t.command` to the |
| + primary (`chat/connections.go`), and the runner's `Connector.remove` |
| + selects by local ID and person, so a worker connection with the same |
| + local ID as one on the primary could remove the primary's. Fix both: |
| + command to the row's runner, and match `(runner_id, local_id)`. |
| +- Hello processing (`chat/runner.go`) stops treating connections as |
| + primary-only. It upserts the connections of whichever runner sent the |
| + hello, scoped to that runner. |
| +- The Connections page groups rows by machine, the primary first. For a |
| + Mac worker at 36 it offers "Add Claude to <Mac>". The card seals to |
| + that runner's key. Needs you `mac_connection` links straight there. |
| +- **D1 bookkeeping.** From the moment a connection on a Mac enters |
| + `connecting` until the runner reports its files deleted, the instance |
| + holds that Mac as "has a model credential" (used by task 15). |
| + |
| +Tests first: `TestContractWorkerConnectionLifecycle` (thintest: start, |
| +cancel, sign out and preference on the worker never reach the primary; |
| +two runners with the same local ID; a sealed token for one runner cannot |
| +be accepted by the other); `TestWorkerHelloConnections` (thin: at 36 |
| +yes, at 35 none); `TestWorkerTokenConnectionStored` (thin: 0600 file in |
| +a 0700 home, refused when the home guard fails); |
| +`TestWorkerRefusesOtherConnectionKinds`; |
| +`TestConnectionsPageGroupsByMachine` (equipo); |
| +`TestContractCredentialHeldFromConnecting`. |
| + |
| +Mutations: route Sign out to the primary; match by local ID only; show |
| +the add button for a worker at 35; store the token 0644. Each must fail |
| +a named test. |
| + |
| +## Task 12. Worker Engineering `Exec`, object scan, outbound pack |
| + |
| +Files: `thin/worker.go`, split into `worker_checks.go` and |
| +`worker_engineering.go` to stay under the size budget; `engineer.go` |
| +(share `stepPrompt`, `fixPrompt`, `rebasePrompt`, `commitMessage`, |
| +`splitHeadline`, `emptyStepReason`); `relay.go` (the worker's upload); |
| +`state.go` (phases). |
| + |
| +One attempt on a worker: |
| |
| 1. Guards: specialist Engineering; owner; `ValidHub`; `ValidTaskBranch`; |
| - protocol 36 spoken; a non-empty base; `engineering_unavailable` when |
| - the CLI is unpinned, the F probes have not passed, or the home guard |
| - (task 14) fails; `XcodeAccess` not stronger than the worker's own |
| - trusted report allows. |
| -2. Marker recorded, lease (`AuthorizeStep`). |
| -3. Await the inbound pack. Check the header against the step row, |
| - including `Commits`. Index it. Require each listed commit with a |
| - complete tree. |
| -4. Prepare the tree in the worker's steps dir under scratch, from the |
| - worker store with only those commits. For a rebase round, use |
| - `TaskTree.Rebase` (merge-tree with the explicit merge base, which needs |
| - only the three commits). |
| -5. Pick a connection among the worker's own (task 11). Failover among |
| - them on limit or sign-in refusal, as `refused` does on the primary, |
| - with a fresh tree each time. |
| -6. Run through the darwin launcher (tasks 8 and 9). Keep the session for |
| - fix rounds and questions (task 12). Fix rounds resume the kept |
| - session as on Linux (`fixSession`). |
| -7. Commit with the existing `tree.Commit` (Equipo Engineering identity, |
| - parent the base). Same rules for unfinished (`step_timeout`), no-shell |
| - and empty results. Compute `Apple` from changed files. |
| -8. **Secret check** before anything leaves: for every known secret of |
| - this worker (each connection's token, its runner credential, the seal |
| - key's private half if stored), as raw text and base64, over the diff |
| - `base..candidate`; then the pinned darwin gitleaks with the trusted |
| - configuration, offline, inside srt with no network, over the changed |
| - files. Any hit ends the step `secret_in_candidate` with no upload; the |
| - log line names the file, never the secret. |
| -9. Record phase `committed` durably, report `committed` with the |
| - candidate. The instance opens the outbound transfer. Upload the thin |
| - pack (`pack-objects --revs --thin` of `^base candidate`) as blob |
| - frames. End `done`, `pushed: false`. |
| -10. Restart after `committed`: resume the upload, never run the CLI |
| - again for that attempt. |
| + protocol 36 spoken; a bound, non-empty base; `EngineeringStatus` |
| + `ready`; `XcodeAccess` no stronger than its own trusted report |
| + allows. Anything else ends `engineering_unavailable` or |
| + `policy_rejected`, with nothing run. |
| +2. Take `Turns`. Record the marker. Lease (`AuthorizeStep`). |
| +3. Await the inbound pack. Compare the header with the step row (kind, |
| + base, old base, candidate). Index it. Check the pack's own inventory |
| + (task 4's method). Write the named commits to the store's `shallow` |
| + file, merging with what is there, so later rev-list and log commands |
| + stop at them. |
| +4. Prepare the tree under the scratch root from the worker store. A |
| + rebase round uses `TaskTree.Rebase` (merge-tree with the explicit |
| + merge base needs only the three commits). |
| +5. Pick a connection among the worker's own. Fail over among them on a |
| + limit or a sign-in refusal, as `refused` does on the primary, from a |
| + fresh tree each time. |
| +6. Run through the darwin launcher. Keep the session for fix rounds and |
| + asks. Fix rounds resume the kept session (`fixSession`) through |
| + task 7's transcript move. |
| +7. Commit with `tree.Commit` (Equipo Engineering identity, parent the |
| + base). Apply the same rules for unfinished, no-shell and empty |
| + results, and record the phase. Compute `Apple` from the changed |
| + files. |
| +8. **Object scan, before anything leaves.** List the new objects |
| + (`rev-list --objects ^base candidate`) and read each with `cat-file |
| + --batch`: blobs (binary too; symlink targets are blobs), trees (file |
| + names) and the commit (message and identity). Search for each known |
| + secret of this worker (every connection's token, its runner |
| + credential, the seal key's private half), raw, base64 (standard and |
| + URL) and hex. Then run the pinned darwin gitleaks, offline, under srt |
| + with no network, over the changed files with the trusted |
| + configuration. Fail closed: a hit, a scanner error, an object over the |
| + scan bound (the 64 MB pack bound), or a list that cannot be read ends |
| + the step `secret_in_candidate`, and nothing is uploaded. Logs and |
| + reports name the path or object id, never the matched bytes. |
| +9. Record phase `committed` durably and report `committed` with the |
| + candidate and phase. The instance opens the outbound transfer. Upload |
| + the thin pack (`pack-objects --revs --thin --stdout` with |
| + `^base candidate`) as blob frames. End `done`, `pushed: false`. |
| +10. A restart after `committed` resumes the upload and never launches |
| + the CLI again for that attempt. |
| |
| Research hand-off: the quoted findings text arrives in the dispatch, as |
| -on the primary. Kept images are not relayed in slice F, and the prompt |
| -says the images stay on the main runner. Explore tasks: the same |
| -Engineering step; the preview runs on the primary from the published |
| -candidate. |
| +on the primary. Kept images are not relayed, and the prompt says the |
| +images stay on the main runner. Explore tasks run the same Engineering |
| +step; their preview runs on the primary from the published candidate. |
| |
| Tests first (`internal/runner/thin/worker_engineering_test.go`, with the |
| fake CLI and the process-group executor without a sandbox, `testbuild` |
| only): |
| |
| -- `TestWorkerEngineeringCommitsAndUploads`: one attempt to `done`, |
| - `pushed: false`. The outbound pack indexes on the primary side |
| - (`publishWorker`) to exactly the candidate. |
| -- `TestWorkerEngineeringRefusesGuards`: one case per guard in step 1. |
| -- `TestWorkerEngineeringRebaseRound`: conflicts listed in the prompt; the |
| - commit's parent is the new base. |
| -- `TestWorkerEngineeringFixRoundResumes`: the second round resumes the |
| - kept session on the same worker. |
| -- `TestWorkerEngineeringSecretInCandidate`: the fake CLI writes the |
| - connection's token (raw, then base64) into a file. Refused, nothing |
| - uploaded, the log names the file only. A gitleaks-detectable fake key |
| - is refused too. |
| -- `TestWorkerEngineeringRestartAfterCommit`: SIGKILL after `committed`; |
| - the restart uploads and never relaunches the CLI. |
| -- `TestWorkerEngineeringFailover`: the first connection is limited; the |
| - second runs from a fresh tree; usage of both reported. |
| +- `TestWorkerEngineeringCommitsAndUploads`: to `done`, `pushed: false`; |
| + the outbound pack indexes on the primary (`publishWorker`) to exactly |
| + the candidate. |
| +- `TestWorkerEngineeringRefusesGuards`: one case per guard. |
| +- `TestWorkerStoreShallowBoundaries`: after two fix rounds and one |
| + rebase into the same store, `git log` and `rev-list` in the store |
| + succeed and stop at the boundaries; the thin pack builds. |
| +- `TestWorkerEngineeringRebaseRound`, `TestWorkerEngineeringFixRoundResumes`. |
| +- `TestWorkerObjectScan`: the fake CLI plants the token raw in a text |
| + file, base64 in a binary file, in a file name, in a symlink target, in |
| + the commit message (through its summary), and hex-encoded. Each is |
| + refused with nothing uploaded and the log names only the path. Plus a |
| + gitleaks-detectable fake key, a scanner that exits with an error, and |
| + an object past the bound. |
| +- `TestWorkerEngineeringRestartAfterCommit`, `TestWorkerEngineeringFailover`. |
| - `TestWorkerChecksUnchanged`: every existing worker checks test passes. |
| |
| -Mutations: skip the base64 form; upload before the secret check; reuse |
| -the refused attempt's tree; relaunch after `committed`; accept a |
| -`pushed: true` path. Each fails a named test. |
| - |
| -## Task 11. Worker connections and "Add Claude to <Mac>" |
| - |
| -Files: `thin/run.go` (`runWorker`: `Conns`, seal key, hello |
| -connections), `thin/conns.go`, `thin/connector.go`, `thin/token.go`, |
| -`thin/signin.go`; instance `internal/equipo/chat/connections.go`, |
| -`internal/equipo/chat_connections.go`, `connections_view.go`, templates. |
| +Mutations: skip the base64 form; scan only the diff; upload before the |
| +scan; ignore a scanner error; reuse the refused attempt's tree; relaunch |
| +after `committed`. Each must fail a named test. |
| |
| -Runner side: a worker at 36 opens `Conns` over its own accounts root, |
| -sends `Connections` and `SealKey` in hello, and accepts the same connect |
| -commands the primary does, addressed to its runner id. Only Claude token |
| -connections, either a pasted token or the sign-in by link where the |
| -worker runs the pinned CLI's `setup-token` in a pty. Codex, API key and |
| -endpoint kinds are refused on a Mac with a clear reason. |
| - |
| -Instance side: the Connections page groups rows by machine (the primary's |
| -first, then each worker by label). For a person with a Mac worker at 36 |
| -it offers "Add Claude to <Mac>". Starting a connection names the runner |
| -id; the card seals to that runner's key; the runner check in the |
| -transaction (`runner_id = ?`) already scopes acceptance. Needs you |
| -`mac_connection` links straight to that card. |
| +## Task 13. Ask the implementer, pinned exactly |
| |
| -Tests first: |
| +Files: `internal/equipo/chat/questions*.go` (creation and dispatch), |
| +`thin/ask.go`, the worker's kept-session store. |
| |
| -- `TestContractWorkerConnectionScoped` (thintest): a connection started |
| - for the worker is delivered only to the worker's mailbox; a sealed |
| - token for the worker cannot be accepted by the primary, or the reverse; |
| - a worker below 36 is never offered. |
| -- `TestWorkerHelloConnections` (thin): hello lists the worker's |
| - connections and seal key at 36, none at 35. |
| -- `TestWorkerTokenConnectionStored` (thin): the token lands in |
| - `.oauth-token`, 0600, in a 0700 dedicated home under the accounts root. |
| - A home guard failure (task 14) refuses to store it. |
| -- `TestWorkerSetupTokenUsesPinnedCLI`: the sign-in pty runs only the |
| - pinned binary. |
| -- `TestConnectionsPageGroupsByMachine` (equipo): rows grouped, "Add |
| - Claude to Tito Studio" shown only for a Mac worker at 36. |
| -- `TestWorkerRefusesOtherConnectionKinds`. |
| - |
| -Mutations: deliver a worker connection to the primary; show the add |
| -button for a worker at 35; store the token with 0644. Each fails a named |
| -test. |
| - |
| -## Task 12. Ask the implementer, pinned on the worker |
| - |
| -Spec §1.4 and §4.4. Files: `thin/ask.go`, `thin/run.go` (`runWorker` |
| -wiring for asks), the worker's kept-session store. |
| - |
| -The worker keeps the Engineering session per (step, attempt, account, |
| -session id) under its state dir with the same retention as the primary. |
| -An ask placed on the step's runner (built in slice B) runs the `answer` |
| -action there, with `git_log`, `git_diff` and `git_show` over the worker's |
| -store, on the kept session. It uses Read-only native tools under the |
| -ported `ReadPermission` (task 7) and the same darwin launcher with the |
| -read-only settings: `denyWrite` includes the worktree. |
| +- When a question is created for an Engineering step, the instance binds |
| + the Engineering attempt, account and session id recorded on the step |
| + (`eng_attempt`, `eng_account`, `eng_session`) and sends them in |
| + `AskCommand`. |
| +- The worker keeps Engineering sessions per (step, attempt, account, |
| + session id) under its state dir, with the primary's retention. An ask |
| + resumes exactly the bound session on the runner that holds it, with |
| + the read-only darwin settings (task 8) and `git_log`, `git_diff` and |
| + `git_show` over its store (task 12's shallow boundaries keep them |
| + working). A different runner, attempt, account or session is refused. |
| +- An offline worker gets "Tito Studio is offline; ask again when it is |
| + back" (exists; extend it to a Mac-made step). |
| |
| -Tests first: |
| +Tests first: `TestContractAskBindsTheSession` (thintest: a question |
| +created after a newer attempt that produced the **same** candidate is |
| +still bound to the attempt it was asked about; the worker refuses the |
| +other); `TestWorkerAskAnswersFromKeptSession`; |
| +`TestWorkerAskRefusesMismatch`; `TestWorkerAskCannotWrite`; |
| +`TestContractAskMacOffline`. |
| |
| -- `TestWorkerAskAnswersFromKeptSession`. |
| -- `TestWorkerAskRefusesOtherAttemptOrAccount`: a later attempt, another |
| - account, or a session id that is not the recorded one is refused. |
| -- `TestContractAskMacOffline` (thintest): the worker is offline, so the |
| - answer is "Tito Studio is offline; ask again when it is back" (exists |
| - as `TestContractAskOfflineRunner`; extend it for a Mac-made step). |
| -- `TestWorkerAskCannotWrite`: the read-only settings deny writes to the |
| - worktree. |
| +Mutations: choose the newest kept session; allow Write in the ask |
| +settings. Each must fail a named test. |
| |
| -Mutations: answer on a non-pinned attempt; allow Write in the answer |
| -settings. Each fails a named test. |
| - |
| -## Task 13. Shipped probes F1 to F5, and the `claude` tag |
| +## Task 14. Shipped probes F1 to F7, P2 token sources, Engineering status |
| |
| Files: `internal/runner/mac/probe.go`, a new `probe_engineering.go`, the |
| -fixture under `internal/runner/mac/fixtures/`, `thin/mac.go` |
| +fixtures under `internal/runner/mac/fixtures/`, `thin/mac.go` |
| (`macProbes`), `thin/capabilities.go`. |
| |
| -The probes ship in the binary and run on the Mac as the runner user, as |
| -P1 to P7 do. They are reported in `capabilities.probes` and trusted only |
| -for this runner version, this settings profile and the verified pinned |
| -CLI, for under a day. They run once a Claude connection exists, with |
| -**one short probe turn** on the connection's glance model, prompted to |
| -run one fixed script with Bash. The verdict never reads model text. As |
| -in P2: every probe has a control that must succeed, a missing line is |
| -not a denial, and outside observers (a loopback listener, sentinel |
| -files with nonces) decide. |
| - |
| -- **F1 sandbox on, no network.** The script's control writes a nonce to |
| - the worktree (must appear). A TCP connect to a loopback listener the |
| - runner holds, a DNS lookup of a name the runner watches, and an HTTPS |
| - request through the CLI's proxy must all fail, and the listener sees |
| - nothing. |
| -- **F2 reads denied.** Nonce sentinels in the runner state dir, the |
| - accounts root, the connection's runtime copy, `~/Library/Keychains`, |
| - another `/Users/*` home (one P4 shows closed) and `/Volumes`: none of |
| - their nonces may appear in the worktree. |
| -- **F3 the token is out of reach.** From inside Bash the script copies |
| - whatever each source yields into the probe tree: `ps -E -p $PPID`, |
| - `ps -E` of every own process, `sysctl kern.procargs2` of the CLI's pid, |
| +The probes ship in the binary and run on the Mac as the runner user, |
| +inside `Turns`, as P1 to P7 do. They are reported in |
| +`capabilities.probes` and trusted only for this runner version, this |
| +settings profile, the verified pinned CLI, this Xcode version and its |
| +simulator runtimes, for under a day. Any change to those inputs means |
| +they run again. They need a Claude connection, and they run as **one |
| +short probe turn** on the connection's small model, prompted to run one |
| +fixed script with Bash. The verdict never reads model text. As in P2, |
| +every probe has a control that must succeed, a missing line is not a |
| +denial, and outside observers decide: a loopback listener, nonce |
| +sentinels, and the runner's own search of the probe tree. The probe |
| +tree is never committed, uploaded or logged, and it is deleted after. |
| + |
| +- **F1 sandbox on, no network.** Control: a nonce written to the probe |
| + tree must appear. A TCP connect to the runner's loopback listener, a |
| + DNS lookup of a name the runner watches, and an HTTPS request through |
| + the CLI's proxy must all fail, and the listener must see nothing. |
| +- **F2 reads denied (shell).** Nonce sentinels in the runner state dir, |
| + the accounts root, the connection's runtime copy, |
| + `~/Library/Keychains`, another `/Users/*` home that P4 shows closed, |
| + and `/Volumes`. No nonce may reach the probe tree. |
| +- **F3 the token is out of reach.** From inside Bash, the script copies |
| + what each source yields into the probe tree: `ps -E -p $PPID`, `ps -E` |
| + of every own process, `sysctl kern.procargs2` of the CLI's pid, |
| `launchctl getenv CLAUDE_CODE_OAUTH_TOKEN`, `env`, and the token file |
| - read by path. The runner then searches the probe tree for the token, |
| - raw and base64, and deletes the tree. The probe tree is never |
| - committed, uploaded or logged. Any hit fails F3. |
| + read by path. The runner then searches the tree for the token (raw, |
| + base64, hex). Any hit fails F3. |
| - **F4 process group.** The script forks a `setsid` child that sleeps. |
| - The runner cancels the turn; the marked sweep must find and end it, |
| - and the proof must hold. |
| -- **F5 Xcode under Claude's sandbox.** Run only when P2 is `denied`. The |
| - P2 hostile fixture (run-script phase, SwiftPM build tool plugin, |
| - XCTest on the newest iPhone simulator) is built and tested by |
| - `xcodebuild` from the Bash tool under the `xcode_access: sandboxed` |
| - settings. Every sentinel read, connection and Keychain read must be |
| - denied, and the build and test must complete (a failed build is not a |
| - denial). |
| - |
| -The `claude` tag is reported when the pinned CLI is verified, F1 to F4 |
| -are `denied`/`passed` for this version and profile, the home guard |
| -passes, and at least one Claude connection is usable. F5 decides only |
| -`xcode_access`. The Machines page shows F1 to F5 beside P1 to P7. |
| + The runner cancels the turn; the marked sweep must end it, and the |
| + proof must hold. |
| +- **F5 Xcode under Claude's sandbox.** Runs only when P2 is `denied`. |
| + The P2 hostile fixture (run-script phase, SwiftPM build tool plugin, |
| + XCTest on the newest iPhone simulator), with F3's token sources added |
| + to each hostile part, is built and tested by `xcodebuild` from the |
| + Bash tool under the sandboxed-Xcode settings. Every sentinel read, |
| + token source, connection and Keychain read must be denied, and the |
| + build and test must complete (a failed build is not a denial). |
| +- **F6 native tools.** Prompted tool calls (Read, Glob, Grep, Write) on |
| + each denied path, through a symlink planted in the probe tree, and |
| + through a symlink swapped by a background process between calls. All |
| + must be refused, by the permission tool or the CLI, and no nonce may |
| + reach the probe tree. The swap race is retried 50 times. |
| +- **F7 no Xcode without access.** Under the no-Xcode settings, `xcodebuild |
| + -list`, `xcrun simctl list` and a Mach lookup of |
| + `com.apple.CoreSimulator.CoreSimulatorService` from Bash must all |
| + fail. Control: the same commands outside the sandbox succeed. |
| +- **P2 gains F3's token sources** in its run-script phase, plugin and |
| + XCTest, under the srt checks profile, so checks that run as the same |
| + user are proven not to reach the token either. P2 `denied` needs them |
| + denied. |
| + |
| +`EngineeringStatus` is `ready` when the pinned CLI is verified, F1 to |
| +F4, F6 and F7 passed for the current inputs, the home guard passes, the |
| +runner is not tainted, and at least one Claude connection is usable. |
| +Otherwise it names the first missing input. F5 decides only |
| +`xcode_access`. The `claude` tag goes with `ready`. The Machines page |
| +shows F1 to F7 beside P1 to P7. |
| |
| Tests first (`internal/runner/mac/probe_engineering_test.go`, recorded |
| -outputs and fakes): |
| - |
| -- `TestF1RequiresControlAndListener`: a "denied" line with the listener |
| - hit is a failure; a missing control is `unavailable`. |
| -- `TestF2NoncesDecide`. |
| -- `TestF3AnySourceYieldsSentinelFails`. |
| -- `TestF4SweepProof`. |
| -- `TestF5OnlyAfterP2AndNeedsTheBuild`. |
| -- `TestClaudeTagNeedsEverything`: drop any one input and the tag goes. |
| -- `TestProbeTurnVerdictIgnoresModelText`: the fake CLI claims success |
| - in text while the sentinels say otherwise; the verdict follows the |
| - sentinels. |
| - |
| -Mutations: accept a missing line as denied; ignore the listener; give |
| -the tag without a connection; run F5 before P2. Each fails a named test. |
| - |
| -## Task 14. Home guard, D1 default, views and copy |
| - |
| -**Home guard** (spec §8.3). A worker refuses to store or use a model |
| -connection while another user can list or traverse its home, or read |
| -its state dir, config dir or accounts root. The check is the same |
| -list/traverse/open test P4 uses, run against the runner's own paths, |
| -plus mode bits and ACLs (`ls -led`). The refusal text says the one fix: |
| -"Run `chmod 700 ~` as <user> on <Mac>, then try again." The worker does |
| -not change permissions itself; that would be changing Studio state |
| -without the person. |
| - |
| -**D1 default** (spec §8.7, Paul may overrule). While a Mac worker holds |
| -a model connection, the instance does not offer "Run outside the |
| -sandbox" for checks on it (`macsandbox.go`), and the worker refuses an |
| -unsandboxed dispatch (`sandbox_unproven`). Isolate this in one predicate |
| -(`unsandboxedAllowed(runner)`) so that if Paul rules otherwise the change |
| -is a few lines plus a warning string. |
| +outputs and fakes): `TestF1RequiresControlAndListener`, |
| +`TestF2NoncesDecide`, `TestF3AnySourceFails`, `TestF4SweepProof`, |
| +`TestF5OnlyAfterP2AndNeedsTheBuild`, `TestF6SwapRace`, |
| +`TestF7NeedsTheOutsideControl`, `TestP2TriesTheToken`, |
| +`TestProbeInputsInvalidate` (a new Xcode build, a new runtime, a new CLI |
| +digest), `TestEngineeringStatusOrder`, |
| +`TestProbeTurnVerdictIgnoresModelText` (the fake CLI claims success in |
| +text while the sentinels say otherwise; the verdict follows the |
| +sentinels). |
| + |
| +Mutations: take a missing line as denied; ignore the listener; give |
| +`ready` without a connection; run F5 before P2; keep a verdict across an |
| +Xcode change. Each must fail a named test. |
| + |
| +## Task 15. D1 across every connection state, views, copy |
| + |
| +**D1 default** (spec §8.7; Paul may overrule). While the instance holds a |
| +Mac as having a model credential (task 11, from `connecting` until the |
| +files are gone), it does not offer "Run outside the sandbox" for checks |
| +on that Mac (`macsandbox.go`). The worker refuses an unsandboxed |
| +dispatch (`sandbox_unproven`) whenever it holds any token file or has a |
| +connection in progress. Put the rule in one predicate |
| +(`unsandboxedAllowed(runner)`) on each side, so if Paul rules otherwise |
| +the change is that predicate plus a warning string. An unsandboxed |
| +choice already recorded on a waiting attempt is withdrawn when a |
| +connection starts, and the creator is told. |
| |
| **Views.** The step line names the Mac when Engineering ran on a worker |
| (house rule 2026-11-07.8: only when it is not the primary). Without |
| Xcode access, the Engineering card says the Mac's checks build it. The |
| -new waits and Needs you lines show (`mac_connection`, `mac_update`, |
| -`workspace_too_large`, `secret_in_candidate`). The Machines page shows |
| -F1 to F5 and whether Engineering can run there. |
| - |
| -**Copy** (drafts; Luna reviews all, Paul sees the user-facing card |
| -lines). Write every new string to `copy.go` as `// COPY REVIEW PENDING` |
| -and to `docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json` in the |
| -copy-review skill's format, each with its key, context and draft. |
| +new waits and Needs-you lines appear (`mac_connection` with its status |
| +reason, `mac_update`, `waiting_base`, `workspace_too_large`, |
| +`secret_in_candidate`). The Machines page shows F1 to F7, the home |
| +guard, the taint and whether Engineering can run there. |
| + |
| +**Copy** (drafts; Luna reviews all of it, and Paul sees the user-facing |
| +card lines). Mark each string pending with `scripts/copy-status.py |
| +pending` and list it in `2026-11-28-mac-slice-f-copy.json` in the |
| +copy-review skill's format, with key, where it shows, and draft. |
| Starting drafts: |
| |
| - `work.needs.mac_connection`: "Needs you: %s needs Claude to make this |
| @@ -794,133 +952,147 @@ Starting drafts: |
| ready, but it has no Claude connection yet." |
| - `work.decide.mac_connection_ask`: "Add Claude to %s and it starts by |
| itself." |
| +- one line per other `EngineeringStatus` reason (signed out, limited, |
| + probes pending, probes failed, home open, tainted) |
| - `chat.connections.add_to`: "Add Claude to %s" |
| - `work.needs.mac_update`: "Needs you: %s needs an update to make |
| changes" |
| -- `work.reason.workspace_too_large`: "the project is too large to send |
| - to the Mac" |
| -- `work.reason.secret_in_candidate`: "the change contained a secret, so |
| - it was not sent" |
| +- `work.reason.base_unavailable`, `work.reason.workspace_too_large` |
| + ("the project is too large to send to the Mac"), |
| + `work.reason.secret_in_candidate` ("the change contained a secret, so |
| + it was not sent") |
| - `work.step.made_on`: "Made on %s" |
| -- `work.step.no_xcode`: "Built and tested by the Mac's checks, not |
| - while making the change" |
| -- `runner.mac.home_open`: "Other people on this Mac can open %s's |
| - home folder. Run chmod 700 ~ as %s, then try again." |
| -- `runner.engineering`: "Makes changes" / `runner.engineering_off`: |
| - "Doesn't make changes yet" |
| -- the F1 to F5 probe names and verdict lines, following |
| - `runner.probe.P1` and on. |
| - |
| -The `mac-placement-wait` strings that slice F makes untrue |
| -(`work.needs.mac_engineering`, `work.decide.mac_engineering_why`: |
| -"Mac runners can't make changes yet") are rewritten for the switch-off |
| -case only ("Mac changes are turned off on this Equipo") and go into the |
| -same JSON. |
| - |
| -Tests first: `TestHomeGuard*` (thin, with temp homes and modes), |
| -`TestUnsandboxedNotOfferedWithConnection` (thintest), |
| -`TestMacEngineeringViews` (equipo, each line on the step, task and |
| -Needs you), and `make copy-release-check` stays as it is (pending copy |
| -blocks release, which is correct). |
| - |
| -Mutations: let the guard pass a 0750 home; offer the unsandboxed choice |
| -with a connection held. Each fails a named test. |
| - |
| -## Task 15. M9 on Linux CI |
| +- `work.step.no_xcode`: "Built and tested by the Mac's checks, not while |
| + making the change" |
| +- `runner.mac.home_open`: names what to change, for example "Other |
| + people on this Mac can open %s's home folder. Run chmod 700 ~ as %s, |
| + then try again." |
| +- `work.decide.unsandboxed_withdrawn`: why the outside-the-sandbox |
| + choice went away |
| +- the F1 to F7 probe names and verdict lines, following |
| + `runner.probe.P1` onwards |
| +- the `mac-placement-wait` strings slice F makes untrue |
| + (`work.needs.mac_engineering`, `work.decide.mac_engineering_why`), |
| + rewritten for the switch-off case |
| + |
| +Tests first: `TestUnsandboxedNotOfferedWithCredential` (thintest: from |
| +`connecting` through deletion, including a failed connect and a sign |
| +out), `TestWorkerRefusesUnsandboxedWithToken`, |
| +`TestUnsandboxedChoiceWithdrawnOnConnect`, `TestMacEngineeringViews` |
| +(equipo: each line on the step, task, Needs you and Machines page). |
| +`make copy-release-check` keeps blocking release while copy is pending, |
| +which is correct. |
| + |
| +Mutations: offer the choice while `connecting`; let the worker run |
| +unsandboxed with a token file present. Each must fail a named test. |
| + |
| +## Task 16. M9 and mixed versions on Linux CI |
| |
| Files: `internal/headless/mac_test.go` (extend `TestMacWorker`), |
| `thin/fakeworker_testbuild.go`, `internal/fakeclaude`. |
| |
| The fake worker is the real thin runner under `testbuild` with |
| -`EQUIPO_FAKE_PLATFORM=darwin/arm64`, the fixture capability report with |
| -F1 to F5 `denied`, the fake CLI, and the process-group executor without a |
| -sandbox. `scripts/no-fake-worker.sh` keeps it out of releases. |
| - |
| -Scenarios, inside the headless budget: |
| - |
| -- **M9a** Woodstar-shaped repository (an `.xcodeproj` with a shared |
| - scheme and an `.equipo/gates.json` gate needing Xcode). Engineering is |
| - placed on the worker, the inbound pack is relayed, the fake CLI edits |
| - a Swift file, the worker commits and uploads a thin pack, the primary |
| - pushes, change files and diffs appear, checks run on the worker, review |
| - runs on the primary, Ready to merge asks (no auto-merge). |
| +`EQUIPO_FAKE_PLATFORM=darwin/arm64`, a fixture capability report with F1 |
| +to F7 passed and `EngineeringStatus ready`, the fake CLI, and the |
| +process-group executor without a sandbox. `scripts/no-fake-worker.sh` |
| +keeps it out of releases. |
| + |
| +Scenarios, within the headless budget: |
| + |
| +- **M9a** a Woodstar-shaped repository (an `.xcodeproj` with a shared |
| + scheme, and an `.equipo/gates.json` gate that needs Xcode). Prepare |
| + base, then Engineering on the worker. The inbound pack is relayed, the |
| + fake CLI edits a Swift file, the worker scans, commits and uploads a |
| + thin pack, and the primary pushes. Change files and diffs appear, |
| + checks run on the worker, review runs on the primary, and Ready to |
| + merge asks (no auto-merge). |
| - **M9b** a fix round from the checks output stays on the worker and |
| - resumes its session; a push failure then Retry republishes the same |
| - commit without running Engineering again. |
| + resumes its session in a new worktree. A push failure, then Retry, |
| + republishes the same commit without running Engineering. |
| - **M9c** a rebase round on the worker. |
| - **M9d** ask the implementer answered on the worker; refused for |
| another attempt; the offline line when the worker is stopped. |
| - **M9e** the worker is SIGKILLed mid-Engineering: process-group |
| termination, Retry on the same worker, done. |
| -- **M9f** switch off: the step waits, nothing reaches the worker. |
| -- **M9g** a worker at protocol 35 (a binary built from `main` at the |
| - branch point, cached as M8 does): `waiting_mac_update`, never an |
| - Engineering dispatch. |
| -- **M9h** secret in candidate: refused, nothing pushed. |
| +- **M9f** the switch is off: the step waits and nothing reaches the |
| + worker. |
| +- **M9g** mixed versions, with binaries built from `main` at the branch |
| + point (cached as M8 does): a protocol 35 worker with a 36 primary, and |
| + a 36 worker with a 35 primary, both wait `waiting_mac_update`. A 36 |
| + worker against an instance rolled back to 35 downgrades in its hello, |
| + queues no protocol 36 command, and loses nothing. |
| +- **M9h** a secret in the candidate: refused, nothing pushed. |
| +- **M9i** a timed-out step on the worker: unfinished through |
| + publication, never shown as finished work. |
| - The `oficina/suite` scenario and every slice 1 to 4 and A to E |
| scenario stay green, especially Linux termination before Retry. |
| |
| -## Task 16. Release, docs, `make ci`, whole-branch review |
| +## Task 17. Release, docs, `make ci`, whole-branch review |
| |
| -- The release needs no new Mac artifact: the runner provisions the CLI |
| - (task 5), and gitleaks for darwin already ships. `make release-runner` |
| - and `scripts/staged-artifacts.py` stay green. The Linux tool proxy |
| +- No new Mac artifact: the runner provisions the CLI (task 5), and the |
| + darwin gitleaks already ships. `make release-runner` and |
| + `scripts/staged-artifacts.py` stay green, and the Linux tool proxy |
| digest is unchanged. |
| -- `docs/mac-runner.md` gains "Make changes on the Mac": turn the switch |
| - on (owner), `chmod 700 ~` as the runner user if the Machines page asks, |
| - then "Add Claude to <Mac>" and sign in. This is draft copy, so it goes |
| - in the copy JSON. |
| +- `docs/mac-runner.md` gains "Make changes on the Mac": the owner turns |
| + the switch on; the runner user fixes its home folder if the Machines |
| + page asks; the person adds Claude to the Mac and signs in. This is |
| + draft copy, so it goes in the copy JSON. |
| - `make ci` once. Fix what it finds. Push. |
| -- Whole-branch Astra review (max three rounds), then the controller |
| - report and a handoff with the witness runbook for task 17. |
| +- Whole-branch Astra review (at most three rounds), then the controller |
| + report, and a handoff with task 18's runbook. |
| |
| -## Task 17. Live witness on production (not the controller's to start) |
| +## Task 18. Live witness on production (not the controller's to start) |
| |
| Runs only after the parent has merged and deployed the release |
| (`scripts/upgrade-thin.sh`, per AGENTS.md), the Studio has self-updated, |
| -and the owner has set `EQUIPO_MAC_ENGINEERING=1`. The controller writes |
| -the runbook and the read-only checks. It does not run any of the steps |
| -that change things. |
| +Paul has ruled on D1 and D2, and the owner has set |
| +`EQUIPO_MAC_ENGINEERING=1`. The controller writes the runbook and the |
| +read-only checks, and runs none of the steps that change things. |
| + |
| +Prerequisite: the Studio's P2 is `denied` (task 1). Otherwise checks |
| +there wait under D1, and step 3 cannot reach Ready. |
| |
| -1. The Machines page shows the Studio at protocol 36, P1 to P7 and the |
| - home guard. If the guard fails, Paul runs `chmod 700 ~` as |
| - `paulequipo` (his step). |
| +1. The Machines page shows the Studio at protocol 36, P1 to P7, the |
| + home guard and the taint. If the guard fails, Paul (or the runner |
| + user) makes the named change. That is his step. |
| 2. Paul taps "Add Claude to Tito Studio" and signs in (his step). F1 to |
| - F5 run; the Machines page shows them, and `claude` appears in the |
| + F7 run, the Machines page shows them, and `claude` appears in the |
| Studio's tags. |
| -3. The Woodstar swipe-back witness task (`tklkbx5vid3y` from |
| - `82a4a0cc`, or a fresh "Fix the Woodstar iOS swipe-back bug"): |
| - Engineering on Tito Studio, with `xcode_access` as F5 decided; |
| - candidate relayed, pushed by docs-t1; checks on the Studio record |
| - `xcodebuild test` (or Woodstar's gate), a real exit code and 200 |
| - lines; review on docs-t1; a fix round, if any, on the Studio; one ask |
| - to the implementer answered from the Studio; Ready to merge asks Paul. |
| - Nothing auto-merges. |
| -4. Read-only checks afterwards: no unmarked processes left on the Studio |
| - (`ps` as paulca), the worker's step dirs swept, and the outbound |
| +3. The Woodstar swipe-back witness: a fresh "Fix the Woodstar iOS |
| + swipe-back bug" task, or a re-run of `tklkbx5vid3y` from `82a4a0cc`. |
| + The base is prepared by docs-t1. Engineering runs on Tito Studio with |
| + `xcode_access` as F5 decided. The candidate is relayed and pushed by |
| + docs-t1. Checks on the Studio record `xcodebuild test` (or |
| + Woodstar's gate), a real exit code and 200 lines. Review runs on |
| + docs-t1. Any fix round runs on the Studio. One ask to the implementer |
| + is answered from the Studio. Ready to merge asks Paul, and nothing |
| + auto-merges. |
| +4. Read-only checks afterwards, as paulca: no marked processes left on |
| + the Studio (`ps`), the worker's step dirs swept, and the outbound |
| transfer closed. |
| |
| Pass means every line of step 3 happened as written. A Woodstar build |
| -failing for Woodstar's own reasons is still a pass if the failure is |
| +that fails for Woodstar's own reasons still passes if the failure is |
| reported honestly. |
| |
| ## 3. Risks and honest limits |
| |
| - `sandbox-exec` is deprecated. `failIfUnavailable` turns its removal |
| - into a stop (`engineering_unavailable`), never a silent unsandboxed |
| - run. |
| + into `engineering_unavailable`, never a silent unsandboxed run. |
| - The claude process itself runs outside any sandbox on the Mac, as the |
| - runner user, talking to Anthropic (the trust Paul granted, §4.4). Its |
| - native file tools are confined by permission rules (task 7), not by |
| - Seatbelt. |
| -- Without F5 the Mac makes changes it cannot build while making them. |
| - Checks build them, so fix rounds cost a round trip. That is slower, not |
| - unsafe. |
| -- SwiftPM packages need network to resolve. Bash has none, so a project |
| + runner user, and talks to Anthropic (the trust Paul granted, §4.4). |
| + Its native file tools are confined by permission rules (task 7), and |
| + F6 proves them live. |
| +- Without F5 the Mac makes changes it cannot build while it makes them. |
| + Checks build them, so each fix round costs a round trip. That is |
| + slower, not unsafe. |
| +- SwiftPM packages need network to resolve, and Bash has none. A project |
| whose packages are not already in the runner user's caches fails its |
| build with `needs_network`, honestly. A package mirror is later work. |
| -- A shared CPU: one step at a time per worker, so a long Engineering |
| +- The CPU is shared: one turn at a time per Mac, so a long Engineering |
| step delays that Mac's checks. |
| -- `have` lists and thin inbound packs remain open (slice B note). |
| - Engineering inbound packs are whole packs of the listed commits, so |
| +- `have` lists and thin inbound packs remain open (a slice B note). |
| + Engineering inbound packs are whole packs of the named commits, so |
| large repositories hit the 64 MB bound early. |
| +- D1 and D2 are Paul's. The defaults are the safe ones, and the witness |
| + waits for his rulings. |