oficina / equipo Public
Darwin progress: the Mac side of Mac runners (slice D, checks only)
Branch thin-v1-darwin from thin-v1-runners at 1b89bd1 (slices A and B, Linux). Spec: docs/superpowers/specs/2026-11-07-equipo-mac-runners.md rev 4. First Mac: tito-studio, user equipo-paul. Nothing here has run on a Mac: everything is tested on Linux with recorded outputs, fakes for srt and xcodebuild, and the test build's fake worker. Conventions as in RUNNERS-PROGRESS.md.
Done
- The runner builds for darwin/arm64. It did not: openat2, OPATH, pidfds, prctl, closerange, SOPEERCRED, the Linux pty ioctls and the boot-time clock. Each is behind a `linux.go
/_darwin.gopair; on macOS the bubblewrap-only calls refuse (ENOSYS). The containment launcher reaches unix throughcontainment/sysunix, soNamespaceMain's text and the certified launcher digest are unchanged.make build` (CI 05-build) cross-compiles the runner and the tool proxy. internal/runner/mac, the Darwin pieces: -ChecksSettings: the §4.4 srt settings over the §4.2 deny list, in srt 0.0.81's schema (read from its package:network.allowedDomains,deniedDomains,filesystem.denyRead,allowWrite,denyWriterequired;allowMachLookuptakes a trailing*). No network; writes only to the tree, the attempt's scratch, DerivedData and SwiftPM caches. Refuses globs, relative paths and a tree inside a denied place (srt's denyWrite wins over allowWrite). -Gate: process-group termination (§5): own session, marker, environment from scratch, caffeinate-w, SIGTERM, 10 s, SIGKILL, a sweep of marked processes (ps -Eon a Mac,/procon Linux),simctl shutdownof what the attempt booted, proof only when the group is gone and nothing marked is left within 30 s. After a restart a reused group id is killed only if a marked process is in it. - Capabilities fromxcodebuild -version,simctl list -j, swift, node, srt, claude; thexcodebuild testgate for a project with no gate (one shared scheme or the one named like it; newest iPhone simulator by UDID; DerivedData in scratch; no signing; several candidates or none ischecks_unavailable). - Probes P1 to P7 and the hostile fixture (run-script phase with Xcode's own script sandbox off, SwiftPM build tool plugin, XCTest), shipped in the binary. P2 isdeniedonly when every attempt of every place says denied and nothing outside contradicts it: a loopback listener per place catches a connection behind a "denied" line; DNS and Keychain controls run outside first; a missing line is not a denial. P3 and P5 say why they did not run. - The launchd agent; the installer's account refusals; the pinned srt lockfile (npm ci, every package by integrity).- Wire (protocol 2, omitempty, dropped at protocol 1):
capabilities.probesandstep.checks_sandbox. Fixturesframes/hello-mac-probes.json,frames/step-mac-checks.json. - Worker on a Mac (
thin/mac.go): each attempt's gate follows the newest probe report; trees under the scratch root (outside the denied state dir); probes run at start when the report is not this version's and profile's, steps wait for them;equipo-runner probeon demand; self-update to the instance's release (darwin target, digest, swapped while no step runs, exit 75);run --env-file. The test build's fake worker now runs the Mac gate; it labels its checks none (it has no sandbox) unlessEQUIPO_FAKE_SANDBOX=seatbeltmakes it play a Mac whose P2 denied, asTestMacWorkerdoes so that Equipo still merges its scenarios on its own. - Install:
install-v1.shdispatches onuname(Darwin/arm64: refuses root, reads the darwin target with plutil, checks shasum);equipo-runner installon a Mac refuses root, administrators, users not namedequipo-*, another user's home and a readable foreign home, copies the runner, installs srt, writesrunner.env, enrols (the link carries the code), loads the agent.GET /install.shiscurl -fsSL https://<instance>/install.sh | sh. - Release:
make release-runnerbuildsdarwin-arm64/beside the Linux runner (and checks it for the fake worker);install-manifest.jsongainstargets; the instance serves the Mac files when they match;staged-artifacts.pyrecords both targets. - Instance: migration 0055
chat_steps.checks_sandbox; a worker's checks carryseatbeltornone(anything else is none); step and task show it; "ran outside the sandbox" on the checks line, badge, timeline and Ready to merge card; the primary's checks are never labelled. The runners view (Connections, Machines) shows platform, where checks run and each probe. One-tap enrolment page. - Docs:
docs/mac-runner.md, Paul's four steps.
Tests (each seen failing first or by a mutation, list below): TestChecksSettings*, TestGate*, TestParseMarked, TestCapabilitiesFromRecordedTools, TestXcodeGate, TestRunProbesAllDenied, TestP2IsDeniedOnlyWhenEverythingIs, TestJudgeP2, TestP4, TestFixtureShips, TestACSleepAndNode, TestRefuseAccount, TestReadAccount, TestHomes, TestLaunchAgent, TestSRTPinned, TestMacWorkerConfig, TestWorkerMacReports, TestMacChecksPick, TestMacProbesStart, TestMacFind, TestMacUpdater, TestInstallMacRefusals, TestInstallMac, TestEnvFileAndExits, TestMacInstallShell, TestInstallPackagingDarwinTarget, TestStagedArtifactsGate (extended), TestCapabilitiesGuard and TestEncodeProtocol1IsTheSlice4Wire (extended), TestContractChecksPlacedOnTheWorker (extended: darwin capabilities with probes, the label, the primary unlabelled), TestChecksOutsideTheSandboxAreLabelled, TestRunnersViewShowsProbes, TestInstallScript, TestEnrolmentLinkIsOneTap, TestOnboardingPairingBound (extended). TestMacWorker (headless, M1/M2/M4/M5) passes on the shared gate.
Mutations, each killed: profile (Keychains dropped, install dir not denied, nesting check off); gate (status file ignored, sweep off, reused group killed, shutdown of what was already booted, inherited environment, proof with marked left); capabilities (unavailable simulators, xcode tag without Xcode); xcode gate (two projects, two schemes); probes (accepted connection ignored, missing line as denied, DNS control ignored, sentinel kept, path in P4, srt-ran without the build); account (admin), launchd (SuccessfulExit); thin (same-version update, digest ignored, swap without the step lock, pick, probe rerun, bash path, reason ignored, label dropped, ready ignored); install (readable home, account, Intel, srt path, launchd exit); script (root, version, digest length, Darwin/Intel); release (darwin served when tampered, staged darwin, target version); instance (worker label on the primary, seatbelt default, task label); views (label, probes); config (overlap); enrolment link.
Astra round 1 (45b6335), fixed
- P2 on the simulator: the hostile test runs on the newest iOS simulator (none: P2 unavailable) and tries the host's login keychain file from there; denied needs the build and test completed under srt and the end proven. P6's test hashes and writes files until killed.
TestP2NeedsTheSimulatorAndAProvenEnd. - Unforgeable verdict: the report lives only in the worker's memory; nothing on disk is read back as a verdict;
equipo-runner probeonly asks for a new run. Trusted while this version's, this profile's, made with the srt, Node and ripgrep on disk now (fingerprint) and under a day old; otherwise checks run labelled outside the sandbox and the probes run again.TestMacProbesTrust,TestSRTFingerprint. - Record before running: marker recorded before anything starts (the worker's git processes carry it too), group recorded once it exists, nothing runs or the group is killed if a record fails; recovery never takes an unrecorded attempt as ended (UnrecordedStep, settled by the marker on a worker, by "no namespace left" on Linux).
TestGateRecordsBeforeRunning,TestGateVerifyByMarkerAlone,TestWorkerRecordsBeforeRunning,TestStepRecoverUnrecorded. - Homes: closed only if this user can neither list, traverse (a missing name answers "not found" to a searcher) nor open a usual file; symlinked homes and their targets; a /Users that cannot be read stops the installer, fails P4 and denies all of /Users.
TestHomes. On Linux the file-read check is not separately testable (reading needs traversal), on a Mac ACLs could differ. - Reinstall stops the agent before replacing anything; the enrolment check then gets the state lock.
TestInstallMacAgain. - Worker only: the Mac says so when it begins enrolment (
worker_only, migration 0055runner_enrolments.worker_only); the instance refuses to show or approve it for a person with no primary ("Add your main runner first"). The runner refuses a welcome as primary (the runners round's ErrRoleMismatch).TestMacEnrolmentNeedsAPrimary,TestWorkerEnrolRefusesAnOlderInstance. - Output: 200 lines of at most 4 KB, enforced on every write.
TestTailIsBounded. - The env file's values reach the Mac host (Options.Getenv), and every tool it runs gets the runner's Node and ripgrep first on PATH.
TestMacHostPaths. Also: Linux-only tests carry a linux build tag andmake vetvets the runner for darwin/arm64. Merged thin-v1-runners d7c803b, then 15feb20 (enrolled role file, cancel before withdrawal, two-phase removal). A Mac also checks the role the instance put in its enrolment credential: anything but worker keeps nothing (ErrEnrolledAsPrimary) and the installer says to add the main runner first (TestEnrolKeepsTheRole,TestInstallMacEnrolledAsPrimary).
Astra round 2 (be0f1e3 and 9e407e2), fixed
- Forged approval: the tools srt runs on are checked against pins compiled into the runner, not a fingerprint taken at run time: ripgrep's and Node's programs as the pinned archives unpack them (
RGBinarySHA256,NodeBinarySHA256) and the srt package treenpm cimakes from the shipped lockfile (SRTTreeSHA256; the same with npm 11.17 and Node 22.23.4's own npm 10.9.9), each at its installed place and srt's .bin link at its fixed target. Checked before and after every probe run and before every sandboxed check; the installer checks them too. A runner is tainted for good once any check runs outside the sandbox (labelled none): it never labels a check sandboxed again, whatever a later probe says. The taint is kept in the state dir and by the instance (runners.tainted_at, set from a tainted hello or any worker check labelled none, never cleared; the instance labels a tainted runner's checks none whatever it reports, and says tainted in every welcome). The runners view and docs/mac-runner.md say so.TestVerifyToolsRefuses,TestVerifyToolsReal(with the real archives and npm tree, run here: a one-byte counterfeit srt, a moved ripgrep and a re-pointed srt link all fail),TestMacCounterfeitSRT,TestMacTaintIsSticky,TestContractWorkerTaintIsSticky,TestInstallMacVerifiesThePins. - Reinstall: an agent launchd has is booted out, and a refused bootout stops the installer at once; it then waits, bounded, until launchd no longer has it and the state lock is free, or changes nothing and says so.
TestInstallMacWhenTheRunnerWillNotStop. - Archive links: entries are created through an os.Root; no symbolic or hard link from an archive is ever made; Node's npm and npx links are made afterwards with fixed targets, corepack is left out.
TestFetchMakesNoLinksFromTheArchive(the chained-link archive).
Env-gated tests (the real archives and npm tree are not downloaded in CI) were run here and pass.
Restage finding: the tool proxy
make release refused b4a3b6d: the darwin portability edit to internal/toolproxy (OPATH behind a per-OS constant) changed the Linux tool proxy's bytes, and its digest is certified. internal/toolproxy is back to exactly its 1b89bd1 source; the runner reaches it only on Linux (ServeToolProxy in toolproxyservelinux.go), and the Mac release has no tool proxy (a worker has no coordinator to serve). The darwin target names only the runner. TestToolProxyIsTheCertifiedBuild builds the tool proxy as the release does and compares it with the certified digest, so CI catches this from now on.
The Mac user's name (Paul, 2026-11-10)
macOS's Add User dialog made paulequipo from "Paul Equipo". The installer now accepts any Standard, non-root user whose short name contains "equipo" in any case (paulequipo, equipo-paul, paul-equipo); admin, root and home isolation are unchanged. Otherwise it says "Equipo runs in its own Mac user so it can't reach your files. Create a Standard user with 'equipo' in its account name, then run this again." TestRefuseAccount, TestInstallMacAddUserDialogName.
Decisions
- P2 not denied: checks still run (ruling 2), labelled none. If the fixture at least built and tested under srt, srt still confines them (the boundary is unproven, not absent); otherwise they run with no sandbox. Only P2
deniedis labelled seatbelt. - srt exits 0 when its command dies of SIGTERM (cli.ts). A pass needs srt's exit and the status the gate's shell recorded both 0.
- launchd restarts only after a non-zero exit (KeepAlive SuccessfulExit false): an update exits 75; a superseded runner exits 0 on a Mac (3 on Linux). The spec said "exits 0 for KeepAlive"; that would also restart a superseded runner into a lease fight.
- srt is installed privately (
~/.local/lib/equipo-runner/srt,npm cifrom a shipped lockfile), notnpm install -g: a Standard user cannot write Homebrew's global prefix, and the lockfile pins every package. - What srt needs on macOS, per its README and package.json: ripgrep, and Node.js 22.12 or later to run (
sandbox-execis built in). A Standard user cannot use Homebrew, so the installer fetches both from their official releases into~/.local/lib/equipo-runner/tools: ripgrep 15.2.0 (ripgrep-15.2.0-aarch64-apple-darwin.tar.gz, sha256 3750b2e9...973e4, the release's own.sha256asset) and Node v22.23.4 LTS (node-v22.23.4-darwin-arm64.tar.gz, sha256 c9e1dbc7...b66428, from SHASUMS256.txt), both re-checked by downloading them. The digest is checked before anything is unpacked; unpacking keeps every entry and symlink inside the archive's root. ripgrep's binary links only libSystem and libiconv. The runner puts both first on its own PATH and the gates' (srt starts throughenv node).TestToolPins,TestFetchChecksTheDigest,TestFetchKeepsToTheRoot; with EQUIPOTOOLARCHIVES set,TestFetchRealArchivesunpacks the real archives (it did, here). - No
claudetag on a Mac until slice F: nothing but checks is placed there. - Mach services are candidates (
com.apple.CoreSimulator.*,com.apple.dt.*,com.apple.testmanagerd*,com.apple.coresymbolicationd); P2 shows whether xcodebuild runs with them. The list is never widened automatically. - The plist is generated per user by the installer, not shipped as a file.
/install.shnames the team id the runner enrols with (no secret; a person still approves).
Only the Mac can show
Everything Seatbelt and Xcode do: whether the profile lets xcodebuild test reach the simulator (the Mach list), whether code run by XCBBuildService, CoreSimulatorService, the plugin or the test inherits the sandbox (P2's question), Keychain reads from inside srt (srt allows securityd, so P2 probably fails on the Keychain and brings ruling 2 in), ps -E and simctl outputs (recorded shapes), the fixture's first build, pmset on a Mac Studio, launchctl bootstrap as a Standard user, xcodebuild -runFirstLaunch without admin (likely refused; ignored), the darwin binary's ad-hoc signature, srt needing ripgrep on macOS, the self-update swap under launchd.
Open issues
- A likely fifth step: macOS homes are often listable by the
staffgroup. The installer then stops and names the ACL that shuts out only the Equipo user (sudo chmod +a "<user> deny list,search,readattr,readextattr,readsecurity" <homes>, undone withchmod -aand the same entry). P4 reports it too. - Auto-merge: until slice 4c's rule for checks outside the sandbox exists (passed only for the creator's own repositories, spec §4.3), Equipo never merges those on its own; it asks "Merge <title>?" (
TestContractChecksPlacedOnTheWorker). - Sandbox violations are not tailed from
log stream(§4.5); P2 does not read the unified log for the Mach services xcodebuild was denied. - CI under load: A5 (headless connections) saw "signed out" while the Codex home was still being deleted (the instance infers signed out from the hello the runner sends once the binding is dropped); the test now waits for the home.
make testpasses-timeout 15mso the headless package's 720s budget, not go test's 10-minute panic, judges it on a loaded runner. - Tool discovery skips
npm root -gand a login shell's PATH. - An srt, Node or ripgrep pin change needs the installer run again; self-update swaps only the runner.
Installing under su or sudo (2026-11-10)
Paul's first install, from sudo su paulequipo, stopped on TMPDIR: parameter null or not set. Neither installer now needs anything from the environment:
install-v1.shworks in$TMPDIRwhen set, else the user's own temporary folder (getconf DARWIN_USER_TEMP_DIR), elsemktemp -d, else a private folder in the user's own home (~/.cache/ equipo-bootstrap). On a Mac it sets HOME from the user directory (dscl) before handing over, and appends the system folders to PATH.TestMacInstallShellUnderSuruns it with TMPDIR unset and HOME set to another user's home (fails on the old script with Paul's error).equipo-runner installreads the home fromdscl(mac.ReadHome), never$HOME, and runs npm and xcodebuild with HOME, USER and LOGNAME of the user (userEnv).TestInstallMacIgnoresInheritedHome; mutations (home from$HOME,userEnvkeeping HOME, xcodebuild given$HOME) fail it.- Before changing anything it checks the login session (
launchctl print gui/<uid>); without one it says "Log in as <user> on this Mac (fast user switching) and keep it logged in, then run this again." (runner.mac.not_logged_in). Fromsudo -iuit installs when the session exists. Refusal case "logged out"; removing the check fails it. - The home-isolation message now suggests the targeted ACL instead of
chmod 700(TestInstallMacHomeACLMessagechecks the exact text). The isolation check already counts an ACL deny as closed: it tries to list, pass through and open a file in each home and counts only permission denied as closed.
Enrolment that waits and says why (2026-11-10)
Paul's install printed the link (H0SNVFN19S), polled staging from 11:58 to 12:06 UTC, then ended on "Runner installation is unavailable." The enrolment row shows it was never approved (no page load or approve POST after 11:58; last good poll 12:06:23). The next poll, at 12:06:28, got a 5xx; any answer other than 200 or 409 ended runner.Enrol, and neither the instance (no log line for a 503 to a device) nor the installer (the bare unavailable line) said what it was. The approval path itself works for a Mac joining a person with a Linux primary (TestMacEnrolmentApprovedAfterAPrimary).
runner.Enrolwaits out no answer, 5xx and 429, backing off from the poll interval up to a minute, until the code expires; the protocol question and the start of the enrolment are tried up to four times. A 5xx on the protocol question is no longer "the instance is older".- 403 is "expired" within a minute of the code's expiry, "turned down" otherwise; running out is "expired", unless it was still failing, which is reported as that failure. Expired or turned down, the saved code is dropped so the next run gets a new link.
Config.EnrolNotifyhears "waiting" once and each retry; both installers print "Waiting for you to approve…", each retry with its cause, and at the end the expiry, the refusal or "Adding this machine to Equipo failed: <cause>" before the unavailable line; the same lines go to the install log (~/Library/Logs/equipo-runner/install.logon a Mac,install.login the runner root on Linux). Causes are the HTTP status and error key or the network error: never a body.- The instance logs a server error on the two device routes, with the route and the error (
TestEnrolmentServerErrorIsLogged). - Tests:
TestEnrolWaitsOutTransientFailures,TestEnrolEndsInWords,TestInstallMacEnrolmentInWords. Mutations shown failing: transient never retried, a 5xx protocol answer taken as older, turned down reported as expired, the used code kept, the last failure hidden by expiry. - Open: the approve button's confirmation lasts five minutes, the code ten. Tapping a page opened more than five minutes earlier is refused ("You do not have access to this page"); opening the link again works.
Copy for review
All marked COPY ACCEPTED FOR NOW and listed in the plan 3 inventory: runner.mac.* (installer lines, runner.mac.not_logged_in and the ACL wording of runner.mac.home and runner.enrol.* added 2026-11-10), runner.add_title ("Add %s to your team"), the runners view (runner.platform, runner.checks_run, runner.sandbox.*, runner.probes, runner.probe.P1 to P7, runner.verdict.*), work.checks.outside_sandbox ("%s, ran outside the sandbox"), and docs/mac-runner.md.