Mac runners spec rev 2: no forge credential on workers, pack relay
Astra's round 1 (NOT READY at 9852fc8) and the controller's steer. The worker never holds the forge credential: the primary ships the exact candidate as a verified git pack through the instance mailbox and pushes the worker's commit itself, so the sealed envelope and its decision are gone, and a sandbox escape on the Mac reaches no forge. Mailbox: the person-keyed commands, Pending, ack and syncSteps gain an additive runner destination (migration 0045), existing runners stay primary, and reports and reconciliation are scoped to the assigned runner and attempt; Linux termination-before-Retry is untouched. Placement: atomic withdrawal, cancel-then-reassign for acked work, Engineering pinned for the task's life, questions pinned to the exact session and attempt, delayed old-SHA reports tested. Native file permissions get an explicit Darwin port of answers.go with alias, glob and symlink-swap tests. Xcode's services are a boundary P2 must prove with hostile fixtures before checks are enabled. Keychain isolation and "one account per macOS user" are probe hypotheses. Docs corrected: Codex read-deny, srt allowMachLookup and securityd, Claude config dirs. Re-sliced A to G with Mac probes before any Darwin work and mixed-version tests. Two decisions remain for Paul.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 file changed,
+454
−432
docs/superpowers/specs/2026-11-07-equipo-mac-runners.md+454 −432
CI failed — run details
diff --git a/docs/superpowers/specs/2026-11-07-equipo-mac-runners.md b/docs/superpowers/specs/2026-11-07-equipo-mac-runners.md| index c6e6f19a..96efc293 100644 |
| --- a/docs/superpowers/specs/2026-11-07-equipo-mac-runners.md |
| +++ b/docs/superpowers/specs/2026-11-07-equipo-mac-runners.md |
| @@ -1,279 +1,214 @@ |
| # Equipo: Mac runners for thin v1 |
| -Status: draft for Paul, 2026-11-07. Written by Claude (Fable 5.1) from the |
| +Status: rev 2, 2026-11-07, after Astra's round 1 (NOT READY at 9852fc8) |
| +and the controller's steer. Written by Claude (Fable 5.1) from the |
| approved thin v1 spec (`2026-11-06-equipo-thin-v1.md`), the slice 1 to 4 |
| -logs, and the code at `thin-v1-slice4` (ca0a65c). Not implemented. Facts |
| -about `srt`, Claude Code and Codex sandboxing were read from their current |
| -docs on 2026-11-07 and are marked where the docs were unclear. |
| +logs and the code at `thin-v1-slice4` (ca0a65c). Not implemented. Facts |
| +about `srt`, Claude Code and Codex were read from their current docs on |
| +2026-11-07; what still needs a probe on the Mac is marked. |
| ## 0. The problem and the shape of the answer |
| Woodstar is an iOS app. On the Linux runner its checks step says "Checks |
| -can't run here (needs macOS)" (`judge.go: needsMacOS`), and Engineering |
| +can't run here (needs macOS)" (`judge.go: needsMacOS`) and Engineering |
| cannot build or run it. Paul has a shared Mac, Tito Studio |
| (`tito-studio`, Tailscale 100.76.110.54). He wants work that needs macOS |
| to go there without choosing anything. |
| The answer is a second runner of the same person, a **worker**, enrolled |
| with one install command and one tap. The worker advertises what it can |
| -do. The instance places each step on a runner that can do it. The |
| +do; the instance places each step on a runner that can do it; the |
| coordinator stays on the primary (docs-t1) and only says where things |
| -ran. Linux keeps bubblewrap unchanged; the Mac trusts the harness |
| -sandboxes (Seatbelt through Claude Code's own sandbox mode, and `srt` for |
| -checks that have no harness). |
| +ran. Linux keeps bubblewrap unchanged. The Mac trusts the harness |
| +sandboxes, as Paul ruled. |
| -Paul's rulings in the brief are binding and are not re-argued here. |
| +Rev 2's structural change: **the worker never holds the forge |
| +credential.** Only the primary talks to Amadan. The primary fetches the |
| +exact candidate and ships it to the worker as a verified git pack |
| +through the instance; the worker returns its commit the same way, and |
| +the primary pushes through `internal/runner/forge` exactly as today. That |
| +removes a credential-transfer protocol and means nothing that escapes |
| +the Mac's sandbox can reach the forge. |
| ## 1. Several runners per person |
| ### 1.1 Roles and identity |
| -Today `primaryRunner` (`chat_wiring.go`) is the newest unrevoked runner of |
| -an owner. That changes to an explicit role on the `runners` row: `role` |
| -is `primary` or `worker`. The first runner a person enrols is primary; |
| -every later enrolment is a worker unless the person has no primary (then |
| -it becomes primary). The coordinator session, move-in, notebook, the |
| -catalog index and `watch_merge` live on the primary, as now. Workers run |
| -steps. |
| +Today `primaryRunner` (`chat_wiring.go`) is the newest unrevoked runner |
| +of an owner. Rev 2 adds an explicit `role` (`primary` or `worker`) to |
| +the `runners` row, in an additive migration that marks every existing |
| +runner `primary`: the production and staging primaries do not move. A |
| +person's first enrolment is primary; later ones are workers. The |
| +coordinator session, move-in, notebook, catalog index, forge credential |
| +and `watch_merge` live on the primary. Workers run steps. |
| Identity is unchanged: each machine runs `equipo-runner enrol`, gets a |
| device code and a runner credential of its own, and holds one outbound |
| -WebSocket with the mailbox, acks, generation lease and `lease` check from |
| -slice 1. The instance's `runner_commands` mailbox is already keyed by |
| -runner, so a frame to a worker waits durably while it is offline. |
| - |
| -**Enrolment in one tap.** The Mac installer (§3) ends by running `enrol` |
| -and prints one link, `https://<instance>/enrol/<code>`. Paul taps it in |
| -Equipo; the page says "Add Tito Studio to your team" (the label comes |
| -from `scutil --get ComputerName`) and has one button. Because a primary |
| -exists, the row is created as a worker. No forms. The runner's first |
| -`hello` fills in what it can do. |
| - |
| -### 1.2 The capability report |
| +WebSocket with acks, generation lease and the `lease` check from |
| +slice 1. **Enrolment in one tap:** the Mac installer (§3) ends by |
| +running `enrol` and prints one link. Paul taps it; the page says "Add |
| +Tito Studio to your team" (`scutil --get ComputerName`) with one button. |
| +Because a primary exists, the row is a worker. |
| + |
| +### 1.2 The mailbox becomes runner-addressed |
| + |
| +The slice 1 mailbox is person-keyed: `commandRecord{Person, Kind, Body}`, |
| +`Pending` serves whatever is pending for the person once it has checked |
| +the connection is the primary, `ack` and the inbox are per person, and |
| +`syncSteps` scans the person's queued and running steps. Rev 2 keeps the |
| +tables and adds a destination: |
| + |
| +- Migration 0045 adds `runner_commands.runner_id` (indexed), backfilled |
| + with the person's primary, and `steps.runner_id` (nullable, empty |
| + means not yet placed). `txn.command` takes a runner id; message, |
| + cancel, reset and `watch_merge` commands name the primary. |
| +- `Pending` serves only commands whose `runner_id` is the connection's |
| + runner; `ack` marks a command acked only if the acking connection is |
| + that runner and holds the current generation and process (the |
| + `current(lease)` check that exists today). Inbox dedup stays |
| + transactional per frame id. |
| +- A step report is accepted only from the runner recorded on the step |
| + row and only for the current attempt (added to `stepReport`'s existing |
| + forward-only and attempt checks). `syncSteps` scans only steps whose |
| + `runner_id` is the syncing runner, so a worker's sync can neither |
| + settle the primary's work nor a Linux attempt still awaiting its |
| + termination proof. Turn reconciliation stays primary-only. |
| +- Tests: a worker acking the primary's command is a no-op; a worker's |
| + sync omitting a step owned by the primary leaves it untouched; a |
| + report from the wrong runner is refused; a Linux step pending |
| + termination survives a worker's sync and still refuses Retry |
| + (`TestStepPendingTermination` extended with a second runner). |
| + |
| +### 1.3 The capability report |
| `hello` gains `platform {os, arch}`, `label`, `sandbox` (`bubblewrap` or |
| -`seatbelt`) and `capabilities`, a bounded JSON object the runner computes |
| -at start, re-probes hourly and when a probe disagrees with the last |
| -report, and sends with every 30 s heartbeat (the instance stores the |
| -newest beside the existing `hello` column, so no new table): |
| - |
| -- `xcode {version, build, path}` from `xcodebuild -version` and |
| - `xcode-select -p`; empty on Linux. |
| -- `simulators [{name, runtime, udid, state}]` from |
| - `xcrun simctl list -j devices available`, capped at 40 entries. |
| -- `toolchains {go, swift, node, python}` versions found. |
| -- `harness {claude, codex, srt}` versions found (§3.3). |
| -- `accounts` as today (`Account` rows, no credential fields), one per |
| - provider home on that machine. |
| -- `tags`: the matching vocabulary derived from the above, from the fixed |
| - set `linux`, `macos`, `xcode`, `ios_simulator`, `claude`, `codex`, `go`. |
| - |
| -The report is for placement and for the Runners page; it never carries a |
| -path outside the runner's own install, a credential or raw tool output. |
| - |
| -### 1.3 Needs and placement |
| +`seatbelt`) and `capabilities`, a bounded object (40 simulators, 300 |
| +bytes per string, 8 KB total) the runner computes at start, re-probes |
| +hourly and on disagreement, and sends with every 30 s heartbeat; the |
| +instance stores the newest beside the `hello` column: |
| -Each step declares `needs`, a subset of the tag set, derived by the |
| -instance from facts it already has, never by the model: |
| - |
| -- Checks: `macos` and `xcode` when `needsMacOS(changed, gateText)` is |
| - true (the rule in `judge.go` today, moved to the instance by having the |
| - primary's index report `needs_macos` per repository in `RepoInfo` and |
| - the Engineering step report whether its change touched Apple files); |
| - `ios_simulator` as well when the repository has an `.xcodeproj` or |
| - `.xcworkspace` with a shared scheme; otherwise `linux` or nothing. |
| -- Engineering: `macos`, `xcode`, `ios_simulator` and `claude` when the |
| - repository is marked `needs_macos` and the Mac path is enabled (§6, |
| - slice D); until then nothing, so it stays on the primary as today. |
| -- Review: nothing. It reads a tree; it runs anywhere. |
| -- Ask the implementer (read-only resume of a step's session): pinned to |
| - the runner that ran the step, because the session home is there. |
| - |
| -Placement happens in `advance` (`review.go`) when a step is created, and |
| -again whenever a runner comes online while steps wait. The rule: among |
| -the person's unrevoked runners whose tags cover the needs, prefer the |
| -primary; otherwise the online worker with the fewest running steps; ties |
| -by enrolment order. The step row records `runner_id` and the dispatch |
| -goes to that runner's mailbox. `DispatchCommand` carries `needs`; a |
| -runner that receives needs it cannot meet refuses with |
| -`placement_refused`, and the instance re-places. |
| - |
| -Honest outcomes when nobody fits: |
| - |
| -- No runner of the person has ever had the tags: checks end |
| - `cannot_run` with `needs_macos` at once (today's behaviour); an |
| - Engineering step with Mac needs runs on the primary with today's |
| - summary. |
| -- A fitting worker exists but is offline: the step is `queued` with |
| - `placement: waiting_runner`, and the card says "Waiting for Tito |
| - Studio (offline since 10:12)". After 30 minutes a checks step resolves |
| - `cannot_run` with the new reason `runner_offline`, never a pass, and |
| - the task goes on to review. An Engineering step keeps waiting and |
| - raises Needs you `runner_offline` so Paul knows to wake the Mac; |
| - Cancel stays available. |
| -- A worker goes offline mid-step: the step stays `running` until the |
| - worker's `sync` on reconnect settles it (today's primary rule, applied |
| - per owning runner). Only the primary's `sync` reconciles turns, as now. |
| - |
| -### 1.4 Health and the Runners view |
| - |
| -Online is what it is today (`runnerOnline` window on `seen_at`), per |
| -runner. `GET /api/v1/runners` returns `{items: [Runner]}`; `snapshot` |
| -gains `runners` (the singular `runner` stays one release for the apps). |
| -The `runner` event fires per runner. The sidebar's Team section lists |
| -runners by label with a dot for online. The coordinator's `status()` |
| -lists them; `read_task` returns each step's `runner_label`; house rule |
| -2026-11-07.8: mention where a step runs only when it is not the primary |
| -("Checks are running on Tito Studio"). |
| - |
| -## 2. The macOS sandbox, per step kind |
| - |
| -### 2.1 What the harnesses give us (verified 2026-11-07) |
| +- `xcode {version, build}` from `xcodebuild -version`; empty on Linux. |
| +- `simulators [{name, runtime, udid, state}]` from `xcrun simctl list -j |
| + devices available`. |
| +- `toolchains {go, swift, node}` and `harness {claude, codex, srt}` |
| + versions. |
| +- `accounts` as today, one per provider home on that machine. |
| +- `tags` from the fixed set `linux`, `macos`, `xcode`, `ios_simulator`, |
| + `claude`, `codex`, `go`. |
| -Claude Code's sandbox (`sandbox.enabled`) is built on |
| -`@anthropic-ai/sandbox-runtime`, Seatbelt on macOS, and covers **shell |
| -commands only**; Read, Edit, Write and WebFetch "follow permission rules |
| -instead." A headless run takes `--settings <file>`, above user and |
| -project files and below managed settings. Keys used here: |
| -`sandbox.enabled`, `failIfUnavailable`, `allowUnsandboxedCommands`, |
| -`excludedCommands`, `filesystem.{allowWrite, denyWrite, denyRead, |
| -allowRead}`, `network.{allowedDomains, allowUnixSockets, |
| -allowLocalBinding, allowMachLookup}`. |
| +No path, credential or raw tool output; a guard test checks every field. |
| -`srt` (Apache-2.0, `npm install -g @anthropic-ai/sandbox-runtime`, 0.0.81 |
| -on main today, Node 22.12 or later, `ripgrep`) wraps one command: |
| -`srt --settings <path> -- <cmd> <args>`. The settings JSON has |
| -`network.allowedDomains` (empty means no network), `allowUnixSockets`, |
| -`allowLocalBinding`, `filesystem.denyRead`, `allowRead` (re-opens inside |
| -a deny), `allowWrite` (empty means no writes), `denyWrite`, plus |
| -`allowPty`, `enableWeakerNetworkIsolation`, `allowAppleEvents`. On macOS |
| -it runs `sandbox-exec` with a generated Seatbelt profile; network goes |
| -through a local proxy named by `HTTP_PROXY`/`HTTPS_PROXY`/`ALL_PROXY`, |
| -and the profile allows only that loopback port, so a program that |
| -ignores the variables has no network. `~` expands; paths are git-style |
| -globs. A built-in mandatory deny list blocks writes to shell rc files, |
| -`.gitconfig`, `.git/config` and `.git/hooks` even inside `allowWrite`. |
| - |
| -Codex's `workspace-write` (`sandbox_mode`, `[sandbox_workspace_write] |
| -writable_roots, network_access`; app-server `turn/start.sandboxPolicy`) |
| -is Seatbelt too, but its docs show **no read deny** for named paths. |
| - |
| -### 2.2 Equipo's deny list (every profile) |
| - |
| -`denyRead` and `denyWrite`: the runner's state dir |
| -(`EQUIPO_RUNNER_STATE_DIR`), the accounts root |
| -(`~/.local/share/equipo/accounts`), the forge credential file, the |
| -session homes, `~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.config/op`, |
| -`~/Library/Keychains`, every home under `/Users` other than the runner |
| -user's, `/Volumes`, and the runner's own install dir for writes. Forge |
| -credentials never leave the runner process: on the Mac as on Linux, the |
| -model's tools and the gate see a tree with no remote and no credential |
| -helper, and the runner commits and pushes after the process has exited. |
| - |
| -### 2.3 Profiles |
| +### 1.4 Needs, placement, pinning and withdrawal |
| -**Checks** (no harness, so `srt`): the runner writes a per-attempt |
| -settings file under its scratch dir and runs |
| -`srt --settings <file> -- /bin/bash -c <gate script>` in the checks tree |
| -(the exact SHA, with the one-commit `.git` as today). Settings: |
| -`allowWrite` is the tree, the attempt's DerivedData dir and temp dir |
| -under the runner's scratch root, `~/Library/Developer/Xcode/DerivedData`, |
| -`~/Library/Caches/org.swift.swiftpm` and `~/Library/org.swift.swiftpm` |
| -(SwiftPM's caches); `denyRead` and `denyWrite` per §2.2; |
| -`network.allowedDomains` empty. A gate that fails because it needed the |
| -network is `needs_network`, honest, as on Linux (the `offline` pattern |
| -gains `Could not resolve host` variants Xcode prints). Environment is |
| -built from scratch: `HOME` is the runner user's home (Xcode needs it), |
| -`DEVELOPER_DIR` from `xcode-select -p`, `TMPDIR` the attempt dir, |
| -`CI=1`, `PATH` `/usr/bin:/bin:/usr/sbin:/sbin` plus the Xcode toolchain. |
| -Exit code and the last 200 lines are recorded as today. |
| - |
| -When the repository has no `.amadan/ci.d`, `.amadan/ci` or `make ci` |
| -but has an `.xcodeproj` or `.xcworkspace`, the Mac runner synthesises |
| -the gate Paul named: `xcodebuild test -scheme <scheme> -destination |
| -'platform=iOS Simulator,name=<device>' -derivedDataPath <attempt dir> |
| -CODE_SIGNING_ALLOWED=NO`, gate name `xcodebuild test`. The scheme is the |
| -one shared scheme under `xcshareddata/xcschemes`, or the one named like |
| -the project; the device is the newest available iPhone simulator from |
| -the capability report. Several candidates or none is `cannot_run` with |
| -`checks_unavailable` and a line saying so. Simulator builds need no |
| -signing identity and no keychain prompt; device builds are out of scope. |
| - |
| -**Engineering** (Claude Code, its own sandbox): the step runs `claude -p` |
| -as today (`--setting-sources ''`, `--strict-mcp-config`, pinned tools, |
| -the `StepPermission` callback that allows only workspace file actions) |
| -plus `--settings <per-attempt file>` with `sandbox.enabled true`, |
| -`allowUnsandboxedCommands false`, `failIfUnavailable true`, |
| -`excludedCommands []`, `filesystem.allowWrite` the worktree plus the |
| -DerivedData and SwiftPM paths above, the §2.2 deny lists, and |
| -`network.allowedDomains` empty. The model's shell therefore builds and |
| -runs simulator tests but has no network; the `claude` process itself |
| -talks to Anthropic as the runner user, outside the sandbox, which is the |
| -trust Paul granted. The Read/Edit/Write tools are not sandboxed by |
| -Seatbelt; the permission callback is what confines them, exactly as it |
| -does today behind bubblewrap, and a mutation test keeps it honest. The |
| -init-frame policy check (`provider/policy.go`) keeps validating argv, |
| -settings, MCP config and tool list; `denied_paths` in the manifest is |
| -the §2.2 list rather than mounts. |
| - |
| -Codex Engineering on the Mac waits. Its sandbox has no read deny, the |
| -thin runner has no Codex step path until slice 5, and nesting `codex` |
| -under `srt` is unproven (probe P5). Mac Engineering is Claude only in |
| -this spec. |
| - |
| -**Review** (`inspect`): Read, Glob and Grep only, no shell, no write |
| -tools, so there is nothing for Seatbelt to do; `ReadPermission` confines |
| -reads to the tree. The prompt's `/workspace` becomes the tree's real |
| -path on the Mac. Review is placed by §1.3, so it usually stays on the |
| -primary even for Mac tasks, and its independence label is unchanged. |
| - |
| -**Ask the implementer** (the slice 4 open item): resumes the step's |
| -session with the `inspect` tool set and `ReadPermission`, on the runner |
| -that holds the session home. It needs step sessions kept per task |
| -(today a fresh `--session-id` per attempt, home deleted on exit); that |
| -is built in slice D with the session home copied back as the |
| -coordinator's is. If that runner is offline the thread gets one line: |
| -"Tito Studio is offline; ask again when it is back." |
| - |
| -### 2.4 Xcode's needs and the known limits |
| - |
| -Xcode talks to CoreSimulatorService and XCBBuildService over Mach, and |
| -those run as per-user launchd services outside any sandbox; the |
| -sandboxed `xcodebuild` must be allowed to look them up. Claude Code's |
| -settings have `sandbox.network.allowMachLookup`; whether `srt` exposes |
| -the same key, and which services `xcodebuild test` needs, is probe P2 |
| -and decides the checks settings file. DerivedData and module caches are |
| -large and reused across attempts on purpose (a cold Woodstar build is |
| -minutes; a warm one is seconds), so the shared DerivedData path is |
| -allowed and not deleted; the per-attempt dir is deleted. |
| - |
| -Honest limits, Seatbelt and `srt`: `sandbox-exec` is deprecated by Apple |
| -but still present and is what both harnesses use; `failIfUnavailable` |
| -turns its removal into a visible stop. No PID namespace, no uid |
| -isolation, no resource limits; path rules resolve through symlinks; |
| -allowed Mach lookups are open. Network filtering is a proxy plus |
| -environment variables with no TLS termination, so an allowed host can be |
| -a front; we allow none. Claude's sandbox covers shell commands only, and |
| -hooks, MCP servers and `apiKeyHelper` run unsandboxed (Equipo disables |
| -hooks and pins MCP). Codex has no read deny. Violations show only in |
| -`log stream --predicate 'process == "sandbox-exec"'`, which the runner |
| -tails during a step and counts in the step log. `denyRead` on another |
| -user's home is belt; Unix permissions are braces, hence §3.5. |
| - |
| -## 3. Install, update, discovery and sign-in on macOS |
| +Each step declares `needs`, a subset of the tag set, derived by the |
| +instance from facts it holds, never by the model: |
| + |
| +- Checks: `macos`, `xcode` (and `ios_simulator` when the repository has a |
| + shared scheme) when `needsMacOS(changed, gateText)` is true. The rule |
| + moves instance-side: the primary's index reports `needs_macos` per |
| + repository in `RepoInfo`, and the Engineering step report says |
| + whether its change touched Apple files. |
| +- Engineering (slice F only): `macos`, `xcode`, `ios_simulator`, `claude` |
| + for a `needs_macos` repository. Until then, nothing. |
| +- Review: nothing. Ask the implementer: pinned (below). |
| + |
| +**Placement** runs in `advance` when a step is created and whenever a |
| +runner comes online while steps wait: among the person's unrevoked |
| +runners whose tags cover the needs, prefer the primary; else the online |
| +worker with the fewest running steps; ties by enrolment order. The step |
| +row records `runner_id` and the dispatch is written to that runner's |
| +mailbox in the same transaction. `DispatchCommand` carries `needs`; a |
| +runner receiving needs it lacks refuses with `placement_refused` and the |
| +step is re-placed. |
| + |
| +**Pinning.** A task's Engineering runner is chosen at the first |
| +Engineering step and stored on the task (`tasks.engineering_runner`); |
| +fix rounds, retries and republishes go there, so two runners never |
| +touch one branch. Ask the implementer resumes the exact `(step, attempt, |
| +account, session_id)` recorded on the step row, on the runner that holds |
| +it; a different runner, account or a later attempt is refused, and an |
| +offline runner gets "Tito Studio is offline; ask again when it is back." |
| + |
| +**Withdrawal.** Re-placement (offline timeout, revocation, refusal) |
| +happens in one transaction that marks the old dispatch `withdrawn` |
| +(never served by `Pending` again) and writes the new one. If the old |
| +dispatch was already acked, the work is possibly running: the instance |
| +sends `cancel_step` for that attempt and waits for its terminal report |
| +with termination before it creates the next attempt elsewhere, exactly |
| +the Retry rule. A delayed report for a withdrawn or older attempt is |
| +refused; a delayed checks or review result for an older SHA is dropped |
| +by the judged-SHA rule and cannot make a newer candidate Ready |
| +(`TestContractReviewAndChecks` gains a delayed-report case for both). |
| + |
| +**Honest outcomes when nobody fits.** No runner has ever had the tags: |
| +checks end `cannot_run`/`needs_macos` at once (today), Engineering runs |
| +on the primary with today's summary. A fitting worker is offline: the |
| +step is `queued`, `placement: waiting_runner`, card line "Waiting for |
| +Tito Studio (offline since 10:12)". After 30 minutes a checks step is |
| +withdrawn and resolves `cannot_run`/`runner_offline`, never a pass, and |
| +review proceeds; an Engineering step keeps waiting and raises Needs you |
| +`runner_offline`; Cancel stays available. |
| + |
| +### 1.5 Health and the Runners view |
| + |
| +Online is today's `runnerOnline` window per runner. `GET |
| +/api/v1/runners` returns `{items: [Runner]}`; `snapshot` gains |
| +`runners` (singular `runner` stays one release). The `runner` event |
| +fires per runner. The Team section lists runners by label with an |
| +online dot. `status()` lists them; `read_task` carries each step's |
| +`runner_label`; house rule 2026-11-07.8: mention where a step runs only |
| +when it is not the primary. |
| + |
| +## 2. Candidates travel as packs, not credentials |
| + |
| +The worker has no clone and no forge access. For a step placed on a |
| +worker, the primary (which already prepares the judge tree with `rev-list |
| +--objects --no-walk` and `pack-objects`, `judge.go: checkRepository`) |
| +builds the one-commit pack of the candidate and sends it as `blob` frames: |
| +`blob{key, index, total, sha256, data}`, `data` base64 under 192 KB so a |
| +frame stays under `MaxFrameBytes`; the instance stores chunks in a |
| +`blobs` table keyed by (person, key) with the destination runner and a |
| +24-hour TTL, and `Pending` serves them to that runner only. Blob frames |
| +are durable and acked like any other. The worker reassembles, checks |
| +`sha256`, runs `index-pack`, and refuses the step (`candidate_unavailable`) |
| +unless the pack yields exactly the dispatched `candidate_sha` with a |
| +complete tree. Bound: 64 MB per candidate; above it the step is |
| +`cannot_run`/`checks_unavailable` with "candidate too large to relay". |
| +The worker keeps the objects per repository under its state dir, and |
| +later dispatches carry a thin pack against what the worker's step |
| +report says it holds (`have`: the SHAs it has), so Woodstar moves once. |
| + |
| +For Engineering on a worker (slice F), the worker commits as the runner |
| +does today (`add -A`, `write-tree`, `commit-tree` on the base, identity |
| +`Equipo Engineering`), reports `candidate_sha`, and returns a thin pack |
| +of the new objects as blobs to the primary. The primary indexes it into |
| +the task's private repository, verifies the commit's parent is the |
| +dispatched base and its tree is complete, and calls `PushBranch` with |
| +every check it has today (repository, task branch, descendant of base, |
| +person, lease, `--force-with-lease`, record then reconcile). Retry of a |
| +failed push republishes from the primary's record, as in slice 4. |
| + |
| +What a worker can reach if its sandbox is escaped (§4.3): its own |
| +enrolment key and state, so it could report a false result **for steps |
| +placed on it**, and later the model account homes on that machine. It |
| +cannot push, cannot read the primary's state and cannot touch another |
| +person's work: the instance accepts its reports only for its own steps |
| +and attempts (§1.2). A worker's checks verdict is labelled with the |
| +runner on the task page, so a person reading "Checks passed (xcodebuild |
| +test, Tito Studio)" knows whose word it is. |
| + |
| +## 3. Install, update, discovery, sign-in and the dedicated user |
| ### 3.1 Artifacts |
| -`make release` adds `releases/equipo-runner-darwin-arm64-<version>/` with |
| -`equipo-runner`, `equipo-tool-proxy` (both `CGO_ENABLED=0 GOOS=darwin |
| -GOARCH=arm64`; the runner uses `modernc.org/sqlite`, so Linux CI |
| -cross-builds it), `io.amadan.equipo-runner.plist` and the install |
| -script. Go ad-hoc signs darwin/arm64 binaries, and `curl` sets no |
| -quarantine attribute, so Gatekeeper does not block them; notarisation is |
| -not needed for a binary the person installs from a terminal. |
| -`install-manifest.json` gains a `targets` map keyed `linux/amd64` and |
| -`darwin/arm64`, each with its digests; `install-v1.sh` dispatches on |
| -`uname`. `make staged-check` records both targets. |
| +`make release` adds `releases/equipo-runner-darwin-arm64-<version>/` |
| +(`equipo-runner`, `equipo-tool-proxy`, `io.amadan.equipo-runner.plist`, |
| +the installer), built `CGO_ENABLED=0 GOOS=darwin GOARCH=arm64` on Linux |
| +CI (the runner uses `modernc.org/sqlite`). Go ad-hoc signs darwin/arm64 |
| +binaries and `curl` sets no quarantine attribute, so Gatekeeper does not |
| +block them. `install-manifest.json` gains a `targets` map (`linux/amd64`, |
| +`darwin/arm64`) with digests; `install-v1.sh` dispatches on `uname`; |
| +`make staged-check` records both targets. |
| ### 3.2 One command, then one tap |
| @@ -287,214 +222,301 @@ launchd has no `EnvironmentFile`), loads it with `launchctl bootstrap |
| gui/$UID`, installs `srt` with `npm install -g` when `npm` is present |
| (else one printed line; checks report `checks_unavailable` until it is), |
| then runs `enrol` and prints the link. A user agent runs only while that |
| -user has a GUI session, and a sleeping Mac is an offline worker: the |
| -runner wraps every step in `caffeinate -i`. |
| +user has a GUI session; a sleeping Mac is an offline worker; the runner |
| +wraps every step in `caffeinate -i`. |
| ### 3.3 Discovery and update |
| -At start the runner looks for `claude` at `~/.local/bin/claude`, |
| -`/opt/homebrew/bin/claude`, `/usr/local/bin/claude`, then a login shell's |
| -`PATH` (`zsh -lc 'command -v claude'`); `codex` and `srt` likewise |
| -(`srt` also via `npm root -g`). Paths and versions go in the capability |
| -report, and `EQUIPO_CLAUDE_PATH` still overrides. |
| - |
| -Update: `welcome` gains `release`. A worker whose version is older |
| -downloads its target from `/releases/<version>/`, verifies the manifest |
| -digests, swaps the binary between steps (never mid-step) and exits 0; |
| -`KeepAlive` restarts it. This also removes the slice 4 skew loop, since a |
| -worker that sees an unknown durable frame now updates instead of |
| -reconnecting forever. Linux keeps its scripted install for now. |
| +At start the runner looks for `claude`, `codex` and `srt` at |
| +`~/.local/bin`, `/opt/homebrew/bin`, `/usr/local/bin`, `npm root -g`, |
| +then a login shell's `PATH`; versions go in the capability report; |
| +`EQUIPO_CLAUDE_PATH` still overrides. Update: `welcome` gains `release`; |
| +an older worker downloads its target from `/releases/<version>/`, |
| +verifies the manifest digests, swaps the binary between steps and exits |
| +0 for `KeepAlive`. A worker that meets an unknown durable frame updates |
| +instead of reconnecting forever (the slice 4 skew loop). Mixed versions |
| +are a tested state (§6). |
| -### 3.4 Account sign-in |
| +### 3.4 Account sign-in and the Keychain hypothesis |
| `equipo-runner login claude` works as on Linux: a dedicated home under |
| `~/.local/share/equipo/accounts/claude-<n>`, the official login, the |
| -observed email recorded. One difference needs a probe (P3): Claude Code |
| -on macOS stores its OAuth credential in the login Keychain rather than |
| -in `$HOME/.claude/.credentials.json`. If it does so even with `HOME` |
| -redirected, the Linux runtime-copy and 25-minute copy cycle do not apply |
| -on the Mac: the CLI reads the Keychain item directly, refresh is native, |
| -and one Claude account per macOS user is the practical limit. The spec |
| -assumes that: the worker has one Claude account, enough for Engineering |
| -and for Review when placed there; no coordinator runs on a worker. If |
| -the probe finds a file instead, the Linux copy code runs unchanged. |
| +observed email recorded. Claude's docs describe separate configuration |
| +directories for several accounts, and on macOS the CLI may keep its |
| +OAuth token in the login Keychain rather than in the home. Both "one |
| +file per home, the Linux copy cycle applies" and "one Keychain item per |
| +macOS user, native refresh, one account" are hypotheses until probe P3 |
| +answers them with sentinel items. Checks-only (slices D, E) needs no |
| +account on the Mac at all; Engineering (F) waits for P3. |
| ### 3.5 A dedicated macOS user: recommended, yes |
| -Run the runner as a standard (non-admin) macOS user `equipo` on |
| -tito-studio. The box is shared, so Unix permissions must be the hard |
| -boundary around Paul's and others' homes, with Seatbelt `denyRead` as |
| -the second layer; Codex has no read deny at all; the runner's Keychain |
| -item is then the runner's, not Paul's own Claude sign-in; DerivedData, |
| -simulators and caches stay out of his account; and a process sweep can |
| -fall back to "every process of user `equipo` outside the runner" without |
| -touching anyone else. Paul must, once: create the user (System Settings, |
| -Users & Groups, Standard); add it to the developer group so simulator |
| -tests run without a prompt (`sudo dscl . append /Groups/_developer |
| -GroupMembership equipo`); log it in with fast user switching and leave |
| -it logged in, sleep off while plugged in; open a terminal as that user, |
| -paste the install command, tap the link. Xcode's licence and |
| -`DevToolsSecurity` are machine-wide and already accepted; the installer |
| -runs `xcodebuild -runFirstLaunch`; the user gets its own simulator |
| -device set on first use. |
| - |
| -## 4. Termination on macOS |
| - |
| -There is no namespace and no pidfd proof. Each attempt starts in its own |
| -session and process group (`Setsid`) with `EQUIPO_ATTEMPT=<key>` in its |
| -environment. Cancel or timeout: `SIGTERM` to the group, 10 s grace, |
| -`SIGKILL` to the group, then a sweep (`ps -axo pid,pgid,user,command` |
| -and, for the runner's own processes, `ps -E`) that kills anything with |
| -the group id or the attempt marker, then `xcrun simctl shutdown` for any |
| -simulator the attempt booted (recorded from `simctl list` before and |
| -after). **Termination is reported, and Retry allowed, when `kill(-pgid, |
| -0)` returns `ESRCH` and the sweep finds no process with the marker, |
| -within 30 s.** `StepReport` and `Step` gain `termination_kind` |
| -(`namespace` on Linux, `process_group` on macOS) so the record is |
| -honest. What Retry does not get: a child that both leaves the group and |
| -scrubs its environment escapes the sweep, and Seatbelt does not prevent |
| -that; XCBBuildService and CoreSimulatorService are per-user launchd |
| -services and survive by design (they hold no lock on the tree). On a |
| -runner crash, startup kills every process with any attempt marker before |
| -reporting `runner_restarted`, as the Linux startup verifies namespaces. |
| -A worktree is removed only after termination, as today. |
| - |
| -## 5. Wire and API v1 changes |
| - |
| -Frames (`internal/wire`, strict decoding, so every field is explicit): |
| - |
| -- `hello` adds `platform {os, arch}`, `label`, `sandbox`, `capabilities |
| - {xcode, simulators[], toolchains, harness, tags[]}`. Bounds: 40 |
| - simulators, 300 bytes per string, 8 KB total. |
| -- `welcome` adds `role` and `release`. |
| -- `dispatch` adds `needs []string`. New step reason `placement_refused`. |
| -- `step` adds `termination_kind`. New checks reason `runner_offline`. |
| -- New sealed frames for the forge credential (§7, decision 2): |
| - `envelope{to_runner, ciphertext}` instance to worker, produced by the |
| - primary; the instance stores and relays, and cannot read it. |
| - |
| -Resources: `Runner` adds `label`, `role`, `since`, `platform`, |
| -`capabilities`; `RunnerList` at `GET /api/v1/runners`; `Snapshot.runners`; |
| -`Step` adds `runner_id`, `runner_label`, `needs`, `placement` |
| -(`placed`, `waiting_runner`, `no_runner`), `termination_kind`; `Task` |
| -adds `needs_you` value `runner_offline`. Coordinator tool results: |
| -`status` lists runners; `read_task` carries `runner_label` per step. |
| - |
| -Fixtures for the native apps: `api/runners.json` (Linux primary online, |
| -Mac worker offline), `api/task-placed.json` (`waiting_runner` then |
| -`placed`), `api/task-mac-checks.json` (an `xcodebuild test` pass and a |
| -fail with `exit_code`), `frames/hello-mac.json`, |
| -`frames/welcome-worker.json`, `frames/dispatch-needs.json`, |
| +Run the runner as a standard (non-admin) macOS user `equipo`. The box is |
| +shared, so Unix permissions must be the hard boundary around Paul's and |
| +others' homes, with Seatbelt denies as the second layer; the runner's |
| +Keychain, DerivedData, simulators and caches stay out of his account; |
| +and a process sweep can fall back to "every process of user `equipo` |
| +outside the runner". The dedicated user still owns the runner's own |
| +enrolment key and state, which §2 bounds. Probe P4 verifies, rather than |
| +assumes, that other homes on tito-studio are unreadable by `equipo` |
| +(`ls` and a sentinel read against each `/Users/*`), and the installer |
| +refuses to enrol while a readable foreign home exists. |
| + |
| +Paul must, once: create the user (System Settings, Users & Groups, |
| +Standard); add it to the developer group (`sudo dscl . append |
| +/Groups/_developer GroupMembership equipo`); log it in with fast user |
| +switching and leave it logged in, sleep off while plugged in; open a |
| +terminal as that user, paste the install command, tap the link. Xcode's |
| +licence and `DevToolsSecurity` are machine-wide and already accepted; |
| +the installer runs `xcodebuild -runFirstLaunch`. |
| + |
| +## 4. The macOS sandbox, per step kind |
| + |
| +### 4.1 What the harnesses give us (verified 2026-11-07) |
| + |
| +Claude Code's sandbox (`sandbox.enabled`) is built on |
| +`@anthropic-ai/sandbox-runtime`, Seatbelt on macOS, and covers **shell |
| +commands only**; Read, Edit, Write and WebFetch "follow permission rules |
| +instead." A headless run takes `--settings <file>`, above user and |
| +project files and below managed settings. Keys used here: |
| +`sandbox.enabled`, `failIfUnavailable`, `allowUnsandboxedCommands`, |
| +`excludedCommands`, `filesystem.{allowWrite, denyWrite, denyRead, |
| +allowRead}`, `network.{allowedDomains, allowUnixSockets, |
| +allowLocalBinding, allowMachLookup}`. |
| + |
| +`srt` (Apache-2.0, `npm install -g @anthropic-ai/sandbox-runtime`, 0.0.81 |
| +on main today, Node 22.12 or later, `ripgrep`) wraps one command: |
| +`srt --settings <path> -- <cmd> <args>`. Its settings JSON has |
| +`network.allowedDomains` (empty means no network), `allowUnixSockets`, |
| +`allowLocalBinding`, `allowMachLookup` (in `sandbox-config.ts`), |
| +`filesystem.denyRead`, `allowRead`, `allowWrite` (empty means no writes), |
| +`denyWrite`, `allowPty`, `enableWeakerNetworkIsolation`, |
| +`allowAppleEvents`. On macOS it runs `sandbox-exec` with a generated |
| +Seatbelt profile; its profile allows `securityd` and `SecurityServer` |
| +lookups (`macos-sandbox-utils.ts`), so denying `~/Library/Keychains` on |
| +disk does not deny the Keychain API; network goes through a local proxy |
| +named by `HTTP_PROXY`/`HTTPS_PROXY`/`ALL_PROXY` and the profile allows |
| +only that loopback port. `~` expands; paths are git-style globs. A |
| +mandatory deny list blocks writes to shell rc files, `.gitconfig`, |
| +`.git/config` and `.git/hooks` even inside `allowWrite`. |
| + |
| +Codex's `workspace-write` (`sandbox_mode`, `[sandbox_workspace_write]`, |
| +app-server `turn/start.sandboxPolicy`) is Seatbelt too and now documents |
| +filesystem read-deny rules under permissions. Codex on the Mac stays |
| +parked (slice G) because the thin runner has no Codex step path until |
| +slice 5 and nesting `codex` under `srt` is unproven (P5). |
| + |
| +### 4.2 Equipo's deny list (every profile) |
| + |
| +`denyRead` and `denyWrite`: the runner's state dir (enrolment key, |
| +steps, relayed objects), the accounts root, the session homes, `~/.ssh`, |
| +`~/.aws`, `~/.gnupg`, `~/.config/op`, `~/Library/Keychains`, every home |
| +under `/Users` other than the runner user's, `/Volumes`, and the install |
| +dir for writes. There is no forge credential on the machine to list. |
| + |
| +### 4.3 Xcode's services: a boundary to prove, not assume |
| + |
| +`xcodebuild` talks over Mach to CoreSimulatorService and XCBBuildService, |
| +per-user launchd services outside any sandbox, and a repository's build |
| +phases, SwiftPM plugins and tests are code the repository controls. It |
| +does not follow from sandboxing `xcodebuild` that code those services |
| +execute inherits the sandbox. Probe P2 is therefore the gate on checks: |
| +a hostile Woodstar-shaped fixture whose run-script phase, SwiftPM build |
| +tool plugin and XCTest each try to read a sentinel file in the runner's |
| +state dir and in another `/Users/*` home, to open a TCP connection and a |
| +DNS lookup, and to read a sentinel Keychain item, all under the §4.4 |
| +checks profile. Checks on the Mac are enabled only when every attempt is |
| +denied; a denial that depends on Unix permissions rather than Seatbelt |
| +is recorded as such. A successful Woodstar build is not evidence. If P2 |
| +fails, the honest fallback is the §2 bound (a worker can lie only about |
| +its own steps, and cannot push) plus a visible "ran outside the sandbox" |
| +label, and Paul decides whether that is acceptable for his own Mac. |
| + |
| +### 4.4 Profiles |
| + |
| +**Checks** (no harness, so `srt`): the runner writes a per-attempt |
| +settings file and runs `srt --settings <file> -- /bin/bash -c <gate>` in |
| +the checks tree (the exact SHA, with the one-commit `.git` as today). |
| +`allowWrite`: the tree, the attempt's DerivedData and temp dirs under |
| +scratch, `~/Library/Developer/Xcode/DerivedData`, |
| +`~/Library/Caches/org.swift.swiftpm`, `~/Library/org.swift.swiftpm`; |
| +§4.2 denies; `network.allowedDomains` empty; `allowMachLookup` set to |
| +exactly what P2 shows `xcodebuild test` needs. A network failure is |
| +`needs_network`, honest, as on Linux. Environment from scratch: `HOME`, |
| +`DEVELOPER_DIR` from `xcode-select -p`, `TMPDIR` the attempt dir, `CI=1`, |
| +a fixed `PATH`. Exit code and the last 200 lines are recorded as today. |
| + |
| +When the repository has no `.amadan/ci.d`, `.amadan/ci` or `make ci` but |
| +has an `.xcodeproj` or `.xcworkspace`, the Mac runner synthesises |
| +`xcodebuild test -scheme <scheme> -destination 'platform=iOS |
| +Simulator,name=<device>' -derivedDataPath <attempt dir> |
| +CODE_SIGNING_ALLOWED=NO`, gate name `xcodebuild test`: the one shared |
| +scheme, or the one named like the project; the newest available iPhone |
| +simulator from the report. Several candidates or none is |
| +`cannot_run`/`checks_unavailable`. Simulator builds need no signing |
| +identity; device builds are out of scope. |
| + |
| +**Engineering** (slice F, Claude Code): `claude -p` as today |
| +(`--setting-sources ''`, `--strict-mcp-config`, pinned tools) plus |
| +`--settings <per-attempt file>` with `sandbox.enabled true`, |
| +`allowUnsandboxedCommands false`, `failIfUnavailable true`, |
| +`excludedCommands []`, `allowWrite` the worktree plus the DerivedData |
| +and SwiftPM paths, the §4.2 denies, `allowedDomains` empty, |
| +`allowMachLookup` per P2. The `claude` process talks to Anthropic as the |
| +runner user outside the sandbox, the trust Paul granted. |
| + |
| +**Native file permissions, ported explicitly.** `claude/answers.go` |
| +hard-codes `/workspace`: `workspaceNativePath` and `protectedNativePath` |
| +test that prefix, and the symlink check walks a Linux mount. On the Mac |
| +the worktree is a real path, so the Darwin port makes the workspace |
| +root a policy field, resolves every requested path with `realpath` |
| +against the worktree root and the §4.2 list before answering, generates |
| +permission `deny` rules for Read, Edit, Write, Glob and Grep on the |
| +§4.2 paths alongside the sandbox denies, and keeps the "nobody to ask" |
| +default. Tests against sentinel files: an alias through `/private` and |
| +`/var` (macOS symlinks), a glob that expands outside the root, `..` |
| +components, and a symlink swapped after the check (the race the Linux |
| +comment already names; on the Mac the generated native deny rules are |
| +the second layer). `StepPermission` and `ReadPermission` share the port. |
| + |
| +**Review** (`inspect`): Read, Glob and Grep only, no shell, so Seatbelt |
| +has nothing to do; the ported `ReadPermission` confines reads. Review is |
| +placed by §1.4 and usually stays on the primary. |
| + |
| +**Ask the implementer**: the inspect tool set on the pinned session |
| +(§1.4), needing step sessions kept per task (session home copied back |
| +as the coordinator's is); built in slice F. |
| + |
| +### 4.5 Honest limits |
| + |
| +`sandbox-exec` is deprecated by Apple but still what both harnesses use; |
| +`failIfUnavailable` turns its removal into a stop. No PID namespace, no |
| +uid isolation, no resource limits; path rules resolve through symlinks; |
| +allowed Mach lookups are open, including `securityd`. Network filtering |
| +is a proxy plus environment variables without TLS termination; we allow |
| +no hosts. Claude's sandbox covers shell commands only; hooks, MCP servers |
| +and `apiKeyHelper` run unsandboxed (Equipo disables hooks and pins MCP). |
| +Violations show only in `log stream --predicate 'process == |
| +"sandbox-exec"'`, which the runner tails and counts in the step log. |
| + |
| +## 5. Termination on macOS |
| + |
| +No namespace and no pidfd proof. Each attempt starts in its own session |
| +and process group with `EQUIPO_ATTEMPT=<key>` in its environment. Cancel |
| +or timeout: `SIGTERM` to the group, 10 s, `SIGKILL` to the group, then a |
| +sweep (`ps -axo pid,pgid,user,command`, `ps -E` for own processes) that |
| +kills anything with the group id or the marker, then `xcrun simctl |
| +shutdown` for simulators the attempt booted. **Termination is reported, |
| +and Retry allowed, when `kill(-pgid, 0)` returns `ESRCH` and the sweep |
| +finds no marked process, within 30 s.** `StepReport` and `Step` gain |
| +`termination_kind` (`namespace` or `process_group`). Not covered: a |
| +child that leaves the group and scrubs its environment; XCBBuildService |
| +and CoreSimulatorService, which survive by design. Startup after a crash |
| +kills every marked process before reporting `runner_restarted`. The |
| +Linux rule is untouched: a Linux step's termination is still the |
| +verified namespace exit, and nothing in §1.2 lets another runner supply |
| +it. |
| + |
| +## 6. Wire, API v1, fixtures and testing |
| + |
| +Frames: `hello` adds `platform`, `label`, `sandbox`, `capabilities`; |
| +`welcome` adds `role`, `release`; `dispatch` adds `needs`, |
| +`runner_id`; new `blob{key, index, total, sha256, data}` both ways |
| +(durable); `step` adds `termination_kind`, `have []string`; new step |
| +reasons `placement_refused`, `withdrawn`; new checks reason |
| +`runner_offline`. Resources: `Runner` adds `label`, `role`, `since`, |
| +`platform`, `capabilities`; `RunnerList` at `GET /api/v1/runners`; |
| +`Snapshot.runners`; `Step` adds `runner_id`, `runner_label`, `needs`, |
| +`placement`, `termination_kind`; `Task` adds `engineering_runner` and |
| +Needs you `runner_offline`. Fixtures: `api/runners.json`, |
| +`api/task-placed.json`, `api/task-mac-checks.json` (pass and fail with |
| +`exit_code`), `frames/hello-mac.json`, `frames/welcome-worker.json`, |
| +`frames/dispatch-needs.json`, `frames/blob.json`, |
| `frames/step-process-group.json`. |
| Copy for review (existing marker until Luna's pass): "Add %s to your |
| team", "Waiting for %s (offline since %s)", "Checks can't run here (%s |
| was offline)", "Needs you: %s has been offline for 30 minutes", "Checks |
| -are running on %s", "%s is offline; ask again when it is back", "Runners". |
| - |
| -## 6. Testing |
| - |
| -CI runs on Linux, so the Mac path is tested with a **fake mac runner**: |
| -the real thin runner started with `EQUIPO_FAKE_PLATFORM=darwin/arm64` |
| -reports a fixture capability report (recorded on tito-studio, probe P1), |
| -uses the process-group executor with no sandbox, and finds a fake |
| -`xcodebuild` on its `PATH` that passes, fails or hangs by scenario. |
| -Everything darwin-only (`srt` settings generation, `simctl` parsing, the |
| -plist, scheme discovery, the sweep) is unit-tested with recorded |
| -outputs. Headless scenarios, all under the two-minute budget: |
| - |
| -- M1 two runners, an iOS change: checks placed on the worker, a real |
| - pass on the task's SHA, review on the primary, Ready to merge with |
| - "Checks passed (xcodebuild test)". |
| -- M2 the worker is offline: `waiting_runner`, the card line, reconnect, |
| - checks run; and the 30-minute path with a fake clock to |
| - `runner_offline`, then review. |
| -- M3 no worker enrolled: `needs_macos` as today (the existing |
| - `4_checks_honest` must still pass). |
| -- M4 worker SIGKILLed mid-checks: failed with `termination_kind |
| - process_group`, Retry allowed, attempt 2 passes. |
| -- M5 the fake gate fails: a fix round from its 200 lines, then passes. |
| -- M6 worker enrolment in one tap, the role `worker`, the envelope |
| - delivered and decrypted, a dispatch refused by a runner lacking the |
| - need and re-placed. |
| -- M7 (slice D) Engineering placed on the worker pushes a branch with |
| - the §2.3 settings file validated in the init frame; ask the |
| - implementer pinned to the worker, and the offline line. |
| -- Guards: no capability string carries a home path or credential; the |
| - deny list is present in every generated settings file (mutation: |
| - dropping the state dir fails a test). |
| - |
| -**Staging witness on tito-studio**, by the builder, after the probes: |
| -install the staging runner under the `equipo` user with its own state |
| -root, enrol it as a worker of the staging owner, then re-judge the |
| -Woodstar witness task `tklkbx5vid3y` at `82a4a0cc`. Pass criterion: the |
| -checks step records `xcodebuild test` (or Woodstar's own gate), a real |
| -exit code, 200 lines of Xcode output, and `passed` or `failed`, never |
| -`cannot_run`; Review stays on the primary; Ready to merge carries the |
| -Mac result. Zero model turns for checks-only. Then the live |
| -`oficina/suite` scenario must still land on the primary unchanged. |
| - |
| -**Probes the builder runs on tito-studio first** (nothing is built on |
| -guesses): |
| - |
| -- P1 record `xcodebuild -version`, `xcode-select -p`, `xcrun simctl |
| - list -j devices available`, `scutil --get ComputerName` as fixtures. |
| -- P2 `srt --settings <draft> -- xcodebuild test ...` on Woodstar: does |
| - it run; which Mach services or paths the violation log names; whether |
| - `srt` has `allowMachLookup` or an equivalent (its README does not list |
| - one; Claude Code's settings do). |
| -- P3 with `HOME` set to an empty dir, `claude /login`: Keychain item or |
| - `.credentials.json`; whether refresh works headless afterwards. |
| -- P4 `launchctl bootstrap gui/$UID` of the plist as a non-admin user; |
| - behaviour across fast-user-switch and sleep. |
| -- P5 `srt -- codex exec` with `workspace-write`: do nested Seatbelt |
| - profiles compose or fail (decides when Codex comes to the Mac). |
| -- P6 a process group SIGKILL during `xcodebuild test`: what survives, |
| - and whether `simctl shutdown` is needed for the tree to be removable. |
| -- P7 `npm install -g @anthropic-ai/sandbox-runtime` under the `equipo` |
| - user: Node version present, where `srt` lands. |
| +are running on %s", "Checks passed (%s, %s)", "%s is offline; ask again |
| +when it is back", "Runners". |
| + |
| +**Linux CI.** The fake worker is the real thin runner started with |
| +`EQUIPO_FAKE_PLATFORM=darwin/arm64`, a fixture capability report from P1, |
| +a fake `xcodebuild` that passes, fails or hangs, and the process-group |
| +executor **without** a sandbox, compiled only under a `testbuild` tag so |
| +no release binary can run unsandboxed. Darwin-only code (`srt` settings, |
| +`simctl` parsing, plist, scheme discovery, sweep, the native permission |
| +port) is unit-tested with recorded outputs. Scenarios, under the |
| +two-minute budget: M1 iOS change, checks placed on the worker via blob |
| +relay, real pass, review on the primary, Ready; M2 worker offline, |
| +waiting, reconnect, run; and the 30-minute path with a fake clock to |
| +`runner_offline`; M3 no worker, `needs_macos` (`4_checks_honest` still |
| +green); M4 worker SIGKILLed mid-checks, `process_group` termination, |
| +Retry, pass; M5 fake gate fails, fix round from its output; M6 one-tap |
| +enrolment as worker, mailbox scoping (wrong-runner ack, sync and report |
| +all refused), `placement_refused` and re-place, withdrawal of an unacked |
| +dispatch, cancel-then-reassign of an acked one, a delayed old-SHA report |
| +that cannot make a newer candidate Ready; M7 blob tampering (bad |
| +`sha256`, wrong SHA, oversize, missing chunk) refused; M8 mixed |
| +versions: an old runner against a new instance ignores `needs` and |
| +`blob`, a new worker against an old instance gets no placement, nothing |
| +is lost; M9 (slice F) Engineering on the worker returns a thin pack, the |
| +primary pushes, pinning holds across a fix round and a republish; ask |
| +the implementer pinned and refused elsewhere. All slice 1 to 4 guards |
| +stay, especially Linux termination before Retry. |
| + |
| +**Probes on tito-studio, before any Darwin build work** (slice C): |
| + |
| +- P1 record `xcodebuild -version`, `simctl list -j`, `ComputerName`. |
| +- P2 the hostile fixture of §4.3 under the checks profile; which Mach |
| + services `xcodebuild test` needs; denial of every sentinel attempt. |
| +- P3 `claude /login` with `HOME` set to an empty dir: Keychain item or |
| + file; whether a second home gets a second identity; sentinel Keychain |
| + items readable from inside the shell sandbox or not. |
| +- P4 home permissions of every `/Users/*` as `equipo`; `launchctl |
| + bootstrap gui/$UID` as non-admin; fast-user-switch and sleep. |
| +- P5 `srt -- codex exec` under `workspace-write`: nested Seatbelt. |
| +- P6 group SIGKILL during `xcodebuild test`: what survives; is `simctl |
| + shutdown` needed before the tree can be removed. |
| +- P7 `npm install -g @anthropic-ai/sandbox-runtime` as `equipo`. |
| + |
| +**Witness** (slice E): staging worker under `equipo` with its own state |
| +root, enrolled as a worker of the staging owner; re-judge the Woodstar |
| +witness task `tklkbx5vid3y` at `82a4a0cc`. Pass: the checks step records |
| +`xcodebuild test` (or Woodstar's gate), a real exit code, 200 lines of |
| +Xcode output, `passed` or `failed`, never `cannot_run`; the pack arrived |
| +by relay; Review stayed on the primary. Zero model turns. The live |
| +`oficina/suite` scenario still lands on the primary unchanged. |
| ## 7. Slices, decisions and risks |
| | Slice | Content | Size | |
| |---|---|---| |
| -| A Runners and placement | roles, one-tap worker enrolment, capability report, `runners` API and view, `needs` and placement in `advance`, offline waiting and `runner_offline`, per-runner dispatch and sync, fake mac runner, M1 to M6 minus the envelope, fixtures | 2 days | |
| -| B Darwin runner | darwin/arm64 release target and manifest, installer and plist, discovery, `--env-file`, self-update, process-group containment and sweep, `srt` checks profile, `xcodebuild test` synthesis, sealed envelope, unit tests on P1 fixtures | 3 days | |
| -| C Witness | P1 to P7 on tito-studio, the `equipo` user, staging worker, Woodstar real pass or fail, fixtures refreshed from the box | 1 day plus Paul's four steps | |
| -| D Mac Engineering and Review | Claude sandbox settings file and init validation, Engineering `needs`, session home per step, ask the implementer pinned, M7, live witness: Woodstar swipe-back built and tested on the Mac | 2 days | |
| -| E Codex on the Mac | after slice 5 and P5 | parked | |
| - |
| -Order follows Paul: A and B give checks-only (no model, no account on |
| -the Mac needed beyond the forge credential); D brings Engineering and |
| -Review with simulator access. |
| +| A Mailbox destinations | migration 0045, `runner_id` on commands and steps, per-runner `Pending`, ack, reports and `syncSteps`, role column with existing runners primary, M6's scoping cases, M8 | 1.5 days | |
| +| B Placement and pinning | capability report, `needs`, placement in `advance`, pinning, withdrawal and cancel-then-reassign, offline rule, `runners` API and view, fake worker (testbuild only), blob relay with M7, M1 to M6 | 2.5 days | |
| +| C Mac probes | P1 to P7 on tito-studio, fixtures recorded, P2 verdict written up | 1 day plus Paul's steps | |
| +| D Darwin checks-only | darwin/arm64 target and manifest, installer and plist, discovery, `--env-file`, self-update, process-group termination, `srt` checks profile from P2, `xcodebuild test` synthesis | 2.5 days | |
| +| E Witness | Woodstar real pass or fail on tito-studio | 0.5 day | |
| +| F Mac Engineering and Review | native permission port with its tests, Claude sandbox settings, sessions per step, pinning in anger, return packs and primary push, M9, live Woodstar swipe-back built and tested on the Mac | 3 days | |
| +| G Codex on the Mac | after slice 5 and P5 | parked | |
| -**Decisions for Paul, three:** |
| +**Decisions for Paul, two:** |
| 1. The dedicated `equipo` user on tito-studio (§3.5): recommended yes, |
| - four one-time steps for Paul. The alternative, running as his own |
| - user, makes Seatbelt the only wall around his home and shares his |
| - Claude Keychain item with the runner. |
| -2. How the worker gets the Amadan agent credential. Recommended: the |
| - primary seals its agent-wide entry to the worker's enrolment key |
| - (X25519 from the enrolment keypair) and the instance relays the |
| - envelope it cannot read, so one tap is still one tap. Alternative: |
| - Paul pastes the credential on the Mac once (`equipo-runner forge |
| - <file>`), which is a form by another name. |
| -3. The 30-minute offline rule (§1.3): checks give up honestly and review |
| - proceeds; Engineering waits and asks. The alternative is to wait |
| - indefinitely for both. |
| - |
| -**Risks.** The Keychain probe (P3) may force one account per macOS user; |
| -that costs nothing for checks-only and only limits Review independence |
| -on the Mac. Xcode under `srt` may need Mach allowances the runtime cannot |
| -express (P2); the fallback is `xcodebuild` run through a one-shot |
| -`claude -p` under Claude's own sandbox, which spends a model turn per |
| -check and is not the plan. A shared Mac is a shared CPU: one step at a |
| -time per worker, `caffeinate` only while a step runs, `ProcessType |
| -Standard`. The sealed envelope adds cryptography to enrolment; it reuses |
| -the enrolment key, and M6 plus the rule that the instance never holds a |
| -value that opens the forge keep it honest. Workers widen the push |
| -surface to a second machine; forge validation (branch, SHA, person, |
| -lease) runs there unchanged, and "two runners never touch one branch" |
| -holds because a task's Engineering steps stay on one runner for the |
| -task's life. |
| + four one-time steps. Running as his own user would make Seatbelt the |
| + only wall around his home and share his Keychain with the runner. |
| +2. If P2 shows that repository code run by Xcode's services escapes the |
| + sandbox and we cannot deny it: accept checks on the Mac with a |
| + visible "ran outside the sandbox" label, bounded by §2 (a worker can |
| + lie only about its own steps and cannot push), or keep "Checks can't |
| + run here" until Apple or `srt` closes it. |
| + |
| +**Risks.** P2 may fail and force decision 2. P3 may limit the Mac to one |
| +Claude account; checks-only does not care, Engineering's Review label |
| +stays honest. A shared Mac is a shared CPU: one step at a time per |
| +worker, `caffeinate` only while a step runs. Pack relay through the |
| +instance costs storage and bandwidth once per repository and a thin pack |
| +per candidate; the 64 MB bound and TTL keep it small, and the instance |
| +stores opaque bytes it never interprets. The mailbox migration touches |
| +every command path; slice A ships alone, with every slice 1 to 4 |
| +scenario green before B begins. |