You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 45fa078
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: architecture/compute-runtimes.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Compute Runtimes
2
2
3
3
Compute runtimes create, stop, start, delete, and watch sandbox workloads for the
4
-
gateway. They do not replace sandbox policy enforcement. Every runtime starts a
5
-
workload that runs the `openshell-sandbox` supervisor, and the supervisor
6
-
enforces the sandbox contract locally.
4
+
gateway. They do not replace sandbox policy enforcement. A runtime either starts
5
+
the co-located `openshell-sandbox` supervisor or provisions its RFC 0012
6
+
`--mode=control` and `--mode=boundary` placements.
7
7
8
8
## Driver Contract
9
9
@@ -13,6 +13,11 @@ Each runtime receives a sandbox spec from the gateway and is responsible for:
13
13
- Injecting sandbox identity and gateway callback configuration.
14
14
- Supplying TLS or secret material for supervisor callbacks.
15
15
- Providing the supervisor binary or image in the workload.
16
+
- Provisioning protected control and boundary configs plus a private Unix socket,
17
+
TLS-authenticated TCP, or vsock transport when the supervisor is separated. Runtime-specific code
18
+
supplies immutable resource claims and transport coordinates; the shared
19
+
boundary protocol supplies lifecycle, exec, signaling, forwarding, and binary
20
+
identity semantics.
16
21
- Forwarding the exact canonical main-process argv and TTY mode without shell
17
22
reconstruction. The sandbox-level environment and policy workspace apply to
18
23
the main process.
@@ -219,10 +224,10 @@ delete, reconciliation removes the row; otherwise it can remain `Deleting`.
219
224
220
225
| Runtime | Best fit | Sandbox boundary | Notes |
221
226
|---|---|---|---|
222
-
| Docker | Local development with Docker available. | Container plus nested sandbox namespace. |Uses host networking so loopback gateway endpoints work from the supervisor. Advertises the combined-supervisor policy-DNS and transparent-TCP substrate. |
227
+
| Docker | Local development with Docker available. | Container plus nested sandbox namespace. |Creates the workload with Docker `network_mode=none`; a host control process mediates egress and access over a private bind-mounted Unix socket. |
223
228
| Podman | Rootless or single-machine deployments. | Container plus nested sandbox namespace. | Uses the Podman REST API and CDI GPU devices when available. Delivers the supervisor via OCI image volume by default; falls back to extracting the binary to a host-side cache and bind-mounting it when `userns` is configured (overlay does not support idmapped mounts). Advertises the combined-supervisor policy-DNS and transparent-TCP substrate. |
224
-
| Kubernetes | Cluster deployment through Helm. | Pod plus nested sandbox namespace. |Uses Kubernetes API objects, service accounts, secrets, PVC-backed workspace storage, and GPU resources. |
225
-
| VM | Experimental microVM isolation. | Per-sandbox libkrun VM. |Managed endpoint-backed driver. The gateway spawns `openshell-driver-vm`, waits for its Unix socket, and then consumes it through the same remote `compute_driver.proto` path used by unmanaged endpoint drivers. The VM driver boots a cached bootstrap `rootfs.ext4`, prepares requested OCI images inside a bootstrap VM with `umoci`, attaches the prepared image disk read-only, and gives each sandbox a writable `overlay.ext4` for merged-root changes and runtime material. The driver persists each accepted launch request beside the overlay and restarts those VMs on driver startup without recreating the overlay. |
229
+
| Kubernetes | Cluster deployment through Helm. | Pod plus nested sandbox namespace. |The proxy-pod topology fences workload egress with NetworkPolicy, runs boundary mode as the workload entrypoint, and runs control mode in a separate zero-capability pod over per-boundary TLS. It requires an enforcing CNI and trusted sandbox namespace. |
230
+
| VM | Experimental microVM isolation. | Per-sandbox libkrun VM. | The guest is NIC-less and runs boundary mode as PID 1; host control owns gateway networking and reaches the guest over vsock. The driver persists each accepted launch request and writable overlay for restart. |
226
231
| Extension | Out-of-tree drivers operated alongside the gateway. | Whatever boundary the driver implements. | Selected by a custom `compute_drivers = ["<name>"]` entry with `[openshell.drivers.<name>].socket_path`, or at launch time by pairing `--drivers <name>` with `--compute-driver-socket=<path>`. A launch-time endpoint may use a canonical built-in name to preserve its driver-config key while replacing in-process construction. The gateway connects to an operator-provisioned UDS, snapshots `GetCapabilities`, and dispatches all sandbox lifecycle calls through `compute_driver.proto`. The driver process and socket lifecycle are operator-owned; the gateway does not spawn, supervise, or remove unmanaged extension drivers. The trust boundary is the socket's filesystem permissions: the operator must ensure only the gateway uid can read/write it. |
227
232
228
233
Per-sandbox CPU and memory values currently enter the driver layer through
Copy file name to clipboardExpand all lines: architecture/sandbox.md
+55-11Lines changed: 55 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,7 @@
1
1
# Sandbox
2
2
3
-
A sandbox is the runtime boundary where agent code executes. It is created by a
4
-
compute runtime and managed inside the workload by `openshell-sandbox`, the
5
-
sandbox supervisor.
3
+
A sandbox is the runtime boundary where agent code executes. A compute runtime
4
+
creates it, and `openshell-sandbox` operates it as one logical supervisor.
6
5
7
6
## Runtime Model
8
7
@@ -21,20 +20,52 @@ container-granted capabilities. This is fail-closed: the supervisor retains
21
20
aborts unless the bounding set ends up empty. A `setpcap``EPERM` is tolerated
22
21
only when the set is already empty; any other outcome fails the spawn.
23
22
23
+
Separated runtimes split the same logical supervisor into two placements:
24
+
25
+
| Mode | Placement and authority |
26
+
|---|---|
27
+
|`openshell-sandbox --mode=control`| Runs outside the workload boundary. Owns gateway credentials, the admitted policy, RFC 0012 lifecycle, network-policy decisions, SSH, and gateway relays. |
28
+
|`openshell-sandbox --mode=boundary --boundary-config <path>`| Runs inside or adjacent to the workload. Owns process launch and observation, exec signaling, PTY control, loopback forwarding, egress capture, and binary identity. It has no gateway credentials or independent policy authority. |
29
+
30
+
The compute driver provisions the two protected configurations and their private
31
+
Unix-socket, TLS-authenticated TCP, or vsock transport. TCP across a shared or
32
+
operator-managed network uses a driver-provisioned trust root and verified server
33
+
name; NetworkPolicy alone is not a confidentiality boundary. All configurations carry the
34
+
same boundary ID, bootstrap credential, protocol version, and immutable driver resource claims.
35
+
The shared remote backend authenticates each request and rejects a resource-claim
36
+
mismatch. Driver crates do not appear in generic supervisor lifecycle, network,
37
+
SSH, or session code.
38
+
39
+
Control mode can expose semantic TCP readiness after the boundary reaches
40
+
`Running`. The bind IP is explicit and address-family neutral; Kubernetes
41
+
drivers inject the pod IP so IPv4 and IPv6 probes reach the same listener.
42
+
43
+
For cross-UID Unix-socket placements, the driver-owned parent directory limits
44
+
socket reachability and the bootstrap credential authenticates every request.
45
+
Boundary mode can re-own a bind-mounted config as root-only before starting the
46
+
workload when its host ownership could otherwise coincide with the workload UID.
47
+
24
48
## Startup Flow
25
49
26
50
1. The compute runtime starts the workload with sandbox identity, callback
27
51
endpoint, TLS or secret material, image metadata, and initial command.
28
-
2.The supervisor loads policy and runtime settings from local files or the
52
+
2.Control mode loads policy and runtime settings from local files or the
29
53
gateway, depending on mode.
30
-
3. It prepares filesystem access, process restrictions, network namespace
31
-
routing, trust stores, provider credential resolution, and inference routes.
32
-
4. It launches the persisted canonical main-process argv and retains its PTY
33
-
or pipes in the main-session multiplexer.
34
-
5. It starts the policy proxy and local SSH server.
35
-
6. It opens a supervisor session back to the gateway for connect, exec, file
54
+
3. The isolation backend attaches and confirms standing enforcement. Boundary
55
+
mode prepares boundary-local filesystem, process, and egress controls.
56
+
4. Control mode connects network mediation, then confirms enforcement and starts
57
+
the admitted main process through the backend. Boundary
58
+
mode applies launch-time controls before its first untrusted instruction.
59
+
5. Control mode starts the local SSH server. Exec and loopback
60
+
streams cross the shared boundary protocol when the modes are separated.
61
+
6. Control mode opens a supervisor session back to the gateway for connect, exec, file
36
62
sync, config polling, and log push.
37
63
64
+
When the admitted main process exits, its status and retained terminal output
65
+
remain available. The confirmed boundary and control-owned access plane continue
66
+
to serve policy-authorized exec and loopback forwarding until explicit stop or
67
+
delete tears down the boundary and terminates any remaining workload processes.
68
+
38
69
## Isolation Layers
39
70
40
71
OpenShell uses overlapping controls rather than a single sandbox primitive:
@@ -109,6 +140,15 @@ generation-pinned authorization form the transparent TCP security boundary.
109
140
Docker and Podman do not currently advertise usable IPv6 egress for this
110
141
substrate, so AAAA queries return NOERROR/NODATA and IPv6 DNS remains fenced.
111
142
143
+
Network-rule ownership depends on supervisor placement. In legacy combined
144
+
mode, `openshell-sandbox` creates the workload network namespace and owns its
145
+
`ip`, iptables, and nftables setup and cleanup. In delegated control/boundary
146
+
mode, the compute driver provisions the protected network substrate before
147
+
control attaches; boundary mode owns only boundary-local observation and the
148
+
listener handed to it. Control mode evaluates policy but must not mutate a
149
+
driver-owned namespace or assume that legacy `ip`/nft cleanup applies. Drivers
150
+
must tear down their own rules and namespace resources with the workload.
151
+
112
152
Provider credential placeholders are resolved through the live provider state
113
153
for each HTTP request, after destination and L7 policy admission. A static
114
154
credential resolves only when the request host, port, and path match an endpoint
@@ -487,7 +527,11 @@ engine with a gateway policy revision.
487
527
to new connections or the next parsed HTTP request where the proxy can safely
488
528
re-evaluate.
489
529
- If the supervisor relay drops, the sandbox can keep running, but connect and
490
-
exec operations fail until the supervisor registers again.
530
+
exec operations fail until the supervisor registers again. In a separated
531
+
topology, a replacement control process replays the identical boundary
532
+
lifecycle and receives the existing process handle. The boundary rejects
533
+
changed launch inputs and releases the single main-process attachment when
534
+
the old control transport closes.
491
535
- If the canonical main process exits, the supervisor durably reports the
492
536
normalized result immediately. A foreground create declares a one-shot main
493
537
attachment, so the supervisor accepts it even after a fast process exits,
0 commit comments