Public: anyone can read this; the crew can change it.

An outside runner (a Mac) registers, claims a repository's labelled checks, and reports them as the pull's real check #18037

Closed opened this has it

Landed in pull #18073 · 2 runs · run

opened this

The owner, 2026-12-04: this Mac registers as a forge runner whenever it is available and runs checks in containers, automated end to end. Second slice of #17910; the first (#17915, a machine reports a named check on a pull's head) lands first.

The Mac side exists: scripts/runner in trevato/forge-apple runs install and test from forge.json in Apple container VMs, on a git-archive export with no .git, gated on AC power, idle time and heat. Today it can only post results as pull comments.

One implementation: the forge already has check runners that take jobs and fetch by git-upload-pack (the Linux runners). Extend that protocol with labels and an outside runner; do not build a second queue or a second runner protocol. If the existing protocol cannot serve a machine the forge cannot reach (the Mac pulls work; the forge never pushes to it), say in the pull exactly what was missing.

Build (the runner pulls; the forge never connects to it):

Not in this issue: per-run repository secrets for the runner (the App Store Connect key); file it after this lands.

Done when: a test registers a runner, queues a check for a labelled repository, claims it with the runner token, fetches the commit with the short-lived credential, streams two log lines and reports ok, and the pull's check is green; the same token is refused a push and any non-runner route; an abandoned claim is re-queued once and then failed.

5 earlier comments
commented

The Mac's runner client is being built against this shape, behind a protocol and a mock. Build to it unless the forge's existing runner protocol already has a route for the same thing; then keep the existing one and say here exactly what differs, field by field.

Auth: Authorization: Bearer <node token>, the token returned once at registration.

POST /api/v1/nodes {name, labels:["macos","arm64","containers"], capacity:{runs:1, cpus, memoryMiB}} -> {id, token}
POST /api/v1/nodes/:id/heartbeat {state:"idle|busy|paused", reason?} -> 204
POST /api/v1/nodes/:id/claim   (long poll; 204 when nothing) -> {id, repo, oid, cloneUrl, cloneToken, install?, test, image?, timeoutSeconds, env{CI, FORGE_*}, mine}
POST /api/v1/runs/:id/log      (text/plain chunk) -> 204
POST /api/v1/runs/:id/finish   {exit, timedOut, node, placement:"device", sandboxEnforced:true} -> 204
POST /api/v1/runs/:id/release  -> 204   (the Mac slept or went on battery; the forge requeues)

id in the claim is the run id; mine says the pull's author is the node's owner. The Mac fetches oid from cloneUrl with cloneToken (through git's environment, never argv), then exports with git-archive, no .git, into a container VM.

Two things the forge must hold whatever the shape: registration needs a signed-in owner or an owner's token (a node cannot register itself anonymously), and sandboxEnforced and placement are what the runner says, shown as said by the runner, not as proven by the forge. A long poll must not hold the serving thread.

commented

Correction to the shape above, read from /contract/openapi.json on v0.7.728: the forge already has the runner protocol, so this issue is an extension of it and the /api/v1/nodes routes above must not be built as a second one.

Existing: POST /api/v1/admin/runners (enrol), GET /api/v1/admin/runners, POST /api/v1/admin/runners/{id}/resume and /revoke, DELETE /api/v1/admin/runners/{id}, POST /api/v1/runner/claim (runner token as bearer), POST /api/v1/runner/jobs/{id} (report, with the job's token), and the job's own git door (/api/v1/runner/jobs/{id}/git/info/refs and git-upload-pack, held to the commit the job names).

So what is left to build is only what that protocol lacks for a Mac: labels on a runner and on a repository's check, a claim that matches them, a pause route beside resume (there is none), a runner limited to chosen repositories, giving a claim back, and the words on the pull when no runner with the label is available. Say in the pull which of these already existed.

commented

Reviewed pull #18073 at its head: ticked Register: an owner makes a runner for chosen repositories with labels (macos, arm64, container), and gets a runner token shown once. The token can claim, log and report for those repositories and nothing else: no push, no user scope, no API beyond the runner routes. Revocable, listed where runners are shown, with last heartbeat.; Heartbeat: the runner says it is available (and its labels); silence past a short window marks it away.; Claim: the runner asks for the next queued check, for a repository it serves, whose forge.json check names one of its labels. The answer carries the run id, the commit oid, the commands, and a fetch credential that is read-only, for that repository only, and expires within the run's time limit.; Logs and result: the runner streams log lines and reports ok or failed with a summary. That run is the pull's real check: it shows on the pull and the run page like any other, and require_checks counts it.; Release and expiry: the runner can give a claim back; a claim whose runner goes silent returns to the queue once, then fails with the reason in words. A check that names a label no available runner has says so on the pull, and does not sit queued without a word.; A repository with no label in forge.json behaves exactly as today.. left open: In openapi.json and contract-tested; a doc page with the runner's loop as curl lines. Comment the final shapes on this issue when it merges. — The contract and the doc page are in, but the final shapes are to be commented on the issue once it merges, so the box stays open..

commented

Left open after pull #18073 landed: 1 unticked item remains (In openapi.json and contract-tested; a doc page with the runner's loop as curl lines. Comment the final shapes on this issue when it merges.). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.

commented

Done on main already, waiting for you to close it: 1041b3a14320189e573abb12fa580c9ce4fd20b2

commented

Closed: already done on main in 1041b3a. Closed by the crew's live triage; reopen it to undo, and it stays open.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs