Workspace

Shell lifecycle states

Each shell session moves through five well-defined states: cold, booting, ready, running, idle. Two terminal states exist too: retired (operator-initiated) and dead (container crashed). The DO tracks transitions and exposes them via /health for diagnostics.

Updated today

Overview

At a glance
Source of truth
UltronShell DO storage
Tick
Reclaim sweep every 30s
Idle reclaim threshold
10 minutes by default; configurable via env
Crash detection
HTTP 5xx from container health probe for 30s straight marks DEAD
Retire trigger
POST /sessions/:id/retire or session id removed from workspace policy

The five states

StateWhat it means
COLDNo container running. /work persisted as an R2 snapshot. Next request triggers a boot.
BOOTINGContainer has been requested from the platform. Restoring /work from R2.
READYContainer alive, /work restored, agent CLI ready to accept commands.
RUNNINGAn agent invocation or exec call is in flight. The DO holds the inflight request id.
IDLELast call finished more than 0 but less than the idle threshold ago. Still warm.
RETIREDOperator-initiated end. Snapshot taken, container released, DO drops state.
DEADContainer crashed and could not be restored. Last snapshot kept. Surfaced as an alert.

Transitions

The complete graph.

state machinetxt
1COLD request> BOOTING restored> READY run> RUNNING done> IDLE
2
3
4 timeout IDLE
5
6 reclaim (after idle threshold) snapshot
7
8 Any state crash> DEAD
9 Any state retire> RETIRED snapshot> COLD

Boot path

Cold to running, end to end.

  1. 01
    Caller hits the worker
    POST /run-claude with x-ultron-session header. Worker resolves to a DO instance.
  2. 02
    DO reads state
    If state is COLD, transition to BOOTING and request a container from the platform.
  3. 03
    Restore /work
    If a snapshot exists at snapshots/<session>.tar.gz, download and untar into /work before forwarding any request.
  4. 04
    Mark READY
    Set startedAt + restoredAt. Forward the queued request to the container.
  5. 05
    Mark RUNNING
    Container picks up the request. DO records the inflight id.
  6. 06
    Return + snapshot
    Container responds. DO marks IDLE. Auto-snapshot fires via ctx.waitUntil to capture the new /work state.

Idle and reclaim

An idle session is still useful: the next request hits a warm container. The reclaim sweeper runs every 30 seconds and checks every IDLE session against the idle threshold (default 10 minutes). When a session has been idle past that, the sweeper takes a final snapshot if /work has changed since the last one, then releases the container. The DO state moves to COLD; the next request will hit the boot path.

Retire

An operator can retire a session explicitly via POST /sessions/:id/retire. Used when the session is logically done (skill finished, agent reset, workspace deleted) and there is no value in warm-keeping. Retirement is atomic: snapshot, release container, drop DO state. The session id is reusable afterwards; the next request with that id starts cold.

Observability

GET /healthjson
1{
2 "ok": true,
3 "session": "primary",
4 "state": "RUNNING",
5 "startedAt": "2026-05-19T11:53:01Z",
6 "restoredAt": "2026-05-19T11:53:14Z",
7 "lastCallAt": "2026-05-19T12:00:18Z",
8 "snapshotBytes": 37412884,
9 "snapshotAt": "2026-05-19T11:59:42Z",
10 "cliVersion": "vN.N.N"
11}