Idle container shutdown

The server automatically stops an empty development container after 15 minutes. Configure or disable it in Settings → Idle containers. Settings belong to the signed-in server user and apply to that user's workspaces. The timeout accepts 1–10080 minutes.

Stopping retains working files, independent session checkouts, volumes, native conversations and saved session profiles. It stops the execution container and its managed Docker-in-Docker and Internet-egress companions. It does not delete them, power off the server or stop unrelated application services. Leftover nested databases and test services stop with their Docker daemon; their existence alone does not keep an otherwise empty development container running.

This policy is distinct from Overnight, which archives work and powers off eligible temporary servers. Explicitly freezing the last provider session may still stop its empty container immediately. Thaw and subsequent launches restore compatible retained containers and their gateways through the existing lifecycle.

When a container is empty

All recorded coding and shell sessions must have exited or failed. Running or starting sessions retain the container, including sessions waiting for input, permission or quota and sessions hidden in the console. Hiding or detaching a session never makes it eligible for shutdown.

The controller also checks workspace ownership, fresh host inventory, native provider processes, pending commands, session launches, restarts, account transfers, Freeze/Thaw, repository preparation, file synchronization, active Run write leases and Overnight locks. Control Room workspaces are excluded.

A new active session cancels the grace period. Container replacement, host or owner changes and session changes start a new grace period. The timer is stored in controller SQLite, so closing TUI, web or the laptop does not stop it. Controller restarts preserve the timestamp. Offline or stale host observations defer shutdown; a fresh inventory is required before continuing.

The server checks every 30 seconds. After the timeout, it queues one guarded lifecycle command. Before stopping, the host rechecks current permission and obtains fresh native process and tmux-pane evidence, with a ten-second deadline. A live pane, native provider, failed probe or changed identity retains the container. A new launch cannot race an already accepted stop; it waits for host confirmation before restarting the retained container.

API, CLI and MCP

Read settings and pending grace periods:

GET /v1/workspace-idle-shutdown

Update the signed-in owner's policy:

PUT /v1/workspace-idle-shutdown
{"enabled":true,"idleMinutes":15}

The response contains policy and owner-scoped workspaces, with workspaceId, project name, host, idleSince, stopAfter and waiting or stopping state. Ordinary snapshots do not need to load this history.

The same authenticated API is available through the CLI api call command and the operator MCP controller_request tool. For example, invoke controller_request with operation: "PUT /v1/workspace-idle-shutdown" and body: {"enabled":true,"idleMinutes":15}. This is an operator/user setting, not a permission for a coding session to modify infrastructure policy on its own.

The execution host must advertise workspace-idle-shutdown-v1; older hosts remain unchanged until upgraded. Intentional stops set the components' Docker restart policy to no, so external restart-policy monitors do not mistake an intentionally retained gateway for a failed service. Starting a retained workspace restores its egress restart policy and starts stopped managed companions before the main container.

Decision history

Open Idle containers → History (h) to inspect grace periods, retained-work reasons, queued commands, final dispatch refusals and stop results. Queued work is not a confirmed stop. A host-confirmed result records the authenticated host receipt; idleStopSkipped:true means the host preserved work. Counts distinguish active managed sessions from observed native agents.

GET /v1/workspace-idle-shutdown/history accepts owned workspaceId and hostId filters, limit (1–50) and cursor, and returns {items,nextCursor,retention}. Both filters must match when supplied together. Operator MCP discovers the same route; session get_idle_container_history reads only its current shared workspace, with limit and cursor. Reading never queues a stop.

History starts when this version runs, with no invented earlier events. It is kept separately from /state for 90 days and at most 5,000 entries per owner. Repeated identical decisions coalesce. See lifecycle history (source access required) for reason, filter and measurement semantics.

Validation

Tests cover empty containers, one or several ended sessions, working and waiting sessions, a launch during the grace period, stale/offline observations, dispatch-time changes, native agents absent from cached observations, leftover nested development services, disabling/changing the timeout, Control Room exclusion, SQLite reopen, authenticated API validation and keyboard editing of the shared settings UI. Runtime tests verify live tmux/provider evidence, malformed or failed probes, coordinated companion stops and retained startup.

The policy uses explicit devctrl session and operation ownership. Arbitrary external workloads should use managed sessions or Run leases to keep their execution environment active; an untracked nested database is not an active agent session.