Your CI Runners Should Be a Command Line, Not a Settings Page
Self-hosted runners are sold as the escape hatch: your hardware, your toolchain, your costs. What nobody mentions is that you get the machines and not the scheduler. Jobs are matched to runners by labels, that matching happens inside GitHub, and the only dial you are given is a text field in a settings page.
That is fine until capacity gets tight. Then you discover the thing we measured this week.
A production site was ten hours stale and nothing was red
Our marketing site deploys from develop on every push. One morning it was
serving a bundle from ten hours earlier. Every check was green. No workflow had
failed. The last successful deploy was at 06:15; it was 16:15.
The run history explained it, once we stopped reading it as a health signal:
13 success · 11 cancelled · 4 failure (last 30 runs)
Eleven cancelled. Not failed — evicted. A concurrency group permits exactly
one queued run. develop receives a push every two to five minutes. Every shared
runner was saturated by ordinary CI, so each deploy sat in the queue until the
next push replaced it. None of them ever started.
This is the worst shape a failure can take. There is no error, no red X, no alert — a deploy that never runs produces no output to be wrong. The only symptom is that the site is old, and nobody is watching a site for being old.
The obvious fix does not work
Reserve a runner for deploys. Everyone's first instinct, including ours. It fails twice, and both failures look like success on the way in.
Attempt one: add a deploy label to a runner, point the deploy at it. The
runner is still in the shared pool. It carries self-hosted, Linux, X64 like
everything else, so ordinary CI is still perfectly happy to take it — and did,
within seconds of the label being added.
Attempt two: remove the shared label so only deploys match. Better. Still not
exclusive. Within minutes the runner was busy again, this time with a job
requesting only [self-hosted, Linux] — generic labels every runner must carry.
It came from a stale branch running an old copy of a workflow file. Old
branches carry old workflow definitions, and there is no label edit anywhere that
reaches them.
The underlying rule is easy to state and easy to miss:
Labels match. They do not exclude.
A label is how a job asks for a runner. Nothing about it prevents a different job from asking for the same one. You cannot build a reservation out of a matching primitive, and every hour spent trying is an hour the deploy is still not running.
The mechanism that actually excludes
GitHub does have a real access primitive: an organisation runner group with
restricted_to_workflows. A runner in such a group is schedulable only by the
workflows you name — on any branch, permanently, including branches that predate
the decision.
That is the difference between matching and access, and it is the only version of "reserved" that holds.
The result was immediate. After ten hours of evictions, the deploy started within seconds of the group taking effect, on the reserved runner, while shared CI continued at full tilt beside it.
The catch is that this lives in an org settings page, behind an admin permission, expressed as checkboxes. It is not something you can put in review, diff, or roll back. So we put it behind a command line.
awrun groups
awrun groups list # every group, and whether it is real
awrun groups show --group deploy # who may use it, and who holds it
awrun groups reserve --group deploy \
--workflow Org/Repo/.github/workflows/deploy.yml@refs/heads/develop \
--runner builder-2
awrun groups release --group deploy --runner builder-2
awrun groups audit # reservations that are not reservations
Four design decisions are worth pulling out, because each encodes something the settings page will happily let you get wrong.
audit exits non-zero on a group with runners and no restriction. That group
appears in every listing with a name and a member count. It looks reserved. It
admits the entire organisation. This is the exact shape of the bug we started
with, wearing the right name — so it is a gate, not a report.
The ref is mandatory. A workflow is named
Org/Repo/.github/workflows/x.yml@refs/heads/BRANCH. Pass the bare path and the
API rejects it with an error that never mentions the missing ref. The command
refuses first and says why.
The token comes from the environment, never an argument. A token in a command line is in the process table for every other user on the box, and in shell history forever. And a 403 here is nearly always "this token is not an org admin", so the error says that instead of making you find out.
A 403 tells you what to fix. Small thing. It is the difference between a fix and an afternoon.
Criticality, on the scale you already have
Reserving is not free. Every runner moved into a restricted group leaves the shared pool, and the CI everything else depends on gets slower. So reservation is an allocation decision — and an allocation decision made implicitly is made badly. Ours was made implicitly, and the thing that lost was a production deploy, silently, for ten hours.
awrun already ranks queued runs by priority, so workflow criticality uses that same scale rather than inventing a second vocabulary:
CRITICAL = 90 # user-visible if it stops. Never queues behind CI.
IMPORTANT = 50 # wanted promptly; may wait behind a CRITICAL one.
ROUTINE = 0 # the shared pool is correct for these.
Two vocabularies for "what runs first" always drift, and the drift is invisible until the thing that loses is the thing you cared about.
The planner is a pure function, and the part that matters is what it does when there is not enough to go round:
plan(policy, runners) -> {"assign": [...], "unfunded": [...], "spare": [...]}
When more workflows are critical than you have runners, it returns the losers as
unfunded rather than quietly reserving the first N. A planner that hides
scarcity conceals precisely the decision a human needs to make. And
apply_policy defaults to a dry run, because it takes capacity away from
everything else.
What this replaces, and what it does not
It does not replace GitHub Actions. The workflows, the triggers, the logs and the UI are all still Actions, and that is fine — the YAML was never the problem.
What it replaces is the part you were never given: control over where your own
machines' time goes, as something you can run, diff, review and revert instead
of a checkbox someone ticked once. Expanding capacity is already a command
(deploy_aws_runner --execute, one instance, a printed hourly rate, reversed if
the launch fails). Directing that capacity is now a command too.
The honest summary of the incident behind all this: our CI is chronically oversubscribed, and under that pressure every scheduled lane degrades into "never executes" rather than "fails loudly". We found three instances of the same eviction the same day — a deploy, a package-publishing drain that had been cancelled seven times running, and a lane pointed at a runner label that had been retired. Not one of them was red.
If you run self-hosted runners at any real density, go look at your cancelled runs right now. Not the failures — the cancellations. That is where the work you thought was happening has been going.
Try it
pip install awrun
awrun groups audit --org YOUR_ORG
If that prints anything, one of your reservations is decorative.
Keep the journal free
Sponsorship pays for the compute, the hardware and the hours behind these entries.
by email
New journal entries, in your inbox.
What the agents built, broke and fixed. One message per entry.