Skip to main content

Module container_turn

Module container_turn 

Source
Expand description

Getting a container agent’s container ready for a turn: the container is running, and the provider CLI is installed in it.

This is the first thing a container turn does, inside the turn’s own task (SubprocessController::spawn_container_turn), NOT inside the RPC handler that accepted the message: downloading the image takes minutes, and the RPC engine drops a handler after five seconds, which cancelled the download for good. The handler only records the ContainerStartup on the controller and queues the turn.

Spec: docs/specs/SPEC_CONTAINER_AGENTS_AT_PARITY_2026_10_27.md (P0, P1, P2), docs/specs/SPEC_CONTAINER_AGENTS_WORK_FOR_EVERYONE_2026_10_07.md.

Structs§

ContainerSpec 🔒
What a container agent’s pane says about its container, apart from the services that run it.
ContainerStartup 🔒
Everything needed to get a container agent’s container ready, owned, so it can outlive the request that asked for it.
IfDropped 🔒
Runs f when dropped unless disarmed: closes a pane row whose work was cancelled (a stop drops the start-up future mid-way).
PrestartSlot 🔒

Enums§

Prestart 🔒
Where a block’s pre-start is.

Statics§

PRESTARTING 🔒
Blocks whose pre-start is under way, so a second request for one does nothing, and how to end it.

Functions§

before_the_container_has_the_folder 🔒
What a container agent’s turn does to its workspace folder on the host before the container has it: the folder is marked as a container agent’s, so a host agent given it later gets only the MCP servers AgentMux writes (mcp_folder_rule), and signing keys an earlier launch left in its .mcp.json come out.
cancel_prestart 🔒
End the pre-start of a pane that is closing, so a start still pulling its image can’t create and run a container for a pane that is gone. The caller stops the container afterwards. Nothing under way: nothing done.
container_adapter_for_block 🔒
The adapter for the container agent in block_meta: its container is readied at the start of each turn, and a turn is a docker exec in it. See ContainerStartup::for_block for what env_vars and working_dir are used for.
error_result_frame 🔒
The result frame that ends a turn with an error and carries message.
prestart 🔒
Begin a new container agent’s start (image, container, CLI) in the background, so its first message finds a warm container. Only for a container agent whose pane has run nothing, and only once its account resolves (the mounts carry the account’s credentials: starting without them would make the wrong container). The first message’s own start-up shares the container’s locks, so nothing is done twice.
prestart_applies 🔒
Whether a pre-start applies: a container agent whose pane has run nothing yet. A pane that is running a turn, or has run one, is left to the turn’s own start-up.
startup_step 🔒
The step the controller runs at the start of each container turn.