Quickstart
Run the Turntable server from a binary or a container.
Only what works today is listed here. You can run one job of a workflow locally with turntable run, or run the server to poll or receive webhooks for a repo and run every job. How the pieces fit explains what the server does around a run.
Binary
Build the binaries into dist/ from a checkout:
bun install
bun run buildThen run one:
./dist/turntable-darwin-arm64 version
./dist/turntable-darwin-arm64 serve --port 8080 --data-dir ./dataThe binary works from an empty directory. Migrations and assets are embedded.
To run from source without building:
bun run devRun a job
turntable run runs one job of a GitHub Actions workflow in a fresh Docker sandbox, using act in host mode, and records the run in the database. You need a running Docker daemon and a git repository.
./dist/turntable-darwin-arm64 run examples/hello/.github/workflows/ci.yml -j hello \
--repo path/to/repo --data-dir ./dataFlags: -j <job> (required), --repo <dir> (default: current directory; the repository root), --image <ref> (default: node:22-bookworm pinned by digest, which has bash, git and node), --event push, --egress none|open (default none), --data-dir ./data.
- What is delivered. The committed tree (
git archive HEAD) plus.git, which act’s checkout stand-in copies into the workspace. Untracked and ignored files (such asnode_modulesor.env) and uncommitted edits are never sent. You get a warning when tracked files have uncommitted changes. - No network by default. The sandbox has no network access.
--egress openis an explicit opt-in that prints a warning. act is downloaded and checked against a pinned sha256 on the host, and everyuses:action is resolved to a commit sha and delivered by sha, so a moved tag cannot change what runs. - Logs. Output streams to your terminal as it happens and is stored in the database, after secret redaction, with byte offsets.
- One job or the whole workflow. With
-j <job>a single job runs (noneedsor matrix). Without-jthe whole workflow runs: the trigger is checked first (--event,--base-ref,--action, and--changed-from <rev>for path filters), jobs run in dependency order with one sandbox each (--max-parallel, default 2),needsresults and outputs flow into dependents, matrices expand into one job per leg, and jobif:is evaluated. Jobs that need docker (container,services,docker://, a docker command or action), run on a non-Linux runner or call a reusable workflow are recorded as skipped with the reason as their log. A workflow that does not trigger for the event runs nothing and exits 0. - Same path as the server. A whole-workflow run is stored as a local run and an in-process scheduler runs its jobs with the same job runner the server’s worker uses (leases, readiness, outputs,
if:andcontinue-on-errorbehave the same). Only the process that started a local run claims its jobs: a server sharing the data directory never does. - Cancel. Ctrl-C cancels the run the way the
canceloperation does: running jobs stop at once, their sandboxes are destroyed and the attempts are marked cancelled. The sandbox is always destroyed when the run ends. - Exit codes.
0success (or a job skipped byif:),1the job failed,2infrastructure error or a workflow that cannot be run,130cancelled.
Docker
Build and run the image:
docker build -t turntable .
docker run --rm -p 8080:8080 -v turntable-data:/data turntableThe image is distroless (the server runs no other program: it fetches and packs a run’s commit in process) and the server runs as the non-root user 65532. It starts as root only to take ownership of its data directory and drops to 65532 before it opens anything (see Root-owned volumes). It stores data in /data and sets TURNTABLE_HOST=0.0.0.0 so the published port is reachable.
Check that it is up
curl http://127.0.0.1:8080/healthzThe response is JSON with ok and the running version.
Deploy
On a host where you cannot run commands in the container (Railway, Fly, a distroless image), bootstrap access with a token hash instead of token create:
# On your own machine: prints the token (stdout) and its sha256 (stderr).
./dist/turntable-darwin-arm64 token generateKeep the token. Set only the hash on the server:
| Variable | Value |
|---|---|
TURNTABLE_BOOTSTRAP_TOKEN_SHA256 | the sha256: value printed above |
TURNTABLE_BOOTSTRAP_ORG | optional, default local |
PORT | set by the host; serve uses it as the default port |
On boot, if the org has no tokens yet, the server creates one operator token with that hash (valid 365 days). It does nothing when the org already has tokens, so the variable is safe to leave set. The token is never stored on the server or in its environment or logs; only its hash is. Use it as Authorization: Bearer <token>.
Root-owned volumes
Railway and some other platforms mount a volume owned by root, which a non-root process cannot write. The image handles this itself: it starts as root with TURNTABLE_DROP_PRIVILEGES=65532:65532 (set in the image), chowns the data directory and the files it expects in it (the database and its -wal and -shm files, and a master key file and its .audit-state directory if they live there) to that user, then drops group, supplementary groups and user, and proves root cannot be regained, all before the database or any key file is opened. Do not set RAILWAY_RUN_UID=0 (or any run-as-root override): the image no longer needs it.
- The chown does not walk the volume. It uses open file descriptors that never follow a symlink, and it refuses a symlink, a file with more than one hard link, anything on another device, and any entry it does not recognise (apart from
lost+found): the server does not start, and names the entry. Remove it, or start without root. - Every step of the drop is checked: if setuid, setgid or setgroups is unavailable, the user, group or supplementary groups are not what was asked, or root can be regained, the server refuses to run.
- Children are reached through the open descriptor of their parent directory, and files are opened without blocking, so a symlink, a FIFO or a swapped directory planted by a past process can neither redirect the chown nor hang the start.
- Other subcommands that open the data directory (
token,keys,github-app,run,oidc,secret,audit,policy,mcp,approvals,incident) apply the same drop-or-refuse first, without chowning, so adocker execas root never leaves root-owned files. Preferdocker exec --user 65532 <container> turntable .... - The server refuses to keep running as root. To run as root on purpose, set
TURNTABLE_ALLOW_ROOT=1. - Started as a non-root user (
docker run --user 65532:65532), nothing is dropped and nothing is chowned. - Everything is opened after the drop, so a master key file (
TURNTABLE_MASTER_KEY_FILE) must be readable by65532: keep it on the data volume, where it is chowned too, or make it readable. - Outside the image, set
TURNTABLE_DROP_PRIVILEGES=<uid>:<gid>yourself if you startturntable serveas root.
Network binding
--host defaults to 127.0.0.1, so a bare binary is reachable only from the local machine. Pass --host 0.0.0.0 or set TURNTABLE_HOST to listen on all interfaces. Put a TLS-terminating proxy in front before you expose it.
Create your first API token
Agents and scripts call the REST API with a bearer token. Create the first one from the command line, because creating tokens over the network needs an org admin and sessions do not exist yet. Local access to the data directory is the trust root.
TOKEN=$(./dist/turntable-darwin-arm64 token create \
--org local --project local --role reader --name my-agent --data-dir ./data)The secret goes to stdout, and the details go to stderr. It is shown once and only its hash is stored, so keep it. Roles are reader (read-only), operator (also cancels runs) and release_operator. Tokens expire after 90 days unless you pass --expires-days N (1 to 365). --project narrows a token to one project. --kind agent (the default) or --kind person says who holds it: a project refuses agent tokens as approvers of untrusted pull request runs by default, so use person for a human’s own token. On a fresh data directory, --org local creates the built-in local org and project.
Use it against a running server:
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8080/api/v1/runsList and revoke tokens the same way:
./dist/turntable-darwin-arm64 token list --org local --data-dir ./data
./dist/turntable-darwin-arm64 token revoke <id> --data-dir ./dataA revoked or expired token stops working at once. The OpenAPI document is at /openapi.json.
Run queued jobs on the server
serve can also run jobs. Start it with --worker and it claims queued attempts, runs each one with act in a sandbox, and records the logs, steps and result. Reruns queued with the rerun operation are picked up the same way.
./dist/turntable-darwin-arm64 serve --worker --data-dir ./data| Flag | Default | Meaning |
|---|---|---|
--worker | off | Run queued attempts in this process. |
--global-cap | 4 | Most attempts running at once. |
--org-cap | 2 | Most attempts running at once for one org, so one tenant cannot take every slot. |
--lease-seconds | 30 | How long a claim lasts without a heartbeat. |
--provider | docker | Sandbox provider: docker (built in) or daytona (not in this build yet). |
--provider-config | none | A JSON file of provider options (docker: docker, maxFileBytes). Secrets never go inline: a provider that needs a key reads it from a file named here. |
--image | node 22 | Sandbox image. |
Each claim is a lease that the worker extends with heartbeats, and everything a worker writes is fenced by it. If a worker dies (a crash, kill -9, a lost host), its lease expires. On boot, and periodically after, the server resolves every attempt with an expired lease by probing its sandbox with exec.status:
- The exec still exists (running, or finished while nobody watched): the server takes the lease over and re-attaches. The job runs in a detached exec that outlives the server, so a job that finished meanwhile keeps its real result. The worker replays the exec’s whole log by offset, rewrites the stored log and steps, and records the real verdict (success, failure, or infra_error if act itself failed).
- The exec is lost, the sandbox is gone, or the provider cannot be reached: whatever still runs is killed, the sandbox is destroyed, and the attempt is marked
infra_errorwith the probe result. It never guesses a verdict.
Runs started by turntable run are claimed only by the process that started them. If that process crashes, its expired leases are resolved like any other worker’s. On shutdown the worker stops claiming and does not abort running attempts (that would record a cancel nobody asked for): their leases lapse and the next boot re-attaches.
Poll a GitHub repo
serve --poll <config.json> watches a public repo and queues a run for each new commit on its default branch, and for new head commits of open pull requests that pass the gate.
{
"tokenFile": "/etc/turntable/github-token",
"repos": [
{
"repo": "acme/web",
"workflow": ".github/workflows/ci.yml",
"defaultBranch": "main",
"intervalSeconds": 60,
"prMode": "allowlist",
"authors": ["octocat"],
"maxRunsPerHour": 30
}
]
}tokenFileis required: polling is authenticated, so its rate limit is not shared with every other unauthenticated client. Put a token in a file outside the repo with mode 0600 (for example fromgh auth token). The token is read once, sent only in theAuthorizationheader and never put in a URL or a log. The config refuses an inline token.allowUnauthenticated: trueopts out explicitly, for a public repo: with no token GitHub allows 60 requests an hour for the whole address, and counts a304 Not Modifiedanswer to a conditional request against it (measured against api.github.com, unlike an authenticated caller). A steady-state poll costs 2 requests (head and branch protection), plus 1 each for tag refs, open pull requests and merge queue branches when on. Keep the total under 45 an hour:intervalSecondsof at least 80 times the requests per cycle (240 seconds for 3, 320 for 4, 400 for 5, summed over all repos). Turntable logs the estimate at start and warns when the interval is too short. A private repo answers an anonymous caller with 404, so it needs a token.- The GitHub client is read-only: every request is a GET, enforced in the client and covered by a test.
- Polling is cheap. Requests are conditional (
If-None-Match), and a 304 does not count against the rate limit.intervalSecondsis 30 to 3600 (default 60; 60 to 120 is the intended range). A failing poll backs off exponentially, never shorter thanRetry-Afteror the rate-limit reset GitHub reports, and a success resets it. When the remaining budget is nearly gone the poller waits for the reset instead of spending it. Theingest_statusoperation shows the budget and each repo’s last poll over MCP or REST. prModeisoffby default. Withallowlist, a pull request runs only if its head repo is the configured repo (a fork never runs, whatever else is true), whoever opened it is inauthors, and the author of its head commit is inauthorstoo. A head commit with no linked GitHub account is refused. The author check is defense in depth, not identity: a commit author is whatever name and email the committer wrote, so anyone who can push can forge it. The real anchors are the same-repo head (pushing a branch there needs write access) and the PR opener (an authenticated GitHub identity). Hosted mode will need verified commits or per-sha approval, tracked on #17. A bot runs only if its exact login (dependabot[bot]) is listed. All of this comes from the API response.prMode: "approval"ingests every open pull request and decides its trust class from re-fetched facts (same repo, and the opener’s collaborator permission, which needs a token that can read it). Untrusted ones are created but wait inawaiting_approvaluntilapprove_runis called with their head sha and workflow hash; they never get secrets.protectedRefsadds protected ref patterns (the default branch always is) andmaxWaitingRuns(default 20) caps how many runs of that repo may wait, andmaxNewPrsPerPoll(default 5) caps how many pull requests from authors outsideauthorsone poll examines.turntable policy set approve-run-min-role <operator|release_operator> --org <slug>sets who may callapprove_run(defaultrelease_operator).egress(none,openorallowlist) sets the sandbox egress for the repo’s runs; unset, the project’s setting applies, which defaults tonone(turntable policy set --egress <mode> --org <slug> [--project <slug>]sets it;turntable policy showlists it). Runs classifieduntrusted_pralways getnone, unlessuntrustedEgressisallowlist. Each run’s plan records its trust class and egress (plan.trust,plan.egress) for isolation and egress policy. See Trust classes.tagRefs(default none) ingests tags as runs. A repo ingests no tag until it lists patterns, each an exact tag ref orrefs/tags/<literal prefix>*with at least one literal character (refs/tags/v*,refs/tags/v1.0.0; neverrefs/tags/*,**, a leading wildcard or a?, which are refused when set, so one setting cannot make every tag a release). A bound project sets them withturntable policy set --ingest on --tag-refs 'refs/tags/v*' --org <slug> --project <slug>(local, audited, never over MCP). Anyone with write access can create a tag at any commit, so a tag becomes a run only when all of this holds, each fact fetched now:- It matches a pattern. Each pattern is listed on its own (conditional, authenticated) and filtered before any tag object is read.
- It is new. A tag is keyed by name and commit, so a tag at the default branch’s head is still its own run, and tags already seen cost nothing: a poll skips them before counting and stops after 10 unseen tags and 100 forge requests, so old tags never starve new ones.
- Its commit is on the default branch’s first-parent history (within 1000 commits), or was itself ingested as a default branch push. A commit that only came in with a merged branch, or sits on an unmerged branch, is refused (and looked at again later). An annotated tag is followed to its commit.
- The workflow is read at that commit and planned like any other run. The class comes from the same trust decision as every run, with the listed patterns as the project’s release refs, so a matching tag is a
releaserun. - A tag run has no actor. The API names an annotated tag’s tagger as free text, not a verified identity, so it is kept only as
facts.taggerLabel(display) and never as the run’s actor, which feeds the author check and the OIDC claims. For a tag run no approver is excluded and the environment needs one more distinct person than its quorum (a quorum of 2 needs 3; the tagger’s name is display only), unless the policy allows author approval (solo). Any other run with no author stays refused. A token minted for the run has noactorclaim. See Releasing from a tag. - Whether it starts depends on a ruleset. The run starts at once only when an active GitHub ruleset on tags has all of
creation,update,deletionandnon_fast_forward, covers the pattern, excludes nothing, and lets only organization or repository admins bypass it. “Covers” is deliberately narrow: the include is~ALL, the very same pattern, orrefs/tags/<literal>*where the literal is a prefix of the pattern’s own; an include with?,[,{,+or**covers nothing. The bypass list is only returned to a token with administration read access: without it a ruleset cannot be verified and counts as unprotected, so grant the poll token (or App)administration: reador every tag run is held. Otherwise (no such ruleset, a looser one, an unverifiable one, or rulesets that cannot be read) the run is created held: it waits forapprove_run(bound to its sha and workflow hash), which for a release tag run needs a release operator whatever the org set for pull requests. Approving the hold does not stand in for an environment’s own gate: a job in a gated environment (such asrelease) stays waiting for that environment’s approval after the hold is approved. The run records which applied (facts.tagProtection:ruleset,noneorunknown) and the poller audits it (poll_tag_run). Rulesets are cached for a minute. A tag already seen at one commit that now points at another is a moved tag: it creates nothing and is audited once astag_moved. Apushwebhook for a tag only wakes the poller; nothing in its payload is believed.
prNumbers(optional) limits pull request ingest to the listed PR numbers, for targeted runs without picking up every open pull request.mergeQueue(defaultfalse) ingests merge queue runs (merge_group). Each poll lists the repo’sgh-readonly-queue/<defaultBranch>/branches and runs one only when its tip commit is signed and verified by GitHub and committed by GitHub’s own address (anyone with write access can create a branch with that name, but cannot make GitHub sign it), and the PR in the branch name is open, in this repo and opened by a listed author. The run istrusted_pr: no secrets, no write token. Amerge_groupwebhook wakes the poller.- A push run’s
before(github.event.before, and the base ofpaths:filters) is GitHub’s own value when the poller can get it: the events API’s push event for that head, else the head commit’s first parent when it has one (right for a one-commit push, the squash-merge case), else the last sha the poller handled. Which of these applied is recorded in the run’s trust facts asbeforeSource(events,first_parent,last_polledornone). Polling can miss a push that landed and was followed by another between two polls: withouteveryPushonly the head becomes a run, as before. everyPush(defaultfalse) also makes a run for each default-branch push the poller missed since the last one it handled: the first-parent commits between that sha and the head, the newest five at most per poll, oldest first, each with its ownbefore. It does nothing after a force push (the last handled sha is no longer behind the head). Turn it on to mirror CI that ran for every push; each extra run counts againstmaxRunsPerHour. Withturntable policy --ingest on, pass--every-push.- Each (repo, workflow, event, sha) becomes a run once.
maxRunsPerHourcaps how many a repo can queue. - Runs land in the
organdprojectyou name (default: the built-inlocalones), with the sha, ref, actor, commit message and PR number filled in. The project is bound to the repo so the worker knows what to fetch. - The whole workflow is planned at ingest. The trigger router applies
on:(event, branch and tag filters, activity types). For a workflow with apaths:filter the poller asks the GitHub compare API which files changed (base...headfor a pull request, the previously seen sha to the new one for a push; read-only, conditional like every request). A change that touches nothing the filter matches, such as docs only, creates no run and is remembered so it is not looked at again. If the changed files cannot be known (the first sight of a branch, a force push, more than 300 files) the filters are not applied and the workflow runs. - Every job becomes a queued job up front, with its
needs, its matrix leg values and the planned job stored on it. Matrices expand to one job per leg. A job that cannot run here (docker, a non-Linux runner), whoseif:is false, or that needs a job that failed is skipped as soon as that is known, with the reason as its log.if: always()andfailure()jobs still run behind a failure, and a failedcontinue-on-errorjob counts as success for its dependents and the run. A failed matrix leg cancels the legs that have not started (fail-fast), andmax-parallellimits legs running at once. Workflows with unknownneeds, a dependency cycle or more than 256 jobs are refused. - A job runs from a generated single-job workflow whose stub need jobs carry the real results and outputs of its dependencies, so
needs.<job>.outputs.<name>works. A job’s outputs are stored when it finishes and handed to the jobs that need it. - Local composite actions are read at ingest. A workflow that uses
./pathactions has them fetched from the commit (read-only, at most 20, nested up to 5 deep, through the same path checks as the safe reader). A docker step inside one, however deeply nested, marks the job unsupported at plan time instead of failing when it runs. - A manual
cancelstops work at once in the process that runs it: the worker is signalled and the sandbox destroyed when the cancel commits. A worker in another process notices at its next heartbeat. - The job plan is stored on the attempt when it starts, so a restarted server re-attaches to a running job with no repo fetch and no network.
- Concurrency groups are tracked per project. A new run whose workflow sets
concurrencywithcancel-in-progress: truesupersedes older unfinished runs of the same group: the new run is created first, then the older run’s queued and running jobs are cancelled and the workers of the running ones are told to stop and their sandboxes destroyed. A group withoutcancel-in-progressqueues like GitHub’s: at most one run is running and one is pending. A new run waits behind the running one (its jobs are not claimed yet), and a newer pending run replaces the older pending one, which is cancelled. Reusable workflows and expression-built matrices are reported as unsupported.
Report results to GitHub as check runs
With a GitHub App configured, the worker can report each job to GitHub as a check run on the run’s head commit. It is off by default and set per project from the CLI only (no operation can change it, so an agent cannot turn it on):
turntable policy set --checks-mode shadow --org <slug> [--project <slug>]
turntable serve --worker --public-url https://ci.example.com ... # or TURNTABLE_PUBLIC_URLshadowpostsshadow / <job name>(plus the matrix leg). The conclusion is alwaysneutral, so it can never gate a merge. The real result is in the output title (Shadow: failure) and summary, and the details link opens the run in Turntable.livepoststurntable / <job name>with real conclusions: success, failure, cancelled and skipped map directly, and an infrastructure error is afailuretitled “Turntable: infrastructure error”.- What the summary says. The real result, the failing step as the runner recorded it, and an extract of the failure (the same extraction as
failure_digest) redacted and capped at 1 KiB, in a code fence so log text cannot add links or mentions. Never more log than that. - Token. Each report mints an installation token for the one repository with
checks: writeand nothing else. The repo must be bound through the App installation; a repo bound without one, and local runs, are never reported. - Reliable, never blocking. The check run id is stored on the attempt, so a restart or re-attach updates the same check instead of adding another. A check created by a worker that died before storing its id is found by its external id (the attempt id). Requests are retried with backoff on outages and rate limits; a refusal (such as a missing permission) is logged and dropped. A GitHub outage never delays or fails a run.
- Not reported yet. Jobs that never start (skipped by
if:or a failed dependency, or cancelled while queued) get no check run.