Repository navigation
feat(osx): run the Mac's fleet account as a self-hosted CI runner that yields to its owner - #238
Merged
Merged
Conversation
…unchd agent The account only logs in over ssh, so it has no gui/ or user/ launchd domain and no sudo. The crontab starts each gate at boot and re-checks it every few minutes through a start script that does nothing when the gate already runs.
…dir, poll the start test
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
PR-Agent run 43168395071.1 on ec0369d: success |
Owner
Author
|
@cubic-dev-ai review this PR |
@inkatze cubic can't start this review because your workspace has reached its free monthly review limit. cubic has reviewed 40,041 of the 40,000 allowed lines of code this month. Reviews resume on 2 December 2026 (in 21 days). Paid plans include much higher monthly review limits. Upgrade now to resume reviews. To help optimise your usage, you can tune cubic to get the most out of your usage limits:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Mac's fleet account can now act as a self-hosted GitHub Actions runner for
inkatze/dotfiles,inkatze/planwrightand any repository listed in the machine-local file~/.config/dotfiles/runner-repos(private names stay out of this repo). dotfiles' ownlintjob uses it for pushes to main.Runner role (
roles/osx/tasks/offload-runner.yml)~/actions-runners/<owner>-<repo>, labelsself-hosted,macOS,mac-fleet. Runs niced (Nice 10, background, low-priority I/O). No sudo, no Homebrew, nothing in the owner's account; the offload guard test now covers the new task file.ghlogin (POST /repos/<owner>/<repo>/actions/runners/registration-token), held in ano_logtask and handed toconfig.shthrough its environment only; never written to disk or logs. A directory that already has a.runnerfile is left alone. The fleetghlogin needs admin on each repository and thereposcope.runner-gate.sh, started byrunner-start.sh): the fleet account only logs in over ssh, so it has no launchd user domain. Two crontab lines per runner (@rebootand every 5 minutes) callrunner-start.sh, which starts the gate detached and niced and does nothing if that gate already runs. The gate runs the listener in--oncemode, only while keyboard/mouse idle time is at least 300 s (osx_runner_idle_seconds) and the one-minute load average is under 6 (osx_runner_load_max). Whichever account owns the console does not matter: a Mac left logged in and untouched serves jobs. Otherwise, with no job started, the listener is stopped and the runner shows offline. A job already running is never interrupted: it finishes niced, and nothing new starts afterwards. A job assigned in the instant the owner returns can be dropped by GitHub as a lost runner and needs a re-run.Workflow (
.github/workflows/test.yml, separate commit)lintcan use the Mac, and only for a push to main ofinkatze/dotfiles.teststays onmacos-lateston purpose: it runs the roles for real against$HOME(symlinks, defaults, Homebrew, sudo), which the fleet account must never take. Thebrew install coreutilsstep runs on hosted runners only.runs-onselects the Mac only when the repository isinkatze/dotfilesand the event is a push (the workflow's push trigger ismainonly). Fork PRs and forks' own pushes getmacos-latest. The workflow has nopull_request_targetorworkflow_runtrigger and must never route either to the self-hosted label.lintjob is queued while the Mac yields or is offline waits (no automatic fallback;timeout-minutes: 30bounds only the run). That gates no merge. Tried instead of a token: routing pull requests to the Mac (rejected, since a queued PR job cannot fall back), and a queued-timeout rerun on hosted runners (needs an API token to see runner status; not done)..github/workflows/test.yml; whichever lands second forward-merges main. Thetest.ymlchange here is its own small commit.Open before ready
Nothing open from the Mac exercise: the crontab starter was exercised as the fleet account over ssh (scratch copy under
~, a stubrun.shthat sleeps, a stubioregonPATHreading a file, load 5.10 before starting; nothing under~/actions-runners, no runner registered, no crontab line added since cron itself was confirmed earlier).runner-start.sh <dir>(RUNNER_POLL_SECONDS=2,RUNNER_LOAD_MAX=100, idle reading 400 s) printedstarter-exit=0, andpsshowedbash .../runner-gate.sh .../runner.psagree),~/.cachehelddotfiles-runner-runner.{err,out,pid}, both logs empty, andstub.logread22:18:20 stub run.sh started --once.sleepwas gone and the gate still ran. Back to 400 s idle: 8 s later a new stub was running andstub.loggained22:20:19 stub run.sh started --once.psprintedNI 20for the gate (started undertaskpolicy -bplusnice -n 10); a plainnice -n 10process printedNI 15on that Mac, so the exact nice value was not confirmed, only that the gate is not at the default priority.diffagainst the snapshot printedcrontab-unchanged:Operator items
gh auth refresh --scopes repoover ssh, and the fleet login needs admin on each repository.lintjobs queue serially.Convergence: polish applied one comment rewrap; one Gemini panel pass on this run (three findings validated and declined: the push trigger is main-only, and two are pre-existing and outside this diff), nothing applied.
Step records
Steps at
pre-implementation(run000004)Ended on
db86d378ec7e.Steps at
pre-ci(run000004)Ended on
db86d378ec7e.Steps at
convergence(run000004)Ended on
9c89a3532ee8.Steps at
pre-pr(run000004)Ended on
9c89a3532ee8.Steps at
pre-implementation(run000005)Ended on
cd56e01b0d85.Steps at
pre-ci(run000005)Ended on
cd56e01b0d85.Steps at
convergence(run000005)Ended on
ec0369d7014c.Steps at
pre-pr(run000005)Ended on
ec0369d7014c.Steps at
post-pr(run000005)Ended on
ec0369d7014c.Summary by cubic
Turns the Mac's fleet account into a self-hosted GitHub Actions runner that only takes jobs while the Mac is idle, so the owner is never squeezed out. One runner per repository (
inkatze/dotfiles,inkatze/planwright, plus allowner/repolines in~/.config/dotfiles/runner-repos), each in~/actions-runners/<owner>-<repo>with labelsself-hosted,macOS,mac-fleet, running niced with no sudo, no Homebrew, and nothing in the owner's account.Runner gate
runner-gate.shstarts the listener only while keyboard and mouse idle time is at least 300 s (osx_runner_idle_seconds) and the one-minute load average is under 6 (osx_runner_load_max), whoever owns the console.runner-start.sh, called from the account's crontab at boot and everyosx_runner_recheck_minutes, keeps the gate running and does nothing when it already runs, outliving any ssh session.ghlogin at run time, live only in ano_logtask's memory and the registering command's environment, and are never written to disk or logs; a directory that already has a.runnerfile is left alone.Workflow routing
lintuses the Mac, and only for pushes to main ofinkatze/dotfiles; pull requests and fork pushes stay onmacos-latest, with nopull_request_targetorworkflow_runtrigger.teststays on hosted runners on purpose: it runs the roles for real against$HOME(symlinks, defaults, Homebrew, sudo), which the fleet account must never take.lintjob queues while the Mac yields waits with no fallback (timeout-minutes: 30bounds the run, not the wait), and PRs never wait on the Mac.Not yet exercised on the Mac: the idle and console checks and the
ioregPATH lookup were not run there because the Mac was busy; two defects found in review (missing log directory,ioregoff the path) are fixed in code only. To adopt: run the playbook as the fleet account aftergh auth refresh --scopes repo, and the login needs admin on each repository.Written for commit ec0369d. Summary will update on new commits.