Agent Lifecycle — Suspend, Resume & Recovery
Beyond the basic start / stop pair, Scion gives you finer control over an
agent’s lifecycle: you can suspend an agent and later resume it with its
harness conversation intact, recover an agent that crashed, and rely on the
Hub to auto-suspend agents that have stalled in order to reclaim resources.
This page is for power users driving agents from the CLI. For the conceptual model behind phases and activities, see Core Concepts: Agent State Model.
Stop vs. Suspend: two ways to wind down
Section titled “Stop vs. Suspend: two ways to wind down”Both stop and suspend tear down the agent’s container, but they record very
different intent:
scion stop |
scion suspend |
|
|---|---|---|
| Phase after | stopped |
suspended |
Next resume |
Fresh harness session | Continues the previous conversation |
| Use when | The task is done, or you want a clean slate | You’ll come back and want the agent to pick up where it left off |
| Harness requirement | None | Harness must support session resume |
Suspend & Resume
Section titled “Suspend & Resume”Suspending an agent
Section titled “Suspending an agent”scion suspend <agent-name>This stops the agent’s container but marks its phase as suspended — a signal
that you intend to resume it later. Only a running agent can be suspended.
To suspend every running agent in the current project at once:
scion suspend --allSuspend requires a harness that supports session resume. If the agent’s harness
does not (for example, the generic harness), the command is rejected with an
error and you should use scion stop instead. When using --all, unsupported
agents are skipped rather than failing the whole batch.
Suspend reasons and retained activities. While an agent is in the suspended phase, the Hub records why it was suspended in suspendReason (cleared as soon as the agent leaves suspended):
user— suspended explicitly by a user or agent (scion suspendorPOST /api/v1/agents/:id/suspend).idle— suspended automatically by the Hub after going idle (see Auto-Suspend of Idle Agents).stalled— suspended automatically by the Hub after stalling (see Auto-Suspend of Stalled Agents).
Suspending an agent that is already suspended succeeds without contacting the Runtime Broker. If its suspendReason is already user, nothing changes. If the Hub had suspended it on its own (idle or stalled), an explicit scion suspend changes suspendReason to user in place, keeping the retained activity, so the agent is no longer woken automatically under lifecycle.idle_suspend. For a never-suspend agent, that change needs --force from a human principal, the same as suspending it while running. The Hub answers 409 Conflict while a start, idle-suspend, or other lifecycle operation is in progress on the agent; retry once it settles.
Suspending an agent also preserves a terminal or error-bearing activity (completed, idle, or harness_error) across the suspend instead of clearing it, so you can still tell whether a suspended agent finished its task, went idle, or hit a model error before it was suspended. scion list displays both next to suspended in the PHASE column, for example suspended (idle) or suspended · completed (stalled), and the web shows the same label on the agent’s status badge, with the reason explained in its tooltip and in a Suspend reason row on the agent page (--activity without --phase still matches active or terminal agents rather than suspended rows carrying a retained activity). The creator’s default auto-subscription (and the web UI’s default subscription triggers) includes SUSPENDED, so supervisors are notified when an agent enters suspended (whether suspended manually or by auto-suspend). For membership-loss holds (suspension.held), see Agent Suspension When a Member Leaves a Project.
Auto-wake on new work (lifecycle.idle_suspend). When the lifecycle.idle_suspend experiment is enabled (alpha, off by default), an agent the Hub suspended on its own (suspendReason idle or stalled) is resumed automatically whenever a direct message, web chat message, @-mention, notification, or scheduled message arrives for it — no --wake flag or agent.lifecycle permission is required on the sender (messaging permission is enough). Direct messages, primary web chat targets, and scheduled messages wait for the resume and then deliver; @-mentions, secondary web chat targets, and notifications are accepted immediately and delivered after a background resume. Agents suspended explicitly (suspendReason user), agents suspended before suspendReason was recorded, and held agents are never woken automatically.
Last terminal screen (hub.suspend_screen). While the hub.suspend_screen experiment is enabled (alpha, on by default), the Hub makes a best-effort, timeout-bounded capture of the agent’s visible scion tmux pane immediately before stopping the container on manual suspend and on stalled or idle auto-suspend (not on membership-loss holds). The saved screen (ANSI-preserving, capped at 64 KiB) is replaced on each subsequent suspend and deleted automatically with the agent. Callers with agent.attach permission can view it via scion look <agent> (which prints a “saved at” banner on stderr) or in the Last screen card on the agent’s Status tab in the Web UI. Runtimes without an exec path simply record no saved screen.
Resuming an agent
Section titled “Resuming an agent”scion resume <agent-name> [task]resume re-launches the container and continues the prior harness conversation
by passing the harness-specific resume flag (--continue for Claude Code,
--resume for Gemini CLI, and so on). Any [task] arguments you supply are
appended to the resumed session as a new prompt, if the harness supports it.
When a suspended agent is woken by an incoming message (via --wake or
auto-wake), harnesses that use a task_flag start promptless and receive the
waking message(s) followed by the resume instruction together in a single
buffered input, rather than as a separate CLI resume turn before the message.
Manual scion resume, restarts, and non-message schedules keep their normal
CLI resume behavior.
| Flag | Description |
|---|---|
-a, --attach |
Attach to the agent’s session immediately after resuming. |
What survives suspend and resume
Section titled “What survives suspend and resume”Because scion suspend (including idle and stalled auto-suspend) stops and
removes the container and scion resume launches a fresh container from the
image, only durable mounts survive across a suspend/resume cycle:
- Survives: the agent’s workspace (on durable storage — host bind-mounts,
clones, worktrees, or NFS; ephemeral pod storage is lost with the container),
mounted volumes (such as shared directories under
/scion-volumes/), and the agent’s home directory ($HOME, where harness session state lives) on runtimes with a persistent home (see Runtime caveats). - Discarded: the container root filesystem (the writable overlay layer,
including packages installed at runtime with
aptor files written outside mounted paths) and/tmp(including scratch worktrees, build caches, or temporary scripts under/tmp).
Keep worktrees, scripts, handoffs, or other files you need after a suspend in
the workspace or a mounted volume rather than under /tmp or the container root
filesystem. Moving /tmp off the container overlay filesystem is tracked in
ptone/scion#1874.
start vs. resume
Section titled “start vs. resume”scion start and scion resume have distinct responsibilities:
scion start(andscion create) creates and starts a new agent (or starts an unstartedcreated/provisioningagent). If an agent with that name already exists in a resumable phase —suspended,stopped, orhalted(including anerroragent remembering one of those phases, or a running agent with an active idle-suspend claim) — the Hub refuses the request with409 agent_exists_resumablerather than silently reusing the existing agent.scion resumeexplicitly brings an existing agent back in place:- On a
suspendedagent, it continues the previous harness conversation. - On a
stoppedorhaltedagent, it restarts the agent in place with a fresh harness session (keeping its identity; the workspace is kept unless it lived on the agent’s pod storage).
- On a
Harness support
Section titled “Harness support”Session resume is a per-harness capability:
| Harness | Resume support |
|---|---|
| Claude Code | ✅ Yes (--continue) |
| Gemini CLI | ✅ Yes (--resume) |
| Generic | ❌ No — use stop/resume |
Crash Recovery: the error phase
Section titled “Crash Recovery: the error phase”When an agent’s process or container exits non-zero — a real crash, an
out-of-memory kill, or a SIGKILL — the agent transitions to the error phase
with a descriptive message such as Agent crashed with exit code 137.
Scion is careful to distinguish a crash from an orderly shutdown. The harness
runs inside tmux, and sciontool recovers the real exit code when the session
ends, then classifies it:
| Outcome | Phase | Activity |
|---|---|---|
| Clean exit (code 0) | stopped |
— |
| Limits reached (turns, model calls, or duration) | stopped |
limits_exceeded |
Crash / OOM / SIGKILL (non-zero) |
error |
— (cleared) |
A crash surfaces as the error phase — the activity is cleared, and the
crash detail is carried in the agent’s message, with the last lines the
harness printed (up to five, on one line and redacted for credentials; the
whole message is cut to 300 characters by dropping the oldest output first),
e.g. Agent crashed with exit code 1: Error: unknown option '--frob'. scion list shows the exit reason next to the phase when one is
recorded, e.g. error (crashed). A harness that exits within its first moments
(a missing binary, a wrapper script that fails) is reported the same way, with
its own exit code; if the harness never started at all, the message reads
Agent failed to start (exit code 1): …. A failed pre-start hook or harness
provisioning step leaves the agent in error with the message
pre-start hook failed: <reason> on every runtime. On Kubernetes, a container killed for exceeding its memory limit
carries exit reason oom_killed and a memory-limit message instead (see
Out-of-memory kills). Two paths can set error: sciontool reports it from the recovered
exit code (the authoritative path), and the Hub also derives error from a
non-zero container exit reported in the broker heartbeat — which covers cases
where the container died before sciontool could report. When a start fails, the Runtime Broker records the failure for that run in a host-owned state file next to the agent’s home directory, and scion list and the Runtime Broker heartbeat show the agent as error even if a leftover container from that attempt (for example a Kubernetes pod left Pending) still reports starting.
A third path covers a container that vanishes without reporting an exit (for
example, removed outside Scion). In Hub-connected setups, a running agent (or
a stopping agent whose final stop report never arrived) that is missing from
its online Runtime Broker’s complete runtime inventory for longer than
missing_agent_grace (default 3 minutes, see
server configuration) moves to error with
exit reason container_missing, instead of staying running while messages
to it are buffered. It can then be restarted like any other error-phase agent.
On Kubernetes, a preempted or evicted agent pod leaves running without
waiting for that grace period; see
Preempted and evicted status.
The error phase is restartable. By default, starting the agent again clears the error and runs a fresh session:
scion start <agent-name>Because the crash discarded the previous run, this is a clean start rather than a session continuation.
In-Place Session Resume after Crash
Section titled “In-Place Session Resume after Crash”If the agent’s harness supports session resume, you can force Scion to attempt to continue the prior conversation rather than starting fresh. This is useful for recovering a crashed or interrupted session:
scion resume <agent-name> --forceUsing scion resume --force on an agent in the error phase permits an in-place restart, passing the harness-specific resume/continue flag so that the interrupted conversation is preserved.
In Hub-connected setups, the same recovery is available in the web UI as a Resume (best effort) action on an error-phase agent, which asks you to confirm first. It calls the agent’s start action with forceResume set (see the API reference). The resume is best effort: if the harness session cannot be continued, the agent may still start fresh or fail again.
Only one start of an agent runs at a time. If you start, resume, or restart an agent while another start of it is still in progress (for example, automatic recovery or a reincarnation), the Hub refuses with 409 start_in_progress and tells you who holds the start and when it will finish or be released; run scion stop to cancel it. A restart whose stop step fails is aborted with a retryable 503 instead of starting a second instance.
Reincarnating an Agent
Section titled “Reincarnating an Agent”To move an existing agent onto the current template, image, and harness config without losing its identity, use scion reincarnate. It keeps the agent ID and slug, clears the previous run’s exitCode and exitReason when the migration begins, starts a new generation with a freshly resolved config, and hands it the task you supply with --handoff-file. Use --dry-run to preview the changes first. Reincarnation requires a Hub, and works for agents in clone-per-agent, shared-workspace, and Hub-managed workspaces. An agent in an empty-per-agent project can be reincarnated on its current Runtime Broker when that Runtime Broker is up to date and uses a local-disk runtime (Docker, Podman, or Apple container) or shared (nfs) workspace storage. Agents in worktree-per-agent projects are not yet supported: the Hub rejects the request, and the Runtime Broker also refuses such a reprovision on its own.
Reincarnating is also how an existing agent picks up changed harness dotfiles (including hook registrations kept in them, such as Claude’s .claude/settings.json) and changed template skills, which are otherwise copied only when the agent is created. Switching harness-config with --harness resets the home instead of overlaying it (see below). Harnesses whose provisioner writes its hook configuration at start, such as Copilot, Antigravity and Grok Build, pick up provisioner changes on the next start. See Changing a harness config affects new agents only.
In a hosted setup with several Runtime Brokers, scion reincarnate <agent> --broker <name|id> also moves the agent to another Runtime Broker. When both Runtime Brokers mount the same NFS export, the workspace stays in place (transferMode: "export"). When a shared export is not available and the hub.agent_move_bundle experiment is enabled with GCS Hub storage, the Hub copies the workspace and $HOME through object storage (transferMode: "bundle") for eligible clone-per-agent and empty-per-agent agents on durable runtimes. Otherwise, --dry-run --force previews a forced move that recreates a clone-per-agent or empty-per-agent workspace on the target (transferMode: "recreate"). See Moving an Agent to Another Runtime Broker.
Switching harness-config
Section titled “Switching harness-config”With the server-layer, alpha, default-off hub.reincarnate_harness_switch
experiment enabled, use --harness <harness-config>
to select a named harness-config from the Hub’s catalog: on a hosted Hub the global
catalog first, then the project’s; on a workstation Hub the project’s first, then the
global one. If that first match is archived or pending, the reincarnation fails with
400 (see Inactive Hub harness configs).
This rebuilds the agent home, even when you name its current
harness-config. It keeps the same agent identity and workspace.
Write a handoff that captures the agent’s active work, then run --dry-run
first to review the plan and its HOME RESET warning:
scion reincarnate my-agent --harness codex --handoff-file handoff.md --dry-runscion reincarnate my-agent --harness codex --handoff-file handoff.mdThe real request prints the same warning and proceeds without a confirmation prompt. There is no rollback.
- Lost: the harness session and transcripts, harness memory edits,
skills/tools/caches the agent installed in
$HOME, shell history and dotfile edits. - Kept: the workspace and branch, Hub conversations and history, and the handoff, which is the only continuity into the new generation.
Files the old harness left in the workspace are not removed. A template can also seed old-harness files back into the fresh home; the plan warns about recognizable files under another harness’s config directory, but that check is best effort.
Settings on a switch. The old explicit image, model and harness auth selection
are cleared and resolved for the target harness-config. To pin them, pass --image,
--model and --harness-auth in the same request. Model aliases use the target
harness-config’s aliases. Inline config_dir, command_args, task_flag and
user settings are also dropped; there are no replacement CLI flags for these
fields on reincarnate. Define the needed values in the target harness-config
before switching. The selected harness-config and these drops persist into later
plain reincarnations. The thinking level and other harness-neutral settings remain.
An explicit create-time no-auth choice is kept, with a warning.
Refusals before the agent is stopped. A dry run gets the same checks as a real request:
| Condition | Response and next step |
|---|---|
| Experiment is off | 400 experiment_disabled; enable hub.reincarnate_harness_switch on the Hub. |
| Unknown harness-config | 404 harness_config_not_found; check its name and scope. |
| Auth method unsupported by the target | 400; choose a method supported by the target harness-config. |
--harness combined with --broker |
400 from the Hub (also rejected by the CLI); switch and move in separate requests. |
| Runtime lacks home-reset support, or the Runtime Broker does not advertise it | 412 unsupported_capability; use a supported runtime and an up-to-date Runtime Broker. |
| Target credentials missing | 422 harness_credentials_missing; the response names the missing environment keys or auth files, never their values. Supply credentials as Hub secrets or choose --harness-auth. |
A target with no_auth.behavior: drop-to-shell never silently switches to no-auth
when credentials are missing. Pass --harness-auth none deliberately to request
no credentials. Credentials present only in the Runtime Broker’s environment
are invisible to the Hub preflight and can cause a false 422; use Hub secrets.
The Runtime Broker also gathers required values before resetting the home.
Runtime support for --harness:
| Runtime | Home reset supported |
|---|---|
docker |
Yes |
podman |
Yes |
container (Apple Container) |
Yes |
cloudrun |
Yes |
cloudrun-instances |
Yes |
kubernetes |
Yes, with NFS or local agent homes |
cloudrun-sandbox |
No; refused |
substrate |
No; refused |
The existing workspace requirements still apply: Agents in worktree-per-agent projects are
refused, and this table does not add support for ephemeral workspaces. Kubernetes
NFS-home resets require an agent image whose sciontool version --features reports
home-reset-v1. An older image refuses the start with home_prepare_failed and
asks for an image with that feature; update the image before retrying.
Failure recovery. Before the reset, a failure restores the previous generation’s
configuration and leaves the home intact. After the home has been reset (or its
state is uncertain), the Hub keeps the new harness-config and marks the migration
failed with the agent in error. Fix the reported cause and follow the Hub’s hint:
- If rebuilding the home failed, run
scion reincarnate <agent>to reprovision the new harness-config. - If rebuilding succeeded but starting failed, run
scion start <agent>. - To select the old harness-config again, run
scion reincarnate <agent> --harness <old-config>. This performs another reset; it does not recover the previous home’s contents.
Harness Errors: the harness is still running
Section titled “Harness Errors: the harness is still running”A harness can fail without exiting. When the model provider rejects a request
(for example a 400 for a denied permission, an expired credential, or an
unknown model), most harnesses print the error in their terminal and return to
their prompt. The process keeps running, so there is no crash to report.
When the harness reports such a turn-ending error on its completion hook, the
agent stays in the running phase with the harness_error activity, and
the reason is in the agent’s message, for example
model API: APIError (status 400). The reason is put on one line, redacted
for credentials and cut to 300 characters.
scion listshows it in LAST ACTIVITY asharness error: model API: APIError (status 400), 2m ago, andscion list --format jsoncarries the reason indetail.message.- Subscribers with the
HARNESS_ERRORtrigger get a notification with the reason.HARNESS_ERRORis in the default triggers. TheERRORtrigger still matches only theerrorphase, a dead harness. - The agent is not marked
stalledwhile it showsharness_error, so the reason is not replaced by a stall. It is still markedofflineif its heartbeats stop. - The next sign that the harness is making progress (a new prompt, a model
call or a tool call) clears it. Fix the cause, then send the agent a message
to make it retry:
scion message <agent-name> "continue".
The web UI shows it as a red harness error badge; hover over the badge to see the reason.
Whether a harness reports the error on a hook depends on the harness. This
was checked by running each harness CLI against a model endpoint that
answers with a 400:
| Harness | Hook that reports the failed turn | Shows harness_error from its hook |
|---|---|---|
| Claude Code (2.1.325) | StopFailure, with the provider’s message |
Yes, also for a 401 (authentication_failed: ...) |
| Antigravity (1.5.9) | Stop with error |
Yes |
| grok-build (1.0.77) | StopFailure with errorDetails |
Yes |
| OpenCode (1.19.5) | session.idle with the bridge’s error |
Yes; the reason has the error name and status, not the provider’s message |
| Pi | agent_end with error from the bridge |
Yes (bridge test payloads) |
| Codex (0.169.0) | None: a failed turn fires no Stop and no notify |
No; the agent stays thinking, and never completed |
| Gemini CLI (0.68.0) | None: AfterAgent fires without an error |
No; the agent shows working |
| Copilot CLI (1.0.112) | errorOccurred, but it looks the same for an error Copilot then retries successfully, and no agentStop follows a failed turn |
No; it is recorded as a failed model call, and the agent shows working |
| Muse Code (1.4.20) | Only the failed model call (PostLLMCall with error); no turn end |
No |
| Hermes | No hooks | No |
For a harness marked No, the agent can still be marked stalled after the
stall threshold; scion look <agent-name> shows the error in its terminal.
Errors that no completion hook reports
Section titled “Errors that no completion hook reports”Some harnesses show a model error in their terminal without reporting it on a
completion hook, and some never get as far as the first turn. sciontool init
watches for both cases inside the agent container:
-
Model API errors seen in telemetry. When the harness exports telemetry (Claude Code, Gemini CLI and Codex with telemetry enabled), Scion reads each model API attempt from it. The agent gets
harness_errorwith the reasonmodel API <status>: <message>when all of the following are true:- the latest attempt of the agent’s main model failed with
400,401,403or404. A failed call to another model, such as a sub-agent or a small background model, does not count; - the agent is
thinkingorworking; - after the failure, nothing else happened for a while: no successful
attempt, no new turn, no status change. The wait is 30 seconds once the
harness has visibly ended its turn (it wrote
workingafter the failure). It is 2 minutes while the turn has not visibly ended, because the harness may still be streaming a retry or the main model’s answer.
A retried transient error, such as a
503followed by a success, does not count. A status change after the failure, for example the harness writingworkingwhen its turn ends, starts the wait again but never cancels the report. - the latest attempt of the agent’s main model failed with
-
The initial task did not start. If the agent was started with a task and its harness reports turn events, Scion checks 3 minutes after the harness is ready. The agent gets
harness_errorwith the reasonharness did not start the initial task: <detail>in either case:- no turn started at all (for example the harness is stuck at a login or authorization screen);
- the turn so far ended on a failed model call that the harness reported on a model hook.
A started turn shows as a prompt, a model call or a tool call, or as a model step or turn that ended without an error. OpenCode and Pi report nothing when the initial prompt starts, so their first finished model step, first tool call or finished turn is what counts. If one of these arrives after the report, the report is withdrawn and the agent returns to
working.The detail is that model error when there is one. Otherwise it is the last lines of the harness terminal, redacted and cut like every reason. Hermes reports no turn events and is not checked.
An error the harness reports on its completion hook takes precedence. Neither check replaces it or reports it a second time.
Gaps that remain: without telemetry, a Codex turn that fails after the prompt
is still marked stalled. The same applies to a GitHub Copilot turn that
fails after the prompt, and to a model error after the first turn on a harness
with no completion-hook error (muse-code).
Some healthy first turns are briefly reported as not started:
- On OpenCode and Pi, a first model step that runs for more than 3 minutes before its first tool call, or before it finishes.
- On GitHub Copilot, a transient model error that Copilot retries successfully early in the first turn, when no tool call follows before the 3-minute check. Copilot reports failed model calls but not successful ones.
Scion retracts such a report and returns the agent to working as soon as
the harness reports a finished step or turn, or a tool call. It never
retracts a harness error that the harness itself reported.
Auto-Suspend of Stalled Agents
Section titled “Auto-Suspend of Stalled Agents”To reclaim resources from agents that are no longer making progress, the Hub can
automatically suspend agents that have stalled. Auto-suspend is off by
default; turn it on with server.hub.auto_suspend_stalled (or Auto-suspend
stalled agents in Admin > Server Config).
An agent is marked stalled by the platform when it is running, its heartbeat
arrived within the last 2 minutes (the process is alive), but no activity events
have arrived within the stall threshold (server.hub.stalled_threshold, default
5 minutes; a value under 2 minutes falls back to the default). While an
agent is in thinking (waiting on a model response), the Hub applies a longer
20-minute cutoff (or stalled_threshold, whichever is larger) so slow model
calls are not marked stalled prematurely. The Hub checks every 5 minutes. With
auto-suspend on, the Hub suspends an agent in the same check that marks it
stalled (including agents that stall past the 20-minute thinking cap), unless
the agent’s harness does not support session resume. Agents already stalled
when you turn auto-suspend on are not suspended unless they become active and
stall again.
After a tool call finishes, the agent shows thinking until its next event
(rather than working), because the harness’s next step is a model call
carrying the tool result. On a Hub with the 20-minute thinking stall cutoff,
that cutoff therefore also covers the model call after each tool, while
turn-end events continue to return the agent to working.
A long build, a test run or a background job emits no activity events, so the
Hub also looks for live work. On each 30-second heartbeat, sciontool init
checks the container for two things:
- A tool call in flight. The activity is
executingand a process the harness started after the tool call began is still running, even one that uses no CPU, such asgh run watch. MCP and language servers started earlier don’t count. - CPU work. A process used at least 1% of one core since the previous heartbeat.
The tmux server, the pane shells, the harness’s own process, sciontool and its
services don’t count. An agent whose container reported live work within the
stall threshold is not marked stalled, and a stalled agent whose container
reports live work returns to its previous activity. An idle agent, including one
with idle MCP or language servers, still stalls at the threshold.
A tool call holds off the stall for at most 60 minutes. It stops earlier when its processes make no progress for 10 minutes: the same processes, with no new CPU time and no reads or writes. A command waiting on a prompt or a dead connection is flagged this way. CPU work is not capped. Either way, auto-suspend skips an agent whose container reported live work in the last 90 seconds, so a running tool call is never suspended.
Auto-suspend uses the same machinery as a manual scion suspend, setting the
agent’s phase to suspended with suspendReason: "stalled", preserving its
harness session (and any completed, idle, or harness_error activity), and
revoking its Hub credentials and active delegation grants. The agent resumes,
continuing where it left off, when someone starts it or sends it a message with
wake (scion message --wake or the web UI’s wake prompt) — or automatically on
any incoming message, mention, notification, or scheduled message when the
lifecycle.idle_suspend
experiment is enabled.
Auto-Suspend of Idle Agents
Section titled “Auto-Suspend of Idle Agents”An agent that reports it has nothing to do (idle) or that finished its task
(completed) still holds its container. The Hub can suspend such agents after a
grace period and wake them again when new work arrives for them.
Idle auto-suspend needs both:
- the
lifecycle.idle_suspendexperiment (alpha, off by default), and server.hub.auto_suspend_idle: true(off by default; Auto-suspend idle agents in Admin > Server Config).
Every 5 minutes, the Hub suspends each running agent that meets all of these:
- Its activity is
idle,completedorharness_error, and has been for longer thanserver.hub.idle_suspend_after(the grace period: default 15 minutes, minimum 5 minutes; a shorter value is ignored and the default applies). The grace is measured from when the activity last changed, not from the last hook event. - Its heartbeat is fresh (an offline agent is left alone).
- Its container reported no live work in the last 90 seconds. Live work
includes a tool call in flight, CPU work (at least ~1% of one core), or a
low-CPU post-startup background process (such as a job waiting on a build lock
or an exposed dev server; startup MCP/LSP servers are excluded). Low-CPU
background protection never suppresses the
stalledmarker and is bounded by runtime tier from the agent’s last activity or CPU work: default 2 hours on local runtimes (docker,podman,container;server.hub.background_liveness_cap_local) and 30 minutes on reserving runtimes (kubernetes/k8s,remote,cloudrun,cloudrun-sandbox,substrate, and any unknown or empty runtime;server.hub.background_liveness_cap_reserved; set either to"0s"to disable). Both stalled and idle auto-suspend honor this guard. - Its harness supports session resume, judged by the harness type behind its harness config, so a custom-named config of a resumable harness qualifies.
- No other lifecycle operation is in progress for it.
An agent is normally suspended within about one sweep interval (5 minutes)
after its grace period ends; with a large backlog of candidates it may take
longer. Agents that are blocked or waiting_for_input, or that are working,
are never suspended by this policy.
The grace is measured from a timestamp the Hub records when the activity
changes. An agent that has been idle or completed since before the Hub
recorded it (that is, since before the idle status shipped) has no such
timestamp, and is not eligible until its activity next changes; there is no
backfill.
The suspend works like scion suspend: the container stops, the harness session
and the idle, completed or harness_error activity are kept, and the
suspend reason is idle. scion list shows such an agent as, for example,
suspended · completed (idle).
Interrupted suspends
Section titled “Interrupted suspends”The suspend is committed in two steps: the Hub records its intent to stop the
agent (with a short lease of a few minutes), stops the container, then records
suspended with reason idle. Failures between the steps are handled so an
agent is never left stopped without a suspend reason:
- Retry. The final write is retried with backoff. While it has not landed, the lease is kept.
- Recovery. If the write still fails, or the Hub restarts after the stop, the
idle sweep records the suspension once the lease has expired and the agent
reports stopping, stopped or error. This needs only the experiment, so turning
auto_suspend_idleoff does not strand an in-flight suspend. A user stop, stop-all, start or delete in the meantime always wins; the sweep never converts such an agent. - Unknown stop outcome. A timeout or other error that leaves it unclear whether the container stopped does not revert the stop intent. If the container is still running, the Hub’s stop-intent reconciliation stops it and the sweep then records the suspension. Only a provable refusal (for example the request never reached the broker) reverts the intent right away.
- Fail fast, then abandon. While a suspend is in progress, messages that need a running agent wait for it to settle (auto-wake paths) or are refused with a “suspending” error. If the lease has expired and the agent is still running, the stop never landed: deliveries are refused at once rather than waiting. After roughly 11 to 16 minutes (the sweep runs every 5 minutes) the sweep abandons the suspend: it reverts the intent, records a message on the agent, and logs a warning, so the agent is reachable again.
- Backoff. An abandoned agent is not idle-suspended again for about 15 minutes, so a persistently failing broker is retried roughly every 30 minutes rather than every sweep.
Auto-wake on new work
Section titled “Auto-wake on new work”With the experiment on, an agent the Hub suspended (idle or stalled) is
resumed automatically when a direct message, web chat message, @-mention,
notification or scheduled message arrives for it, with no --wake and no
lifecycle permission needed on the sender (permission to message the agent is
enough). This is what makes it safe for an agent to go idle while it waits for
a child agent or a scheduled callback hours away. An agent suspended by a user
(reason user), one suspended before reasons were recorded, and a held agent
are never woken this way.
To keep a Hub-suspended agent down, suspend it again (scion suspend <agent>,
POST /api/v1/agents/:id/suspend, or Keep suspended on the agent page): with the experiment on, this changes its
reason from idle or stalled to user in place, without touching the
runtime, so new work no longer wakes it.
What is gated
Section titled “What is gated”| Behavior | Gate |
|---|---|
The idle activity, sciontool status idle, the IDLE notification trigger, stall and offline exclusion of idle |
None (always on) |
Retained activities and suspendReason on suspended agents, and their display |
None (always on) |
| Stalled auto-suspend | server.hub.auto_suspend_stalled |
| Idle auto-suspend sweep | lifecycle.idle_suspend and server.hub.auto_suspend_idle |
Auto-wake of idle- or stalled-suspended agents, and converting them to user with suspend |
lifecycle.idle_suspend |
For the settings, see server.hub.
Never-Suspend Agents
Section titled “Never-Suspend Agents”Standing leads, listeners, and service agents may need to stay running through
idle and stalled auto-suspend sweeps and routine bulk suspends. When the
lifecycle.never_suspend
experiment is enabled (alpha, off by default; independent of
lifecycle.idle_suspend), you can mark an agent with suspendPolicy: "never".
What Never-Suspend Does and Does Not Do
Section titled “What Never-Suspend Does and Does Not Do”| Path | Behavior for a never-policy agent |
|---|---|
| Idle auto-suspend sweep | Skipped — the agent stays running. |
| Stalled auto-suspend | Skipped — the agent is still marked stalled and stall notifications still fire, but the Hub does not suspend it. |
Bulk suspend (scion suspend --all) |
Skipped and reported as skipped (never-suspend) unless --force is passed. |
| Manual single suspend | Refused with 409 agent_never_suspend unless force: true (--force) is sent by an allowlisted human user or dev principal with agent.lifecycle. Applies equally when converting an idle- or stalled-suspended agent to user. |
| Membership-loss hold | Still applies — security revocation is never weakened or overridable. |
stop, stop --all, delete, limits_exceeded stops, reincarnate |
Unaffected — stop remains the explicit escape hatch. |
A forced suspend is audited (agent.suspend.forced), notifies the agent’s
creator when performed by another user, records suspendReason: "user" (so it
does not auto-wake), and keeps suspendPolicy: "never" across resume.
Agents whose harness does not support session resume are never auto-suspended
anyway; setting suspendPolicy: "never" on one is allowed and returns an
advisory warning that the flag has no effect.
Turning lifecycle.never_suspend off keeps stored suspendPolicy values in the
database but ignores them (flagged agents behave like auto), and refuses
create or PATCH requests that set suspendPolicy with 400 experiment_disabled.
Setting and Changing the Policy
Section titled “Setting and Changing the Policy”-
CLI at create or start (human and agent modes):
Terminal window scion create standing-lead --never-suspendscion start standing-lead --never-suspend "Monitor incoming requests"scion listshows a marker next to the phase for flagged agents, andscion look <agent>reportsSuspend policy: never. Re-runningscion createorscion starton an existing agent with a differentsuspendPolicyreturns409 suspend_policy_create_only. -
Manual and bulk suspend override (human principals with
agent.lifecycle):Terminal window scion suspend standing-lead --forcescion suspend --all --force -
Changing after creation (API and Web UI): send
PATCH /api/v1/agents/{id}with{"suspendPolicy": "never"}or{"suspendPolicy": "auto"}, or toggle Never suspend on the agent’s Edit page in the Web UI. The field is T0 metadata and takes effect immediately in any phase (emitting anagent.suspend_policy.setaudit record). SettingsuspendPolicy: "never"after an auto-suspend claim or stop intent was already taken does not cancel that in-flight suspend; thePATCHresponse setssuspensionInFlight: trueand the Web UI shows a hint explaining that the policy will apply once the agent is running again. -
Web UI: while
lifecycle.never_suspendis enabled, the Create Agent form offers a Never suspend checkbox, agent lists and detail pages show a Never suspend badge, the hub-wide Agents page supports filtering bysuspendPolicy:never/suspendPolicy:autoin the filter box and surfaces non-default lifecycle and messaging settings in the Traits column, and clicking Suspend on a flagged agent opens a confirmation dialog that sendsforce: true.
Current Limits (v1)
Section titled “Current Limits (v1)”- Per-project quota (
max_never_suspend_agents_per_project): an optional fairness limit (unlimited by default) that counts flagged non-deleted agents in the project; creating orPATCHing over the cap returns429, and restoring a soft-deleted flagged agent over the cap returns409. - Agent principals can set the flag only at creation. Calling
scion create --never-suspendorscion start --never-suspendfrom an agent works under the existingagent.createrules, butPATCH /api/v1/agents/{id}from an agent principal returns403. - Users from a federated hub cannot use
force. Only allowlisted human user and dev principals on the local Hub withagent.lifecyclemay force-suspend a flagged agent; federated and agent principals receive403 force_suspend_forbidden.
Troubleshooting & Diagnostics
Section titled “Troubleshooting & Diagnostics”Most stuck, stalled, or failing agents are recoverable without deleting and recreating them. Recreating an agent should be a last resort, as it destroys unpushed working tree files and terminal history.
Always start by running scion look <agent-name> to inspect the active screen state and scion logs <agent-name> to review internal telemetry before performing recovery.
1. Common Stuck States & Recovery (Triage Table)
Section titled “1. Common Stuck States & Recovery (Triage Table)”| Symptom | Probable Cause | Correct Recovery Action |
|---|---|---|
harness error in scion list |
The harness reported that the model provider rejected its turn (the reason is in the message, for example model API: APIError (status 400)). The harness is still running. |
Fix the cause (credentials, model name, permissions), then send scion message <agent-name> "continue" to retry. Do not recreate the agent. |
| Transient API errors in logs | LLM provider rate-limits, quotas, or minor timeouts. | Send a wake-up command: scion message <agent-name> "continue". Do not recreate the agent. |
LIMITS_EXCEEDED state |
The agent reached its configured turn, model call, or duration ceiling. | Send a continue command: scion message <agent-name> "continue". This clears the ceiling for another cycle. |
| Cryptographic primitive error | The Hub regenerated its signing keys (e.g., on restart) or there is a key mismatch in a multi-replica deployment. | Send scion message <agent-name> "continue". Message delivery does not rely on the agent’s own token. If looping, contact the operator: the Hub’s SharedSigningSecret (SCION_SERVER_SESSION_SECRET) must be pinned in the deploy config. |
| Deadlocked token refresh (401 loops in logs) | The agent’s token expired and its automatic refresh loop deadlocked. | Try sending scion message <agent-name> "continue". If this has no effect, recreate the agent. |
Phase created / lastSeen zero for 5+ minutes (not shown as created (not started)) |
The agent creation timed out or failed to schedule. An agent made with scion create is shown as created (not started) instead; it is waiting for scion start, not stuck. |
The system is likely under heavy resource pressure. Wait a few minutes. If still stuck, delete and recreate. To prevent: reduce concurrent agent starts. |
Start fails with no_runtime_broker (422) |
Temporary connection issue after a system restart or project reconnect. | Wait 30–60 seconds and try starting again. If persistent, verify Runtime Broker status with scion runtime-broker status. |
| Split-Brain Configuration (git project ignore settings) | Config files are loading incorrectly due to overlapping global vs. project settings. | Run scion config dir to see the effective config path. Ensure the merge chain matches: defaults → global → in-repo → external → environment. |
| Interactive prompt blocking | The agent’s harness is stuck waiting for an unhandled prompt (e.g. yes/no query). | Send the dismissive keystroke to the terminal: scion keys <agent-name> "Enter" (or "y", etc.). One key per call — there is no sequence syntax. |
Deletion Authority & Hierarchical Teardown
Section titled “Deletion Authority & Hierarchical Teardown”scion delete <agent-name> --non-interactive immediately reclaims container resources. Since an agent’s true deliverable is its artifact (pushed commits, opened PRs, files written to a shared volume), deleting a completed agent is the default, recommended clean-up path.
Teardown on the Runtime Broker can outlast the request. If it does, scion delete waits up to three minutes for the Hub to confirm the delete, and only then removes the local worktree. If the delete fails, the worktree is kept. Agent deletion and failed-start cleanup pass every removal through one check: with symlinks resolved, a path may be removed only if it lies inside one of the agent’s own directories, and a path that is or contains a project workspace is refused. Only the agent’s own git worktree entry is removed, never with a repository-wide prune, and a worktree path that resolves elsewhere through a symlink is left alone. If the Runtime Broker teardown is still unresolved, the agent also can’t be started, restarted or woken (409 delete_in_progress) until you run scion delete again. If the Runtime Broker holds a different run of the agent than the Hub recorded, it deletes nothing. If that run is one of the agent’s earlier runs, as a failed start can leave behind, the Hub then deletes it and removes the agent. Otherwise the Hub refuses the delete with 409 conflict and keeps the agent, and --force deletes the run the Runtime Broker holds and then removes the agent. In both cases, if that delete fails, the Hub keeps the agent. See scion delete and DELETE /agents/:id.
However, to prevent premature deletion of agents with active or pending tasks, strict teardown guidelines must be followed.
1. Who May Authorize Deletion
Section titled “1. Who May Authorize Deletion”| Agent Role | Authorized to Delete | Allowed Timing |
|---|---|---|
| Task-bounded agent | The agent’s creator or supervisor. | Immediately once the output has been accepted and verified. |
| Agent with an open human question | The agent’s creator or supervisor. | Only after all questions to humans are answered and the conversation is explicitly concluded. |
| Lead — the first agent on a project or workstream, an agent coordinating that project or workstream, or an agent explicitly designated by a human as its lead | Only on explicit human instruction naming the workstream | It carries continuity from the initial request through closure, including non-code and non-repository projects |
| Delegated supervisor with a bounded assignment, not a lead | Its creator or authorized supervisor, subject to the assigned workflow; a human where that workflow requires it | After its deliverable is accepted, verified and durable, its subtree is torn down, and its human questions are resolved |
2. Hierarchical (Bottom-Up) Teardown
Section titled “2. Hierarchical (Bottom-Up) Teardown”When cleaning up a complex multi-agent hierarchy, teardown must proceed bottom-up to avoid leaving orphaned containers running:
- The parent orchestrator learns its goal is reached and notifies the child sub-agents.
- The child sub-agents finish their current cycle, push their work, and signal completion.
- The parent orchestrator deletes the child worker agents.
- The parent orchestrator confirms its entire subtree is deleted and exits.
- The human operator or higher-level parent deletes the parent orchestrator.
3. Safety Rules for Cleanup
Section titled “3. Safety Rules for Cleanup”- Completion is not Deletion: A completed task means the work is finished, not that the agent should be deleted. The user or coordinator may want to assign a follow-up task.
- Unanswered Questions block Deletion: If an agent has raised an open, unanswered question to a user, it cannot be deleted.
- Commit is not Push: Never delete an agent with unpushed work. Always verify that all local commits have been pushed to the remote branch, and any local deliverables have been copied to shared directories or volumes.
Runtime caveats
Section titled “Runtime caveats”Session continuation works only when the agent’s home directory — where the harness stores its conversation state — survives the container being reclaimed. Treat suspend/resume and auto-suspend session continuation as a Docker-proven capability, with this caveat for other runtimes:
- Docker — the proven path. The agent home is a host bind-mount that survives the container being reclaimed, so suspend/resume and auto-suspend continue the harness session with no additional configuration. The same holds for any setup with a persistent or NFS-backed home.
- Kubernetes / Cloud Run — these runtimes can have an ephemeral home. Without durable home persistence, resume restarts the container but the harness session may not continue. Durable home persistence (for example, object storage such as GCS) is future work, and these runtimes are gated on NFS-style persistence regardless — so do not assume full suspend/resume parity here yet.