oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

Mac runners slice F: Engineering on a Mac worker

Status: rev 4, 2026-11-28. Astra round 1 NOT READY (20 findings), round 2 NOT READY (8 partly resolved, 4 new), round 3 READY AFTER FIXES (4 partly resolved, 1 new, 2 trivial). All findings applied; no fourth round (round limit). Spec: docs/superpowers/specs/2026-11-07-equipo-mac-runners.md rev 4 plus its §8 addendum (2026-11-28), which is current where they differ. Branch mac-slice-f from origin/main 8bd40ed1. Controller brief: CONTROLLER-BRIEF-mac-slice-f.md.

Rulings (Paul, 2026-11-28): D1 no, as the default below: once the Studio holds a Claude token, checks there run sandboxed or not at all. D2 keep paulequipo: Paul signs in Claude for it at the witness and runs chmod 700 ~ as paulequipo if the home guard asks.

Paul (2026-11-28): "Surely mac runners need to be able to do native Mac and iOS development?" Slice F lets a Mac worker run Engineering steps with Claude Code, so iOS and Mac changes are made, and where the sandbox is proven built, on a Mac. The primary still holds the forge, chooses bases, pushes, reviews and merges.

0. Ground rules for every task

  • Tests first. Each task writes its failing tests, runs them, and sees them fail for the stated reason before implementing. Every guard named in a task gets a mutation check: break the guarded line, watch a named test fail, restore. Record commands and results in docs/superpowers/plans/MAC-SLICE-F-PROGRESS.md (AGENTS.md).
  • Targeted runs while iterating, such as go test ./internal/runner/thin/ -run TestWorkerEngineering -count=1. make ci runs once, before the whole-branch review. Darwin code is built on Linux. Every task that touches darwin files runs GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build ./... and make vet (which vets the runner for darwin/arm64).
  • What only a Mac can show is unit-tested with recorded outputs and fakes, then proven by the shipped probes (task 14) once a release runs on the Studio. Each recorded output carries its date and the machine it came from.
  • Protocol 36 (wire.ProtocolMacEngineering) gates every new frame, field and command. wire.Encode(f, p) for p < 36 drops them. The fixture tests encode each new frame at 35 and at 36. Both the primary and the worker must speak 36 before Mac Engineering is placed. Confirm the number with the parent before code, since other branches also allocate numbers. Use one migration, with the next free number at the time.
  • Copy follows AGENTS.md: new runtime strings go in internal/equipo/copy.go, marked pending with python3 scripts/copy-status.py pending. The same strings also go in the copy-review JSON docs/superpowers/plans/2026-11-28-mac-slice-f-copy.json for Luna's review (task 15). Luna's edits are applied verbatim, and the strings stay pending. Acceptance happens only through the project's own path (AGENTS.md: the owner's "Copy can accept on my behalf" setting with matching server records and exact text hashes), never by the controller, the parent or an implementer. Pending copy keeps blocking release, which is correct. No em dashes, no exclamation marks.
  • Round limit. Astra reviews this plan, the risky tasks (3, 4, 7, 8, 9, 10, 11, 12, 15) and the whole branch, at most three rounds each. After round 3 the controller fixes what is clearly right, records what stays open, and asks the parent. There is never a fourth round.
  • Never merge, deploy, enrol, change Studio state, sign in to a provider, or run a live model turn. The shipped probe turn (task 14) runs only on the Studio, after a deploy someone else does.

1. What exists and what is missing

Built (slices A to E, RUNNERS-PROGRESS.md, DARWIN-PROGRESS.md): per-runner mailbox, roles, protocol negotiation, capability report, placement with start authorization and withdrawal, the Engineering pin column, transfers and blob relay, the primary's publish/published path (thin/relay.go: publishWorker), the darwin runner build, the srt checks profile, the process-group gate (mac.Gate, mac.Turns), probes P1 to P7, the launchd agent, the installer, self-update, the taint, and the user-temp cleanup (simctl shutdown all, then sweep).

Missing, with the task that adds it:

| Gap | Task | |---|---| | The worker refuses every step but Checks (thin/worker.go) | 12 | | Placement never sends Engineering to a worker; mac-placement-wait parks it | 3 | | No base resolution for a worker's first step or rebase round (the primary picks it inside Engineer.Exec) | 3, 4 | | No darwin Claude Code pin; Mac discovery runs an unpinned claude | 5 | | No darwin launch policy (Linux Engineering is a bubblewrap-certified launch) | 8 | | No MCP tool endpoint on a Mac | 6 | | /workspace hard-coded in answers, transcripts (projects/-workspace) and prompts | 7 | | Restart proof can pass with the recorded group alive (mac/gate.go !ours) | 9 | | Token check and sign-in need Linux containment (tokencheck.go, signin.go) | 10 | | No home guard; P4's Exposed tests only as the current user | 10 | | A worker has no connections, seal key or Conns; Cancel and Sign out target the primary by local ID | 11 | | TransferHeader has one commit; no shallow handling; no pack inventory check | 2, 4, 12 | | Change diffs are accepted only from the step's runner while running | 2, 4 | | Worker outcomes (unfinished, no-shell) survive only for primary Engineering | 4 | | AskCommand lacks the Engineering attempt, account and session binding | 13 | | No probes of Claude's own sandbox on a Mac; P2 never tries the token | 14 | | D1 and D2 not enforced anywhere | 10, 15 | | No M9 scenario | 16 |

2. Task order

| # | Task | Risk | Per-task Astra | |---|---|---|---| | 0 | Base: merge mac-placement-wait, allocate numbers | low | no | | 1 | Read-only probes, static reads, the Studio's verdicts | low | no | | 2 | Wire, protocol 36, migration, fixtures | medium | no | | 3 | Instance: placement, base preparation, pinning, waits, switch | high | yes | | 4 | Primary: prepare base, packs, publication-bound diffs, worker outcomes | high | yes | | 5 | Darwin Claude Code pin and provisioning | medium | no | | 6 | Darwin MCP tool endpoint | medium | no | | 7 | Native permission port and workspace paths | high | yes | | 8 | Darwin Engineering policy and settings | high | yes | | 9 | Darwin executor, termination, machine lock, cleanup | high | yes | | 10 | Darwin credential operations, home guard, taint gate | high | yes | | 11 | Worker connections, lifecycle routed by runner | high | yes | | 12 | Worker Engineering Exec, object scan, outbound pack | high | yes | | 13 | Ask the implementer, pinned exactly | medium | no | | 14 | Shipped probes F1 to F7, P2 token sources, Engineering status | medium | no | | 15 | D1 across every connection state, views, copy | high | yes | | 16 | M9 and mixed versions on Linux CI | medium | no | | 17 | Release, docs, make ci, whole-branch review | medium | yes | | 18 | Live witness on production (after someone else deploys) | n/a | no |

Dependencies: 2 before everything else that touches the wire. 3 and 4 together (the base exchange spans both). 5, 6 and 7 are independent and may run in parallel worktrees. 8 needs 5 to 7. 9 needs 8. 10 needs 5, 8 and 9. 11 needs 2 and 10. 12 needs 4 and 8 to 11. 13 needs 7 and 12. 14 needs 9, 10 and 12. 15 needs 3, 11 and 14.

---

Task 0. Base

  1. git merge origin/mac-placement-wait into mac-slice-f, or rebase onto main if it has merged by then. Run its tests: go test ./internal/thintest/ -run 'MacWait|Macrecheck|Placement' -count=1 and go test ./internal/equipo/ -run TestMacWait -count=1.
  2. Ask the parent for the protocol number (expected 36) and the next free migration number. Write both at the top of the progress file.
  3. Create MAC-SLICE-F-PROGRESS.md in the layout of DARWIN-PROGRESS.md (Done, Decisions, Only the Mac can show, Open issues, Copy), with D1 and D2 from spec §8.7 listed as open until Paul rules.

Task 1. Read-only probes, static reads, the Studio's verdicts

Before any Darwin code, as slice C did. Nothing on the Studio changes. SSH as paulca only (ssh -o BatchMode=yes tito-studio, with the sandbox off, since ~/.ssh is read-denied inside it). No sudo. Never read paulequipo's files: its home can be listed, but its contents are not ours. Scratch on docs-t1 goes in a mktemp -d under $TMPDIR, removed at the end of the task.

On the Studio as paulca (record output in the progress file, dated):

  • R1 sw_vers, xcodebuild -version, xcode-select -p, xcrun simctl list -j runtimes, swift --version, sysctl hw.ncpu hw.memsize, uptime. Seen 2026-11-28: macOS 27.2, Xcode 27.2 (27B52), iOS 27.0 and 27.2 runtimes, M5 Ultra, 36 cores, 96 GB, load about 1.7, several other users' Claude sessions running.
  • R2 ls -led /Users/* (the ACL picture; seen: paulequipo's home is drwxr-x--- group staff, no ACL shutting out other users), id paulequipo, and ps -axo user,pid,etime,command | grep equipo-runner.
  • R3 sandbox-exec -p '(version 1)(allow default)' /usr/bin/true, then the same with a nested sandbox-exec inside it. Record whether macOS 27.2 lets a Seatbelt profile be applied inside another. This is background only: the design does not nest.
  • R4 ps -E -p <own pid> and a sysctl kern.procargs2 read of a same-user process, from a plain shell and from inside a hand-written profile (deny default)(allow process-exec)(allow file-read*). This shows what process-info* governs on 27.2. F3 is the proof.

The Studio's current verdicts. Ask the parent for the production Machines page line for Tito Studio: protocol, P1 to P7 verdicts, tainted or not. If P2 is not denied, write it in the progress file as a witness blocker (spec §8.7, D1) and go on. Slice F does not include repairing P2. If the parent has a fix branch for P2, note its name.

On docs-t1, static reads of the pinned CLI. Fetch the official Claude Code 2.1.312 release manifest and the darwin-arm64 binary (about 200 MB, within the "ask before a few GB" rule) into the scratch dir. Check the binary against the manifest digest, then read it with rg -a and strings, without running it. Record what each finding matched:

  • S1 the darwin-arm64 digest and the manifest URL. This becomes claude.ExecutableSHA256DarwinArm64.
  • S2 the sandbox settings keys the build reads: sandbox.filesystem. {allowWrite, allowRead, denyRead, denyWrite}, sandbox.network. {allowedDomains, allowUnixSockets, allowLocalBinding, allowMachLookup}, failIfUnavailable, allowUnsandboxedCommands, excludedCommands, enableWeakerNestedSandbox; what an empty allowedDomains means (no network, or ask). A key the design needs that is absent is a stop: write it up and ask the parent.
  • S3 the version of @anthropic-ai/sandbox-runtime the build embeds, and, from that tag's source (macos-sandbox-utils.ts), what its generated profile allows by default: process-info*, mach-lookup (including securityd), the breadth of file-read*, sysctl-read.
  • S4 whether the build reads the OAuth token from a file descriptor (a *_FILE_DESCRIPTOR variable beside CLAUDE_CODE_OAUTH_TOKEN), and whether a set CLAUDE_CODE_OAUTH_TOKEN skips every Keychain read and write (security, Claude Code-credentials).
  • S5 how the Bash tool starts its shell on darwin (detached, setsid, a new process group), and what CLAUDE_CODE_SUBPROCESS_ENV_SCRUB removes. Task 9 depends on EQUIPO_ATTEMPT surviving.
  • S6 how the build names a project's transcript directory from its cwd (the rule that gives projects/-workspace on Linux), so task 7 can compute it for a real Mac path.

Delete the scratch dir. Done when R1 to R4, the verdicts and S1 to S6 are in the progress file, and any stop has been raised.

Task 2. Wire, protocol 36, migration, fixtures

Files: internal/wire/ (runners.go, tasks.go, questions.go, capabilities validation, a new mac_engineering.go), the frames testdata, the migration, internal/equipo/chat/transfers.go (storage only).

Changes:

  • TransferHeader stays a comparable struct. Add Kind ("" for checks, engineering) and OldBaseSHA. An Engineering transfer has BaseSHA (the tree to start from), and for a rebase round also OldBaseSHA and CandidateSHA. Add func (h TransferHeader) Commits() []string, the bounded, de-duplicated list the pack must yield, and Valid(), which checks each SHA and allows at most three. Every existing != comparison keeps working.
  • Migration: transfers.kind, transfers.old_base_sha; chat_steps.xcode_access, chat_steps.outcome_phase (committed, unfinished or no-shell, kept apart from transfer progress), chat_steps.session_id (the kept Engineering session); chat_questions.eng_attempt, eng_account, eng_session, runner_id, base_sha, candidate_sha (frozen when the question is created, task 13). Additive only.
  • New durable command PrepareBaseCommand{task, step, attempt, repo, rebase, from_base, candidate} (instance to primary) and report BaseReport{task, step, attempt, base_sha, reason} (primary to instance).
  • DispatchCommand.XcodeAccess (sandboxed or "").
  • StepReport.XcodeAccess echoes what ran. StepReport.SessionID names the kept session (protocol 36, from any runner; the primary starts sending it too). StepReport.OutcomePhase carries the commit's outcome separately from progress phases.
  • PublishCommand.OutcomePhase, and PublishedReport.ChangeFiles *ChangeFiles, DiffCollection string and OutcomePhase, so the instance keeps the worker's outcome through publication (task 4).
  • ChangeDiffUpload gains Publication (empty: today's path).
  • AskCommand gains EngAttempt, EngAccount, EngSession.
  • Capabilities.Engineering *EngineeringStatus{state, reason}: ready, no_connection, signed_out, limited, probes_pending, probes_failed, cli_unpinned, home_open, tainted, busy is not a state (placement counts running steps).
  • ValidCapabilities accepts probes F1 to F7, with denied and passed allowed where each probe defines them.
  • New reasons: secret_in_candidate, workspace_too_large, engineering_unavailable, base_unavailable. New placements: waiting_mac_connection (with the status reason), waiting_mac_update, waiting_base. New Needs-you kinds: mac_connection, mac_update.
  • A worker's hello at 36 may carry Connections and SealKey. The instance ignores both from a worker below 36.

Tests first (internal/wire): TestProtocol36Constants (and update the tests that pin 35); TestEncodeDropsMacEngineeringBelow36 for every new field and frame; TestTransferHeaderCommits (order, de-duplication, the bound of three, invalid SHAs, kind rules); TestValidCapabilitiesF; fixture round-trips for frames/prepare-base.json, frames/base.json, frames/dispatch-mac-engineering.json, frames/blob-engineering.json, frames/published-change-files.json, frames/hello-worker-conns.json, frames/ask-pinned.json, frames/step-mac-engineering.json; a migration test over a database holding open checks transfers and kept questions.

Mutations: drop a < 36 clear in Encode; allow four commits; accept denied for F4. Each must fail a named test.

Task 3. Instance: placement, base preparation, pinning, waits, switch

Files: internal/equipo/chat/runners.go (place, macEngineering, placeWaiting), macsandbox.go, transfers.go, tasks.go, a new base_prepare.go, the store's boot config, internal/thintest/.

Behaviour:

  • engineeringNeeds adds wire.TagClaude for Mac work.
  • Switch: EQUIPO_MAC_ENGINEERING=1, read at boot. Unset, Mac Engineering waits exactly as mac-placement-wait left it.
  • Switch on. The candidate runners are, in order, the pinned worker (enrolled, not removing), then the §1.4 order among workers covering the needs. Both the worker and the primary must speak ≥ 36; otherwise wait waiting_mac_update, with Needs you naming which one. If a Mac covers everything but claude, wait waiting_mac_connection carrying the worker's EngineeringStatus reason. Never place on a different worker just because the pinned one lost its tag; wait for it.
  • Base preparation, two phases in separate transactions: 1. If the attempt has no bound base (a first step, or a rebase round whose new tip is unknown), write prepare_base to the primary's mailbox. The step waits waiting_base. 2. On the primary's base report for the current attempt, from the primary's connection, not withdrawn: bind base_sha to the attempt, then place, dispatch and open the inbound Engineering transfer in one transaction. Any other report is refused and logged. base{reason: base_unavailable} ends the attempt failed with that reason and Needs you retry. A fix round's base is the task branch's published tip, which is already known, so it skips phase 1. A Retry rebinds nothing that was bound to an earlier attempt.
  • XcodeAccess: sandboxed is sent only when the instance holds the worker sandbox-proven (sandboxProven) and its probe report has F5 denied. A tainted Mac never gets it.
  • A removed pinned worker follows the existing removal path (quarantine, then Recover). After Recover the next Engineering step re-pins to a fitting Mac or waits waiting_mac. It is never placed on the Linux primary. The protocol 1 primary exception from mac-placement-wait stays.
  • Review of a Mac-made candidate is placed on the primary after publication. Ready to merge never auto-merges a Mac-made candidate, because a worker cannot run certified base gates (injection defences).

Tests first, as contracts in internal/thintest/mac_engineering_contract_test.go, with a primary and a fake worker both at 36 unless stated:

  1. TestContractMacEngineeringPlacedOnWorker: prepare-base first, then the dispatch with its transfer (kind engineering, base only) in one transaction, and the pin set.
  2. TestContractMacEngineeringSwitchOff.
  3. TestContractMacEngineeringStatusWaits: one case per EngineeringStatus reason. Each is its own wait and Needs-you line, and placeWaiting places once the status is ready.
  4. TestContractMacEngineeringOldWorker and ...OldPrimary: both wait waiting_mac_update; neither receives a field or frame from protocol 36.
  5. TestContractMacEngineeringOffline: waiting_runner, then Needs you runner_offline after 30 minutes, Cancel works, and it never moves to Linux.
  6. TestContractMacEngineeringPinHolds: a fix round, a Retry, a republish and a rebase round all go to the pinned worker even with a second fitting worker. The rebase transfer carries base, old base and candidate.
  7. TestContractMacEngineeringPinnedLostTag: the pinned worker drops claude mid-task. The next round waits for it; it is never placed on the second worker.
  8. TestContractMacEngineeringPinnedRemoved.
  9. TestContractPrepareBase: a report from the worker, for an older attempt, after withdrawal, or after Cancel is refused; a second report for the same attempt is a no-op; base_unavailable ends it with Retry.
  10. TestContractMacEngineeringXcodeAccess.
  11. TestContractWorkerEngineeringReports: a worker's pushed: true is refused; committed opens the outbound transfer for exactly that candidate; done waits for the primary's published (extending TestContractPublishedBeforeWorkerDone).
  12. TestContractReviewStaysOnPrimary and TestContractMacMadeNeverAutoMerges.

Mutations: place on the primary when the pin is removed; omit claude; place with an old primary; send xcode_access without F5; open the transfer before the base is bound; accept a base report from the worker. Each must fail a named contract.

Task 4. Primary: prepare base, packs, publication-bound diffs, worker outcomes

Files: internal/runner/thin/relay.go (packCandidate, publishWorker, a new prepareBase), change_files.go, change_diffs.go, link.go (the new command), and on the instance internal/equipo/chat/change_diffs.go, transfers.go, tasks.go (unfinishedReport and the no-shell handling).

Runner (primary):

  • prepareBase: fetch, then resolve the default tip exactly as Engineer.Exec does today (defaultTip, including the unborn case, which is refused for a worker as base_unavailable). Report base. Durable and idempotent: a restart re-reports the same SHA for the same attempt.
  • packCommits(header): with no kind, today's one-commit pack. For an Engineering header, rev-list --objects --no-walk of exactly header.Commits() into pack-objects. Refuse a commit missing from the clone, a non-SHA or a repository that is not ValidHub before git runs.
  • publishWorker after a successful push (at 36): compute change files for base to candidate, queue change-diff uploads bound to the publication (leaving out the primary's known secrets, as today), and report published with ChangeFiles, DiffCollection and the OutcomePhase the instance put in the publish command. Failure to compute diffs is a diagnostic, never a push failure.

Instance:

  • Accept change-diff uploads that name a publication only from that publication's primary connection, for the worker's task, step and attempt, while the publication is pending or published, in either order relative to the worker's done. Change both acceptance paths: changeDiff (today it needs the step's runner and running) and acceptChangeDiffs (today the uploader must equal the step's runner). Refuse stale publications, another primary and a wrong attempt.
  • The worker's done never touches ChangeFiles or the diff collection on a worker step; only published sets them. A done arriving after published must not clear them.
  • Keep the worker's outcome. A worker's committed report records outcome_phase. The instance copies it into publish, the primary echoes it in published, and only then does the step take step_timeout (unfinished) or the no-shell reason, with Pushed set by the primary. Republish keeps it. Two places rebuild Pushed=true from an unfinished outcome today, and both must not do so for a worker: the instance's unfinishedReport (chat/tasks.go) and the runner's (thin/step.go).

Tests first:

  • TestPrepareBaseResolvesAndIsIdempotent, TestPrepareBaseRefusesUnborn (thin).
  • TestPackCommitsInventory (thin): index the pack into an empty repository, then list the commit objects in the pack itself (verify-pack -v, or show-index plus cat-file --batch-check). Exactly the named commits, each with a complete tree, and no other commit.
  • TestPackCommitsRefuses (thin).
  • TestPublishWorkerChangeFilesAndDiffs (thin): files and diffs bound to the publication; the bearer token never in a diff.
  • Instance contracts: TestContractPublicationDiffs (both orderings of worker done and the primary's uploads, a restart between, a stale publication, a wrong primary, a wrong attempt); TestContractWorkerUnfinishedThroughPublication (timeout, no-shell fix round, failed publication then republish: the phase survives and Pushed comes only from published); TestContractPublishedFilesSurviveDone (files and diffs visible on the task in both orderings of done and published, and after a restart); TestWorkerUnfinishedReportNeverPushed (thin, the runner's unfinishedReport).
  • TestPackOversizeIsWorkspaceTooLarge: declared oversize ends the step workspace_too_large with Needs you.

Mutations: walk history (drop --no-walk); accept diffs from the worker; set Pushed from the worker's unfinished report; queue diffs before the push. Each must fail a named test.

Task 5. Darwin Claude Code pin and provisioning

Files: internal/runner/provider/claude/pins.go, a new internal/runner/mac/claude.go, thin/mac.go (macTools, newMacHost), mac/caps.go.

The worker runs only the 2.1.312 darwin-arm64 binary whose digest (task 1, S1) is compiled in as claude.ExecutableSHA256DarwinArm64. It provisions that binary itself, so Paul has no install step. It never runs a claude from PATH or EQUIPO_CLAUDE_PATH again, not even for --version. The capability report states the pinned version only after verification.

Tests first (internal/runner/mac/claude_test.go):

  • TestClaudePinDarwin: ReleasePinFor("darwin", "arm64") is the constant; nothing else on darwin has a pin.
  • TestProvisionChecksDigestBeforeExec: one changed byte is refused, never made executable, and nothing is left behind.
  • TestProvisionBoundsAndPlace: a 512 MB bound; written only under ~/.local/lib/equipo-runner/tools/claude-2.1.312/ through an os.Root, mode 0700, no symlink followed; a present file with the wrong digest is replaced.
  • TestProvisionOnlyFromTheOfficialURL: the URL comes from the version and platform constants. A local file can stand in only under the testbuild tag.
  • TestVerifyBeforeEveryLaunch: the launcher re-hashes before each launch; a swapped file stops it with engineering_unavailable.
  • TestDiscoveryNeverRunsUnpinnedClaude: the capability probe runs no binary but the verified pin.

Env-gated (EQUIPO_CLAUDE_DARWIN_BINARY=<path>), run once on docs-t1 with the task 1 download: the real binary matches the pin.

Mutations: skip the digest; follow a symlink; run PATH claude in discovery. Each must fail a named test.

Task 6. Darwin MCP tool endpoint

The Linux tool proxy stays byte-identical (do not touch internal/toolproxy). The release check that it matches its certified digest must stay green. On darwin, equipo-runner tool-proxy --socket <path> speaks the same stdio MCP protocol to the CLI and the same framing to the step socket.

Files: internal/runner/tool_proxy_serve_darwin.go (now refuses), a darwin-only command in cmd/equipo-runner, thin/mcp.go (openToolSet), thin/toolsocket_other.go.

Tests first:

  • TestDarwinToolProxySpeaksTheProtocol: shared code split as darwin || testbuild, so it runs on Linux. The permission tool, submit_candidate, ask_person, submit_answer and the answer action's git_* tools round-trip with the same replies as the Linux proxy; a transcript recorded from the Linux proxy tests is the oracle.
  • TestToolSocketPeerUID: on darwin only the runner's own uid is accepted (LOCAL_PEERCRED, peer_darwin.go), exercised through its seam.
  • TestToolSocketPathFits: the socket path stays under 104 bytes for a long /Users/<name> home (use the scratch root's short t/).
  • The certified Linux tool proxy check passes unchanged.

Mutations: accept any peer uid; allow a permission the Linux proxy denies. Each must fail a named test.

Task 7. Native permission port and workspace paths

Spec §4.4, "Native file permissions, ported explicitly", and the transcript and prompt paths. Files: provider/claude/answers.go, thin/claude.go (transcriptPath, keepTranscript, copyPrivate callers), thin/engineer.go and thin/ask.go prompts.

  • The workspace root and the read-only research root become policy fields. Linux keeps /workspace and /research, and its certified policy hashes must not change: assert the Linux settings bytes are identical before and after.
  • Every requested path is resolved with realpath against the real root and checked against the §4.2 list before answering. Read, Edit, Write, Glob and Grep deny rules are generated for each §4.2 path. StepPermission and ReadPermission share the port. "Nobody to ask" stays the default.
  • transcriptPath(home, cwd, session) computes the project directory from the cwd with the CLI's rule (task 1, S6). Resuming a kept transcript into a new attempt's worktree moves it into the new cwd's project directory. Linux output is unchanged.
  • Prompts name the workspace root from the policy, not /workspace.

Tests first (answers_test.go, a new answers_darwin_policy_test.go that runs on Linux with temp dirs standing in for Mac paths, claude_transcript_test.go):

  • TestPermissionLinuxUnchanged: every existing answer test passes; the Linux settings hash is unchanged.
  • TestPermissionRootIsResolved: a symlinked alias of the root (the stand-in for /var to /private/var) is allowed only when it lands inside the real root.
  • TestPermissionRefusesEscapes: .., a glob that expands outside the root, an absolute outside path, an inside symlink pointing out.
  • TestPermissionDeniedPathsGenerated: each §4.2 path appears as Tool(/<path>) and Tool(/<path>/**) for all five tools.
  • TestTranscriptPathForRealCwd and TestResumeAcrossWorktrees: keep in worktree A, resume in worktree B, then again after a runner restart. Linux paths stay projects/-workspace.
  • TestPromptsNameTheRoot.

The symlink swap after the check cannot be proven by a unit test. Live proof is probe F6 (task 14), and Engineering stays unavailable until F6 passes.

Mutations: compare prefixes without resolving; drop the .. check; skip one deny path; hard-code -workspace on darwin. Each must fail a named test.

Task 8. Darwin Engineering policy and settings

Files: a new internal/runner/mac/engineering.go, a darwin policy beside provider/claude/launcher.go (darwinPolicy, validateDarwin), and mac/profile.go, which shares the §4.2 list with checks.

The darwin policy is its own certified shape, not provider.BuildPolicy with bubblewrap fields faked. It records the pinned CLI digest, argv, settings JSON, MCP JSON (the darwin tool endpoint), workspace root, attempt scratch, denied paths, environment keys and xcode_access. Before launch the launcher regenerates it from its inputs and requires byte equality, as validatePolicy does.

Settings per attempt (keys confirmed by task 1, S2):

  • disableAllHooks: true, plugins off, autoMemoryEnabled: false, --setting-sources '', --strict-mcp-config, --disable-slash-commands, --permission-mode manual, --permission-prompt-tool mcp__equipo__permission, tools Bash,Read,Write,Edit,Glob,Grep (as Linux Engineering).
  • sandbox.enabled: true, failIfUnavailable: true, allowUnsandboxedCommands: false, excludedCommands: [], autoAllowBashIfSandboxed: true.
  • filesystem.allowWrite: the worktree and the attempt scratch. With xcode_access: sandboxed, also the attempt's DerivedData under scratch, the runner user's DARWIN_USER_TEMP_DIR (resolved as the checks profile does, mac/usertemp.go), ~/Library/Developer/Xcode/DerivedData and the SwiftPM caches. denyRead and denyWrite: the §4.2 list, plus the connection's dedicated home and its runtime copy.
  • network.allowedDomains: []. If S2 shows that empty means "ask", the permission tool answers deny, and F1 proves no connection is made. allowUnixSockets: [], allowLocalBinding: false, and allowMachLookup set to the P2-recorded list (mac.CheckMachServices, narrowed by P2) only with sandboxed Xcode access, else []. An empty list is not proof of no Mach access (S3 lists the runtime's defaults); F7 is the proof.
  • permissions.deny: task 7's generated rules. ask: the native tools on the workspace root.
  • Environment from scratch: HOME the runner user's home (Xcode needs it), CLAUDE_CONFIG_DIR the runtime copy, CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1, DISABLE_AUTOUPDATER=1, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, TMPDIR the attempt scratch, DEVELOPER_DIR from xcode-select -p, a fixed PATH, LANG, EQUIPO_ATTEMPT=<marker>. The token goes by descriptor if S4 found one, otherwise in CLAUDE_CODE_OAUTH_TOKEN. Either way F3 must prove the sandboxed shell cannot read it.
  • A read-only variant for asks: denyWrite includes the worktree, and the tools are Read,Glob,Grep.

Tests first (internal/runner/mac/engineering_test.go): TestEngineeringSettingsExact (golden JSON for both Xcode modes and the read-only variant); TestEngineeringSettingsRefuses (a worktree inside a denied place, relative paths, globs, scratch inside the worktree, a token home inside the worktree); TestEngineeringNoMachWithoutAccess; TestEngineeringPolicyValidatedBeforeLaunch (one byte of settings, a different argv, an extra environment key: no launch); TestEngineeringEnvFromScratch; TestEngineeringTokenNotInArgvOrPolicy (the token is never in argv, the stored policy, the step log or a report).

Mutations: allow network; drop the accounts root from denyRead; grant Mach lookups without access; inherit the environment. Each must fail a named test.

Task 9. Darwin executor, termination, machine lock, cleanup

Spec §5. Files: internal/runner/mac/gate.go (pull the process-group executor out so the gate and Engineering share it), a new internal/runner/mac/launch.go implementing thin's starter for a Mac, mac/usertemp.go (Turns), thin/step.go (recordedStart), thin/state.go (recovery).

  • Record order. Write the marker to the step row before the process starts; nothing starts if that write fails. Write the actual group id once the process exists; if that write fails, kill the group and stop.
  • Stop. Close stdin and wait for a graceful end (as stopStep), then SIGTERM to the group, 10 s, SIGKILL, then the marked sweep (ps -E). Then the user-temp cleanup protocol as it is today: simctl shutdown all (the mac-user-temp ruling; all simulators of the runner user are its own), then the sweep of what the attempt created.
  • Proof. Termination is proven only when kill(-pgid, 0) returns ESRCH and no marked process is left, within 30 s. Fix the restart path (mac/gate.go): today gone := !ours || ... passes when no marked process is found, even if the recorded group is still alive. New rule: if the recorded group is alive and holds no marked process, it is either our child that scrubbed its environment or a reused group id. Do not kill it, and do not prove termination. The step stays unterminated (no Retry) until the group is gone. Keep today's protection against killing a reused group.
  • One machine lock, per operation. Every operation that runs repository code, runs Xcode, or has a model token in a process takes mac.Turns for that operation's life and no longer: a check, an Engineering attempt, an ask, a probe run (P1 to P7, F1 to F7), a token check, a sign-in pty, a token store. Descendants the operation itself starts (Xcode under Engineering, the simulator under a check) belong to it. Turns are serialized, so a stored connection never blocks sandboxed checks and Engineering from taking turns one after another. The temp-cleanup "pending" record is owned by the turn that wrote it; only its owner or a restart may clear it.
  • The credential flag is separate from the lock. The persistent "this Mac has a model credential" flag (task 11, D1) lasts from a connection's connecting until its files and any Keychain item are proven gone. It only forbids unsandboxed turns; it does not hold Turns.
  • termination_kind: process_group. If task 1 (S5) shows the marker does not survive the CLI's scrub, stop and raise it: the honest limit in §5 would then cover every Bash command.

Tests first (internal/runner/mac/launch_test.go, Linux-runnable with the /proc sweep): TestEngineeringLaunchRecordsMarkerThenGroup; TestEngineeringTerminationGroupAndMarker (a fake CLI forks a setsid child that keeps the marker: the sweep ends it and the proof waits); TestRestartUnmarkedSurvivorWithholdsProof (an unmarked process alive in the recorded group: no kill, no proof); TestRestartReusedGroupNotKilled (an unrelated group reusing the id: not killed, no proof until it is gone); TestRestartKillsMarked; TestTurnsCoverEveryTokenOperation (an Engineering turn, a token check and a probe cannot overlap; checks wait while a sign-in pty is open); TestStoredConnectionAllowsSerialTurns (with a connection stored, Engineering then sandboxed checks then an ask run one after another); TestCleanupOwnedByItsTurn (an interrupted cleanup is finished only by its owner or a restart, never by another turn).

Mutations: proof without the group check; record the group before the marker; let a token check run outside Turns; let one turn clear another's pending cleanup. Each must fail a named test.

Task 10. Darwin credential operations, home guard, taint gate

Files: thin/tokencheck.go, thin/signin.go, thin/token.go, a new mac/credentials.go, a new mac/homeguard.go, and thin/mac.go.

  • Darwin token check. The same check as Linux (the CLI's own auth status and usage read with the token), run through the darwin launcher (tasks 8 and 9) with a check-only policy: no tools, no workspace, no network for any shell. Same outcomes, cancellation and crash recovery as Linux. No containment manager needed.
  • Darwin sign-in by link. The pinned CLI's setup-token in a pty under the darwin launcher, inside Turns, with the same prompt framing, code delivery (sealed), timeout and recovery as thin/signin.go. Keychain. Prevention first: launch with whatever S4 showed keeps the CLI off the Keychain (the token in the environment, CLAUDE_CONFIG_DIR set). Then detection: before and after, list the login Keychain's generic-password items by attributes only (security dump-keychain without -d, or find-generic-password without -w) and diff the lists. An item that appeared during the attempt is deleted only when it is positively the attempt's own: in the runner user's login Keychain named by path, with the CLI's service name (from S4) and an account the CLI derives for this connection's config dir. Delete it by service, account and keychain path (security delete-generic-password -s <service> -a <account> <keychain>). The connection is refused, and the credential hold stays set until a second listing shows the item gone. Any other new item, or one whose ownership is ambiguous, is never deleted: the hold stays, the connection is refused, and the Machines page names the item's service for the person to remove. An item present before the attempt is never touched; if one with the CLI's service name exists before the first sign-in, the worker refuses to add a connection and says so. The before-list is written durably before the pty starts, so a crash or cancel is cleaned up on restart.
  • Home guard (spec §8.3, item 1). Decide from ownership, mode bits and ACLs alone; never test by opening files as ourselves (P4's Exposed cannot see what another user sees). Pass only if all of these hold: - the home, state dir, config dir and accounts root are owned by the runner user; - none has group or other bits; - none has an ACL entry granting anyone else any right at all (read, list, search, readattr, readextattr, readsecurity, write, append, addfile, addsubdirectory, delete, delete_child, writeattr, writeextattr, writesecurity, chown), whether or not inherited; - each lies inside the home; - every ancestor from the home down to each root is a real directory (no symlink) owned by the runner user, with no group or other write bit and no such ACL grant, so nobody else can replace it. Read the facts with stat and ls -led (recorded outputs), or the ACL API through the seam. On failure, name what to change.
  • Taint gate (D2 default). A runner tainted on the instance or in its own state takes no model connection, and its EngineeringStatus says tainted.
  • The guard and the taint are checked when a connection is stored and before every use, not only once.

Tests first: TestDarwinTokenCheck (success, signed out, limited, cancelled, a crash then recovery), TestDarwinSignIn (code delivered, timeout, cancel, restart, a Keychain item created means refused, deleted by its exact attributes and the flag held until a second listing shows it gone, a pre-existing item untouched, a failed delete keeps the flag, an unrelated item created at the same time left alone with the hold kept, matching attributes in another keychain left alone), TestHomeGuard (0700 passes; 0750; an ACL grant to everyone; an ACL grant to one user; a write, writesecurity or chown ACL grant; an inherited grant; a root outside the home; a symlinked ancestor; an ancestor owned by another user; a mode changed between store and use), TestTaintBlocksConnections.

Mutations: accept group read; ignore ACL entries; skip the check before use; let a tainted runner store a token. Each must fail a named test.

Task 11. Worker connections, lifecycle routed by runner

Files: thin/run.go (runWorker: Conns, the seal key, hello connections), thin/conns.go, thin/connector.go; on the instance chat/connections.go, chat/runner.go (hello processing), chat_connections.go, connections_view.go and the templates.

Runner side: a worker at 36 opens Conns over its own accounts root, sends Connections and SealKey in hello, and accepts connect, cancel, sign-out and preference commands addressed to its runner id. It accepts only Claude token connections, by pasted token or by the darwin sign-in (task 10). Codex, API key and endpoint kinds are refused with a stated reason.

Instance side:

  • Every connection operation is routed by the connection row's runner_id: start, cancel, sign out, forget, preference delivery, usage, refresh. Today Cancel and Sign out use t.command to the primary (chat/connections.go), and the runner's Connector.remove selects by local ID and person, so a worker connection with the same local ID as one on the primary could remove the primary's. Fix both: command to the row's runner, and match (runner_id, local_id).
  • Hello processing (chat/runner.go) stops treating connections as primary-only. It upserts the connections of whichever runner sent the hello, scoped to that runner.
  • The Connections page groups rows by machine, the primary first. For a Mac worker at 36 it offers "Add Claude to <Mac>". The card seals to that runner's key. Needs you mac_connection links straight there.
  • D1 bookkeeping, a durable hold. From the moment a connection on a Mac enters connecting, the instance holds that Mac as "has a model credential" (used by task 15). The hold is released only when the runner reports the connection's files gone and no Keychain residue (task 10), not on file deletion alone. The runner keeps the same hold in its own state across restarts.

Tests first: TestContractWorkerConnectionLifecycle (thintest: start, cancel, sign out and preference on the worker never reach the primary; two runners with the same local ID; a sealed token for one runner cannot be accepted by the other); TestWorkerHelloConnections (thin: at 36 yes, at 35 none); TestWorkerTokenConnectionStored (thin: 0600 file in a 0700 home, refused when the home guard fails); TestWorkerRefusesOtherConnectionKinds; TestConnectionsPageGroupsByMachine (equipo); TestContractCredentialHeldFromConnecting (held through a refused connect that left a Keychain item, and across a restart, until both are gone).

Mutations: route Sign out to the primary; match by local ID only; show the add button for a worker at 35; store the token 0644. Each must fail a named test.

Task 12. Worker Engineering Exec, object scan, outbound pack

Files: thin/worker.go, split into worker_checks.go and worker_engineering.go to stay under the size budget; engineer.go (share stepPrompt, fixPrompt, rebasePrompt, commitMessage, splitHeadline, emptyStepReason); relay.go (the worker's upload); state.go (phases).

One attempt on a worker:

  1. Guards: specialist Engineering; owner; ValidHub; ValidTaskBranch; protocol 36 spoken; a bound, non-empty base; EngineeringStatus ready; XcodeAccess no stronger than its own trusted report allows. Anything else ends engineering_unavailable or policy_rejected, with nothing run.
  2. Take Turns. Record the marker. Lease (AuthorizeStep).
  3. Await the inbound pack. Compare the header with the step row (kind, base, old base, candidate). Index it. Check the pack's own inventory (task 4's method). Write the named commits to the store's shallow file, merging with what is there, so later rev-list and log commands stop at them.
  4. Prepare the tree under the scratch root from the worker store. A rebase round uses TaskTree.Rebase (merge-tree with the explicit merge base needs only the three commits).
  5. Pick a connection among the worker's own. Fail over among them on a limit or a sign-in refusal, as refused does on the primary, from a fresh tree each time.
  6. Run through the darwin launcher. Keep the session for fix rounds and asks. Fix rounds resume the kept session (fixSession) through task 7's transcript move.
  7. Commit with tree.Commit (Equipo Engineering identity, parent the base). Apply the same rules for unfinished, no-shell and empty results, and record the outcome (committed, unfinished, no-shell) in its own durable field, never in the transfer progress phase. Compute Apple from the changed files. Retain the candidate: copy its new objects from the task tree's private repository into the worker store (git --git-dir=<tree git> pack-objects --revs --stdout with ^base and the candidate on stdin, piped to git --git-dir=<store> index-pack --stdin) and pin it with a ref (refs/equipo/<task>/<step>/<attempt>) before anything else, so upload, restart, republish and asks never depend on the attempt's directory. The instance's forgetTask (today primary-only, chat/questions.go) also sends forget_task to every worker that holds the task's steps, and the worker honours its KeepUntil: the ref and kept sessions go at once when there is none, or when it passes.
  8. Object scan, before anything leaves. List the new objects (rev-list --objects ^base candidate) and read each with cat-file --batch: blobs (binary too; symlink targets are blobs), trees (file names) and the commit (message and identity). Search for each known secret of this worker (every connection's token, its runner credential, the seal key's private half), raw, base64 (standard and URL) and hex. Then run the pinned darwin gitleaks, offline, under srt with no network, over the changed files with the trusted configuration. Fail closed: a hit, a scanner error, an object over the scan bound (the 64 MB pack bound), or a list that cannot be read ends the step secret_in_candidate, and nothing is uploaded. Logs and reports name only the object id and its kind, never a path (a file name can be the secret) and never the matched bytes. Independently, the summary, headline, log tail and every report string are passed through the same known-secret redaction before they leave the worker.
  9. Record progress committed durably and report committed with the candidate and its outcome. The instance opens the outbound transfer. Upload the thin pack (pack-objects --revs --thin --stdout with ^base candidate) as blob frames. End done, pushed: false.
  10. A restart after committed resumes the upload and never launches the CLI again for that attempt.

Research hand-off: the quoted findings text arrives in the dispatch, as on the primary. Kept images are not relayed, and the prompt says the images stay on the main runner. Explore tasks run the same Engineering step; their preview runs on the primary from the published candidate.

Tests first (internal/runner/thin/worker_engineering_test.go, with the fake CLI and the process-group executor without a sandbox, testbuild only):

  • TestWorkerEngineeringCommitsAndUploads: to done, pushed: false; the outbound pack indexes on the primary (publishWorker) to exactly the candidate.
  • TestWorkerEngineeringRefusesGuards: one case per guard.
  • TestWorkerStoreShallowBoundaries: after two fix rounds and one rebase into the same store, git log and rev-list in the store succeed and stop at the boundaries; the thin pack builds.
  • TestWorkerEngineeringRebaseRound, TestWorkerEngineeringFixRoundResumes.
  • TestWorkerObjectScan: the fake CLI plants the token raw in a text file, base64 in a binary file, in a file name, in a symlink target, in the commit message (through its summary), and hex-encoded. Each is refused with nothing uploaded, and neither the log nor the report contains the token or the file name. Plus a gitleaks-detectable fake key, a scanner that exits with an error, an object past the bound, and the token in the CLI's summary text (redacted in the report).
  • TestWorkerCandidateRetained: after the attempt dir is removed and the runner restarts, the upload resumes, a republish works and an ask reads the candidate from the store.
  • TestWorkerForgetTask: a forget with no KeepUntil removes the ref and sessions at once; one with a later KeepUntil keeps them until it passes; TestContractForgetReachesWorkers (thintest) shows the instance sends it to the worker as well as the primary.
  • TestWorkerEngineeringRestartAfterCommit, TestWorkerEngineeringFailover.
  • TestWorkerChecksUnchanged: every existing worker checks test passes.

Mutations: skip the base64 form; scan only the diff; upload before the scan; ignore a scanner error; reuse the refused attempt's tree; relaunch after committed. Each must fail a named test.

Task 13. Ask the implementer, pinned exactly

Files: internal/equipo/chat/questions*.go (creation and dispatch), thin/ask.go, the worker's kept-session store.

  • Every runner reports the kept session id in its Engineering step report at 36 (StepReport.SessionID), and the instance stores it on the step (chat_steps.session_id, task 2).
  • When a question is created for an Engineering step, the instance freezes on the question row the Engineering attempt, account, session id, runner, base and candidate (task 2's columns) and sends them in AskCommand. Dispatch (nextQuestion), cancel (stopQuestion), replies (ownQuestion) and reconnect (syncQuestions) all read today's mutable step; each must use the frozen runner and values instead.
  • The worker keeps Engineering sessions per (step, attempt, account, session id) under its state dir, with the primary's retention. An ask resumes exactly the bound session on the runner that holds it, with the read-only darwin settings (task 8) and git_log, git_diff and git_show over its store (task 12's shallow boundaries keep them working). A different runner, attempt, account or session is refused.
  • An offline worker gets "Tito Studio is offline; ask again when it is back" (exists; extend it to a Mac-made step).

Tests first: TestContractAskBindsTheSession (thintest: a question created after a newer attempt that produced the same candidate is still bound to the attempt it was asked about, and a step that moved on after the question was created does not change its runner, base or candidate; the worker refuses the other); TestWorkerAskAnswersFromKeptSession; TestWorkerAskRefusesMismatch; TestWorkerAskCannotWrite; TestContractAskMacOffline; TestContractQuestionLifecycleFrozen (cancel, a reply and a reconnect sync after the step moved to a new attempt all address the frozen runner and attempt).

Mutations: choose the newest kept session; allow Write in the ask settings. Each must fail a named test.

Task 14. Shipped probes F1 to F7, P2 token sources, Engineering status

Files: internal/runner/mac/probe.go, a new probe_engineering.go, the fixtures under internal/runner/mac/fixtures/, thin/mac.go (macProbes), thin/capabilities.go.

The probes ship in the binary and run on the Mac as the runner user, inside Turns, as P1 to P7 do. They are reported in capabilities.probes and trusted only for this runner version, this settings profile, the verified pinned CLI, this Xcode version and its simulator runtimes, for under a day. Any change to those inputs means they run again. They need a Claude connection. They run as three short probe launches on the connection's small model, each prompted to run one fixed script with Bash:

  • launch A, under the no-Xcode Engineering settings: F1, F2, F3, F6, F7;
  • launch B, under the sandboxed-Xcode settings, only when P2 is denied: F5;
  • launch C, under the no-Xcode settings, last: F4, which cancels the launch.

Each launch's results are stored with the inputs it ran under. The status aggregates them only when every required result matches the current inputs. The verdict never reads model text. As in P2, every probe has a control that must succeed, a missing line is not a denial, and outside observers decide: a loopback listener, nonce sentinels, and the runner's own search of the probe tree. The probe tree is never committed, uploaded or logged, and it is deleted after.

  • F1 sandbox on, no network. Control: a nonce written to the probe tree must appear. A TCP connect to the runner's loopback listener, a DNS lookup of a name the runner watches, and an HTTPS request through the CLI's proxy must all fail, and the listener must see nothing.
  • F2 reads denied (shell). Nonce sentinels in the runner state dir, the accounts root, the connection's runtime copy, ~/Library/Keychains, another /Users/* home that P4 shows closed, and /Volumes. No nonce may reach the probe tree.
  • F3 the token is out of reach. From inside Bash, the script copies what each source yields into the probe tree: ps -E -p $PPID, ps -E of every own process, sysctl kern.procargs2 of the CLI's pid, launchctl getenv CLAUDE_CODE_OAUTH_TOKEN, env, and the token file read by path. The runner then searches the tree for the token (raw, base64, hex). Any hit fails F3.
  • F4 process group. The script forks a setsid child that sleeps. The runner cancels the turn; the marked sweep must end it, and the proof must hold.
  • F5 Xcode under Claude's sandbox. Runs only when P2 is denied. The P2 hostile fixture (run-script phase, SwiftPM build tool plugin, XCTest on the newest iPhone simulator), with F3's token sources added to each hostile part, is built and tested by xcodebuild from the Bash tool under the sandboxed-Xcode settings. Every sentinel read, token source, connection and Keychain read must be denied, and the build and test must complete (a failed build is not a denial).
  • F6 native tools. Prompted tool calls (Read, Glob, Grep, Write) on each denied path, through a symlink planted in the probe tree, and through a symlink swapped by a background process between calls. All must be refused, by the permission tool or the CLI, and no nonce may reach the probe tree. The swap race is retried 50 times.
  • F7 no Xcode without access. Under the no-Xcode settings, xcodebuild -list, xcrun simctl list and a Mach lookup of com.apple.CoreSimulator.CoreSimulatorService from Bash must all fail. Control: the same commands outside the sandbox succeed.
  • P2 gains F3's token sources in its run-script phase, plugin and XCTest, under the srt checks profile, so checks that run as the same user are proven not to reach the token either. P2 denied needs them denied.

EngineeringStatus is ready when the pinned CLI is verified, F1 to F4, F6 and F7 passed for the current inputs, the home guard passes, the runner is not tainted, and at least one Claude connection is usable. Otherwise it names the first missing input. F5 decides only xcode_access. The claude tag goes with ready. The Machines page shows F1 to F7 beside P1 to P7.

Tests first (internal/runner/mac/probe_engineering_test.go, recorded outputs and fakes): TestProbeLaunchesAggregate (a stale launch A with a fresh launch C is not ready), TestF1RequiresControlAndListener, TestF2NoncesDecide, TestF3AnySourceFails, TestF4SweepProof, TestF5OnlyAfterP2AndNeedsTheBuild, TestF6SwapRace, TestF7NeedsTheOutsideControl, TestP2TriesTheToken, TestProbeInputsInvalidate (a new Xcode build, a new runtime, a new CLI digest), TestEngineeringStatusOrder, TestProbeTurnVerdictIgnoresModelText (the fake CLI claims success in text while the sentinels say otherwise; the verdict follows the sentinels).

Mutations: take a missing line as denied; ignore the listener; give ready without a connection; run F5 before P2; keep a verdict across an Xcode change. Each must fail a named test.

Task 15. D1 across every connection state, views, copy

D1 default (spec §8.7; Paul may overrule). While the instance holds a Mac as having a model credential (task 11, from connecting until the files and any Keychain item are proven gone), it does not offer "Run outside the sandbox" for checks on that Mac (macsandbox.go). The worker refuses an unsandboxed dispatch (sandbox_unproven) while its own durable credential hold (task 11) is set, which covers token files, connections in progress and Keychain residue. Put the rule in one predicate (unsandboxedAllowed(runner)) on each side, so if Paul rules otherwise the change is that predicate plus a warning string. An unsandboxed choice already recorded on a waiting attempt is withdrawn when a connection starts, and the creator is told.

Views. The step line names the Mac when Engineering ran on a worker (house rule 2026-11-07.8: only when it is not the primary). Without Xcode access, the Engineering card says the Mac's checks build it. The new waits and Needs-you lines appear (mac_connection with its status reason, mac_update, waiting_base, workspace_too_large, secret_in_candidate). The Machines page shows F1 to F7, the home guard, the taint and whether Engineering can run there.

Copy (drafts; Luna reviews all of it, and Paul sees the user-facing card lines). Mark each string pending with scripts/copy-status.py pending and list it in 2026-11-28-mac-slice-f-copy.json in the copy-review skill's format, with key, where it shows, and draft. Starting drafts:

  • work.needs.mac_connection: "Needs you: %s needs Claude to make this change"
  • work.decide.mac_connection_why: "This change needs a Mac. %s is ready, but it has no Claude connection yet."
  • work.decide.mac_connection_ask: "Add Claude to %s and it starts by itself."
  • one line per other EngineeringStatus reason (signed out, limited, probes pending, probes failed, home open, tainted)
  • chat.connections.add_to: "Add Claude to %s"
  • work.needs.mac_update: "Needs you: %s needs an update to make changes"
  • work.reason.base_unavailable, work.reason.workspace_too_large ("the project is too large to send to the Mac"), work.reason.secret_in_candidate ("the change contained a secret, so it was not sent")
  • work.step.made_on: "Made on %s"
  • work.step.no_xcode: "Built and tested by the Mac's checks, not while making the change"
  • runner.mac.home_open: names what to change, for example "Other people on this Mac can open %s's home folder. Run chmod 700 ~ as %s, then try again."
  • work.decide.unsandboxed_withdrawn: why the outside-the-sandbox choice went away
  • the F1 to F7 probe names and verdict lines, following runner.probe.P1 onwards
  • the mac-placement-wait strings slice F makes untrue (work.needs.mac_engineering, work.decide.mac_engineering_why), rewritten for the switch-off case

Tests first: TestUnsandboxedNotOfferedWithCredential (thintest: from connecting through deletion, including a failed connect and a sign out), TestWorkerRefusesUnsandboxedWithToken (also with only Keychain residue left after a refused connect and a restart), TestUnsandboxedChoiceWithdrawnOnConnect, TestMacEngineeringViews (equipo: each line on the step, task, Needs you and Machines page). make copy-release-check keeps blocking release while copy is pending, which is correct.

Mutations: offer the choice while connecting; let the worker run unsandboxed with a token file present. Each must fail a named test.

Task 16. M9 and mixed versions on Linux CI

Files: internal/headless/mac_test.go (extend TestMacWorker), thin/fakeworker_testbuild.go, internal/fakeclaude.

The fake worker is the real thin runner under testbuild with EQUIPO_FAKE_PLATFORM=darwin/arm64, a fixture capability report with F1 to F7 passed and EngineeringStatus ready, the fake CLI, and the process-group executor without a sandbox. scripts/no-fake-worker.sh keeps it out of releases.

Scenarios, within the headless budget:

  • M9a a Woodstar-shaped repository (an .xcodeproj with a shared scheme, and an .equipo/gates.json gate that needs Xcode). Prepare base, then Engineering on the worker. The inbound pack is relayed, the fake CLI edits a Swift file, the worker scans, commits and uploads a thin pack, and the primary pushes. Change files and diffs appear, checks run on the worker, review runs on the primary, and Ready to merge asks (no auto-merge).
  • M9b a fix round from the checks output stays on the worker and resumes its session in a new worktree. A push failure, then Retry, republishes the same commit without running Engineering.
  • M9c a rebase round on the worker.
  • M9d ask the implementer answered on the worker; refused for another attempt; the offline line when the worker is stopped.
  • M9e the worker is SIGKILLed mid-Engineering: process-group termination, Retry on the same worker, done.
  • M9f the switch is off: the step waits and nothing reaches the worker.
  • M9g mixed versions, with binaries built from main at the branch point (cached as M8 does): a protocol 35 worker with a 36 primary, and a 36 worker with a 35 primary, both wait waiting_mac_update. A 36 worker against an instance rolled back to 35 downgrades in its hello, queues no protocol 36 command, and loses nothing.
  • M9h a secret in the candidate: refused, nothing pushed.
  • M9i a timed-out step on the worker: unfinished through publication, never shown as finished work.
  • The oficina/suite scenario and every slice 1 to 4 and A to E scenario stay green, especially Linux termination before Retry.

Task 17. Release, docs, make ci, whole-branch review

  • No new Mac artifact: the runner provisions the CLI (task 5), and the darwin gitleaks already ships. make release-runner and scripts/staged-artifacts.py stay green, and the Linux tool proxy digest is unchanged.
  • docs/mac-runner.md gains "Make changes on the Mac": the owner turns the switch on; the runner user fixes its home folder if the Machines page asks; the person adds Claude to the Mac and signs in. This is draft copy, so it goes in the copy JSON.
  • make ci once. Fix what it finds. Push.
  • Whole-branch Astra review (at most three rounds), then the controller report, and a handoff with task 18's runbook.

Task 18. Live witness on production (not the controller's to start)

Runs only after the parent has merged and deployed the release (scripts/upgrade-thin.sh, per AGENTS.md), the Studio has self-updated, Paul has ruled on D1 and D2, and the owner has set EQUIPO_MAC_ENGINEERING=1. The controller writes the runbook and the read-only checks, and runs none of the steps that change things.

Prerequisite: the Studio's P2 is denied (task 1). Otherwise checks there wait under D1, and step 3 cannot reach Ready.

  1. The Machines page shows the Studio at protocol 36, P1 to P7, the home guard and the taint. If the guard fails, Paul (or the runner user) makes the named change. That is his step.
  2. Paul taps "Add Claude to Tito Studio" and signs in (his step). F1 to F7 run, the Machines page shows them, and claude appears in the Studio's tags.
  3. The Woodstar swipe-back witness: a fresh "Fix the Woodstar iOS swipe-back bug" task, or a re-run of tklkbx5vid3y from 82a4a0cc. The base is prepared by docs-t1. Engineering runs on Tito Studio with xcode_access as F5 decided. The candidate is relayed and pushed by docs-t1. Checks on the Studio record xcodebuild test (or Woodstar's gate), a real exit code and 200 lines. Review runs on docs-t1. Any fix round runs on the Studio. One ask to the implementer is answered from the Studio. Ready to merge asks Paul, and nothing auto-merges.
  4. Read-only checks afterwards, as paulca: no marked processes left on the Studio (ps), the worker's step dirs swept, and the outbound transfer closed.

Pass means every line of step 3 happened as written. A Woodstar build that fails for Woodstar's own reasons still passes if the failure is reported honestly.

3. Risks and honest limits

  • sandbox-exec is deprecated. failIfUnavailable turns its removal into engineering_unavailable, never a silent unsandboxed run.
  • The claude process itself runs outside any sandbox on the Mac, as the runner user, and talks to Anthropic (the trust Paul granted, §4.4). Its native file tools are confined by permission rules (task 7), and F6 proves them live.
  • Without F5 the Mac makes changes it cannot build while it makes them. Checks build them, so each fix round costs a round trip. That is slower, not unsafe.
  • SwiftPM packages need network to resolve, and Bash has none. A project whose packages are not already in the runner user's caches fails its build with needs_network, honestly. A package mirror is later work.
  • The CPU is shared: one turn at a time per Mac, so a long Engineering step delays that Mac's checks.
  • have lists and thin inbound packs remain open (a slice B note). Engineering inbound packs are whole packs of the named commits, so large repositories hit the 64 MB bound early.
  • D1 and D2 are Paul's. The defaults are the safe ones, and the witness waits for his rulings.