interleave.yml reference
Every field of the recipe that tells the cloud sandbox how to boot your repo.
interleave.yml lives in your repo's root. interleave init drafts it from your machine. Commit it so
PR runs use the same recipe. It never holds secret values, only secret://NAME references.
Interleave validates the file strictly: an unknown key is an error, so a typo fails loudly instead of
being ignored. Durations are strings like "500ms", "120s", "5m" or "1h". Quote versions
("16", not 16).
Editor autocomplete
The JSON Schema is published at /schema/interleave.schema.json on
this site. Point your editor's YAML extension at it, or add a $schema line.
Example
The recipe init drafts for a Next.js app with Postgres and Redis:
version: 1
runtimes:
node: "20"
pnpm: 10.34.7
services:
postgres:
version: "16"
port: 5432
db: acme
user: acme
password: acme
redis:
version: "7"
port: 6379
apps:
web:
install: pnpm install --frozen-lockfile
build: null
start: pnpm run dev
port: 3000
role: ui
health:
path: /api/health
timeout: 180s
setup:
- pnpm exec prisma migrate deploy
- run: pnpm run db:seed
soft: true
env:
DATABASE_URL: postgresql://acme:acme@localhost:5432/acme?schema=public
REDIS_URL: redis://localhost:6379
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: secret://generated/NEXTAUTH_SECRET
auth:
strategy: credentials
username: ada@acme.test
password: secret://TEST_USER_PASSWORD
triggers:
pull_request:
enabled: true
branches: [main]Boot order
- The PR's commit is checked out and
runtimesare installed. - Each app's
installruns. servicesstart and are waited on until healthy.setupsteps run in order, withenvset.- Each app's
build(if set) andstartrun. - The
uiapp's health check decides when the environment is ready.
After the first successful boot, Interleave snapshots the sandbox. PR runs restore the snapshot and
only reinstall apps whose lockfiles or install commands the PR changed. Editing anything except triggers builds a new snapshot.
Top-level fields
| Field | Type | Default | |
|---|---|---|---|
$schema | string | Optional schema URL for editors. Ignored by Interleave. | |
version | 1 | required | Recipe format version. Always 1. |
runtimes | map | {} | Language runtimes and tools. |
services | map | {} | Databases and other sidecars. |
apps | map | required | The processes that make up your app. At least one. |
setup | list | [] | Commands run after services are healthy, before apps start. |
env | map | {} | Environment variables for setup steps and apps. |
integrations | map | {} | Third-party tooling the sandbox runs for you. |
auth | map | {strategy: none} | The test user the browser agent signs in as. |
sandbox | map | {size: small} | How big the cloud sandbox is. |
database | map | {reset: per-case} | Whether cases share data or each starts clean, and your own reset command. |
triggers | map | When runs start without a comment. |
runtimes
A map of tool name to version, installed with mise inside the sandbox. Any tool mise knows works.
runtimes:
node: "22.11"
python: "3.12"
pnpm: "9"services
Native sidecars started before setup. Each engine appears at most once.
| Engine | Fields |
|---|---|
services.postgres | version, port, db, user, password |
services.mysql | version, port, db, user, password |
services.mongodb | version, port, db, user, password |
services.redis | version, port |
services.mailpit | version, port |
| Field | Type | |
|---|---|---|
version | string, required | Engine version, quoted: "16". |
port | integer, required | Port the service listens on inside the sandbox (1–65535). |
db | string | Database to create. |
user | string | User to create. |
password | string | That user's password. These are sandbox-only credentials, so plain values are fine. |
mailpit catches outgoing email, so flows like sign-up confirmation can be tested without sending
real mail.
apps
A map of app name to app. Names are lowercase letters, digits, - and _, starting with a letter or
digit. Exactly one app must have role: ui.
| Field | Type | Default | |
|---|---|---|---|
apps.<name>.cwd | string | . | Directory, relative to the repo root, the app's commands run in. |
apps.<name>.install | string or null | Install command, e.g. pnpm install --frozen-lockfile. | |
apps.<name>.build | string or null | Build command. null runs in dev mode, the way you run it locally. Set it to test production builds. | |
apps.<name>.start | string, required | Start command. | |
apps.<name>.port | integer | Port the app listens on. Required for ui and api apps. | |
apps.<name>.role | ui, api, worker | ui | ui is what the browser opens and gates readiness. api serves the UI. worker runs in the background and needs no port. |
apps.<name>.health | map | How Interleave knows the app is up. |
health
| Field | Type | Default | |
|---|---|---|---|
health.path | string | / | Path to request. Must start with /. |
health.mode | http-any, http-2xx, tcp | http-any | http-any: any HTTP response counts. http-2xx: only 2xx. tcp: the port accepts connections. |
health.timeout | duration | 120s | How long to wait before the boot fails. |
health.host | string | Host header to send, for host-routed apps (for example Django's ALLOWED_HOSTS). |
setup
Commands run in order after services are healthy and before apps start: migrations, seeds, fixtures. Each step is a string, or a map:
| Field | Type | Default | |
|---|---|---|---|
setup[].run | string, required | The command. | |
setup[].soft | boolean | false | A failing soft step warns instead of failing the boot. Useful for optional seeds. |
setup[].cwd | string | repo root | Directory to run it in. |
setup:
- pnpm exec prisma migrate deploy
- run: pnpm run db:seed
soft: true
cwd: apps/webenv
Environment variables for setup steps and apps. Names are letters, digits and _, not starting with a
digit. A value is either a plain string or a secret reference:
| Value | Meaning |
|---|---|
postgresql://… | Plain value, committed as is. Use it for local URLs and config that isn't secret. |
secret://NAME | Read from the project's encrypted vault at boot. Set it with interleave secrets set NAME. |
secret://generated/NAME | A stable placeholder Interleave derives from the project, for values that only need to exist and stay the same, like session signing keys. |
Any other string that starts with secret:// is rejected. See Secrets for how values are
encrypted and what Interleave blocks.
integrations
integrations.stripe
| Field | Type | |
|---|---|---|
integrations.stripe.forward_webhooks_to | string | Path on the ui app. The sandbox runs stripe listen --forward-to to it, so checkout flows get their webhooks. Needs a Stripe test key in the vault. |
integrations:
stripe:
forward_webhooks_to: /api/webhooks/stripeauth
The test user the browser agent signs in as. Without it (strategy: none), cases start signed out and
can only test public pages, or sign up a new user each time.
auth:
strategy: credentials
username: ada@acme.test # or secret://TEST_USER_EMAIL
password: secret://TEST_USER_PASSWORD
login_path: /login
# start: signed-out # opt out: every case signs in itself
sign_in: # only if the login form isn't found on its own
username_selector: "#email"
password_selector: "#password"
submit_selector: button[type=submit]
check_path: /dashboard
sign_up: # only if the user should be created through your app
path: /signup| Field | Type | Default | |
|---|---|---|---|
auth.strategy | none, credentials | none | credentials gives the agent a test user. |
auth.username | string or secret ref | required with credentials | The test user's email or username. |
auth.password | string or secret ref | required with credentials | Their password. Keep it in the vault. |
auth.login_path | string | /login | Path of the sign-in page. |
auth.start | signed-in, signed-out | signed-in | How each case's browser starts. |
auth.sign_in | map | Hints for the one sign-in per run. Every field is optional. | |
auth.sign_in.username_selector | CSS selector | The username or email field. | |
auth.sign_in.password_selector | CSS selector | The password field. | |
auth.sign_in.submit_selector | CSS selector | press Enter | The submit button. By default Enter is pressed in the password field. |
auth.sign_in.check_path | string | A signed-in page opened after signing in. The session counts only if it doesn't land back on the login page. | |
auth.sign_up | map | Create the test user through your app's sign-up page when signing in fails. | |
auth.sign_up.path | string | /signup | The sign-up page. |
auth.sign_up.submit_selector | CSS selector | press Enter | The sign-up form's submit button. |
Use a dedicated test account, never a real person's.
Where the test user comes from
The sandbox starts from your migrations and seed, not your local database, so an account you made by
hand locally won't be there. init looks for a test user in your seed scripts, bootstrap env vars
(FIRST_SUPERUSER_*, TEST_USER_* and similar) and README. If there isn't one, add it in any of
these ways:
- During
init: pick Sign up a new user through my app, or pass--test-user qa@interleave.test(with--login-pathand--signup-pathif yours differ). - On the dashboard: Projects → your repo → Environment → Test user.
- In
interleave.yml: anauth:block as above. It wins over the dashboard setting.
With sign-up, each sandbox signs the user up through your app's own sign-up page (filling email, password, confirm-password and name fields and ticking required checkboxes), then signs in. Interleave generates the password per project, so nobody needs to know it.
For an account that already exists, for example in a Clerk or Auth0 dev instance, choose an existing
account instead (--signup-path none). The password goes into the vault: init seals it on your
machine, or run interleave secrets set TEST_USER_PASSWORD and name that secret on the dashboard.
Sign-up through the UI doesn't work for apps that need email verification or an invite. Seed the user, or use an existing account.
Signed-in start
With a test user, cases start signed in (start: signed-in):
- The runner signs the user in once per run through your real login form and saves the browser session (cookies and localStorage). With parallel case sandboxes it's once per sandbox.
- Each case starts with that session and opens signed-in pages directly, with no login steps.
- Cases about signing in start signed out and sign in themselves: cases tagged
auth, cases that type the test user's password, and cases that open the login page. - If a signed-in case fails because the session expired, the runner signs in once more before the retry. If the sign-in itself fails, cases start signed out and the run log says why.
- The case report shows how each case started, for example "Signed in as ada@acme.test" or "Signed out · tagged auth".
- The session never leaves the sandbox. It's kept in a private file deleted at the end of the run, it isn't in snapshots or artifacts, and its values are redacted from evidence.
start: signed-out makes every case sign in itself, which is slower but tests the login form each time.
database
Every case of a run uses the same database, which your setup steps seed once. Left alone, a "create
folder" case would leave a folder behind for the "rename folder" case after it, and the second case
fails for a reason that has nothing to do with your change. Resetting the data between cases is the
best way to avoid those false failures.
| Field | Type | Default | |
|---|---|---|---|
database.reset | per-case | none | per-case | per-case resets the data before every case and retry. none lets cases see each other's rows. |
database.command | string or { run, cwd } | Your own reset, run instead of the built-in one. Works with any database. |
Postgres: nothing to set up
With a services.postgres entry, Interleave copies the data before the first case and puts it back
before every case and every retry. The test user's session survives, because the copy is taken after
the sign-in. Sequences go back too, so ids repeat from run to run. Triggers don't fire during the
restore, so the database diff only shows what the app changed.
Any other database: database.command
For MySQL, MongoDB, SQLite, a hosted database or anything else, give Interleave a command that puts the data back. It runs before every case and every retry, except before the very first case.
database:
command: pnpm db:resetAdd a cwd when the script lives in a subfolder:
database:
command:
run: make reset-db
cwd: apiSome commands that already do this:
| Stack | Command |
|---|---|
| Prisma | pnpm exec prisma migrate reset --force --skip-generate (runs your seed) |
| Django | python manage.py flush --no-input && python manage.py loaddata seed |
| Rails | bin/rails db:reset |
| Drizzle, Knex or your own scripts | pnpm run db:reset |
| SQLite | a small script that deletes the rows over a connection, e.g. bun src/db/reset.ts (don't copy over the file: the app keeps it open) |
What the command has to do:
- Leave the test user in place. Reset to the seeded state, with the account Interleave signs in as.
If the command removes it, Interleave signs in again after each reset (and signs up through
auth.sign_upif you set it), but that costs a few seconds per case. - Run with the same environment as
setup, includingDATABASE_URLand your secrets, from the repo root or thecwdyou give. It gets five minutes. - Be quick. It runs once per case. Truncating and reseeding a small dataset is ideal; a full migrate-from-scratch on a big schema is slow.
- Be safe to run while the app is up. Dropping and recreating the database can break the app's open connections. Prefer truncating tables or restoring a copy over the app's own connection.
A failing command logs a warning and the case still runs, so a broken reset shows up in the run log rather than failing the whole run.
Opting out
database:
reset: noneUse it if your app can't take its tables being emptied and refilled between cases, for example when it
keeps long-lived state in memory that mirrors the database. A command together with reset: none is
an error. Setting INTERLEAVE_DB_RESET=off in the sandbox env does the same for one run.
When nothing resets the data
Without a Postgres service and without a command, cases share whatever earlier ones leave behind.
Every run says so in its log. Interleave also tells the case writer to create what each case needs and
not to rely on another case having run, which helps but can't undo a counter or a list that grew.
Redis, files on disk and other stores are only reset if your command does it.
sandbox
How much CPU and memory the cloud sandbox gets. It holds your app, its databases and a browser at once.
| Field | Type | Default | |
|---|---|---|---|
sandbox.size | small | large | small | small is 2 vCPU / 4 GiB. large is 4 vCPU / 8 GiB and costs about twice as much per sandbox-minute. |
sandbox:
size: largeinterleave init writes size: large when the app used 2 GiB or more of memory on your machine, or when
the repo runs three or more apps. Otherwise the block is left out. Change it by hand at any time, and
init --keep-recipe keeps it.
Each finished run records the most CPU and memory its sandboxes used, and how much of the time the CPU
was saturated (95% or more). If a small run shows memory near 4 GiB or the CPU saturated for most of
the run, set size: large. Changing the size builds a new snapshot on the next run.
triggers
When runs start without a comment. Without this block, only @interleave test comments (and the CLI
and Action) start runs. Comments always work, whatever triggers says.
triggers:
pull_request:
enabled: true
branches: [main, "release/*"]
paths: ["apps/web/**", "!**/*.md"]
skip_drafts: true
instructions: Focus on the checkout flow.triggers.pull_request can also be true, shorthand for { enabled: true }.
| Field | Type | Default | |
|---|---|---|---|
triggers.pull_request.enabled | boolean | false | Start a run when a PR is opened, pushed to or marked ready for review. |
triggers.pull_request.branches | list of globs | every branch | Only PRs into these base branches. |
triggers.pull_request.paths | list of globs | every change | Only PRs that change a matching file. A leading ! excludes. |
triggers.pull_request.skip_drafts | boolean | true | Don't run draft PRs. They run once marked ready for review. |
triggers.pull_request.instructions | string | What automatic runs focus on, like the text after @interleave test. Up to 4,000 characters. |
Globs support * (within a path segment), ** (any number of directories) and ? (one character).
Patterns apply in order, like GitHub Actions: a !pattern removes what earlier ones matched, and a
list of only exclusions starts from every file.
Read from the base branch
Interleave reads triggers from the tip of the PR's base branch, never from the PR itself, so a PR
can't turn automatic runs on for itself or change their instructions. Changing triggers never
rebuilds the environment snapshot.
See GitHub for how automatic runs behave on new pushes and fork PRs.