Employee Mac CI pilot
PR Checks can offer each planned frontend or backend Vitest shard and a group of TypeScript and lint checks to one consenting Mac. The default is Blacksmith. The pilot uses the existing Vitest graph, shard list, Actions queue and required check. There is no new scheduler, dashboard service or deployment.Placement decision
HTCondor uses owner activity and machine state to decide when to admit, suspend and vacate work. Incredibuild lets owners limit helper cores. We use local admission and withdraw the worker on owner return. Resuming a suspended Node process on another Mac would require its heap, open files and subprocesses. Restarting one immutable file list is simpler. HTCondor execution-point policy · Incredibuild helper controls A distributed compiler does not naturally divide a TypeScript program graph, a Turbo dependency build, or a Vitest environment. Per-test dispatch would repeat checkout, install and graph startup. Large related selections already write disjoint file lists. A worker can consume one list with the existing test command. Small selections finish in the planner. Backend setup generates its native Prisma client. The separate #13041 comparison reports matching results for all three backend shards on its trusted revision. Recheck its macOS path fix before enrolling a backend workload. Outside the approved pilot revision, full frontend shards retain the office route from #12986. On the pilot revision their fallback uses Blacksmith. Graphite optimization, queue checks and the priority controller still apply. GitHub selects a matching online runner and can requeue an unaccepted assignment. A self-hosted job can remain queued for 24 hours. A job execution timeout cannot bound pickup. The pilot dispatches one separate main-branch workflow and obtains its run ID from the REST response. Only a small hosted coordinator holds Actions write permission. It runs main’s script and receives no PR checkout. The Mac gets read access to the source, PR metadata and one run’s artifacts. Runner routing · Dispatch APITrust and enrollment
- Obtain the owner’s consent for one session. Confirm the Mac can run current Actions, Bun, Node 20, Git with Command Line Tools, Python 3, gh and jq. Use a dedicated standard account named
moda-ci, with no personal login, keychain items, sudo, production access, Full Disk Access, SSH agent, mounted home shares or access to other VM services. Use restricted network access to GitHub, package registries and required tool downloads. A local subnet check is a placement hint. VPNs and overlapping subnets can match it. - An organization administrator must restrict the runner group
moda-employee-macsto this private repository and selected workflowModaLabs/ModaObservability/.github/workflows/employee-mac.yml@refs/heads/main. Protect main. Verify the effective group policy before registering any device. If the plan lacks selected-workflow restrictions, leave enrollment disabled. A label or a same-repository PR alone cannot protect the device. Native processes can read everything the service account can read. Ephemeral registration limits pickup to one job. It does not clean the disk or isolate hostile code. Only approve code and dependencies trusted to run under this account. Workflow group restrictions · GitHub secure use - Use GitHub’s organization New self-hosted runner instructions for the detected OS and architecture. Verify its published download checksum. Configure a fresh private runner directory with the group’s short-lived registration token and flags
--ephemeral --runnergroup moda-employee-macs --labels employee-mac-pilot --name <unique-device-session>. Keep the registration token, any admin login and personal environment out of the worker. Launch from a clean login as the CI account. Do not install a persistent service. Use a protected copy of the launcher from main outside the checkout. - Run
python3 worker.py --office "$OFFICE_CIDR" --runner "$RUNNER_DIR". Without--runnerthe script only checks admission. Supply the network assigned by the office operator. The foreground launcher waits up to 15 minutes for ten minutes of input inactivity. It requires AC, the office route, normal memory pressure and headroom. It holds one account-wide session lock. It samples eligibility every five seconds while the listener runs. Owner activity, unplugging, leaving the network, pressure, or Ctrl-C withdraws the listener. It signals the process group and allows 15 seconds to exit. Disconnecting an offline host can delay GitHub’s completion signal. - Drain by letting the single job finish and declining another registration. To pause immediately, stop the foreground launcher. Remove any offline registration in organization Actions settings. Clean the dedicated work directory, caches and any remaining CI-account processes before re-enrollment. A worker that leaves processes behind after interruption requires inspection. No change to lid, sleep, personal accounts or existing VMs is needed. Adding a second owner uses the same group and a new session name.
Budget and first run
The launcher reads logical CPU count, physical RAM, free pages, page size, idle time, power, route and memory pressure on that machine. It reserves at least 4 GiB of free memory. It selects the smaller of one quarter of RAM and free memory above that reserve. A slot needs at least 4 GiB of allowance and four logical CPUs. Its Vitest worker count is bounded by one quarter of the logical CPUs and by the memory estimate. It sets a V8 heap target per process and serializes Turbo build tasks. Free pages exclude reclaimable cache, so a healthy Mac can decline work. These are admission and concurrency controls. Nice priority, worker count and old-space size do not cap peak process-tree CPU, native allocations, swap or I/O. The OS can schedule a single process on several cores. For an owner who requires enforceable bounds, keep native enrollment off. A separately approved isolated guest can bound guest CPU count and guest-visible RAM. It still has host overhead. This pilot does not provision guests. Apple virtual CPUs · Apple guest memory An administrator reviews the exact synthetic merge commit, including workflow and dependency changes, before setting repository Actions variableEMPLOYEE_MAC_APPROVED_SHA to its full SHA. Obtain it from the PR merge ref. This is a one-revision grant. Use a new PR Checks run (for example reopen the same PR after setting the grant, then verify its merge SHA). A new merge SHA requires fresh approval. Clear the grant after the pilot. Select a PR whose planner emits an affected full shard, a related shard, or the TypeScript Checks job.
Priority, fork and Graphite queue runs go straight to hosted for this shard. Only attempt one can dispatch. At pickup the protected workflow checks the current PR, merge SHA, live priority, parent workflow, base/head, attempt and coordinator job. Each parent and workload key has a separate child concurrency group. Each coordinator polls its children concurrently. The coordinator accepts only its returned child ID and attempt one. The worker installs the frozen lockfile without Turbo credentials. The parent checks the immutable SHA, parent, attempt, workload key and returned child ID before accepting evidence.
- Full frontend and backend shards run the package’s full CI test entry point with the planned index and total. The Linux parent discovers the expected files using the installed Vitest sequencer. Related shards use the existing parent file-list artifact. Small related selections that execute in the selection job stay hosted. Both paths require matching JUnit file coverage and counts. A skipped case, bad report or missing artifact falls back to hosted. Suites with routine skips can therefore produce little or no saving.
- The static worker builds upstream dependencies and runs lint and typecheck for the nine explicitly listed TS packages in
scripts/ci/employee-mac/workload.mjs. Each command must match the approved script shape and exit zero. The receipt lists every completed package and task. Only an exact receipt removes those packages from the hosted lint/typecheck invocation. Affected tests/builds, architecture checks, Python tasks, Prisma generation and guards still run hosted. The separate clean-tree Vercel typecheck remains a Linux parity gate. - The pilot can dispatch several units at once. A Mac still accepts one ephemeral job per session. Units that miss the pickup window fall back independently. The coordinator waits for its batch before releasing dependent hosted jobs. Budget its billed time and the extra planning/install cost when comparing runs.
Failure, recovery and cost
- No pickup by 90 seconds, or no terminal result within 12 minutes of dispatch, triggers a force-cancel request and hosted execution. These bounds start when the hosted coordinator runs. GitHub or Blacksmith scheduling can delay real pickup. An API error also selects hosted. A lost dispatch response is never retried. A late worker checks that the coordinator is still active.
- A local test failure gets hosted verification in the original hosted job, on its original merge SHA with its original list. The local test failure still fails the gate if Linux passes. The child retains its log and JUnit artifact. Setup failure, lost worker or unavailable evidence requires a successful hosted check. There is no retry loop. A cancel race or disconnected process can briefly overlap with hosted work. A canceled parent cannot grant a pass to a later attempt.
- To roll back, clear the grant and apply
ci:priorityto an active PR. The existing controller cancels and reruns PR Checks at the same revision. Full-run retries execute this pilot shard on hosted. Stop enrollment and remove the group registrations. GitHub rerun identity - The parent coordinator logs the child ID, placement outcome, elapsed time and observed pickup delay. Compare GitHub’s job creation/start timestamps to separate queue time from setup. Keep the owner’s local pressure/withdrawal reason and worker/heap settings with the pilot record. Count fallbacks per dispatched child. Deduplicate by parent run, attempt and shard. A heartbeat proves neither availability nor a passed test. CI dashboard limitations
- Measure actual billed hosted minutes for all coordinator, result-import and fallback jobs. Compare with a matched hosted shard of the same SHA and list. Report both observed totals and the estimated difference, including whole-minute rounding and CPU tier. Count an avoided hosted test execution only when Mac evidence was accepted. Mac elapsed minutes do not measure hosted savings. The coordinator itself consumes hosted minutes while polling, and the other related shards currently wait for its answer. Expand only if measured net cost, queue delay and owner experience justify it.