Runtime and guest integration
ArcBox runs computer workloads inside Linux virtual machines and controls them through a guest agent. The runtime turns image and request data into an OCI workload description, checks that the VM boundary can honor it, then sends process, file, network, and readiness work across the guest boundary.
Execution boundary
The execution boundary keeps host control separate from processes and services inside a guest. The computer runtime owns the VM lifecycle and uses a transport-neutral guest-agent contract so the same workload flow can work with different ways to reach a guest. See Computer runtime and Virtualization platform for the surrounding VM lifecycle and platform layers.
This diagram shows how a host request becomes work inside a computer and how results return to the host.
flowchart LR
Request[Host workload request] --> Runtime[Computer runtime]
Runtime -->|create and check OCI workload| Workload[Workload contract]
Workload -->|start command and mounts| Agent[Guest agent]
Runtime -->|boot and prepare| VM[Computer VM]
VM --> Agent
Agent --> Process[Guest process]
Agent --> Files[Guest files and services]
Process -->|output and exit| Runtime
Files -->|file and port results| Runtime
The agent boundary has two parts. A readiness gate proves that the guest agent serves requests, while the agent operations carry process execution, file access, clock sync, network changes, and port waits after boot. The current VM transport uses a vsock connection, but the runtime keeps that choice behind the agent factory. References: computer/…/agent.rs• L1-16, computer/…/agent.rs• L42-100, computer/…/agent.rs• L144-195
OCI workload contract
The OCI workload contract is the shared description between image configuration, host requests, and guest execution. An OCI specification is a JSON-shaped description of a root filesystem, process, mounts, and Linux settings; ArcBox uses it as an input contract rather than as a promise to support every OCI feature.
The workload is formed in two stages:
- Image settings and the create request combine into one OCI specification. The request can replace the command, add or replace environment values, choose a working directory and user, allocate a terminal, and add host-directory mounts.
- The runtime checks the specification against guest-agent support. Supported process fields become a guest start command, and bind mounts become shared host directories. Unsupported fields fail before the workload starts.
This flow keeps image defaults and request overrides in one place before the runtime crosses into the guest.
flowchart TD
Image[Image config] --> Build[Build OCI workload]
Request[Create request] --> Build
Accounts[Image user and group data] --> Build
Build --> Spec[OCI config.json model]
Spec --> Check[Support and isolation checks]
Check -->|accepted fields| Start[Guest StartCommand and bind mounts]
Check -->|unsupported or rejected fields| Error[Workload error]
Start --> Agent[Guest agent]
The VM is the isolation boundary for a computer. The runtime rejects hooks, namespaces, seccomp, capabilities, resource limits, devices, and other fields that the guest agent cannot carry out. This prevents a workload from appearing to honor a setting that would otherwise be silently ignored. The arcbox-oci model supports OCI version 1.2.0 data, but its own validation is only a basic shape check; the workload contract performs the support and isolation check. See Container and OCI runtime for the container-specific view. References: computer/…/workload.rs• L1-19, computer/…/check.rs• L1-129, computer/…/spec.rs• L61-164, computer/…/spec.rs• L15-24, computer/…/spec.rs• L88-155
Guest-agent services
The guest agent is the service point inside a running computer. It accepts host requests after readiness and coordinates actions that must happen in the guest, while the runtime keeps the public operation and lifecycle context on the host.
The boundary supports these service groups:
| Service group | Purpose |
|---|---|
| Readiness and clock | Prove that the agent serves requests and align guest time with the host. |
| Process execution | Run commands, stream output, accept input, resize terminals, send signals, and report exit. |
| File access | Read, write, inspect, change, remove, rename, and watch guest files. |
| Network control | Reconfigure a restored guest and wait for a guest service to listen on a port. |
| Workload startup | Start a process from the OCI-derived command and mount description. |
Run and interactive execution return a stream whose final event is the process exit. This lets the host forward output while still recording completion when a client stops reading. File operations use their own guest file channel, so file data does not need to be encoded as process control messages. See Guest-agent integration for the guest service contract and host-facing request flows. References: computer/…/agent.rs• L144-195, computer/…/agent.rs• L232-274, computer/…/start.rs• L10-25
OCI bundle and state model
The OCI model gives the runtime a portable way to describe a workload and its lifecycle metadata. An OCI bundle is a directory with config.json and a root filesystem path; ArcBox can load, create, validate, update, and save that description before a computer runs it.
Container state is durable metadata, not the source of computer VM lifecycle. Its OCI states move from creating to created, then running, and finally stopped; an error can move a state directly to stopped. ArcBox computer pause is owned by the computer manager and is not represented as an OCI status. References: computer/…/bundle.rs• L1-7, computer/…/bundle.rs• L36-73, computer/…/bundle.rs• L165-195, computer/…/state.rs• L15-40, computer/…/state.rs• L109-185
Lifecycle and recovery
The runtime joins VM lifecycle with guest reachability so it does not report a usable computer before the guest agent can answer. Boot prepares the VM and its readiness observer, starts the guest, waits for the agent, and then permits workload operations. Restore also requires network reconfiguration when the guest receives a new network identity.
Workload execution follows the same ownership rule after startup: the runtime starts the guest process, consumes its output, and applies the exit result even if the client connection ends. This keeps process completion and computer state tied to the guest event rather than to one host stream. References: computer/…/agent.rs• L42-100, computer/…/agent.rs• L157-169, computer/…/agent.rs• L253-262, computer/…/start.rs• L21-40
Change checklist
When these files or sections are changed, remember to consider these:
- A new OCI field needs a matching decision in the workload support check and a matching translation or rejection at the guest boundary. Parsing alone does not make the guest honor it.
- Changes to image defaults or request overrides must preserve command, environment, user, working-directory, terminal, and mount precedence before the start command is built.
- Changes to agent readiness must preserve the distinction between transport readiness and a later guest service or workload readiness check.
- Changes to streamed output must preserve the final exit event and state updates after a client disconnects.
- Changes to the OCI state model must not make it the source of pause or resume behavior. Computer lifecycle remains owned by the computer manager.
- Changes to the agent protocol or transport must keep the host contract, guest service, readiness gate, and restore network path aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A spec uses an OCI feature outside the computer contract. | The workload cannot run as requested. | Reject the field before sending a start command instead of ignoring it. |
| The host treats an answering agent as proof that a guest service is ready. | The first workload or service request can fail during guest startup. | Keep agent readiness separate from service and workload readiness. |
| A named user or group is absent from the image account files. | OCI workload creation fails before guest execution. | Resolve names against the image account data and return a user error. |
| A client stops consuming output before process exit. | The computer can retain stale running state. | Keep draining or tracking the guest stream until the final exit event. |
| A restored guest keeps its old network identity. | Host calls reach the wrong address or fail to reach the guest. | Reconfigure the guest and reconnect through the settled network identity. |
| A hook is present in a computer workload. | The workload requests behavior the VM guest path does not execute. | Reject non-empty hooks at the workload contract. |
Key files
| File | Why to read it |
|---|---|
| computer/…/agent.rs | Defines the transport-neutral guest-agent boundary and the host-visible process, file, readiness, clock, and network services. |
| computer/…/workload.rs | Explains the OCI-to-guest workload contract and its error categories. |
| computer/…/spec.rs | Shows how image settings and create requests form one OCI workload description. |
| computer/…/start.rs | Shows the accepted OCI fields that become a guest start command and bind mounts. |
| computer/…/check.rs | Shows which OCI isolation and execution settings are rejected or unsupported. |
| computer/…/bundle.rs | Defines the OCI bundle boundary around config.json and the root filesystem. |
| computer/…/state.rs | Defines durable OCI container state and its lifecycle transitions. |
| computer/…/spec.rs | Defines the OCI workload shape and its basic validation. |
| docs/container-and-oci-runtime.md | Child page for container and OCI execution behavior. |
| docs/guest-agent-integration.md | Child page for guest-agent requests and service integration. |