Concept

Session lifecycle

A session is a small state machine. The orchestrator drives it the same way on every backend, recording each transition in the audit log and pushing it to the SSE stream.

Phases#

SessionPhase mirrors the underlying Kubernetes Job/pod phases. A session begins pending, becomes running, then reaches exactly one terminal phase — succeeded, failed, or killed — before being torn_down.

pendingrunningsucceededfailedkilledtorn_down
FieldTypeDescription
pendingSessionPhaseAccepted; the sandbox is not yet running.
runningSessionPhaseThe workload is executing inside the gVisor sandbox.
succeededSessionPhaseThe workload exited 0 and the result was collected.
failedSessionPhaseThe workload exited non-zero.
killedSessionPhaseTerminated by the platform — quota, deadline, or fork-bomb guard.
torn_downSessionPhaseEvery per-session resource has been reclaimed.

Kill reasons#

When phase === "killed", the session carries a killReason explaining why the platform terminated it.

FieldTypeDescription
cpu_exceededKillReasonCPU quota exhausted.
memory_exceededKillReasonMemory limit hit (OOMKilled). Live-validated on k3d.
wall_clock_exceededKillReasonJob activeDeadlineSeconds reached. Live-validated on k3d.
pids_exceededKillReasonProcess count over podPidsLimit — the fork-bomb guard.
Honest caveat
On the live Kubernetes path, OOM and deadline kills are validated end-to-end; pids_exceeded is currently modelled by the simulator and is the area called out for hardening in the evidence report. A documented boundary beats a hidden one.

Lifecycle events#

As a session moves through its phases, the orchestrator records audit events and emits stream frames. A typical clean run produces: session_created sandbox_started → (any egress_allowed /egress_denied) → workload_exited result_collectedsession_torn_down. See data contracts for the fullAuditEvent and StreamFrame shapes.