Repository navigation
ci(runner): job-started.sh refuses fork jobs on the Mac runner too, tested in a hosted container - #3984
Conversation
The hook found the job's Runner.Worker and wrote its refusal through /proc, which macOS does not have, so on the Apple Silicon runner eamac-ovis-mac it would refuse a fork's job without killing the worker. Where /proc is missing it now asks ps for the parent and name, and writes the refusal to the system log (logger -t ovis-runner-guard). The decision and the Linux path are unchanged. The hook tests now run on macOS too: on Linux a failing ps stub keeps them on /proc, and on macOS a symlinked bash stands in for Runner.Worker. README: a "Mac runner" section under Security model.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
…lf-hosted Mac (#3981) ## Why On 2026-11-16, GitHub's hosted macOS arm64 runners ran short. Since 18:00 KST, five macOS jobs never got a runner and were cancelled after 15 minutes in the queue ("The job was not acquired by Runner of type hosted even after multiple attempts"). Four of them were this check, "Native macOS session identity". The ones the Actions API still lists: | Run | Job | Queued (UTC) | Cancelled (UTC) | |---|---|---|---| | 43844908713 | desktop (darwin-arm64) | 10:01:18 | 10:16:19 | | 43871878368 | Native macOS session identity | 13:02:19 | 13:17:20 | | 43879220298 | Native macOS session identity | 13:48:17 | 14:03:18 | Each cancel turns the PR red until someone reruns the job, so a merge waits 20 minutes or more. On a hosted runner the check takes 40 s (median of 25 recent green runs; max 54 s). The project's self-hosted Mac runner (Apple Silicon; labels `self-hosted, macOS, ARM64, self-hosted-ovis-mac`) is registered in this repository, online and idle. This PR adds a switch to move only this one check to that runner. **It changes nothing until the repository variable `CI_MAC_LABELS` is set**, and that must not happen before the fork refusal below exists on the Mac. ## Where the job runs `runs-on: ${{ github.event.pull_request && github.event.pull_request.head.repo.full_name != github.repository && 'macos-15' || fromJSON(github.workflow == 'CI' && github.ref != 'refs/heads/main' && vars.CI_MAC_LABELS || '"macos-15"') }}` | Run | `CI_MAC_LABELS` unset | set to `["self-hosted","self-hosted-ovis-mac"]` | |---|---|---| | Fork pull request (the guard decides before the variable is read; also a deleted head repository) | macos-15 | macos-15 | | Same-repository pull request, branch push or manual CI run off main | macos-15 | the Mac | | Push to main | macos-15 | macos-15 | | Release validation (`release.yml` → `release-validate.yml` → ci.yml as a called workflow) | macos-15 | macos-15 | - **The guard** is the light jobs' fork guard character for character (`remote-bundles.yml` `bundle-windows`), with `'macos-15'` in place of `'ubuntu-24.04'`. `&&` and `||` short-circuit, so for a fork `fromJSON` is never evaluated, whatever the variable holds. - **What a release does:** it never validates on the Mac. A called ci.yml runs under its caller's name ("Release validation"), so `github.workflow == 'CI'` is false there. A Release run may also take main's push run in place of its own, so main's runs stay on `macos-15` as well (`docs/development.md`'s release table stays true). `scripts/release-ci-reuse.test.ts` fails if any workflow other than ci.yml reads `CI_MAC_LABELS`, or if ci.yml reads it without that gate. ## What protects the Mac today A fork's pull request runs the fork's own workflow files. So a fork can write `runs-on: [self-hosted, self-hosted-ovis-mac]` itself, whatever this expression says. That path is older than this PR: the runner is already registered and online. The self-hosted Linux runners refuse fork jobs in `scripts/self-hosted-runner/job-started.sh`, but that hook finds and kills the job's `Runner.Worker` through `/proc`, which macOS does not have. The repository has no refusal that works on the Mac. Today two things protect it: the repository's approval policy for fork pull request workflows, `all_external_contributors` (every outside contributor's run waits for a maintainer's approval), and a job-started hook on that runner since 2026-11-05 that refuses fork jobs. That hook is a copy from the branch of #2835, which was closed unmerged: it is not in this repository and was never reviewed. #3984 brings a reviewed hook that works on macOS. **`CI_MAC_LABELS` must not be set before a reviewed fork refusal that works on macOS is in place on that runner.** That refusal is a separate change (#3984), not part of this PR. ## What changes - `ci.yml` `macos-session`: the `runs-on` above, plus `CLAUDE_CONFIG_DIR: ''` in the job's env. `server/claude-store.test.ts` skips two session-identity tests (:83 and :440, 8 assertions) when a Claude config dir is exported, and still exits 0. A runner whose environment carries the variable would turn them off silently. In the job's eight test files, every other skip depends on the platform, on running as root (`getuid() === 0`), or on `/proc` (Linux). One assertion in `scripts/install-herdr-core.test.ts:292` runs only when `plutil` is on PATH, which is `/usr/bin` on every Mac. - `.github/actions/setup-ci`: - **On the Mac:** `oven-sh/setup-bun` installs into `$HOME/.bun/bin` (`src/action.ts` at the pinned 0c5077e5: `join(homedir(), ".bun", "bin")`, then rename over `bun`). The Mac runner runs as the Mac's own account, so a job would replace that person's Bun. A second setup-bun step, for self-hosted non-Linux runners only, gives it `HOME: ${{ runner.temp }}/setup-bun-home`. The runner empties that folder at the start and end of every job, and setup-bun puts that `bin` on the job's PATH. I dry-ran the action at the pinned SHA on the project's self-hosted Mac runner with that HOME (cache off, since there is no Actions token outside a job). Bun 1.4.2 landed only under the temp HOME, the real `~/.bun/bin/bun` kept its SHA-256, and nothing under `~/.bun` changed. - **On self-hosted Linux:** nothing changes. "Verify prepared self-hosted tools" and "Seed Bun cache from the runner host" went from `runner.environment == 'self-hosted'` to `runner.environment == 'self-hosted' && runner.os == 'Linux'`. That is the same on every self-hosted Linux runner and false on the Mac, where the prepared-image check refuses anything but Linux x64 (`::error::The prepared CI image requires Linux x64.`) and there is no host cache. The hosted setup-bun and setup-node steps keep main's exact conditions. - **Test gap (older than this PR):** no test pinned the verify step's `if`, and the setup-bun check was a loose `toContain`, so turning the Linux check off broke nothing. `scripts/ci-setup.test.ts` now pins the verify step's condition, both setup-bun conditions and the Mac step's HOME. - `scripts/light-runner-workflow.test.ts` pins this job's expression, its `CLAUDE_CONFIG_DIR: ''`, the fork guard coming before any variable, and hosted labels for a fork and for an unset variable. Its existing check (no pull request job reaches a self-hosted runner without the fork guard) accepts exactly this expression. `scripts/release-ci-reuse.test.ts` lists the new event read in `EVENT_READS` and adds the release test above. - Docs: `docs/development.md` (variable, release, account, fork refusal) and `scripts/self-hosted-runner/README.md`. I mutation-checked each guard by removing it in a scratch edit; each removal fails its test: the workflow/main gate (4 tests), `CLAUDE_CONFIG_DIR` (1), the Linux-only verify step (1) and the Mac setup-bun HOME (1). ## Measured on the project's self-hosted Mac runner (by hand, as close to the job as possible) macOS 27.0.1 arm64. Fresh shallow clone of main `00069b4`. Bun 1.4.2 downloaded into a scratch folder. `BUN_INSTALL_CACHE_DIR` inside the checkout, emptied before each run (the self-hosted path skips the Actions cache). The runner's PATH. `HERDR_TEST_MODE=unit`. The job's exact `bun test` line (8 files): | Run | `bun install --frozen-lockfile` | `bun test` | Result | |---|---|---|---| | 1 | 8.7 s | 29.8 s | 263 pass, 7 skip, 0 fail | | 2 | 10.8 s | 27.7 s | 263 pass, 7 skip, 0 fail | | 3 | 17.7 s | 28.5 s | 263 pass, 7 skip, 0 fail | | 4 | 17.6 s | 28.1 s | 263 pass, 7 skip, 0 fail | | 5 | 16.8 s | 28.9 s | 263 pass, 7 skip, 0 fail | All 8 files passed in every run (the 7 skips are platform skips, the same as on the hosted runner). That is 38-46 s for install and tests, plus checkout (5.5 s in the runner's 2026-11-05 log of this job) and Bun setup: about the hosted 40 s, without the queue. The tests keep off the real state on that Mac, where the account's herdr and Ovis are running. They give their spawns a temporary `HOME`/`XDG_CONFIG_HOME`, use `port: 0` on loopback and `mkdtemp` roots, and the `bunfig.toml` preload points `HERDR_SOCKET` at a missing socket. macOS herdr discovery lists the account's processes with `ps eww` but probes only sockets of a server whose `HOME` is the test's temp home. The installer test puts stand-in `launchctl`/`id` first on PATH. After the five runs, nothing under that account's herdr, Ovis or Claude folders had changed, and its herdr and Ovis processes kept their start times. Context: #2835 (all macOS jobs to this Mac, with a heartbeat route) was closed on 2026-11-09 because that machine is too slow as a general CI runner. This PR moves only this one ~40 s unit check, measured above. ## How to switch on, and back - **On** (only after the fork refusal above is installed on the Mac): set the repository variable `CI_MAC_LABELS` to `["self-hosted","self-hosted-ovis-mac"]`. - **Back:** delete the variable (or set it to `"macos-15"`). The next run is hosted again. - A non-JSON value fails the job on same-repository runs (a red check, forks unaffected). A list that does not name the Mac, such as `["self-hosted"]`, could match the Linux runners; use the exact value above. ## Risk - One runner: these jobs queue behind each other, about 40 s each. - If the Mac is off or asleep, the check waits for it instead of failing; delete the variable to go back. This check is not one of the required checks. - With the variable set, Dependabot's same-repository PRs (SHA-pinned action bumps) also run this job on the Mac. ## Not measured A real Actions job on that runner with this diff (setup-bun with the temp HOME inside the runner, its post-job cache save, the runner's job-started hook). That first happens when the variable is set. ## Validation - `bun test scripts/light-runner-workflow.test.ts scripts/ci-setup.test.ts scripts/release-ci-reuse.test.ts`: 123 pass, 0 fail, plus the mutation runs above. - `bun run check fast` on the final tree: passed (workflow syntax, generated files, typecheck, build, unit tests). - No changelog fragment: CI-only, nothing users notice.
A refusal kills the hook's own parent only when every check proves it the job's Runner.Worker, made again right before the kill: still the hook's parent, its executable Runner.Worker (/proc/<pid>/exe and name on Linux, /bin/ps on macOS), the hook's user, an unchanged start time. No ancestor walk, no $PPID fallback. When a check fails it kills nothing and blocks in its step. The event filter goes by the event's name as well as the payload, and jq compares the names itself. Every test that can reach a refusal runs only under hook-test-harness.sh, behind a guard it proves first: a PID namespace of its own, or the runner image's container (a new read-only marker in the image, its init as PID 1, the harness a subreaper). Elsewhere those tests skip. The macOS CI step runs the allow-path test alone. The README's Mac runner section uses placeholders, and its hand check blocks rather than kills.
…test image - runJobStarted runs the hook under a parent named not-the-worker, so a refusal nobody meant there blocks and kills nothing, and the test fails at its own timeout. - The live runner image carries no test marker: the container guard needs a throwaway image built from it with the marker added. - README: no hand-run refusal; end a blocked hook only after the job is cancelled and its worker is gone; drop the DYLD_INSERT_LIBRARIES claim, which runner v2.338.2's source does not support for the hook's step. - job-started.sh re-reads the hook's parent last before the kill.
- block() re-reads the hook's own parent every 5 s, with the proof's reads, and exits non-zero once that parent is no longer the one it started under: only the parent waits on the hook, and with the worker gone no step can run. It never signals anything; a failed read keeps it blocking. The README's ps-then-kill instruction is gone: cancelling the job is enough. - The harness's container guard refuses the host's initial PID namespace (pid:[4026531836]), and its probe refuses any process in /proc that is neither the harness nor above it (builtins only). - The harness recognises a block by the hook's own "this hook blocks" line, not by a silence; a new case has the parent end after the block.
…ood; a block must hold - hook-test-harness.sh: four `$$` had become `$` (the namespace read, the not-PID-1 check, the ancestry walk's start, a comment), so the container guard could never pass. Restored. - job-started.sh: under a shell other than bash, which need not set $PPID, the hook blocks for good again; that branch has no exit. - The harness takes a block as holding only once the hook, after its "this hook blocks (pid N)" line, starts a second /bin/sleep with it and its parent still running (at most 150 polls of /proc, 0.1 s apart); otherwise it reports unproven.
…s /proc/self - The non-bash branch turns errexit off: the runner starts sh with -e (ScriptHandlerHelpers.cs:19), and two failed sleeps must not end the hook. - The block loop reads its parent from /proc/self/stat and ends only when that /proc numbers the hook as $$. - README: right before the kill only the start time and the parent are read again; the self-ending block's limit (a process between worker and hook) is stated; the harness's persistence bound is polls plus scheduling.
Ending a block releases nothing when the hook's parent is the worker itself, as the runner starts it; a process between them that exits while the worker lives lets the worker finish the step. Comment lines only.
…nt readers hook-test-harness.sh hands the hook an event path (GITHUB_EVENT_PATH); it is started only by the hook's tests, no workflow starts it, and it decides nothing about what a run does, so a Release run may still take main's run.
…ner job The hook's isolated tests (its refusals, the signal to a proven worker, the block and its end) run in CI again, as main's refusal tests did, now in a confined throwaway container on GitHub's ubuntu-24.04: the check "Hook kill tests (container)", on every pull request (drafts included) and every push to main. - hook-test.Dockerfile: oven/bun pinned by digest, jq, procps, python3, a non-root user and the marker the harness guards on; not the runner image. - hook-test-container.sh: starts the container detached and confined, prints and checks its isolation before any test starts, and fails on any skip or any count but 8 pass. - The isolated refusals also cover a fork's pull_request_review_comment. - README: where each test runs, the pid-reuse limit, ps comm as the macOS proof.
…' image truly - hook-kill-tests.yml ends with a step, independent of the container script, that fails unless the files the container wrote say status 0 and exactly 0 fail; 8 pass with no skip; the workflow test pins that step, and that the job has no continue-on-error and no needs. - Comments, the skip warning and the README no longer say the tests' image is built from the runner image; the README says that a blocked hook and its fake parent end with the container, and that on macOS only the allow path runs.
…ache The container copies every top-level entry of the checkout except .ci-cache, the Bun install cache setup-ci restores into the workspace on GitHub's runners, so the required check never spends its copy timeout on that cache. find's -exec ... + form fails when any cp fails, and the copy must hold bunfig.toml and node_modules.
…tHub's checks The local merge gate runs Fast checks in the runner image, where the seven isolated job-started hook tests skip, and an admin merge through it would skip the check "Hook kill tests (container)", which runs them on GitHub's runner. So a PR that touches scripts/self-hosted-runner/ or scripts/self-hosted-runner.test.ts waits for GitHub's checks.
Merge passMerged head
Merge pass note for #3984 (ci(runner): job-started.sh refuses fork jobs on the Mac runner too, tested in a hosted container). What it does: the self-hosted runners' job-started hook refuses any job whose code comes from a fork, now on the Mac runner too. To stop a refused job it sends one signal to its direct parent, and only when that parent is proven to be the runner's worker; otherwise it blocks and signals nothing. A new check, "Hook kill tests (container)", runs the hook's refusal and kill tests on GitHub's hosted runner inside a throwaway confined container, on every pull request and every push to main. It becomes a required check after this merge, by the maintainer's decision of 2026-11-17. |
What
scripts/self-hosted-runner/job-started.shrefuses fork jobs on the self-hosted Mac runner as well as in the Linux runner image, from the same input (GITHUB_REPOSITORY,GITHUB_EVENT_NAME,GITHUB_EVENT_PATH, read withjq). This PR also changes how a refusal ends the job: the hook kills exactly one process, and only when it has proved that process is the job'sRunner.Worker. Otherwise it kills nothing and blocks.AGENTS.md: a pull request that touchesscripts/self-hosted-runner/or its test file waits for GitHub's checks (the local merge gate's Fast checks skip the isolated hook tests).The refusal: a proven worker, or nothing
A failing hook alone only fails its own "Set up runner" step: runner v2.338 still runs the job's
if: always()andif: failure()steps, so the hook ends the job by SIGKILLing itsRunner.Worker. The runner starts the hook as the worker's direct child (runner v2.338.2:JobHookProvider.cshands the hook toScriptHandler, which startsbashthroughProcessInvokerwithUseShellExecute = false). So the only candidate is the hook's own parent, the$PPIDthat bash recorded at start. It is killed only when every check below holds:Runner.Worker:/proc/<pid>/exe(which a process cannot rename) and its name in/proc/<pid>/comm;/bin/ps -o comm=prints. On macOS that path is the only proof of the executable, and any executable file namedRunner.Workersatisfies it.Right before the kill the hook reads the parent's start time and then its own parent again; both must be unchanged. It does not read the executable, name or user again at that point. The OS is chosen once (
/proc/$$/statreadable or not). Every number read from/procorpsis checked to be a pid before any arithmetic, and the kill isbuiltin kill. Nothing walks the ancestors, there is no fallback to$PPID, and nothing treats "pid > 1" as safe.The limits
kill.psrun on macOS; it has not been measured.killtakes a number. On Linux a pidfd helper (pidfd_send_signal) could; this pull request does not add one.ps -o comm=is the only proof of the executable. Any executable file namedRunner.Workersatisfies it.Runner.Worker.prctland no subreaper; its only libc imports arekillandsocket. The .NET 8 runtime it targets has noprctlcall in itsSystem.Native.bsd/kern/kern_exit.c,proc_reparentlocked(q, initproc, …)), and in a runner container to the image's init (ENTRYPOINT ["tini", "--", …]).ProcessInvoker.cs:485-499). The job'salways()andfailure()steps could then run, and the hook cannot prevent that: its parent is then not the proven worker. The runner starts the hook directly from the worker, so no such process is there.When the worker is not proven: block, then end
When any check fails, the hook kills nothing. It writes the refusal with its own pid and blocks in its step, ignoring HUP, INT and TERM, so no later step starts. About every 5 seconds (a
sleep, plus scheduling) it reads its own parent again. On Linux that read is/proc/self/stat, and it counts only when that/procnumbers the hook as$$. Once a read succeeds and names a process other than the one it started under, it exits non-zero. A failed read keeps it blocking, and it never signals anything. So a blocked hook that cannot read its parent never ends by itself, and signals nothing. On a host that would take the allow test refusing wrongly AND its parent reads failing persistently.JobHookProvider.cs→ScriptHandler→ProcessInvoker,UseShellExecute = false), so that parent is the worker, and once the worker is gone no step can run.Under a shell other than bash, which need not even set
$PPID, the hook cannot tell when its parent is gone, so it blocks for good and kills nothing. That branch has no exit statement and turns errexit off (set +e), because the runner startsshwith-e(ScriptHandlerHelpers.cs:19). The runner starts the hook withbashwhereverbashis on its PATH.Read from runner v2.338.2's source, not yet seen on a live runner: the hook's step runs under
always()(JobExtension.cs:309-312), so a cancel or the job's timeout does not cancel it. The worker stays in it, and the listener kills the worker once the cancel timeout has passed (at least 45 s,JobDispatcher.cs:1279-1285). No later step runs, and the blocked hook then ends by itself. A person has nothing to end by hand.What it lets through
A job runs only when its event names no other head repository:
pull_request*orworkflow_runevent that names none, anissue_commentwithout object-valued issue and comment, a missing event name, or an unset variable is a refusal;jqcompares the names itself, so no trailing newline or look-alike name passes. A crafted name cannot add a line to::error::(tojson).The repository's approval policy for outside contributors' fork runs is unchanged: the hook is the second lock, the one a fork's workflow files cannot change. No repository setting or variable is changed.
Tests
On any host (
scripts/self-hosted-runner.test.ts, "runs a job from this repository"): only jobs the hook allows, under a parent that can never pass the proof. That parent is a copy of bash namednot-the-worker(on macOS a symlink to bash);/proc/<pid>/exeand its name on Linux, and on macOS whateverpsprints, never end inRunner.Worker. A refusal nobody meant there blocks and kills nothing, and the test fails at its own timeout, which signals only the parent it spawned.Isolated only (
scripts/self-hosted-runner/hook-test-harness.sh): every case that can reach a refusal. The harness starts the hook, and any parent for it, only after one of two guards passes:A PID namespace of its own (
unshare --user --map-root-user --pid --fork --mount-proc --kill-child): the harness is PID 1, PID 1 of/proccarries the run's random token, and no other process is visible.A throwaway container of an image that carries the marker,
hook-test.Dockerfile's (not the runner image): the root-owned, read-only marker/opt/runner-hooks/ovis-runner-imageadded. The live runner image has no marker, so these tests never run in a live runner's container. The guard needs four more things:/.dockerenv;/proc/self/ns/pidis notpid:[4026531836]);/procthat is neither the harness nor above it. That refuses a container sharing another's PID namespace.The harness is also made a child subreaper, and it proves that an orphan of its subtree comes to it.
Anywhere else the tests skip and print why. A failed
unshareor a missing marker only ever leads to a skip.Cases:
proc=/proc ps=/bin/psline: procps proves and kills, while a failing, silent or look-alikepsblocks;systemd,Runner.Worker2,Runner.Worke), the worker as a grandparent, a worker renamedsystemd, and asystemdthat names itselfRunner.Worker;The harness recognises a block by the hook's own "this hook blocks (pid N)" line. It then requires the block to hold: pid N must start a second
/bin/sleep(it has read its parent again and stayed), with the hook and its parent running at every poll of/proc, within at most 150 polls 0.1 s apart (15 s of waits plus the reads and scheduling, not a strict bound). The bound is the hook's own loop, never a silence, and it shows the block held through one more read of its parent, not forever. Every case asserts that two decoys (anotherRunner.Workerand aRunner.Worker2) still run, and that every process above the harness still runs with the same start time.CI runs them in a container on every pull request and every push to main: the new check "Hook kill tests (container)" (
.github/workflows/hook-kill-tests.yml).ubuntu-24.04, written literally in the job.scripts/self-hosted-runner/hook-test.Dockerfile's image (not the runner image). That image isoven/bun:1.4.2-debianpinned by digest, plus jq, procps, python3, a non-root user and the marker. It installs dependencies on the VM with--ignore-scripts, then runshook-test-container.sh.--rm --init --network none --cap-drop ALL --security-opt no-new-privileges --pids-limit 2048, the source read-only, no socket, no--pid.docker inspect's HostConfig and mounts, PID 1 docker-init, a PID namespace other than the VM's and the initial one, no docker socket, empty capability sets,loalone,/srcread-only).Which case runs where
[], a string, a wrong shape, two documents, unset repository, no jq, and 3 with a closed output)ps(a procpspson Linux)Against main. On main, Linux CI ran 14 refusal cases asserting SIGKILL in Fast checks, under a hook that killed whichever ancestor was named
Runner.Worker. All 14 are in the container check, together with the rest above.The check becomes required. "Hook kill tests (container)" becomes a required check on main after this pull request merges, by the maintainer's decision of 2026-11-17, once it has run green on main. Nothing in the repository asserts that it is or is not required. The workflow test pins its name, runner, permissions, triggers, confinement and its last step: the check of the files the container wrote.
When it runs.
pull_requestwith ci.yml's own types (opened,synchronize,reopened,ready_for_review), so it appears wherever the required checks do, and on a push to main. Retargeting a pull request's base does not start it, as it does not start CI today.pull_requestrun, for this check as for every other.0 fail;8 pass;with no skip. A script that returned early leaves no such files.What a pull request can change
A pull request runs its own copy of this workflow, which it may change like any workflow. The job's last step trusts files written by scripts the pull request itself can edit, as does every check whose workflow a pull request can edit. Closing that would need an organisation-level required workflow, which a repository owned by a personal account does not have. Reviewers read the diff of
scripts/self-hosted-runner/and of this workflow on every pull request that touches them.Events the hook cannot judge
The hook judges a job by its event alone.
issue_comment,workflow_dispatch,schedule,push,merge_groupandrepository_dispatchrun this repository's own workflow files.pull_request_targetfrom a fork, because its workflow may check out the fork's head.What this branch's workflows do:
issue_comment: onlycla.ymluses it, and it runs onubuntu-24.04.schedule:growth-snapshot,omp-question-compat,windows-installandwindows-terminal-qarun on GitHub's runners.Jobs that can take a self-hosted label on
workflow_dispatch,pushorworkflow_run:ci.ymlandremote-bundles.ymlcheck outgithub.sha;mac-dmg.ymlandwindows-app.ymlcheck out an input tag of this repository;release.ymlchecks outgithub.shaor a tag of this repository;pages.ymlchecks outworkflow_run.head_sha, only when the triggering run was a push of this repository.Each downloads only its own run's artifacts.
None of them checks out or runs a pull request's code, or a comment's text. A workflow added later that does must not take a self-hosted label.
Mac runner
scripts/self-hosted-runner/README.md"Mac runner" says how to install, check and undo the hook there, with placeholders for the machine's paths, account, service label and runner name. It asks no one to run a refusal by hand, or to end a blocked hook: cancelling the job is enough.Validation
Why it was tested this way: an earlier, uncommitted version of this change, tested on a host, signalled its startup parent and ended a whole user session. The hook now signals only a proven worker and otherwise blocks. Its refusal and kill tests refuse to run outside a private PID namespace or a marked container.
At
2c2afb34(the hook as it is in this pull request), locally, in confined containers, never on a host:The kill tests ran in one throwaway container of the runner image with the marker added: 8 pass, 0 fail. The container was started with
--rm --init --user runner --network none --cap-drop ALL --security-opt no-new-privileges, in its own PID namespace (checked inside and fromdocker inspect), with no docker socket and the source read-only.In a container of the live runner image, the same file skips them: 1 pass, 7 skipped, 0 fail, with both reasons named.
bun run check fastin a confined container without network: workflow syntax, generated types and themes, typecheck, build and unit tests all ok; unit tests 17863 pass, 0 fail.On GitHub's run at that head:
Every check passed.
At
ec206b58(this pull request's head), locally, in confined containers, never on a host:loalone,/srcread-only, anddocker inspect'sPrivileged=false CapDrop=[ALL] CapAdd=[] NetworkMode=none PidMode= SecurityOpt=[no-new-privileges].bun run check fastin a confined container without network: 17872 unit tests pass, 0 fail, and the six stages ok (workflow syntax, generated types, generated themes, typecheck, build, unit tests).ubuntu-24.04runner: the job took 52 s (about 56 s from the pull request event to its result). Install took about 0.4 s with the cache restored, the image build about 14 s, and the run 27 s with the last check. The copy that leaves.ci-cacheout took at most about 1.4 s, with the Bun cache restored into the checkout. 8 pass, 0 fail, with the proofs printed before any test.The live runner image is not rebuilt for this pull request. The marker is only in the test image.
No changelog fragment: this is a CI runner change users do not notice.