Broken pushes of a stage from 2 or more repos among its last 10 pushes trip the bare
<stage> breaker, which pauses the stage on every repo until an operator resumes it.
Items, planner pauses, the Next page, Needs, Now and the Pipeline page see it as one
row for all repos. The split of stage-wide rows runs once (settings marker), names
each row's repo in its reason, keeps existing per-repo rows unless an active split row
replaces an inactive one, and leaves the stage rows inactive, resumed at the split.
Breaker keys are <stage>:<repo> for fixup, cifix, fixissue and merge. The breaker counts
one repo's pushes since that key's last resume; red main CI after our merge and post-merge
defects trip merge:<repo> on every repo. Planner facts carry each item's own repo trips,
the planner skips a tripped repo's candidates while the step runs for other repos, and
Act is not gated by push breakers (it writes no commit). A maintainer with write access
to the repo resumes its trip. Needs, Now, Home and the Pipeline page show one row per
tripped repo. A migration on SQLite and Postgres splits stage-wide rows into per-repo
rows and carries each stage's last resume to the repos with earlier pushes or merges.
The runner reads each job's log copy state before claiming it, so nothing waits
between the claim and the spawn. One copy cycle writes the new lines of every
running job in one multi-row INSERT after the cancel checks, and copies run one
after another in the process. The final copy runs whether or not the job's end
was recorded. Chunks are scrubbed before they are stored and again when read,
and are deleted after 90 days on their own; job rows keep their retention.
A Task Runner with an own lane says so on its slots' claims, and those
slots leave calls bound to its user to the lane; older Task Runners take
them in a slot, where they count like any call. Only own-lane leases
(remote_calls.own_lane) are left out of slots and Max calls at once.
The maintainers' lane watches each waiting maintainer's lease count and
newest lease time, so a turnover that keeps the count still wakes it, and
an operator or the maintainer who wrote it can withdraw a waiting
maintainer's message. Maintainer turns no longer run one at a time first,
and their reference check waits briefly and counts as no answer when
their runner offers no small tier or takes nothing.
- The row records whether the volume was made empty for the current start
(volume_fresh). A kept volume is only checked for its base commit, never seeded
or wiped; a kept volume that is gone or being deleted is replaced by a fresh one
before the pod is made.
- A resume that cannot start or seed (pull failure, pending or seed limits, pod
gone, create tries, a kept volume without its base commit) goes back to parked
with its kept volume and checkpoint, up to 3 tries (resume_tries); after that it
stays parked with the reason in its error and is not resumed again.
- A kept volume is dropped only when its node is gone: the node is missing or not
ready for 5 min, or, when nodes cannot be read, every node refused the pod for the
volume's node affinity. Never while the last checkpoint failed.
- A failed checkpoint is recorded (checkpoint_error); while set, the parked volume
is kept past its keep time. The keep-time deletion lets go of the volume on the
row before deleting it.
- The lease's resume note keeps the queued stdin (remote_calls.base_stdin) and says
what the last resume did: kept tree, rebuilt from the checkpoint of hh:mm, or
rebuilt with no checkpoint.
- `ws init` removes a stale git index lock.
The runner copies the new whole lines of a running job's log file into
job_log_chunks every 5 seconds and once at its end (one INSERT per copy, one
DELETE of the oldest chunks once a job passes 256 KiB plus slack), and
command-line runs do the same. The job page reads the log file when it is on
its disk and the stored chunks otherwise, so a dashboard that does not share
the runner's volume shows job logs. pruneJobs deletes the chunks with the job.
Maintainers' messages are answered by their own step, without a daily
limit and outside the operators' count. Calls bound to a login count
toward no slot or Max calls at once; the Task Runner claims them in an
own lane beside its slots, and a turn none of its runners takes within
two minutes waits for a later job. The reference check of a maintainer's
turn is bound to them too, and a bound call's taker must offer its tier.
A maintainer's message to Opus is refused while the pipeline is off or
the step is paused. The prompt frames a maintainer's turn as a request
that does not change its instructions. Choices record whose message led
to them, shown beside Opus's pick, and maintainers keep the Feedback box.
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.
A maintainer with write permission on the item's repo may write to Opus
while model calls run on users' own Task Runners. The turn is stored and
framed as a maintainer's, and its remote call is bound to their login
(remote_calls.for_login): only their runners lease it and its follow-ups,
the author preference does not pass them over, and nobody else picks it.
Without a ready runner the message to Opus is refused; posting without
Opus still works. The model queue shows a bound call's wait. Sharing
posts, fix-up instructions and settling stay as they were.
- The CLI queues the job as cli-queue: the runner runs it, so a runner restart resumes it (resumeJob still refuses
command-line runs, whose process belongs to the command).
- The launcher's passes fail a session whose job ended without ending it (deadline, cancel, a stop it does not resume
from) and end its workspace unless kept.
- A resumed job waits on the session's recorded call, even one that ended meanwhile, instead of queueing a second
session; the outcome is stored before the diff stat.
- The call may wait 30 min in all in the queue; the pod's time limit covers seeding, that wait and a margin. The launcher
does not park a workspace whose bound remote call is queued or leased.
- A job claims its session atomically; another job stops without touching the workspace. The CLI records the job id
only while none is set, and marks the session failed on any queueing error.
- 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.
A job the runner stops, or finds left running at start, goes back to the queue with the same id
(jobs.resumes, at most 2 times) instead of failing with RUNNER_STOPPED. Its remote calls are not
withdrawn: enqueueCall in the resumed run adopts the call of the earlier run with the same prompt,
version, bundle hash and parent that is still open or answered and unread (remote_calls.bundle_hash,
consumed_at), so a reply a Task Runner sent during the restart is used. The agent runs of those calls
stay running, the caller-gone sweep leaves them alone until the job ends, and the job's usage adds up
over its runs.
A disk container (AutoCraft image) first in every step pod fails the task when its volume
holds more than the environment's storage, which local-path does not enforce; a per-step
time cap (maxStepSec) and sized /src emptyDirs bound the rest, as docs/operations.md
explains. Tasks are claimed one at a time and every claim that cannot start goes back to
the queue. A pod stuck in deletion or on a node that stopped reporting, or running past a
deadline Kubernetes should have enforced, loses its task; a failed create of a later
stage's pod is retried with backoff before the task is lost. The launcher owns its tasks
(reapLost skips them) and keeps them alive even while the API is down; each container's
output is logged once; the pending health text stays stable; kubernetes environments
have no usable env key; the namespace cannot change while tasks run; pods select the
configured architecture; a source pod killed before it reports loses the task; a step's
own exit 124 before its limit is an ordinary failure.
A kubernetes environment has no worker: the runner's pod launcher claims tasks for it
and runs each as a sequence of pods on one per-task volume. A task pod (network api)
fetches the task with a one-time key, a source pod (network fetch) unpacks the source,
applies the patch and reads the CI gate, then each run of consecutive steps with the
same network mode runs as ordered containers of one pod in the toolchain image, and an
upload pod (network api) sends the artifacts. The runner reads exit codes, OOM kills
and times from pod status and output from the pod log; the pod key can read its task
and upload artifacts, never report a result, and no key is valid while repository code
runs. A pod that disappears or never starts loses the task under the existing rule
(requeued once, then failed). Settings, envs add/set options and a health check per
environment.
The planner read the sensitive-content reasons, changed lines and extras-pending state of each reviewed
head's cached diff from up to four files per PR on every pass. The code that writes or removes those files
(the diff fetch in cachedDiff, noteReread, dropCachedDiff) now stores the derived values in diff_facts,
one row per PR head, and the PR facts loader reads them with one join. A cache read that finds a diff
without its row stores it. The runner fills the table from the existing files at start when the rules
fingerprint in the diff_facts_built setting differs from the code's, for the latest review head of every
PR; the table is planner input under the reviews topic.
writePlanCache read every item_plans row each pass to diff against. It keeps what it read and wrote
per connection, valid while item_plans_rev (moved by a trigger on every item_plans write) has the
value it saw. The liveness check extracts the status fields and the action count in SQL and skips
switched-off and ended items there.
A merged PR files its held issue unless the bound merge path ended before the merge time, so a pre-approval the merge itself cancels no longer drops it. Rows are bound to the press's own path: the pre-approval it created (runPipelineStep returns its id) or the decision's answer history count, so a new answer or pre-approval never revives one. createIssue treats an unsent request (failed app-token mint) as a clear failure and marks a write held back by pacing; pacing counts no try. A row left in filing is settled from its audit row. held_followups moves to its own topic outside the planner input, so row writes keep the failure backoff.
A card that answers Merge, or whose fix-up merges, stores its open_issue step in held_followups instead of opening it. The Act job of the PR's repo opens it once the PR merged (same act-open-issue write and audit, counted against Act's daily limit then), and drops it when the PR closes unmerged or the merge path ends. A filing row is written before the create, so a restart never opens two. Card lines and the choices card read "After the merge: open an issue in <repo>: ..."; the item page shows the held issue and why it was dropped.
- The commenter's write permission is read through the app installation (appPermission), which writes repo_permissions, so a
maintainer's pre-approval stays alive under refreshSettlers; an access GitHub cannot read is retried, and a command that
expires that way is answered once ("could not check your access; comment again").
- The comment's creation time is stored. A PR is pre-approved only at the head it had then: a force push, a later commit date or
a later first check suite on the head refuses it ("the PR changed after your comment; comment again"), and preapproveMerge
takes the pinned head. On an issue, the closing PR is queued only when it is older than the comment and unchanged since.
- A comment older than 5 minutes at delivery queues nothing; before acting the comment is read again by id and must exist, have
the same author and still hold the same command.
- A login never bound, a viewer, and a non-operator on a quiet PR get no answer; nothing is answered on a quiet PR. Unexpected
errors are answered with a fixed text; only an answer to someone the queue rule lets queue skips the comment approval.
- github_commands gets an index on (state, reply) and the runner prunes settled rows after 30 days; parseCommand skips indented
code and HTML comments across lines.
The cached queue order ranks by claimClass when it is built; fast-lane
claims filter the cached order; a lease from the capped claim path drops
the cache; room keeps the stamp cadence and reads the queued calls
through the queued index; one capacity.slots (N plus the fast lane) set
by work; remote_helpers slots and busy defined once.
Heartbeat failures and recoveries are recorded in the heartbeat loop;
status reports retry through withRetry; deleted tokens' statuses go with
pruneRemote; an unaudited harness version holds as harness-missing in a
run as in readiness; a too-old helper names the update command; docs for
update, the status report's slots, busy and last error, and the
remote-starved checks.
Lease tombstones, old lease drops and spent cool-off rows go with the
minute maintenance (pruneRemote); requeue and unlease drop the cached
queue order; the liveness stamp uses the helper routes' connection.