Skip to content

Commit 4f70122

Browse files
committed
feat(driver): add MXC compute driver for Windows isolation sessions
Introduces the openshell-driver-mxc crate implementing ComputeDriver backed by Microsoft MXC isolation sessions (Windows only). Wires the new driver into the server's build_compute_runtime dispatch and adds the Mxc variant to ComputeDriverKind. Also adds a local protobuf-src stub (tools/protobuf-src-local) to unblock Windows builds that lack MSYS2/MinGW, and pins the zig Windows x64 toolchain in mise.lock.
1 parent 34b5d7c commit 4f70122

16 files changed

Lines changed: 1615 additions & 18 deletions

File tree

‎Cargo.lock‎

Lines changed: 19 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,9 @@ strip = true
151151
[profile.dev]
152152
# Faster compile times for dev builds
153153
debug = 1
154+
155+
# On Windows without MSYS2/MinGW, protobuf-src cannot build from source.
156+
# Patch it with a local stub that reads PROTOC from the environment.
157+
# Remove this patch once MSYS2 is installed or CI handles the build.
158+
[patch.crates-io]
159+
protobuf-src = { path = "tools/protobuf-src-local" }

‎crates/openshell-core/src/config.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pub enum ComputeDriverKind {
4747
Vm,
4848
Docker,
4949
Podman,
50+
/// Microsoft MXC isolation session (Windows only).
51+
Mxc,
5052
}
5153

5254
impl ComputeDriverKind {
@@ -57,6 +59,7 @@ impl ComputeDriverKind {
5759
Self::Vm => "vm",
5860
Self::Docker => "docker",
5961
Self::Podman => "podman",
62+
Self::Mxc => "mxc",
6063
}
6164
}
6265
}
@@ -76,8 +79,9 @@ impl FromStr for ComputeDriverKind {
7679
"vm" => Ok(Self::Vm),
7780
"docker" => Ok(Self::Docker),
7881
"podman" => Ok(Self::Podman),
82+
"mxc" => Ok(Self::Mxc),
7983
other => Err(format!(
80-
"unsupported compute driver '{other}'. expected one of: kubernetes, vm, docker, podman"
84+
"unsupported compute driver '{other}'. expected one of: kubernetes, vm, docker, podman, mxc"
8185
)),
8286
}
8387
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[package]
5+
name = "openshell-driver-mxc"
6+
description = "MXC (Windows isolation session) compute driver for OpenShell"
7+
version.workspace = true
8+
edition.workspace = true
9+
rust-version.workspace = true
10+
license.workspace = true
11+
repository.workspace = true
12+
13+
[lib]
14+
name = "openshell_driver_mxc"
15+
16+
[dependencies]
17+
openshell-core = { path = "../openshell-core" }
18+
tokio = { workspace = true }
19+
tonic = { workspace = true }
20+
futures = { workspace = true }
21+
tokio-stream = { workspace = true }
22+
serde = { workspace = true }
23+
serde_json = { workspace = true }
24+
base64 = { workspace = true }
25+
tracing = { workspace = true }
26+
thiserror = { workspace = true }
27+
uuid = { workspace = true }
28+
29+
[dev-dependencies]
30+
tokio = { workspace = true }
31+
32+
[lints]
33+
workspace = true
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# openshell-driver-mxc
2+
3+
OpenShell compute driver backed by **Microsoft MXC** (`wxc-exec`) on Windows.
4+
5+
## Design
6+
7+
This driver implements the gateway's `ComputeDriver` gRPC contract as an
8+
**in-process library** linked into `openshell-gateway`. It drives MXC through
9+
the state-aware lifecycle (`provision` → `start` → `exec` → `stop` →
10+
`deprovision`), runs the agent **inside the driver** (exec-in-driver), and
11+
**self-reports readiness** — there is no in-sandbox supervisor, no host-side
12+
surrogate, and no `ConnectSupervisor` relay. See
13+
`docs/reference/mxc-compute-driver-design.mdx` for Shailendra's full
14+
architectural rationale (decisions D1–D4).
15+
16+
## Capability Matrix (June 15 demo slice)
17+
18+
| Capability | MXC driver | Closing it requires |
19+
|---|---|---|
20+
| Filesystem policy (read-write / read-only grants) | ✅ provision-time AppContainer shares | — |
21+
| Governed egress (CONNECT proxy + OPA + L7) | ❌ | `implement-openshell-mxc-egress-proxy` |
22+
| Network policy | ❌ `isolation_session` rejects network config | MXC feedback item M1 + egress skill |
23+
| Process policy (seccomp, uid/gid) | ❌ host-side governance design; OS isolation only | not pursued |
24+
| Interactive exec/connect/forward | ❌ exec runs in-driver, no client attach | `adapt-openshell-gateway-windows` |
25+
| Bundled agent image | ❌ no OCI image; relies on Windows host install | — |
26+
| Restart durability | ❌ in-memory registry; restart orphans live sessions | follow-on |
27+
| Concurrent sandboxes | ⚠️ isolation_session v1 is single-session | MXC backend feature |
28+
29+
The June 15 demo proof point is **filesystem policy enforcement**:
30+
- **Positive**: write to the in-policy `share_dir` succeeds; `hello.txt` appears on the host.
31+
- **Negative**: write outside the policy fails with Windows access-denied; driver emits a
32+
`DriverPlatformEvent` denial and the exec exits non-zero.
33+
34+
## Configuration (`[openshell.drivers.mxc]`)
35+
36+
```toml
37+
[openshell.drivers.mxc]
38+
# Path to wxc-exec.exe (required for live runs)
39+
wxc_exec_path = "C:\\path\\to\\wxc-exec.exe"
40+
# MXC configurationId — never use "small" (known OS bug)
41+
default_configuration_id = "composable"
42+
# Agent command executed inside the sandbox
43+
agent_command = ["cmd", "/c", "echo hello > C:\\work\\demo\\hello.txt"]
44+
# Working directory for the agent (defaults to share_dir)
45+
agent_cwd = "C:\\work\\demo"
46+
# Host directory mapped read-write into the sandbox
47+
share_dir = "C:\\work\\demo"
48+
# Enable --debug on wxc-exec invocations
49+
debug = false
50+
```
51+
52+
Or via environment / CLI:
53+
```
54+
OPENSHELL_DRIVERS=mxc openshell-gateway ...
55+
openshell-gateway --drivers mxc ...
56+
```
57+
58+
## Prerequisites (live runs)
59+
60+
- Windows 11 Insider build ≥ 26300.8553
61+
- `IsoSessionApp.dll` present and registered
62+
- `wxc-exec.exe` built with `--features isolation_session`
63+
- Giedrius's policy mapper crate wired as the primary `PolicyMapper` binding
64+
(until then the `StubPolicyMapper` grants only `share_dir` as read-write)
65+
66+
## PolicyMapper seam
67+
68+
Policy translation (`SandboxPolicy` → MXC `ContainerConfig`) is delegated to
69+
Giedrius's Rust mapper crate via the `policy::PolicyMapper` trait. Until that
70+
crate lands, `StubPolicyMapper` applies only the `share_dir` grant and rejects
71+
everything else. **No live agent runs** until the real mapper is wired.
72+
73+
## Deferred work
74+
75+
- **Interactive exec/connect/forward** → `adapt-openshell-gateway-windows`
76+
- **Governed egress / network policy** → `implement-openshell-mxc-egress-proxy`
77+
- **Restart durability** (deprovision orphaned sessions on startup) → follow-on
78+
- **GPU passthrough** → not pursued in host-side-governance design

0 commit comments

Comments
 (0)