The backend owns every run from submission to its stored outcome. Once a
run is accepted it launches the run’s worker
(launchers), watches it, stops it when the run is cancelled
or overruns its deadline, records an outcome when the worker cannot, and
removes the worker afterwards. Every run that reaches a worker therefore
ends with a report: the worker’s own run_finished, or one the backend
records on its behalf.
saci-<run id>. When the launch fails, the run ends
error with the runtime’s reason, for example
the worker could not be launched: ....run_finished, or when
the backend records an outcome because the worker is gone (see below).A launch can time out or lose its answer while the runtime still creates
the worker. In that case the backend asks the runtime whether saci-<run
id> exists:
The stable name means a repeated launch can never create a second worker.
POST /runs/{run}/cancellation (or saci cancel) records the request.
The worker reads the request, cancels its running step and then runs the
remaining cleanup units (see cleanup). The watcher
stops the worker with SIGTERM, followed by SIGKILL after 30 seconds:
after_stop: skip;limits.cleanup_timeout_secs.On SIGTERM the worker cancels its running step and any cleanup, keeps the
evidence it collected, and reports the run as cancelled. If the worker
dies before reporting, the backend records cancelled with the reason
the run was cancelled; its worker stopped before reporting the end.
The worker enforces limits.run_timeout_secs itself and reports the run
as timed out. The backend is the backstop: when a run is still unfinished
60 seconds past created_at + run_timeout_secs (plus
limits.cleanup_timeout_secs when the policy has after_stop: cleanup),
the backend stops the worker and records error with the reason the run exceeded its deadline
(limits.run_timeout_secs) and its worker was stopped.
A worker that exits or disappears without reporting its end leaves an
unfinished run. The backend keeps every event the worker had delivered,
then ends the run error with one of these reasons:
| What happened | Reason |
|---|---|
| The worker exited | the worker exited with code N before reporting the end, followed by its last output lines, redacted with the run’s secrets |
| The runtime no longer knows the worker | the worker disappeared before reporting the end |
When the backend starts, it looks at every run that is not finished yet, before it accepts new launches:
| The run | What the backend does |
|---|---|
| Its worker still exists | Watches it again. The worker retries its reports while the backend is down, so its progress and end arrive once the backend is back. |
| It was accepted but never handed to a worker (no worker token was issued) | Launches it now. Nothing has run yet. |
| Anything else (a token was issued, but the worker is gone) | Ends it error with the backend restarted and the run's worker is gone; the run is not repeated because its actions may already have run. |
The backend never repeats a run that may already have acted on its targets. Resubmit such a run yourself if repeating it is safe.
Workers of runs that had already finished, whose cleanup the earlier process did not complete, are removed. Workers of runs this backend does not know are left alone, since another backend may own them.
When no runtime is usable at start-up, every unfinished run ends error
with the launch failure.