Skip to content

Commit 9ca19e6

Browse files
authored
refactor(compute): decouple gateway driver composition (#2823)
* refactor(compute): decouple gateway driver composition Move first-party composition and VM process ownership into openshell-gateway, leaving openshell-server backend-independent. Update packaging and build references with the new crate, simplify the compiled-driver boundary, and keep the driver-free gateway path buildable with bundled Z3 tooling. Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(telemetry): bound compute driver categories Signed-off-by: Drew Newberry <anewberry@nvidia.com> * refactor(core): keep runtime transport generic Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(compute): complete server driver decoupling Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(compute): preserve driver integrations after rebase Signed-off-by: Drew Newberry <385+drew@users.noreply.github.com> * fix(compute): preserve docker tracing after decoupling Signed-off-by: Drew Newberry <385+drew@users.noreply.github.com> * fix(compute): preserve driver behavior after extraction Signed-off-by: Drew Newberry <anewberry@nvidia.com> * refactor(compute): remove MXC policy side channel Signed-off-by: Drew Newberry <anewberry@nvidia.com> * refactor(compute): separate policy delivery from readiness Signed-off-by: Drew Newberry <anewberry@nvidia.com> --------- Signed-off-by: Drew Newberry <anewberry@nvidia.com> Signed-off-by: Drew Newberry <385+drew@users.noreply.github.com>
1 parent b4afcd8 commit 9ca19e6

83 files changed

Lines changed: 2173 additions & 3327 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/build-openshell-mxc-windows/SKILL.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ crypto dependency builds.
231231
| `windows:build:arm64` | Release-builds `openshell-gateway.exe` and `openshell.exe` for ARM64. |
232232
| `windows:test:x64` | Runs native x64 workspace tests with `--no-fail-fast`, excluding unsupported Windows packages as top-level workspace targets. |
233233
| `windows:test:arm64` | Runs native ARM64 workspace tests with `--no-fail-fast` and the same package exclusions. Rejects non-ARM64 hosts. |
234-
| `windows:test:unsupported:x64` | Re-runs focused `openshell-server` tests for unsupported Windows driver behavior. |
234+
| `windows:test:unsupported:x64` | Re-runs focused `openshell-gateway` tests for unsupported Windows driver behavior. |
235235
| `windows:test:unsupported:arm64` | Re-runs the same focused contracts natively on ARM64. Rejects non-ARM64 hosts. |
236236
| `windows:artifacts` | Reports size and SHA256 for release artifacts that exist. |
237237
| `windows:ci` | Runs the full ordered x64-host Windows CI lane, plus ARM64 check/build when not skipped. |
@@ -248,10 +248,10 @@ Windows must continue to reject unsupported compute drivers clearly.
248248

249249
| Driver | Windows build behavior | Runtime behavior |
250250
|---|---|---|
251-
| Docker | Driver crate excluded; server config contract retained. | Gateway construction returns unsupported. |
252-
| Kubernetes | Driver crate excluded; server config contract retained. | Gateway construction returns unsupported. |
253-
| Podman | Driver crate excluded; server config contract retained. | Gateway construction returns unsupported. |
254-
| VM | Driver crate excluded from workspace validation. | Gateway construction returns unsupported. |
251+
| Docker | Driver crate excluded; gateway registration stub retained. | Gateway construction returns unsupported. |
252+
| Kubernetes | Driver crate excluded; gateway registration stub retained. | Gateway construction returns unsupported. |
253+
| Podman | Driver crate excluded; gateway registration stub retained. | Gateway construction returns unsupported. |
254+
| VM | Driver crate excluded; gateway registration stub retained. | Gateway construction returns unsupported. |
255255

256256
The focused contract tasks for either native architecture run:
257257

‎.agents/skills/build-openshell-mxc-windows/reference.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Windows is a build target only. These runtimes remain unsupported:
8585

8686
Rules:
8787

88-
- Keep config/library stubs where the gateway needs them.
88+
- Keep registration stubs in the gateway composition crate where the gateway needs them.
8989
- Return clear unsupported errors at runtime.
9090
- Do not build standalone Windows driver binaries.
9191
- Do not add Docker Desktop, WSL, Hyper-V, Podman machine, Podman Desktop, or
@@ -180,7 +180,7 @@ blocked dependency.
180180
### Focused tests report many filtered-out tests
181181

182182
This is expected for `windows:test:unsupported:x64`. Cargo runs one named test
183-
and filters the other `openshell-server` tests. Report these as filtered, not
183+
and filters the other `openshell-gateway` tests. Report these as filtered, not
184184
ignored.
185185

186186
## Reporting Counts

‎.agents/skills/debug-openshell-cluster/SKILL.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ The target deployment flow is:
1919
4. The CLI registers a reachable gateway endpoint with `openshell gateway add`.
2020
5. The gateway creates sandboxes through the selected compute driver.
2121

22-
The standard gateway binary explicitly installs its compiled Docker, Podman,
23-
Kubernetes, and VM registrations at startup. With no configured driver, the
22+
The `openshell-gateway` composition crate explicitly installs its compiled
23+
Docker, Podman, Kubernetes, and VM registrations at startup; `openshell-server`
24+
does not link compute-driver crates. With no configured driver, the
2425
gateway probes only installed registrations in priority order (Kubernetes,
2526
Podman, then Docker); VM has no probe and remains opt-in. A custom gateway
2627
binary may install a different set, so confirm the binary's registered drivers

‎.agents/skills/openshell-cli/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ the operation that removes retained state.
384384

385385
This is the most important multi-step workflow. It enables a tight feedback cycle where sandbox policy is refined based on observed activity.
386386

387-
**Key concept**: Policies have static fields (immutable after creation: `filesystem_policy`, `landlock`, `process`) and two dynamic fields: `network_policies` and `network_middlewares`. Both dynamic fields can be updated without recreating the sandbox when the selected compute driver supports live policy updates. MXC rejects live policy replacement and merge updates; delete and recreate an MXC sandbox instead.
387+
**Key concept**: Policies have static fields (immutable after creation: `filesystem_policy`, `landlock`, `process`) and two dynamic fields: `network_policies` and `network_middlewares`. Both dynamic fields can be updated without recreating the sandbox when the selected compute driver supports live policy updates. Drivers without the standard supervisor fetch revisions through the sandbox configuration API and report whether they loaded them.
388388

389389
An endpoint with omitted `protocol` retains explicit-proxy behavior. Explicit
390390
`protocol: tcp` requests policy DNS and transparent TCP and currently requires
@@ -454,7 +454,7 @@ Edit `current-policy.yaml` to allow the blocked actions. **For policy content au
454454
- Binary matching patterns
455455
- Ordered `network_middlewares`, host selection, HTTP and WebSocket bindings, and `fail_open` or `fail_closed` behavior
456456

457-
`network_policies` and `network_middlewares` can be modified at runtime when the selected compute driver supports live policy updates. MXC rejects live policy replacement and merge updates; delete and recreate an MXC sandbox instead. If `filesystem_policy`, `landlock`, or `process` need changes, the sandbox must be recreated. Built-in middleware such as `openshell/regex` needs no gateway registration. An operator-run middleware must already be registered under `[[openshell.supervisor.middleware]]`; changing that static registration requires a gateway restart.
457+
`network_policies` and `network_middlewares` can be modified at runtime when the selected compute driver supports live policy updates. Use `--wait` to verify that the active runtime loaded the revision; do not infer enforcement from the gateway accepting the update. If `filesystem_policy`, `landlock`, or `process` need changes, the sandbox must be recreated. Built-in middleware such as `openshell/regex` needs no gateway registration. An operator-run middleware must already be registered under `[[openshell.supervisor.middleware]]`; changing that static registration requires a gateway restart.
458458

459459
Middleware can inspect parsed HTTP request bodies and complete client-to-upstream WebSocket text messages over both `ws://` and `wss://` when the implementation advertises the matching binding. The built-in `openshell/regex` advertises both bindings and applies its fixed patterns to UTF-8 text. A host-matched HTTP-only attachment can inspect the upgrade GET but does not join the WebSocket chain; look for `binding_not_selected` coverage. Binary messages pass under both `on_error` modes and active stages emit `unsupported_message_type` coverage; upstream-to-client messages remain uninspected. A broken fail-open WebSocket stage is disabled for the rest of that connection; inspect sandbox OCSF logs for `openshell.middleware.websocket_stage_disabled`.
460460

‎.agents/skills/openshell-cli/cli-reference.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ The sandbox name defaults to the last-used sandbox.
417417

418418
### `openshell policy update [name]`
419419

420-
Incrementally merge live network policy changes into the current sandbox policy when the selected compute driver supports live updates. Multiple flags in one invocation are applied as one atomic batch and create at most one new revision. MXC rejects live policy merges; delete and recreate an MXC sandbox instead.
420+
Incrementally merge live network policy changes into the current sandbox policy when the selected compute driver supports live updates. Multiple flags in one invocation are applied as one atomic batch and create at most one new revision. Use `--wait` to verify that the active runtime loaded the new revision.
421421

422422
| Flag | Default | Description |
423423
|------|---------|-------------|
@@ -447,7 +447,7 @@ Notes:
447447

448448
### `openshell policy set [name] --policy <PATH>`
449449

450-
Replace the full policy on a live sandbox when the selected compute driver supports live updates. Only the dynamic `network_policies` field can be changed at runtime. MXC rejects live policy replacement; delete and recreate an MXC sandbox instead.
450+
Replace the full policy on a live sandbox when the selected compute driver supports live updates. Only dynamic policy fields can be changed at runtime. Use `--wait` to verify that the active runtime loaded the new revision.
451451

452452
| Flag | Default | Description |
453453
|------|---------|-------------|

‎.github/workflows/branch-checks.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ jobs:
169169
170170
- name: Verify telemetry can be compiled out
171171
run: |
172-
cargo build -p openshell-server --bin openshell-gateway
172+
cargo build -p openshell-gateway --bin openshell-gateway
173173
tasks/scripts/verify-telemetry-compiled-out.sh present target/debug/openshell-gateway
174-
cargo build -p openshell-server --bin openshell-gateway --no-default-features --features defaults-without-telemetry
174+
cargo build -p openshell-gateway --bin openshell-gateway --no-default-features --features defaults-without-telemetry
175175
tasks/scripts/verify-telemetry-compiled-out.sh absent target/debug/openshell-gateway
176176
cargo build -p openshell-sandbox --bin openshell-sandbox --no-default-features --features defaults-without-telemetry
177177
tasks/scripts/verify-telemetry-compiled-out.sh absent target/debug/openshell-sandbox

‎.github/workflows/branch-e2e.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
interpreter: /lib/ld-linux-aarch64.so.1
167167
uses: ./.github/workflows/build-binaries.yml
168168
with:
169-
package: openshell-server
169+
package: openshell-gateway
170170
binary: openshell-gateway
171171
artifact-name: openshell-gateway-plain-${{ matrix.triple }}
172172
triple: ${{ matrix.triple }}

‎.github/workflows/build-gateway-binaries.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
interpreter: ""
4444
uses: ./.github/workflows/build-binaries.yml
4545
with:
46-
package: openshell-server
46+
package: openshell-gateway
4747
binary: openshell-gateway
4848
triple: ${{ matrix.triple }}
4949
runner: ${{ matrix.runner }}

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ These pipelines connect skills into end-to-end workflows. Individual skill files
4343
| `crates/openshell-otel-test-support/` | OpenTelemetry test support | Shared loopback OTLP collector fixture for tracing tests |
4444
| `crates/openshell-core/` | Shared core | Common types, configuration, error handling |
4545
| `crates/openshell-extension-core/` | Extension core | Shared extension identity, JWT claims, bearer-token rotation, and TLS transport primitives |
46+
| `crates/openshell-gateway/` | Gateway binary composition | Links selected first-party compute drivers into the backend-agnostic server registry |
4647
| `crates/openshell-sdk/` | Shared client SDK | Async Rust gateway client (gRPC transport, TLS, OIDC refresh, edge tunnel); consumed by CLI, TUI, and `@openshell/sdk` |
4748
| `crates/openshell-providers/` | Provider management | Credential provider backends |
4849
| `crates/openshell-tui/` | Terminal UI | Ratatui-based dashboard for monitoring |
@@ -51,6 +52,7 @@ These pipelines connect skills into end-to-end workflows. Individual skill files
5152
| `crates/openshell-driver-db-credstore/` | Database credential driver | In-process `CredentialDriver` backend for gateway database credential storage |
5253
| `crates/openshell-driver-kubernetes/` | Kubernetes compute driver | In-process `ComputeDriver` backend for K8s sandbox pods |
5354
| `crates/openshell-driver-docker/` | Docker compute driver | In-process `ComputeDriver` backend for local Docker sandbox containers |
55+
| `crates/openshell-driver-mxc/` | MXC compute driver | Windows in-process `ComputeDriver` backend for MXC sandbox execution |
5456
| `crates/openshell-driver-podman/` | Podman compute driver | In-process `ComputeDriver` backend for local Podman sandbox containers |
5557
| `crates/openshell-driver-vm/` | VM compute driver | Standalone libkrun-backed `ComputeDriver` subprocess (embeds its own rootfs + runtime) |
5658
| `crates/openshell-prover/` | Policy prover | Policy verification and proof generation |

‎Cargo.lock‎

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

0 commit comments

Comments
 (0)