Repository navigation
feat(swm-macos-runner): one-slot Tart macOS runner (plan part 1) - #288
Merged
Merged
Conversation
added 16 commits
November 17, 2026 17:36
The live checks on MIMOLETTE passed: both rule files load before the VM bridge exists, IPv4 and IPv6 LAN traffic is blocked, and df on the external disk does not hang under launchd. An IPv6 DNS pass rule did not match, so the build blocks all IPv6 LAN traffic and DNS uses the IPv4 resolver. Also fix the Undo hold value and the Tart version.
app_jwt reads GH_APP_KEY_SERVICE and GH_APP_KEY_ACCOUNT, defaulting to the NOS runner item, so the smartwatermelon macOS runner can reuse the helper.
The guest runs this hook before any workflow step and denies every event that does not provably come from a branch of the same repository in an allowed owner. Tests use crafted payloads, and a control run against an allow-all hook must fail exactly 16 deny cases, so the cases are proven able to fail. CI runs the suite in tests.yml.
Add com.apple/swm-tart (v4) and swm-tart-v6 (bridge101) next to the NOS anchors, each set with its own ok files so one set failing never clears the other. The plist now runs the guard every 60 s.
One check_v4_anchor helper serves both sets, and the main ruleset is read and checked once, failing both sets as before.
config.sh holds the pinned base, runner version and limits; SWM_IMAGE hashes guest/ plus the base digest. build-image.sh clones the base, installs the runner, hook and run-job.sh, renames to SWM_IMAGE, then deletes old swm-macos-runner-* images. Every tart call is bounded.
A failed stop left tart run up and the plain wait hung, so swm-build-tmp was never deleted. wait_run polls for SWM_STOP_LIMIT_S, then kills the run pid through KILL_BIN. A run that outlives a good stop now fails.
supervisor.sh run|once|test-alert keeps one mimolette-macos VM per job. Each pass sweeps leftover mimolette-macos-* VMs and the recorded runner, checks pf, disk and the image (builds it when missing), then clones, boots and waits for the IP, the guest agent and the IPv6 ok file. Only then does it mint the token and the JIT config, which goes to tart exec on a pipe, never argv or a file. Alerts go out once per change of KIND; after 3 fails the loop backs off. A SIGTERM ends the running tart call and tears the slot down. wait_run moves from build-image.sh into lib.sh so both scripts share it. lib.sh gains abort_bounded and notify_ok; config.sh gains the supervisor waits, the swm-runner App IDs and the ok-file paths.
…art-hung The commit review found two gaps. A SIGTERM during the clone, ip or readiness wait waited out the tart call (up to 600 s, past launchd's ExitTimeOut); now everything from the clone to the end of the job is abortable. And a readiness exec that timed out while the guest booted marked the pass tart-hung and alerted at once; it now counts as a start failure.
Reset fails and send recovered after the job exec returns 0, not at the JIT handoff. A failed job now counts like a start failure (3 fails: one alert, backoff). A SWM_JOB_MAX_S time-out is neutral: an idle runner hits it every 6 h.
Adds install.sh (libexec copy, plist render, bootout then bootstrap), the LaunchAgent plist (ExitTimeOut 300), its tests and the runbook. Notes the shared ntfy topic and the 60 s pf guard in the NOS runbook.
Add update.sh and its LaunchAgent (every 600 s): pull the clone, and when the runner code or github-app.sh has a new commit and the slot file says job=0, run install.sh. install.sh now installs and loads the updater too, and skips reloading it when the updater itself runs it.
… subnet The pf rules cover only 192.168.65.0/24. The supervisor now keeps the tart ip output and, for any other address, logs it, tears the VM down and counts a pf fail instead of handing over the JIT config.
…plist The hang drill sets SWM_CLONE_LIMIT_S in the env file, but install.sh rendered only NTFY_TOPIC, so the drill changed nothing. Lines matching SWM_<NAME>_S=<digits> now go into the supervisor plist environment. Any other SWM_ line, or a repeated knob, is refused before anything is installed.
An idle JIT runner holds job=1 for up to 6 h, so the updater almost never saw job=0 and a merged fix could wait a day. The updater now writes update-pending when it holds a version back and clears it after a good install or when nothing is new. The supervisor, at the start of a pass with job=0 and before the clone, waits for that file to go (SWM_UPDATE_WAIT_S, 900 s; SIGTERM ends the wait). The runbook now says job=1 means the runner may be idle or busy.
The final review found two unverified gaps: whether a job VM can reach global IPv6 addresses, and whether workflow env reaches the job-started hook. Task 8 Step 3 now probes both and says what to do if either fails.
smartwatermelon-agent
Bot
requested a review
from twistedmelonman
as a code owner
November 18, 2026 20:00
twistedmelonman
approved these changes
Nov 18, 2026
twistedmelonman
approved these changes
Nov 18, 2026
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.
Plan part 1, Tasks 0–7: the code for the smartwatermelon macOS CI runner on MIMOLETTE. Each job runs in its own Tart VM, and there is one slot. Task 8, the live proof on MIMOLETTE, is not done yet. It needs sudo and a fork PR from Andrew.
What this adds under
scripts/swm-macos-runner/:macOS runner:. It refuses a VM that is not on the Tart subnet.docs/runbooks/swm-macos-runner.md.Changes to
scripts/nos-runner/:github-app.shreads any Keychain key item. NOS defaults are unchanged.The new pf rules go live only after Andrew reruns
install-pf.shwith sudo in Task 8. The live NOS updater installs thegithub-app.shchange within 600 s of the merge.Two possible gaps have no code fix yet: VM IPv6 to global LAN addresses, and workflow
env:reaching the hook. Plan Task 8 Step 3 now has a probe for each, with the action to take if it fails.Tests:
bash scripts/swm-macos-runner/tests/run-tests.shgives 0 FAIL. The first red run of every new test ran in a throwaway Linux container on MIMOLETTE. Each task had a spec and quality review, and the final review of the whole branch had one fix wave and a re-review.Advances #252