| 1 | # Mac slice F progress: Engineering on a Mac worker |
| 2 | |
| 3 | Protocol: **37** (`wire.ProtocolMacEngineering`). Migration: **0120**. |
| 4 | Allocated by the coordinating session on 2026-11-28: dynamic specialists |
| 5 | slice 1 takes protocol 36 and migrations from 0115; slice F takes 37 and |
| 6 | 0120. Whichever merges second renumbers down to the next free number at |
| 7 | merge time if the other has not used its range. The plan says "protocol |
| 8 | 36" throughout; read 37. |
| 9 | |
| 10 | Branch `mac-slice-f` from `origin/main` 8bd40ed1, with |
| 11 | `origin/mac-placement-wait` (74140828) merged in at 436a7b6a. Plan: |
| 12 | `2026-11-28-mac-runners-slice-f.md` rev 4. Spec: |
| 13 | `docs/superpowers/specs/2026-11-07-equipo-mac-runners.md` rev 4 plus its |
| 14 | §8 addendum. Conventions as in `RUNNERS-PROGRESS.md` and |
| 15 | `DARWIN-PROGRESS.md`. Nothing here has run on a Mac unless a line says |
| 16 | so: Mac behaviour is tested on Linux with recorded outputs and fakes. |
| 17 | |
| 18 | ## Done |
| 19 | |
| 20 | 0. **Base.** `origin/mac-placement-wait` merged (436a7b6a). Its tests |
| 21 | pass on the merge: `go test ./internal/thintest/ -run |
| 22 | 'MacWait|Macrecheck|Placement' -count=1` ok (3.9 s); |
| 23 | `go test ./internal/equipo/ -run TestMacWait -count=1` ok. |
| 24 | 1. **Probes and static reads** (2026-11-28; Studio as paulca 17:55Z to |
| 25 | 18:09Z, docs-t1 static reads 17:57Z to 18:10Z). Full record: |
| 26 | `MAC-SLICE-F-TASK1-FINDINGS.md`. Nothing on the Studio changed; the |
| 27 | CLI was never run. Kept for task 5: the verified binary at |
| 28 | `~/.cache/mac-slice-f-build/claude-2.1.312-darwin-arm64` on docs-t1. |
| 29 | - S1: darwin-arm64 sha256 |
| 30 | `6b5ec691195e551b02c41df9f7d723f4ea61eaa03c2df90acefe3736f1aeb620`, |
| 31 | matching https://downloads.claude.ai/claude-code-releases/2.1.312/manifest.json |
| 32 | (the installer now uses only downloads.claude.ai). |
| 33 | - S2 stop: no. Every key is present. Empty `allowedDomains` asks |
| 34 | (`SandboxNetworkAccess`), it does not deny; `network.strictAllowlist` |
| 35 | gives the hard deny. `enableWeakerNestedSandbox` is Linux only. |
| 36 | - S3: 2.1.312 embeds an unreleased sandbox-runtime (matches no npm |
| 37 | release 0.0.79 to 0.0.83); read from the binary. Its profile allows |
| 38 | `securityd`/`SecurityServer` lookups, all file reads, listing every |
| 39 | process. |
| 40 | - S4: `CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR` is read |
| 41 | (`/dev/fd/<n>`); fallback file `<config dir>/.oauth_token`. A set |
| 42 | token does not skip two startup `security find-generic-password` |
| 43 | reads (only `--bare`/`CLAUDE_CODE_SIMPLE` do). Keychain service is |
| 44 | `Claude Code-credentials-<8 hex of sha256(config dir)>` when |
| 45 | `CLAUDE_CONFIG_DIR` is set; account is `$USER`. |
| 46 | - S5 stop: no. `EQUIPO_ATTEMPT` survives the scrub. But see the |
| 47 | termination issue below. |
| 48 | - S6: project dir = realpath(cwd), NFC, every non-`[A-Za-z0-9]` UTF-16 |
| 49 | unit to `-`, over 200 chars truncated plus `-base36(|hash|)`. |
| 50 | `CLAUDE_CODE_PROJECT_DIR_NAME` (`[A-Za-z0-9_-]{1,64}`) pins it when |
| 51 | `CLAUDE_CONFIG_DIR` is set. |
| 52 | - R3: nested Seatbelt profiles fail on 27.2 (background only). |
| 53 | - R4: on 27.2 the kernel hides the environment of platform binaries |
| 54 | (bash, zsh, sleep, env, sandbox-exec) from other processes, and |
| 55 | shows it for every other same-user process, also from inside a |
| 56 | `(deny default)` profile with `process-info*` rules. |
| 57 | - R2: every other home now denies `paulequipo` list and search by |
| 58 | ACL. `paulequipo`'s home is `drwxr-x---` group `staff`, so staff |
| 59 | users can list it: the home guard (task 10) will ask for |
| 60 | `chmod 700 ~` (D2 covers it). |
| 61 | 2. **Wire, protocol 37, migration 0120** (098407b0, a5650332). New |
| 62 | frames `prepare_base` and `base` (`PrepareBaseCommand`, `BaseReport`); |
| 63 | `TransferHeader.Kind`/`OldBaseSHA` with `Commits()` (base, old base, |
| 64 | candidate; de-duplicated; `MaxTransferCommits = 3`) and `Valid()`; |
| 65 | `Capabilities.Engineering *EngineeringStatus{state, reason}`; F1 to F7 |
| 66 | in `ValidCapabilities` (F4 succeeds `passed`, the others `denied`); |
| 67 | `XcodeAccess`, `SessionID`, `OutcomePhase` on dispatch/step/publish/ |
| 68 | published; `PublishedReport.ChangeFiles`/`DiffCollection`; |
| 69 | `ChangeDiffUpload.Publication`; `AskCommand.Eng*`; new reasons, |
| 70 | placements and Needs-you kinds; `WithoutWorkerConnections` for a |
| 71 | worker hello below 37. Below 37 Encode refuses the new frames, an |
| 72 | Engineering transfer and a publication's diff upload, and drops every |
| 73 | other new key, including explicit empty, zero and null values (Astra |
| 74 | r1 finding; nine message types are re-encoded below 37). Migration |
| 75 | 0120 adds `runner_transfers.kind`/`old_base_sha`, |
| 76 | `chat_steps.xcode_access`/`outcome_phase`/`session_id`, |
| 77 | `chat_questions.eng_attempt`/`eng_account`/`eng_session`/`runner_id`/ |
| 78 | `base_sha`/`candidate_sha`. Tests: `TestProtocol37Constants`, |
| 79 | `TestEncodeDropsMacEngineeringBelow37`, |
| 80 | `TestEncodeDropsEmptyMacEngineeringKeysBelow37`, |
| 81 | `TestTransferHeaderCommits`, `TestValidCapabilitiesF`, eight fixture |
| 82 | round-trips, the 0120 migration test over open checks transfers and |
| 83 | kept questions. Mutations: drop the dispatch clear (fails |
| 84 | `TestEncodeDropsMacEngineeringBelow37`); `MaxTransferCommits = 4` |
| 85 | (fails `TestTransferHeaderCommits`); F4 `denied` accepted (fails |
| 86 | `TestValidCapabilitiesF`); dispatch downgrade back to value-based |
| 87 | (fails `TestEncodeDropsEmptyMacEngineeringKeysBelow37`). Astra: r1 |
| 88 | READY AFTER FIXES (1 Important), r2 READY. |
| 89 | |
| 90 | 3. **Instance placement** (ba31a7e1, 1c370c0f, b9b568d8). Mac Engineering |
| 91 | is placed on a worker only with `EQUIPO_MAC_ENGINEERING=1`; unset, it |
| 92 | waits as `mac-placement-wait` left it. Base preparation in two |
| 93 | transactions (`prepare_base` to the primary, then on its `base` |
| 94 | report bind, place, dispatch and open the inbound Engineering |
| 95 | transfer together); a report from anything but the current attempt's |
| 96 | primary connection is refused and logged. A replaced primary (or one |
| 97 | below 37) invalidates an outstanding preparation; the new attempt asks |
| 98 | the replacement, or waits `waiting_mac_update`. A task's Mac need is |
| 99 | durable (`chat_tasks.mac_needs`, in 0120, written once, never |
| 100 | cleared; the catalog can only add), so no sequence of removals, |
| 101 | re-pins or catalog changes sends Mac Engineering to Linux. Pin holds |
| 102 | for fix, Retry, republish and rebase rounds; `xcode_access` only with |
| 103 | `sandboxProven` and F5 `denied`; review of a Mac-made candidate on the |
| 104 | primary, never auto-merged. `wire.Step.engineering_status` added for |
| 105 | the views. 18 contracts in `internal/thintest/mac_engineering_contract_test.go`; |
| 106 | mutations in `task-3` of the SDD workspace report, all killed except |
| 107 | one that the durable column made redundant (replaced by R1 to R3). |
| 108 | Astra: r1 NOT READY (3 Important; the protocol 1 exception declined, |
| 109 | see Decisions), r2 NOT READY (2), r3 READY. |
| 110 | 16. **M9 and mixed versions on Linux CI** (bae4df76, 8f99c333, |
| 111 | a5956779, 46a1bede, fcb76064, eda98c02, 492edc2f, 4854d8fe). The test |
| 112 | build's fake worker (real thin runner, `EQUIPO_FAKE_PLATFORM=darwin/arm64`, |
| 113 | testbuild-only pin override, scoped process table, srt stand-in for a |
| 114 | seatbelt Mac, fake credential operations) runs M9a to M9i in |
| 115 | `TestMacWorker` and M9g in `TestMacMixedVersions` (branch-point |
| 116 | binaries from 8bd40ed1 in the M8 cache); `scripts/no-fake-worker.sh` |
| 117 | refuses it in releases. M9e proves a lingering setsid child is ended |
| 118 | by recovery and the turn cleared by the idle read before Retry on the |
| 119 | same worker; M9g takes the same worker 37 to 35 to 37. Production |
| 120 | fixes found here: a Mac at 37 holds its slice F hello report until a |
| 121 | welcome says 37; below 37 a worker holds Engineering step reports in |
| 122 | its outbox (it sends a step report only once positively identified as |
| 123 | a non-Engineering step it was dispatched), and a dispatch arriving |
| 124 | after a cancellation keeps its classification; `startProcess` refuses |
| 125 | a second start. With cgo on the test gets a static gitleaks from the |
| 126 | module cache. Process note: M9b, M9c, M9d, M9h and M9i came after |
| 127 | their production support; recorded exception backed by named |
| 128 | mutations. The headless-mac CI lane grows by about 75 s. Astra: r1 |
| 129 | NOT READY (4 Important, 1 Minor), r2 NOT READY (2, 1 Minor), r3 READY |
| 130 | AFTER FIXES (1, fixed in 4854d8fe). |
| 131 | 15. **D1 across every connection state, views, copy** (9fe073cc, |
| 132 | 24f27519). One predicate per side, `unsandboxedAllowed(runner)`: |
| 133 | while the instance holds a Mac as having a credential (from |
| 134 | `connecting` until files, Keychain residue and anything unproven are |
| 135 | gone) "Run outside the sandbox" is not offered there, and the worker |
| 136 | refuses an unsandboxed dispatch (`sandbox_unproven`) while its own |
| 137 | hold is set; a recorded unsandboxed choice is withdrawn when a |
| 138 | connection starts, and the creator told. Views: "Made on <Mac>" and |
| 139 | the no-Xcode line from `chat_steps.on_worker` (in 0120, set at |
| 140 | dispatch); "Add Claude to <Mac>" from the step's `WaitingFor`; the new |
| 141 | waits and Needs-you lines; the Machines page shows F1 to F7, the home |
| 142 | guard, the taint (hold-aware wording) and whether Engineering can run; |
| 143 | `Capabilities.RunnerUser` (37, validated) names the runner user there. |
| 144 | Copy JSON complete (59 entries, 6 marked `paul_sees`). Also fixed: |
| 145 | task 11's `TestContractWorkerSyncHolds` flake (the test read before |
| 146 | the sync applied; 50 of 50 after). `make copy-release-check` does not |
| 147 | block pending copy today (it greps REQUIRED, the tool writes |
| 148 | PENDING); the coordinating session fixes that on main, after which |
| 149 | this branch is red until the copy is accepted. Astra: r1 NOT READY |
| 150 | (3 Important, 1 Minor; the gate finding declined), r2 READY. |
| 151 | 14. **Shipped probes F1 to F7, P2 token sources, Engineering status** |
| 152 | (9a01dbf8, 41e8e5d2, d69fffd8, b27368cd, 9c429dc8; package |
| 153 | `internal/runner/mac/fprobe`). Three short launches (A: F1, F2, F3, |
| 154 | F6, F7; B: F5 only with P2 denied; C: F4) inside `Turns`. Protected |
| 155 | execution evidence: during a probe launch the permission tool allows |
| 156 | exactly one Bash command, the hashed probe script with a fresh |
| 157 | nonce; the script and the whole F5 fixture sit where nothing in the |
| 158 | launch can write, and their digest is checked just before; results |
| 159 | go where only the script writes; F6 is judged from the CLI's own |
| 160 | `tool_use`/`tool_result` events with the prescribed arguments, and |
| 161 | only permission refusals or verified benign reads count; links, |
| 162 | swaps and late insertions are done and recorded by the runner. |
| 163 | Model text never counts; a missing line is never a denial. F2/F3 |
| 164 | compare in memory against hashed needles and write only |
| 165 | `allowed`/`denied`/`failed`; F3 reads the observed CLI pid's |
| 166 | `KERN_PROCARGS2` with the runner's own reader, `ps -E` (an exec |
| 167 | refusal counts only with the outside control), `env` with a control |
| 168 | marker, and `/dev/fd`. DNS is a protected-script record backed by an |
| 169 | outside resolve (the runner cannot watch the system resolver |
| 170 | without root). Results trusted only for this runner version, |
| 171 | settings, pinned CLI, Xcode and runtimes, under a day, revalidated |
| 172 | at every use; inputs and simulators read fresh per launch. |
| 173 | `EngineeringStatus` `ready` (with the `claude` tag, stripped below |
| 174 | 37) only with F1 to F4, F6, F7 at their success verdicts, the guard |
| 175 | passing, no taint, nothing unproven and a usable connection; F5 |
| 176 | decides `xcode_access`. P2 gains the token sources. Exceptions |
| 177 | recorded in the task 14 brief (fprobe drafted before its tests; |
| 178 | F2's other-home sentinel is the OS's, not the sandbox's). Astra: r1 |
| 179 | NOT READY (2 Critical, 8 Important), r2 NOT READY (1 Critical, 7 |
| 180 | Important), r3 NOT READY (4); those fixed after r3 (9c429dc8) |
| 181 | without a fourth round. |
| 182 | 13. **Ask the implementer, pinned exactly** (b3eebcc6, 0cc6ca8c, |
| 183 | 3b166611). Every runner reports the kept session at 37; a question |
| 184 | freezes attempt, account, session, runner, base and candidate at |
| 185 | creation, and dispatch, cancel, replies and reconnect use the frozen |
| 186 | values. The worker answers only from that kept session with the |
| 187 | read-only settings and git tools over its store, after confirming |
| 188 | the lease as a question inside its turn; any mismatch is refused |
| 189 | before anything runs. Answers redacted whole (across stream chunks) |
| 190 | before the 16 KiB clip; the ask prompt quotes title and question |
| 191 | with source labels (shared with the Linux primary and Pi; their |
| 192 | golden changed only in that quoting). An offline Mac answers "Tito |
| 193 | Studio is offline. Ask again when it is back." (`work.ask.mac_offline`, |
| 194 | pending), as HTML, JSON and in the script composer as text. Also |
| 195 | fixed: a worker's owner list was read only at start. Process note: |
| 196 | four tests after their code, mutation-backed. Astra: r1 NOT READY (5 |
| 197 | Important), r2 NOT READY (1), r3 READY. |
| 198 | 12. **Worker Engineering `Exec`, object scan, outbound pack** (64e64327, |
| 199 | 24a53f2e, f494162e; `worker_checks.go`, `worker_engineering.go`, |
| 200 | `worker_scan.go`, `worker_store.go`, `worker_launch.go`). Guards, |
| 201 | then `Turns`, marker and lease; readiness and trusted Xcode access |
| 202 | re-checked inside the held turn. Inbound pack compared with the |
| 203 | step row on every chunk (`State.pack`, the one check), inventory |
| 204 | checked, named commits merged into the store's `shallow`. Fresh tree |
| 205 | per connection on failover; the kept session resumed through the |
| 206 | pinned project dir. Commit, then the candidate copied into the store |
| 207 | and pinned by `refs/equipo/<task>/<step>/<attempt>` with the session |
| 208 | binding and report metadata in the same durable transition. Object |
| 209 | scan before anything leaves: every new object read with `cat-file |
| 210 | --batch`, every known secret of the worker searched raw, base64 |
| 211 | (standard and URL) and hex, then pinned gitleaks offline under the |
| 212 | P2-proven srt checks profile with original file names and no path |
| 213 | exclusions; a hit, scanner error, unproven scanner, over-bound |
| 214 | object or unreadable list ends `secret_in_candidate` and nothing is |
| 215 | uploaded; logs name only object ids and kinds; every report string |
| 216 | and the step log redacted before persisting. Upload of the thin pack, |
| 217 | `done` with `pushed: false`; a restart after `committed` resumes the |
| 218 | upload and never relaunches; a second `send_pack` is answered from |
| 219 | the kept candidate; `KeepUntil` checked before serving any pack; |
| 220 | `forget_task` reaches workers. `ErrUnproven`/`ErrRecord` keep the |
| 221 | step unterminated. Process note: some tests after their code; |
| 222 | recorded exception backed by named mutations (24a53f2e's body). |
| 223 | Astra: r1 NOT READY (8 Important), r2 NOT READY (3), r3 READY. |
| 224 | 11. **Worker connections, routed by runner** (10dd3978, d77c9c64, |
| 225 | a1a2c293). A worker at 37 opens `Conns` over its own accounts root, |
| 226 | sends `Connections` and `SealKey` in hello, and accepts only Claude |
| 227 | token connections (pasted or the darwin sign-in) addressed to its |
| 228 | runner id; other kinds refused with a reason. Every connection |
| 229 | operation is routed by the row's `runner_id` and matched by |
| 230 | `(runner_id, local_id)`; a sealed token for one runner cannot be |
| 231 | accepted by another; Connections page grouped by machine with "Add |
| 232 | Claude to <Mac>" for a worker at 37. Durable credential hold on both |
| 233 | sides from `connecting` until files gone, no Keychain residue and |
| 234 | nothing `credential_unproven`; the handshake hello is never a |
| 235 | complete inventory (only a post-welcome `Hello.Inventory` with an |
| 236 | accepted capability report signs out); sync sets the hold, never |
| 237 | releases it; below 37 worker connection commands are held unacked |
| 238 | and replays refused; `chat_usage.runner_id` only at 37. Process note: |
| 239 | some tests came after their code; recorded exception, each backed by |
| 240 | a named mutation (d77c9c64's body). Astra: r1 NOT READY (4 |
| 241 | Important), r2 NOT READY (1), r3 READY. |
| 242 | **Follow-up (2026-11-29, 3545d40a, e60ab737, 0338fdd4, a16e4bee): |
| 243 | clearing a turn left unproven after a crash.** Asked for by the |
| 244 | coordinating session after task 16's M9e: an incomplete record used |
| 245 | to keep a Mac's step unretryable for good. First clearance, an idle |
| 246 | read under `Turns`, at runner start and on Retry: two complete reads |
| 247 | of the runner uid find only the runner, its tracked helpers and |
| 248 | processes older than the earliest unresolved turn, and every |
| 249 | obligation of every unresolved turn is gone across all uids; allowed |
| 250 | only when no unresolved turn ran anything outside a sandbox |
| 251 | (`unsandboxed_ran`, written durably before such code starts; a |
| 252 | uid switch needs a setuid exec, which task 1 R4 found Seatbelt |
| 253 | refuses). Fallback, a reboot (`kern.boottime` and |
| 254 | `kern.bootsessionuuid`): per-marker, boot-qualified completions, |
| 255 | acknowledged by each consumer only after it commits. One deadline |
| 256 | covers reads, cleanup, discharge and the final save. The Machines |
| 257 | page shows a count only (`processes_left`) and "Restart the Mac to |
| 258 | clear it." (pending, re-review after Luna). Astra: r1 NOT READY (3 |
| 259 | Critical, 2 Important), r2 NOT READY (1 Critical new, 3 partly), r3 |
| 260 | NOT READY (3 partly); those fixed after r3 (a16e4bee) without a |
| 261 | fourth round. |
| 262 | 10. **Darwin credentials, home guard, taint gate** (b2d8a17c, a8b97126, |
| 263 | 7029e88a, 1e1bad03; package `internal/runner/mac/creds`). Token |
| 264 | check, auth status and sign-in by link through the darwin launcher |
| 265 | inside `Turns`, the token only by descriptor. Each launch is watched: |
| 266 | a durable before-listing of the runner user's login keychain (by |
| 267 | path, fail closed), an after-listing, and deletion only of an item |
| 268 | positively the launch's own (stable attributes: keychain, class, |
| 269 | service `Claude Code-credentials-<hash>`, account); an ambiguous or |
| 270 | unreadable CLI-prefixed item refuses the connection; the hold clears |
| 271 | only when `Verify` proves the launch's recorded run ended, or the Mac |
| 272 | rebooted after the watch began, and a clean listing follows. |
| 273 | Otherwise every Claude store and use is refused and the Machines page |
| 274 | shows `credential_unproven` (pending copy). Home guard from |
| 275 | ownership, mode bits and ACLs only, protected roots precomputed, |
| 276 | ancestors checked, re-checked before every use (the Studio's |
| 277 | `paulequipo` home, `drwxr-x---` staff, fails it: `runner.mac.home_open`). |
| 278 | Taint gate per D2. Process note: the thin wiring's code came before |
| 279 | its tests; recorded exception on task 9's condition, all 29 original |
| 280 | guards mutated and killed (a8b97126's body). Astra: r1 NOT READY (6 |
| 281 | Important), r2 NOT READY (1), r3 NOT READY (2 new); those fixed after |
| 282 | r3 (1e1bad03) without a fourth round. |
| 283 | 9. **Darwin executor, termination, machine lock, cleanup** (4cc9a164, |
| 284 | 0feb233e, 569cdb51, ab7a5de0; new package `internal/runner/mac/proc`). |
| 285 | Marker before start, group after (kill on a failed write). Stop: stdin |
| 286 | close, SIGTERM, 10 s, SIGKILL to every group and session recorded |
| 287 | while the turn ran, the marked sweep, and a sweep of every runner-uid |
| 288 | process born during the turn that is not the runner's own (PID and |
| 289 | start time, including helper descendants seen while the helper |
| 290 | lived; no exemption by path), one re-snapshot after the first kill |
| 291 | pass; a launchd-parented system-path process born after that pass |
| 292 | began is a relaunch and is spared. Proof within one absolute 30 s |
| 293 | deadline covering every read, note and fsync, only when every target, |
| 294 | recorded group and session and marked process is gone and no non-own |
| 295 | runner-uid process born during the turn is alive; EPERM is not gone; |
| 296 | a failed scan voids earlier clearance. A record is complete only |
| 297 | when every launch of the turn wrote its evidence; an incomplete one |
| 298 | is never proven after a restart (`runner.unproven.record_incomplete`, |
| 299 | pending). Restart never kills a recorded group that holds no marked |
| 300 | process and never proves while it lives. `mac.Turns` per operation; |
| 301 | the pending cleanup owned by its turn; cross-process obligations |
| 302 | under one flock. Spec §8.8 records the setsid and platform-binary |
| 303 | findings, the sweep and the one honest limit (identifying a launchd |
| 304 | relaunch). Process note: the first commit's code came before its |
| 305 | tests; the coordinating session accepted a recorded one-off on the |
| 306 | condition that every original guard be mutated (20, all killed, in |
| 307 | 0feb233e's body). Astra: r1 NOT READY (1 Critical, 10 Important, 1 |
| 308 | Minor), r2 NOT READY (4 partly, 2 new), r3 NOT READY (3 partly); the |
| 309 | three fixed after r3 (ab7a5de0) without a fourth round, for the |
| 310 | whole-branch review to check. |
| 311 | 4. **Primary: bases, packs, publication diffs, outcomes** (5fb353cd, |
| 312 | 5f233ecc, 7006e3de, 8d83ec65, cfbbc476). `prepareBase` resolves the |
| 313 | default tip as `Engineer.Exec` does (unborn refused as |
| 314 | `base_unavailable`), durable and idempotent. `packCommits` packs |
| 315 | exactly `header.Commits()` (`rev-list --objects --no-walk`), refusing |
| 316 | bad SHAs, missing commits and non-`ValidHub` repositories before git |
| 317 | runs; the inventory test reads the pack itself. After a worker's push, |
| 318 | the primary computes change files and publication-bound diffs (its |
| 319 | known secrets withheld, file names and old names screened: a secret |
| 320 | there sends no files or diffs, the push stands). The instance accepts |
| 321 | them only from the publication's own primary |
| 322 | (`chat_steps.publication_runner`, in 0120), in either order with the |
| 323 | worker's `done`, which never touches them; a replaced primary fails |
| 324 | its pending publication and Retry re-sends the kept candidate to the |
| 325 | new one. The worker's outcome is recorded only at 37, survives |
| 326 | publication and republish, and `Pushed` comes only from `published`. |
| 327 | Oversize Engineering pack ends `workspace_too_large` with Needs you. |
| 328 | Astra: r1 NOT READY (3 Important), r2 READY. |
| 329 | 6. **Darwin MCP tool endpoint** (5bece793, ecd60076; merged, budgets |
| 330 | d1c3e9bf). `equipo-runner tool-proxy --socket` on darwin speaks the |
| 331 | Linux proxy's protocol (strict transcript oracle recorded on docs-t1 |
| 332 | 2026-11-28); peer uid by `LOCAL_PEERCRED`; sockets under |
| 333 | `<scratch>/t/`, 103 bytes served, 104 refused before any dial; at |
| 334 | startup it closes inherited descriptors without close-on-exec and |
| 335 | empties its environment. `internal/toolproxy` and the Linux digest |
| 336 | unchanged; the Linux release runner has no darwin endpoint. Astra: r1 |
| 337 | READY AFTER FIXES (3 Important, 1 Minor), r2 READY. |
| 338 | 8. **Darwin Engineering policy and settings** (b38a187d, abfcb79e, |
| 339 | e35b4b5c). Its own certified shape (pinned CLI digest, argv, |
| 340 | settings, MCP JSON, roots, scratch, denied paths, environment keys, |
| 341 | `xcode_access`), regenerated and compared byte for byte before every |
| 342 | launch. `sandbox.enabled`, `failIfUnavailable`, no unsandboxed |
| 343 | commands, `network.strictAllowlist: true` with no domains, no unix |
| 344 | sockets, no local binding; Mach lookups only with sandboxed Xcode |
| 345 | access. Denied both ways: §4.2, the connection's home and runtime |
| 346 | copy, `<scratch>/t`, and an Engineering-only list of 33 default |
| 347 | credential places in the home (`~/.claude`, `~/.claude.json`, |
| 348 | `~/.codex`, gh, git, netrc, Docker, npm, App Store Connect keys, |
| 349 | shell histories); write-only: the install dir and the pinned CLI's |
| 350 | dir, with matching native Write/Edit denies. Token only on fd 3 |
| 351 | (`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`); environment from scratch. |
| 352 | A read-only ask variant and a check-only variant. Required roots |
| 353 | refused when empty. Linux certified hashes identical (23 shapes). |
| 354 | Astra: r1 NOT READY (3 Important), r2 READY. |
| 355 | 5. **Darwin Claude Code pin** (053eab8f, 491b09c4; merged e67a8903). |
| 356 | `claude.ExecutableSHA256DarwinArm64`; the runner provisions 2.1.312 |
| 357 | from downloads.claude.ai through an `os.Root`, 512 MB bound, digest |
| 358 | checked before the file is made executable and before every launch; |
| 359 | every directory from the home down is a real directory owned by the |
| 360 | runner user with no group or other write, tool dirs 0700; the hashed |
| 361 | file is held open to `start` and the path re-checked as the same file |
| 362 | just before it. Discovery never runs an unpinned `claude`. The real |
| 363 | binary matched the pin (env-gated test, docs-t1). Astra: r1 READY |
| 364 | AFTER FIXES (2 Important), r2 READY. |
| 365 | 7. **Native permission port and paths** (af270613, 0418722d, ad68f025; |
| 366 | merged ead74b4a; merge fix 1614ca81 moved the §4.2 list to the leaf |
| 367 | package `internal/runner/mac/denylist`). On darwin each file request |
| 368 | gets one allow or deny, never a person; paths resolved against the |
| 369 | real root, compared per component in NFC and case-folded; Grep walks |
| 370 | its target with no-follow, inode-checked opens in 256-entry batches up |
| 371 | to 200,000 entries and refuses hard links, escaping links, errors and |
| 372 | changed types; Bash is allowed (every command sandboxed), |
| 373 | `SandboxNetworkAccess` denied; `CLAUDE_CODE_PROJECT_DIR_NAME=-workspace` |
| 374 | pins the transcript directory. Linux settings and certified hashes |
| 375 | identical for 21 launch shapes. Astra: r1 NOT READY (Critical: Grep |
| 376 | read hard links; Important: Unicode), r2 NOT READY (3), r3 READY. |
| 377 | |
| 378 | ## Decisions |
| 379 | |
| 380 | - **Protocol 1 primary exception (task 3): declined.** The plan keeps |
| 381 | "the protocol 1 primary exception from `mac-placement-wait`", but that |
| 382 | branch's own Astra round (74140828) removed it: an older primary is no |
| 383 | exception, and Mac work waits. The brief resolves conflicts in favour |
| 384 | of what landed. Astra round 2 on task 3 agreed. |
| 385 | - **Termination sweep (task 9), approved by the coordinating session |
| 386 | 2026-11-28:** besides the attempt's group and the marker, the runner |
| 387 | records every group and session seen under the CLI while the turn |
| 388 | runs, and at stop sweeps every runner-uid process started after the |
| 389 | turn began, except the runner and the helpers it started for itself |
| 390 | (tracked by PID and start time, never by name) and launchd-started |
| 391 | system agents. Recorded as a spec §5 addendum in task 9. |
| 392 | |
| 393 | - **Network deny (task 8):** settings add `network.strictAllowlist: |
| 394 | true`, and the permission tool denies `SandboxNetworkAccess`. Empty |
| 395 | `allowedDomains` alone asks (task 1, S2). |
| 396 | - **Token by descriptor (tasks 8, 10):** the token goes only through |
| 397 | `CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`, never in `claude`'s |
| 398 | environment (R4: a sandboxed command can read it through |
| 399 | `KERN_PROCARGS2`), and no `.oauth_token` file exists in the runtime |
| 400 | config dir. F3 proves it, including that the descriptor is not open in |
| 401 | Bash children. |
| 402 | - **Scrub side effects (tasks 7, 8):** `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1` |
| 403 | stays. It forces permission mode `default` and turns off |
| 404 | `autoAllowBashIfSandboxed`, so the permission tool answers Bash |
| 405 | itself: allow, since every command is sandboxed |
| 406 | (`allowUnsandboxedCommands: false`, `failIfUnavailable: true`). The |
| 407 | golden settings and argv record what the CLI is given; the plan's |
| 408 | `autoAllowBashIfSandboxed: true` stays set but is not relied on. |
| 409 | - **Transcript dir (task 7):** on darwin the launch pins |
| 410 | `CLAUDE_CODE_PROJECT_DIR_NAME=-workspace` (a certified environment |
| 411 | key), so a kept session resumes in any worktree without a move, and |
| 412 | the layout matches Linux. `transcriptPath` uses the pinned name. If a |
| 413 | live resume shows the variable ignored, fall back to the S6 rule and |
| 414 | the move (cost: task 7 rework, seen at the witness). |
| 415 | - **Startup Keychain reads (task 10):** accepted. With a per-attempt |
| 416 | `CLAUDE_CONFIG_DIR` the service name is unique, so the reads find |
| 417 | nothing. No `security` shim. Task 10's before and after listing still |
| 418 | catches any write. |
| 419 | |
| 420 | - **D1 (Paul, 2026-11-28): no.** Once the Studio holds a Claude token, |
| 421 | checks there run sandboxed or not at all. This is the plan's default |
| 422 | (task 15's `unsandboxedAllowed(runner)` predicate on each side). |
| 423 | - **D2 (Paul, 2026-11-28): keep `paulequipo`.** Paul signs in Claude for |
| 424 | it at the witness (task 18) and runs `chmod 700 ~` as `paulequipo` if |
| 425 | the home-folder guard asks. The taint gate stays as built (a runner |
| 426 | tainted on its instance record or in its own state takes no model |
| 427 | connection); the Studio's production enrolment carries no taint. |
| 428 | |
| 429 | ## Only the Mac can show |
| 430 | |
| 431 | - Recordings owed from tito-studio as the runner user: `security |
| 432 | dump-keychain` of the login keychain (the fixture is constructed from |
| 433 | the documented format), its `cdat` format, whether the listing works |
| 434 | in a launchd session without a prompt, and `kern.boottime` through |
| 435 | `unix.SysctlTimeval` on macOS 27.2 (task 10). |
| 436 | - `proc_pidpath`, `getsid` (also for other users' processes) and |
| 437 | `kern.proc` on 27.2, and whether kernel start times and the runner's |
| 438 | clock agree closely enough for the relaunch cutoff (task 9). |
| 439 | - Whether the token descriptor stays open in Bash children, whether the |
| 440 | CLI re-reads it, and whether a managed settings file overrides the |
| 441 | per-attempt settings (task 8, F3). |
| 442 | - The check-to-use race and hard links from Bash (task 7, F6). |
| 443 | - The whole of F1 to F7 (task 14) has run only against fakes: whether |
| 444 | the CLI asks the permission tool for every Bash command, whether |
| 445 | `xcodebuild` builds from a read-only fixture directory, the CLI's |
| 446 | permission-denied wording, `/bin/ps` exiting 126 in the Bash sandbox, |
| 447 | the runner's reader inside the sandbox, the hostile Swift added to the |
| 448 | P2 fixture, and launch A's roughly 100 tool calls on the small model. |
| 449 | Each fails closed. A probe run can hold the Mac's turn for up to |
| 450 | about 50 minutes. |
| 451 | |
| 452 | ## Open issues |
| 453 | |
| 454 | - Do not release between task 2 and task 4: the build says 37 before the |
| 455 | behaviour behind it lands. |
| 456 | - The four new reasons are not in `StepReasons` yet; the task that first |
| 457 | sends each adds it with pending copy (3: `base_unavailable`; 4 and 10: |
| 458 | the others). |
| 459 | - Pre-existing, not slice F: downgrades for protocols 26, 28, 31 and 35 |
| 460 | keep explicitly empty keys on message types slice F does not touch |
| 461 | (for example a lease with `"access_card":""` below 26). A general fix |
| 462 | (re-encode every decoded frame below the current protocol) is for the |
| 463 | parent to schedule. |
| 464 | - Seen while verifying task 2 on docs-t1: 28 `internal/runner/thin` |
| 465 | preview, devbox and site tests fail at 697ff1bc as well (to check |
| 466 | against `origin/main` before `make ci`); `TestPlan3ReleaseBoundaries` |
| 467 | fails on `work.needs.mac_runner`, copy pending from |
| 468 | `mac-placement-wait`. |
| 469 | |
| 470 | - **Termination of Bash commands (task 9), raised with the parent |
| 471 | 2026-11-28.** Each Bash tool command runs in its own session and |
| 472 | process group (`detached: true`), so signalling the attempt's group |
| 473 | misses them, and on 27.2 `ps -E` cannot see the marker on the platform |
| 474 | binaries that make up the chain. The §5 sweep as written misses a |
| 475 | sandboxed `sleep 1000 &`. |
| 476 | - Spec §4.1 says sandbox-runtime 0.0.81 and "empty means no network"; |
| 477 | 2.1.312 differs (see Decisions). Spec §4.5's |
| 478 | `log stream --predicate 'process == "sandbox-exec"'` does not match |
| 479 | this build's tagging; match `Sandbox:` deny lines. |
| 480 | - The Studio has three iOS runtimes, one device-specific |
| 481 | (`iOS-27-2-iPhone19-4`); simulator choice must not assume one runtime |
| 482 | per version. |
| 483 | - Studio Machines page line (protocol, P1 to P7, taint): needs Paul's |
| 484 | sign-in; the parent is relaying it. |
| 485 | |
| 486 | ## Copy |
| 487 | |