Registration stores the app's keys in the github_app table, sealed with the
token box derived from session_key, so dashboard replicas and the runner read
the same keys without a shared filesystem, and the secrets file can be a
read-only mount. A secrets file that still holds github_app_* keys is imported
while no row exists; a removed app keeps its row (keys null) so the file does
not bring it back. Processes reread the row at most every 10 seconds.
- Table workspace_sessions (kind, repo, base, item, prompt, environment, keep, time limit, state, outcome, workspace,
remote call, job), general enough for later implementation sessions; kind 'try' for now.
- `autocraft-server workspace try <repo> <sha> --item N --prompt TEXT [--workspace ID] [--env ID] [--keep]
[--deadline-sec N]` records the session and queues a workspace-try job with {repo, session}; the prompt stays out of
job params and logs.
- Step workspace-try (Fix stage, no lane, so the planner never queues it; 160 min): creates or takes the workspace,
waits for it to be ready (registered as the external wait "Workspace start"), queues the bound call with the fix-issue
patch prompt's model, effort and tier and only the workspace tools, awaits it, then logs the outcome and cost, tool
calls and shell time from workspace_calls, and the diff stat against the base commit with new files. The workspace
is ended unless kept.
- The job's own diff-stat exec is recorded as tool `report` and does not count toward the session's limits.
- workspaces.remote_call_id binds a workspace to the remote call whose session uses it; workspace_calls.run_id records
the lease run a relayed call came from.
- Dashboard: the workspace server on /mcp/task/workspace and the tool route queues each call as a workspace_calls row
with its arguments whole and waits for the row's result with keep-alive ticks; a call still queued when the lease ends
is refused. Workspace tool bodies may be up to 12 MiB.
- Job: awaitCall serves the workspace bound to its call, runs claimed rows side by side on the job's WorkspaceSession
(which settles each row), hands rows still running after a restart back to the session, and refuses queued rows when
the call ends.
- Wake: Db.notify and Db.listen, Postgres NOTIFY on one listening connection per handle that reconnects; the relay polls
every 10 s behind it, and at the model queue's interval on SQLite.
- Tool replies carry image content after the text: protocol 5 (3 and 4 still accepted); Task Runner 1.3.6 falls back
through 4 and 3 and prints a line for images in autocraft tool.
- queueWorkspaceCall queues a session call with the workspace server and binds the workspace in one transaction.
- A running call within its time limit (plus 30 s) keeps a workspace from parking; calls record their deadline and
touch last_call_at when they start as well as when they finish.
- Checkpoints use a copy of the index (GIT_INDEX_FILE), never the session's index or its lock.
- The checkpoint is read only where it is needed; a parked workspace whose volume is gone ends 24 h after parking.
- A failed pod create keeps the workspace starting with its pod and volume names, so the sweep leaves them; creates are
tried again on later passes up to CREATE_TRIES, and a 409 for a pod still being deleted waits for it to go.
- The lavapipe ICD file follows the environment's architecture.
- Call arguments are cut before they are encoded, so the stored JSON is always whole.
- Tables workspaces and workspace_calls (SQLite and the generated Postgres schema).
- src/build/workspace-pods.ts: the PVC ws-<id> and pod ws-<id>, labelled autocraft-workspace and network none;
restricted Pod Security, no service-account token, the helper copied from the AutoCraft image by an init container,
required anti-affinity against the AutoCraft pods, priority class craft-workspace, resources from the environment's
workspace settings.
- src/build/workspace-launch.ts: a workspace pass after the build-task pass. requested -> starting -> seeding ->
ready, with git archive of the base commit from AutoCraft's clone streamed into ws untar; parked after 30 min
without a call (checkpoint, pod deleted, volume kept for 1 h); checkpoints every 10 min while ready; failures delete
pod and volume; an orphan sweep of workspace pods and volumes no live row owns.
- src/build/workspaces.ts: execWs checks the pod against its workspace label, takes the call number from the row,
records the call and returns the parsed helper header with cleaned output.
- KubeApi.exec takes a stream as stdin.
- CLI: autocraft-server workspace start | list | show | run | end, and the workspace settings on envs add/set.