Appendix › How a job runs

How a job runs

9 min read

Appendix. Background reading on how Operation Kit is built. You don't need it to install or use Operation Kit; start with the main docs.

What happens on your server between "a card moves to Working" and "the job is done": where the job runs, how it is kept apart from other jobs, why a restart doesn't kill it, and how work is spread over your model accounts. For the practical side, see Job sandboxes and Seats, limits and switching providers.

On this page
  1. The short version
  2. What happens when a card starts
  3. Private working copies
  4. Keeping the app running
  5. Model account rotation
  6. The edit guard
  7. References

The short version

  • One card, one job, one sandbox. Each job runs in its own locked-down container that can see only its own work folder, and the container is removed when the job ends.
  • Jobs don't share files. A job that works on code gets its own copy of the repository on its own branch, so two jobs can't overwrite each other.
  • Restarts don't kill work. Jobs run apart from the app itself, so updating or restarting Operation Kit leaves running jobs alone.
  • Work is spread over your model accounts. If one account hits its usage limit, only that account pauses; jobs on the others keep going.

This page explains the design. To check or change the sandbox settings, read Job sandboxes. To connect more model accounts, read Seats, limits and switching providers.

What happens when a card starts

Every card on the board is worked on by a job: one run of an AI coding tool (Claude Code by default; Codex or Grok if you set that up) given a goal, a full brief and a budget. The job reads, plans, edits files, calls services, and then either finishes or reports what is blocking it. Nobody types into it while it runs. You can watch it live on the card and send it a follow-up message.

When a card moves to Working, the server does four things:

  1. Picks a model account

    It chooses a healthy account from the ones you connected. See Model account rotation below.

  2. Prepares a private work folder

    A card that works on a code repository gets its own copy of that repository on its own branch. A card with no repository gets a private folder of its own. See Private working copies.

  3. Writes the brief

    It puts together the job's prompt from the bot's instructions, your workspace notes, the card and a summary of related work. That is explained in How a job gets its context.

  4. Starts the sandbox

    It starts a fresh container for this card, named ok-jail-<card id>, and runs the job inside it.

The per-card sandbox

The sandbox is a small, separate container with tight limits:

Not an adminThe job runs as an ordinary user, with every special Linux permission removed and no way to gain new ones. The container's own system files are read-only.
Sees only its own filesIt mounts the card's work folder (as /workspace) and a home folder of its own. It never sees another job's files, the server's other folders, or the Docker control socket.
One-shotIt is removed when the job ends. Retries start a new one.
Not a network wallOutbound internet is allowed, because the job has to reach your model provider and install tools. The sandbox separates files and processes, not network traffic.

The installer turns this on for you (SESSION_ISOLATION="docker" in client.conf), and if the sandbox can't start, the job fails rather than running unprotected. The full list of settings is on Job sandboxes.

Why jobs survive a restart

Inside the sandbox, the job runs under tmux, a small program that keeps a terminal program running in the background, independent of whatever started it.

If a job ran as a plain child process of the app's server, the job would die whenever the server stopped: for an update, a crash, or a reboot of the container. With many jobs running, every fix you shipped to the app would cost you every job in progress. Because each job lives in its own container under tmux, the app can stop and start again without touching it. When the server comes back, it finds each running job by name and carries on watching it.

SWE-agent (Yang et al., 2024) showed that the way an agent connects to its computer shapes its results as much as the model does. A fragile setup forces the job to spend effort defending against interruptions. A durable one lets it get on with the task.

Private working copies

A job never edits the main copy of a code repository. Before it starts, the server creates a worktree for the card: git's name for a second copy of the same repository, with its own files and its own branch, that shares the history with the original. The branch is named after the card (cc/obj-<card id>-<title>), and the job commits and pushes there. In the sandbox, that copy is the /workspace folder and nothing else is visible.

The folder is named after the card's number rather than the repository or the branch, so two cards never share one, even if they work on the same repository at the same time. When a card is a step of a larger card that opens a pull request, its branch starts from the larger card's branch, so the pieces fold into one pull request.

If two jobs worked in the same folder, one job's "reset this folder" or "delete untracked files" could wipe out the other's half-finished work, and nobody would notice until the result was wrong. With a copy per card, that can't happen.

Note

The work folders live under your Operation Kit folder on the server's disk (/opt/operationkit/state/tmp by default), so they survive a reboot. If a job is stopped in the middle of a step, the step it was on is lost; what it already committed and pushed is safe. That's why every job is told to write its deliverable to its final file early and fill it in as it goes.

Keeping the app running

Inside the app's container, a short startup script does two things: it starts tmux, then it starts the app's server and restarts it two seconds after it stops, for any reason. Simplified:

tmux start-server
while true; do
  start the app server
  wait 2 seconds
done

Around that, Docker restarts the whole app container if it stops (restart: unless-stopped) and runs a health check on it.

This is deliberately simple. Operation Kit runs as one app on one server you own. A crash of the app is almost always a bug to fix, not a load problem, so the supervisor's job is to get the app back quickly. Running jobs are not affected either way: they live in their own sandboxes, not in the app's process. What a restart does interrupt is whatever the web page was asking the server at that moment; your browser reconnects.

Model account rotation

Jobs run on your own model accounts: a Claude subscription or an Anthropic API key, plus optional Codex or Grok accounts. In Settings → Models each one is a seat, meaning a model account Operation Kit can run jobs on. You can connect several, and Operation Kit spreads jobs across them.

The reason is usage limits. Every provider limits how much one account can do in a given window. If every job ran on one account, the jobs would use up that allowance together and then all stall at once. With several seats, a limit on one seat pauses only that seat, and jobs on the others keep going.

How a seat is chosen

  1. Skip seats that can't run

    Seats you switched off, seats cooling down after a usage limit, and seats whose sign-in has expired are left out.

  2. Prefer an idle seat

    On a sandboxed install, a seat with no job running comes first.

  3. Then by priority

    A lower priority number wins. All seats start at the same priority, so by default they are used evenly.

  4. Then the least busy

    Fewest jobs running right now, then fewest jobs today.

When a seat hits a limit

Usage limitThe seat pauses until the reset time the provider gives. If the provider gives none, it pauses for 15 minutes, then 30, and so on, doubling up to 5 hours. A successful run clears the pause.
Expired or revoked sign-inTreated differently, because waiting won't fix it. The seat is parked as needing reconnection and isn't retried until someone signs in again or an admin fixes the account.
No seat freeThe card waits. Every 30 seconds Operation Kit checks for seats that have come back and starts waiting cards, up to one per free seat.

Limits worth knowing

  • A Codex or Grok seat runs one sandboxed job at a time, because two jobs refreshing the same sign-in would log each other out. A Claude seat can run several.
  • The whole install runs at most 100 jobs at once. That limit is fixed in the code. In practice your seats and their plans set the real limit.
  • Rotation spreads the work across accounts you already pay for. It doesn't raise any one account's allowance, and it isn't a way around a provider's terms.

Credentials stay out of reach

A job's sandbox never sees the folders where your seats' sign-in files live. A Claude seat's token is handed to the job as an environment variable. A Codex or Grok seat's sign-in folder is attached to the one job using it, and to nothing else.

A person's own GitHub and Google connections (Settings → Integrations) are a separate layer. Which seat ran the model and whose name is on the resulting commit or email are independent.

AgentBench (Liu et al., 2023) points out that real agent deployments hit limits that have nothing to do with how smart the model is: rate limits, shared resources, memory. Rotation treats the usage limit as a scheduling problem rather than a capacity one.

The edit guard

On top of the sandbox, every Claude job that works in a copy of a repository has a check on its file-editing tools. Before the coding tool's Edit, Write, MultiEdit or NotebookEdit runs, a small script looks at the file path. If the file is in a main project copy and outside the card's own working copy, the edit is refused. Edits inside the card's copy, and to its notes or home folder, go through.

if the file is inside this card's working copy:  allow
if the file is inside a main project copy:       refuse, and say why
anything else (notes, home, scratch):            allow

A refusal comes back to the model as a clear message, for example "BLOCKED: this file is in the live checkout, outside your worktree. Edit the copy under your worktree instead." The model reads it and adjusts. It can't switch the check off, because the check runs in the coding tool itself, below the model.

What the guard covers, and what the sandbox covers

The guard only sees the coding tool's edit tools. A shell command could still write wherever the process is allowed to. That is why the sandbox exists: it mounts only the card's own folder, so other jobs' folders and the main copies aren't there to write to. The guard is the fast check with a readable error; the sandbox is the wall.

InterCode (Yang et al., 2023) found that coding agents need feedback from their environment, including what was blocked and why. A silent "permission denied" makes a model retry blindly; a clear message lets it fix its approach.

References

Published research behind the choices above.

Last checked against Operation Kit main (f504a64), 11 Nov 2026Suggest an edit