Site administration
Turn on the factory pass engine
A factory run makes many model calls, and a deploy can reset the object that runs it. The pass engine runs a factory run in passes. Each pass is one alarm of the FactoryJobObject of the run, and makes at most one model call. So a deploy cuts at most one pass of a run. This page turns the pass engine on for one repository, then for every repository, and turns it off again.
18 min read
What to know first:
- Four kinds of runs use the pass engine:
- Reader runs. A reader run is the run of an agent that runs no commands and changes no code, such as the Security audit.
- Container runs of the built-in agents, such as PR review, and the runs of the dependency agent and of the CI cache agent. Such a run has no Workflow. It runs its commands on a Ravion VM, and its
FactoryJobObjectruns its steps. See A dependency run on the pass engine and A CI cache run on the pass engine. - Runs of custom agents. The agent's own code runs on a Ravion VM. See A custom agent's run on the pass engine.
- Jobs of agent workflows. See An agent workflow job on the pass engine.
- Agent workflow jobs with a step that uses a coding CLI do not use the pass engine.
- Each run keeps the engine that it started with. A change of the setting changes only the runs that start after it.
- Each Worker reads the setting again within 60 seconds.
You need:
psql, andneonctlsigned in to the Neon organization of the forge.The URL of the database of the forge in
PG_URL. The URL holds a password, so keep it in your shell only:PG_URL="$(neonctl connection-string main --project-id tiny-unit-38538247 --role-name app --database-name source)"Ravion, set up for CI. See Set up Ravion for CI.
A repository to prove it on, with the Security audit and PR review turned on. See Turn on the agents.
1. Check that the Ravion pipeline takes the job image
A container run on the pass engine starts its VM with the job image. The file apps/web/ravion/pipeline.yaml lists job in the values of the input image, so a pipeline made from it takes the image. A pipeline made from an older copy of the file takes only node and browser.
In Ravion, open the pipeline of the forge. Its id is the value of
RAVION_PIPELINE_ID.Look at the values of the input
image. Whenjobis not one of them, add it, and save the pipeline:- id: image type: string description: The image of the job. The agent gets the image from the forge, so the step does not read this input. values: - value: node - value: browser - value: job
If the pipeline does not take the job image, no container run on the pass engine gets a VM. Each one fails as never started, about 10 minutes after it got its slot.
2. Turn it on for one repository
Prove the pass engine on one repository first, for example a test repository.
Caution
Add the list of repositories before you turn the engine on. While the engine is passes and there is no list, every repository gets the pass engine.
Find the id of the repository:
psql "$PG_URL" -c "SELECT r.id FROM repos r LEFT JOIN orgs o ON r.owner_kind = 'org' AND o.id = r.owner_id LEFT JOIN users u ON r.owner_kind = 'user' AND u.id = r.owner_id WHERE r.name = '<name>' AND coalesce(o.name, u.username) = '<owner>'"Type the owner with the same capital letters as on the forge, for example
TanStack. The answer has one row: the id of the repository.Put the repository in the list:
psql "$PG_URL" -c "INSERT INTO site_settings (key, value, updated_at) VALUES ('factory.engine_repos', json_build_array('<repository id>')::text, (extract(epoch from now()) * 1000)::bigint) ON CONFLICT (key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at"For more repositories, give each id:
json_build_array('<id 1>', '<id 2>').Turn the engine on:
psql "$PG_URL" -c "INSERT INTO site_settings (key, value, updated_at) VALUES ('factory.engine', 'passes', (extract(epoch from now()) * 1000)::bigint) ON CONFLICT (key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at"
Within 60 seconds, the new reader runs, container runs, custom agent runs and agent workflow jobs of the repository use the pass engine.
3. Check a run
- On the repository, start a reader run. For example, start the Security audit of a pull request. See Start an agent run.
- Start a container run. For example, start PR review on the same pull request.
- When each run ends, open its page. See Find and read a run.
- Make sure that each run succeeded, and that its log shows the messages of the agent and its verdict.
- In Ravion, make sure that the pipeline has a run for the VM of the PR review. Its description starts with
Source CI job factory-.
An audit can say Clean with no log, when its first check decided it and no agent ran. See An audit with no log. In that case, start another reader run, for example Triage on an issue.
4. Turn it on for every repository
On every repository, the container runs take VMs next to the CI jobs. Turn it on for every repository only when Ravion has room for both:
- The AWS account of Ravion can run at least 64 vCPU: both EC2 limits of Prepare the AWS account are at 64 or more. On 2026-12-01 they were at 48, and the CI jobs alone filled them in busy hours.
- At the same time, raise Remote CI jobs per account by at least 10. It is in the card CI and AI of Admin, then Limits. On 2026-12-01 it was 9. The container runs of an account that pays take places in it next to its CI jobs. See How much of Ravion the pass engine takes.
Then delete the list:
psql "$PG_URL" -c "DELETE FROM site_settings WHERE key = 'factory.engine_repos'"
Within 60 seconds, the new reader runs, container runs, custom agent runs and agent workflow jobs of every repository use the pass engine.
5. Go back to the Workflow engine
Set the engine to workflow:
psql "$PG_URL" -c "UPDATE site_settings SET value = 'workflow', updated_at = (extract(epoch from now()) * 1000)::bigint WHERE key = 'factory.engine'"
Within 60 seconds, new runs use the Workflow engine. A run that started on the pass engine ends on the pass engine.
Done
The new reader runs, container runs, custom agent runs and agent workflow jobs of every repository use the pass engine. A deploy now cuts at most one pass of such a run, or one call of a custom agent.
A container run on the pass engine
- It waits for its slot in the CI queue of its account, with the CI jobs that run on VMs. Their limits count it too.
- The usage ledger counts it as a small Ravion VM (
ravion-small), not as a container. - Its VM runs in the US environment of Ravion (
RAVION_EE_US), or in the environment of its repository when it has one. See Give a repository its own Ravion hosts. - When the author of the item has write access, the VM keeps a disk for the factory runs of the repository (
src-<repository id>-factory). Otherwise the VM starts on a clean disk, and keeps none. - When the VM is not ready within 10 minutes, the run fails as never started. Then the forge stops the VM.
- A command of its agent (
run_command) can run for up to 30 minutes, longer than a pass. A short command ends in the pass that started it: the tool call waits for it for up to 1 minute. A longer command ends the pass and runs on the VM with no open call. It keeps its output and its exit code in files on the VM. While it runs, the run makes no model call, and itsFactoryJobObjectreads the state of the command each minute. The pass after the end of the command gives its result to the model. A cancel of the run stops its commands first. - Its commands run as the user 1000 of its container (
nodein the job image), in a workspace that the runner agent keeps in a folder of the VM. The files of a long command are in a folder that only root writes, so a command can't change the output or the exit code that the run reads. - The runner agent keeps the repository scope of the run from outside its container: it freezes and thaws the container, stops the commands of the run, and writes the proofs that a checkpoint needs. This needs agent protocol version 2. A VM whose agent is older takes no factory run: the run's container is lost.
- Each instance of the run's
FactoryJobObjectchecks the scope once before the first command that it sends to the container, after its start or after a reset of the object. The commands after that check, in a pass or between passes, share it: a pass never checks again while a call of a program runs. A check that fails is not kept, so the next command checks again. Between passes, a model call or a tool that runs only on the forge never waits for the check. A pass waits for the check before its model call, and only the first pass of an instance makes it. - After a tool call that can change files, at most every 5 minutes, the run saves a checkpoint of its workspace. The agent freezes the container, archives the workspace, and sends the archive to the forge, which keeps it with the run's other checkpoints (
factory-checkpoints/<repository id>/<run id>/). Then the container goes on. A save that fails is logged, and the next one comes 5 minutes later, not after the next tool call. - When the run loses its VM (its agent does not connect again within 2 minutes), the run starts a new VM. Its agent restores the newest checkpoint of the run there, or the commit is checked out when the run has none, and the run goes on from its log. Work after that checkpoint is gone from the files, so a command of the agent can run again. A run starts at most 4 VMs. A run whose new VM is not ready within 10 minutes fails.
An agent workflow job on the pass engine
A job of an agent workflow runs its steps one unit at a time, and each pass runs at most one unit:
- A
runstep runs on the VM as one command. When it ends within 1 minute, the step ends in the same pass. A longer command ends the pass, and the pass after its end reads its exit code and its output. - A
dostep and the job'sifrun the bundle of the workflow on the VM as one command, in the same way. - An
agentstep runs in passes of its own, and each pass makes at most one model call. The step after an agent step starts in the next pass. Its prompt function, its custom tools and their descriptions run the bundle on the VM as one command each, as adostep does. Each bundle run keeps its own session in the object's storage, under its unit, so runs that overlap (a custom tool call of a program and a direct one, or two calls of one program) each get their own result. A command of the agent (run_command) runs as for a container run. - When the start of a bundle run never reached the VM, the job starts it again. After a reset of the object, it waits 1 minute, then starts it with a new secret. When the exec of a start fails while the VM is up, the job fences the command on the VM: a start that comes after the fence runs nothing. A
do,if, prompt or describe unit then fails the run, because it did not start. A custom tool call answers that it did not start, and the agent can send it again. When the answer of the fence gets lost too, the next pass finds the command fenced and ends the unit in the same way. When the start was there first, the job goes on with it. - A program of an agent step in code mode (
execute_typescript) runs on the VM as one command, for up to the time that the step has left when it starts. When it ends within 1 minute, its call ends in the same pass, and the agent reads its result in the next pass, which makes the next model call. A longer program ends the pass, and runs on the VM with no open call. While it runs, the job makes no model call. The object that started it wakes when it ends. After a reset of the object, the job reads its state each minute. The pass after its end gives its result to the agent. - The
external_calls of a program go to the job'sFactoryJobObject, also between passes. The program's session is in the object's storage, with only the sha256 of its secret, so a reset of the object does not start the program again. The first call of a step's program in an instance of the object builds the step's tools: its forge, custom and media tools, with no MCP connection (Workers Logs: thediaglineprogram tools, with itsms). The step's later programs call the same tools, until the step ends. After a reset, the first call builds them again. A custom tool call runs within the time that the step has left at the call. A call that a reset cut runs again only when its tool may run twice, as for a custom agent. A call that runs for more than 25 seconds answers that it still runs, and the program asks again. - The job reads the last 1 MiB of a program's output, and keeps its result, so a pass that a reset cut reads it again with no command. Once the step's end is saved, the job drops the kept results of its programs and bundle runs. One program runs at a time. A program's source, with the code that the forge adds around it, goes to the VM in the environment of its start, so it can be up to 64 KiB: its base64 fits in one variable, and in the 128 KiB that Linux gives the arguments and the environment of an exec, whatever the stack limit. A larger limit needs a start of that size on a real VM first. A job on the Workflow engine keeps the same limit, so a program gets the same answer on both engines. When the start of a program never reached the VM, the job starts it again, as for a bundle run, and a start whose exec failed while the VM is up is fenced in the same way: the agent gets "The program did not start" and can send it again. A cancel of the job stops the program first.
- After each step that ended, the job saves a checkpoint of its workspace through the runner agent of its VM, and only then reports the step. A step that ended in one pass and could not be reported then, for example because a deploy reset the object during its save, saves its checkpoint in the next pass.
- When its VM is lost, the job ends, and the next job of the cell starts at the first step that did not end. Its agent restores the checkpoint of the step before it on the new VM, so the files that the earlier steps wrote are there. When the checkpoint does not restore, the job ends before its steps run: they never run on a fresh checkout that misses those files.
A dependency run on the pass engine
A run of the dependency agent is a container run, with these rules:
- An update run changes the versions of one group and opens its pull request. It calls no model. Its install, for example
pnpm install, runs on the VM as one command, for up to 10 minutes. The first pass puts the checkout back on the run's commit, changes the versions in eachpackage.jsonand starts the install. The passes after it only read whether the install ended. The last pass pushes the branch of the group and opens its pull request, or says why nothing was pushed, with the end of the output of the install. - When the start of the install never reached the VM, the next pass starts it again. It does not change the checkout again.
- A fix run fixes the failed CI of an update. Its first pass puts the checkout on the last push of the update. The passes after it go on with the changes of the agent.
A CI cache run on the pass engine
A run of the CI cache agent is a container run. Its tool trace_job runs a whole CI job, so it works as run_command does:
- The job runs on the VM as one command, for up to the time limit of the call: 15 minutes, unless the agent asks for another one, up to 30 minutes. It runs in a clean copy of the run's commit that only this call uses.
- When the job ends within 1 minute, the call gives its trace in the same pass. A longer job ends the pass. While it runs, the run makes no model call, and the pass after its end gives the trace to the model.
- One job runs at a time. When the agent asks for several jobs at once, the next one starts in a later pass.
- When the start of the job never reached the VM, the call starts it again, with the same command.
A custom agent's run on the pass engine
- It runs on a Ravion VM, as a container run of a built-in agent does, with the same slot, disk and area.
- The agent's code (the bundle of its factory file) runs on the VM as one command, for up to the run's time limit. Each pass only starts it or reads whether it ended, and makes no model call.
- Each model call and each forge tool call of the agent goes to the run's
FactoryJobObject, as before. The run's session is in the object's storage, with only the sha256 of the run's secret, so a reset of the object between two calls does not start the agent again. The next call reads the session, and the object reads the model's key and makes the tools again. - A reset during a model call or a tool call cuts that call, and the agent's code sends it again with the same id. A model call runs again, and its cost counts once. A tool call runs again only when its tool may run twice: a tool with
replay: 'safe', such as the read tools,commentandreview(which post once for each call id), or a durable tool, such asrun_command. Any other tool call, such aslabel,closeorrecord_verdict, answersThe tool may or may not have run. Check before you retry., and gives the same answer each time the agent asks again. So a write never runs twice. The harness has the same rule for the tool calls of a built-in agent. A factory file built with an older@tanstack-source/cisends no ids: a reset fails its call, as before. - A command of the agent (
run_command) runs within its tool call, for up to 30 minutes, as on the Workflow engine. - When the start of the agent's code never reached the VM, the run starts it again after 1 minute, with a new secret.
- A cancel of the run stops the agent's code first.
How the setting picks the engine
The engine of a new run comes from two rows of site_settings:
factory.engine | factory.engine_repos | Engine of a new reader run, container run, custom agent run or agent workflow job |
|---|---|---|
No row, or a text that is not passes | Any | Workflow |
passes | No row, or [] | Passes, on every repository |
passes | A JSON array of repository ids | Passes on these repositories, Workflow on the others |
passes | Not a JSON array of repository ids | Workflow, on every repository |
A typo in the list never turns the pass engine on for every repository. To read the two rows:
psql "$PG_URL" -c "SELECT key, value FROM site_settings WHERE key LIKE 'factory.engine%'"
How much of Ravion the pass engine takes
A reader run takes no VM. Each other run on the pass engine takes one VM, from its start to its end:
- It waits for its place in the CI queue of its account, as a CI job on a VM does. For an account that pays, Remote CI jobs per account caps its container runs and its CI jobs on VMs together. Another account keeps the limits of its containers.
- Its VM has the vCPU of the run's instance type. Most runs take a small VM, with 1 vCPU.
An estimate for the pass engine on every repository, from the factory runs of the week before 2026-12-01:
| What | How much |
|---|---|
| Container runs | 96 to 210 a day, each about 1.5 to 4.6 minutes, and about 1 minute more to start and stop its VM |
| VM time | About 250 to 1,200 VM minutes a day, mostly 1 vCPU: 0.4% to 1.7% of what 48 vCPU give in a day |
| The busiest hour | 27 runs, about 2.4 VMs at once (about 5% of 48 vCPU), with short bursts of about 10 vCPU (about 20%) |
In the same week, the CI jobs took 14,000 to 79,000 vCPU minutes a day. The CI of one busy repository can take 36 vCPU at once: 9 large jobs, at a Remote CI jobs per account of 9. That is why step 4 waits for 64 vCPU.