routing.txt
RelayRunner docs: Routing Page: https://relayrunner.dev/docs/concepts/routing Markdown: https://relayrunner.dev/docs/concepts/routing.md All pages: https://relayrunner.dev/docs/llms.txt
Other pages (Markdown):
- Route GitHub Actions jobs to any runner: https://relayrunner.dev/docs/get-started/overview.md
- How it works with GitHub Actions: https://relayrunner.dev/docs/get-started/github-actions.md
- Quickstart: https://relayrunner.dev/docs/get-started/quickstart.md
- Install the CLI: https://relayrunner.dev/docs/get-started/install.md
- RelayRunner for Mac: https://relayrunner.dev/docs/get-started/mac-app.md
- Set up with an agent: https://relayrunner.dev/docs/get-started/agents.md
- Move your workflows over: https://relayrunner.dev/docs/get-started/move-over.md
- Principles: https://relayrunner.dev/docs/concepts/principles.md
- Routing: https://relayrunner.dev/docs/concepts/routing.md (this page)
- Runner order: https://relayrunner.dev/docs/concepts/runner-order.md
- Optimized checks: https://relayrunner.dev/docs/concepts/optimized-checks.md
- Spend controls: https://relayrunner.dev/docs/guides/spend-controls.md
- Providers: https://relayrunner.dev/docs/runners/providers.md
- Your machines: https://relayrunner.dev/docs/runners/self-hosted.md
- GitHub-hosted: https://relayrunner.dev/docs/runners/github.md
- Hosted providers: https://relayrunner.dev/docs/runners/hosted.md
- Runner labels: https://relayrunner.dev/docs/reference/labels.md
- Add a provider: https://relayrunner.dev/docs/contribute/add-provider.md
- Run CI on your laptop while you work: https://relayrunner.dev/docs/guides/laptop-ci.md
- macOS and iOS builds on your Mac: https://relayrunner.dev/docs/guides/mac-builds.md
- Share your team's machines: https://relayrunner.dev/docs/guides/team-machines.md
- Keep up with coding agents: https://relayrunner.dev/docs/guides/agent-surge.md
- Activity and history: https://relayrunner.dev/docs/dashboard/activity.md
- Signals: https://relayrunner.dev/docs/dashboard/signals.md
- Performance: https://relayrunner.dev/docs/dashboard/performance.md
- Usage and savings: https://relayrunner.dev/docs/dashboard/usage.md
- Telemetry: https://relayrunner.dev/docs/dashboard/telemetry.md
- AI: https://relayrunner.dev/docs/dashboard/ai.md
- CLI: https://relayrunner.dev/docs/reference/cli.md
- relay.yml inputs: https://relayrunner.dev/docs/reference/relay-inputs.md
- Repo config: https://relayrunner.dev/docs/reference/repo-config.md
- MCP server: https://relayrunner.dev/docs/reference/mcp.md
- RelayRunner API: https://relayrunner.dev/docs/reference/api.md
- Workspaces and members: https://relayrunner.dev/docs/dashboard/workspaces.md
- GitHub App: https://relayrunner.dev/docs/reference/github-app.md
- Security: https://relayrunner.dev/docs/reference/security.md
- Data and privacy: https://relayrunner.dev/docs/reference/privacy.md
- Remove RelayRunner: https://relayrunner.dev/docs/dashboard/remove.md
- Troubleshooting: https://relayrunner.dev/docs/reference/troubleshooting.md
- Errors: https://relayrunner.dev/docs/reference/errors.md
- FAQ: https://relayrunner.dev/docs/reference/faq.md
- Feedback: https://relayrunner.dev/docs/contribute/feedback.md
- Changelog: https://relayrunner.dev/docs/changelog.md
- Agents can change your routing: https://relayrunner.dev/docs/changelog/agent-changes.md
- Confirm agent changes that pause or reorder runners: https://relayrunner.dev/docs/changelog/agents-ask-first.md
- Pick runner sizes on the dashboard: https://relayrunner.dev/docs/changelog/auto-runner-sizes.md
- CLI changelog: https://relayrunner.dev/docs/changelog/cli.md
- Failed checks show why a job couldn't route: https://relayrunner.dev/docs/changelog/couldnt-route-check.md
- Try a runner provider on your own workflows: https://relayrunner.dev/docs/changelog/evaluate-a-provider.md
- Routing retries through GitHub outages: https://relayrunner.dev/docs/changelog/github-outages.md
- Send job logs to OpenTelemetry or an S3 bucket: https://relayrunner.dev/docs/changelog/job-log-export.md
- Job time split into setup, build and test: https://relayrunner.dev/docs/changelog/job-phases.md
- Mac app changelog: https://relayrunner.dev/docs/changelog/mac.md
- RelayRunner for Mac: https://relayrunner.dev/docs/changelog/mac-app.md
- Send a crash report from the Mac app: https://relayrunner.dev/docs/changelog/mac-crash-reports.md
- Route jobs by os, arch and cpus: https://relayrunner.dev/docs/changelog/machine-shapes.md
- CI traces in your observability tool: https://relayrunner.dev/docs/changelog/opentelemetry-traces.md
- Platform changelog: https://relayrunner.dev/docs/changelog/platform.md
- Retries, queueing and provider usage: https://relayrunner.dev/docs/changelog/retries-queueing-and-provider-usage.md
- Route a repo from the dashboard: https://relayrunner.dev/docs/changelog/route-a-repo.md
- Per-workflow run times and job sizing for members: https://relayrunner.dev/docs/changelog/run-times.md
- Usual job times, job history and the Mac queue: https://relayrunner.dev/docs/changelog/usual-times-and-mac-queue.md
Routing
How a GitHub Actions job opts in to routing, and how the relay picks its runner.
A job opts in to routing with a relay job. The relay names the runners the job may use, and gets one of them back.
The relay job
jobs:
relay-test:
uses: relayrunner/actions/.github/workflows/relay.yml@v1
with:
machine: macOS, ARM64
github: macos-latest
test:
needs: relay-test
runs-on: ${{ needs.relay-test.outputs.runner }}
steps: ...
Tell the relay what the job needs with os, arch and cpus, such as os: linux and cpus: 4. Every provider in your runner order can then take the job, each with its smallest runner that fits, and a machine fits when it has the OS and enough cores.
To use a specific runner instead, the relay takes one input per provider:
machine: labels a self-hosted machine must have, all of them.self-hostedaccepts any machine.github: a GitHub-hosted label, such asubuntu-latest.- A hosted provider's input, such as
depotorblacksmith: one of that provider's labels, such asdepot-ubuntu-24.04. See Hosted providers.
Without os, arch or cpus, leave out a provider and the job never runs there. Set one to auto, such as blacksmith: auto, and you pick the job's size on the Router page instead of in the file. See relay.yml inputs for the details.
What happens on a push
- The relay job is queued on GitHub with
runs-on: relayrunner. - GitHub tells RelayRunner, which answers the relay itself. It runs no steps and bills no minutes. This takes about a second.
- The relay goes down your workspace's runner order from the top. It skips any provider the job didn't name, and picks the first one that can take the job now.
- The relay finishes with a
runneroutput: a one-time label for a machine, or the job's own label for a hosted provider. - Your job runs on that label. A machine gets a fresh one-job runner for it.
If your machines are busy and nothing else fits, the job waits for one. See When every machine is busy. If nothing fits at all, the relay fails with the reason and the job doesn't start. See When nothing fits.
Which machine
The self-hosted step takes a machine that is online, idle, not paused, has every machine label, and is shared with whoever started the job. Your own machines come first for your jobs. A machine takes jobs while it has a free slot (see Jobs at once).
Rules that always apply
- Public repos never run on machines. The self-hosted step is skipped for them.
- A provider missing from the runner order is never used, even if the relay names it.
- One relay routes one job. If two jobs or a matrix share one relay's output, only the first runs. Give each job its own relay.
When a provider stops picking up jobs
If a hosted provider's runner type leaves 3 jobs in a row waiting 10 minutes with no runner, the Router skips it and sends jobs to the next step instead. This covers outages, network trouble, and an account that hit its spend cap. A job that runs and fails doesn't count.
After 10 minutes, the Router sends one job back to try it. If a runner picks it up, the runner type is back in use. If not, the Router waits twice as long before the next try, up to an hour.
The Router page shows each runner type it's skipping, with a Try again now button for owners and admins. When no other step can take a job, the Router still sends it to the skipped runner type rather than failing the relay.
When a provider can't see the repo
A hosted provider only runs jobs from repos its GitHub App can access. If its app is installed on Selected repositories without this repo, a job sent there would wait with nothing to pick it up.
If a job the Router sent to a hosted provider isn't picked up within a minute, the Router ends it with a message that names the provider, then re-runs the relay once the run finishes, so the job goes to the next step in your runner order. That provider is skipped for that repo until a later job tries it again, on the same schedule as above, and it's back in use as soon as a runner picks one up. The Activity page shows each of these retries.
The Router also skips Blacksmith and Groundbox for an organization that hasn't installed their GitHub App.
To fix it, give the provider's GitHub App access to the repo in your GitHub settings.
This is on by default. To keep sending jobs to a provider however long they wait, turn off Skip runners that stop picking up jobs under Settings on the Router page.
When every machine is busy
If every machine that fits is busy and no later step in your runner order can take the job, the job waits for a free slot instead of failing. The relay passes, and the job shows as queued on GitHub until a machine has room. Jobs get free slots in the order they started waiting.
A waiting job runs as soon as a slot frees, on whichever fitting machine frees first. Cancelling the run takes it out of line, and GitHub cancels a job that waits more than 24 hours.
If the machine a job was sent to goes offline before the job starts, or its runner fails to start, the job goes back in line the same way. It runs on the next fitting machine with room, or on the same machine once it reconnects. A machine that stays offline for a minute counts as gone.
If no machine that fits comes back within 5 minutes, or the job's runner fails to start on three tries, the job fails with a message saying why, so the run finishes instead of waiting 24 hours. With automatic retries on, the Router re-runs it and routes it again from your runner order.
To send jobs elsewhere instead of waiting, add a step after your machines, such as github or a hosted provider.
When nothing fits
The relay fails straight away with one line that names why each provider couldn't take the job, starting with the one you can act on, such as:
No runner available: no self-hosted machine is online and idle;
githubisn't set on this relay.
The relay's log and the run's summary page show the same line, with a link to the dashboard page that fixes it, and a RelayRunner: couldn't route check on the commit puts the reason in the pull request's checks list. The job that needs the relay doesn't start. Re-run it once a machine is back, or add a fallback so it doesn't happen again: give the relay a github label and keep GitHub-hosted in the runner order.
When a machine goes away mid-job
Routing happens before a job starts. If you stop relayrunner connect or the machine sleeps while a job is running, that job fails, the same as on any self-hosted runner. Turn on automatic retries to have the Router re-run it, or see Re-running a job.
To take a machine out of rotation without cutting off a running job, pause it first.
Re-running a job
Re-run all jobs runs the relay again, so the job routes from the top of your runner order.
Re-run failed jobs keeps the relay's earlier answer, so where the job goes depends on the runner it had:
| The job ran on | A re-run goes to |
|---|---|
| A connected machine | The same machine if it's free, else another machine that fits the job, else it waits for one |
| A runner added from GitHub | The same runner |
| GitHub-hosted | GitHub-hosted, with the same label |
| A hosted provider | The same provider, with the same label |
To move a failed job to a different provider, use Re-run all jobs.
Automatic retries
The Router can re-run a job that failed because of its runner rather than its own steps. A job counts when:
- Its runner never started its steps.
- The connected machine running it went offline.
- GitHub lost touch with its runner.
A job whose own steps failed isn't retried, unless AI is on and sure the failure is flaky, like a timeout. GitHub only re-runs jobs once the whole run has finished, so the retry starts then. The Router re-runs the relay with it, so the retry routes again.
Turn this on with Retry jobs when their runner fails under Settings on the Router page. Owners and admins can choose:
- Send the retry to: any runner, the same runner first, or a different runner first. When nothing else can take a retry meant for a different runner, it goes back to the one it failed on.
- Retries per run: 1 or 2.
A repo can turn retries on or off for itself with retry in its relayrunner.yml. Each retry shows on the Activity page with the reason. Runs with more than one relay aren't retried yet.
When RelayRunner can't answer
If the GitHub App isn't installed on the repo's owner, or RelayRunner can't be reached, the relay job stays queued until GitHub gives up on it. It doesn't fall back on its own, because only RelayRunner can answer a relay. See Troubleshooting.
See why a job ran where it did
The dashboard's Activity page shows each routed job, the runner it got, and every step that was skipped with the reason. See Activity and history.