Skip to content

Commit 3042d76

Browse files
committed
fix(mxc): repair Windows inference demos
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
1 parent fb2980e commit 3042d76

11 files changed

Lines changed: 974 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/openshell-driver-mxc/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ openshell-policy = { path = "../openshell-policy" }
5858
base64 = { workspace = true }
5959
rustls = { workspace = true }
6060
serde_json = { workspace = true }
61+
# Parse the shipped gateway templates in cross-platform drift guards.
62+
toml = { workspace = true }
6163
# Used by the drift guard test (handled_fields_inventory) to parse YAML into a
6264
# generic serde_json::Value for key enumeration.
6365
serde_yml = { workspace = true }
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
OpenShell MXC Windows inference demos
2+
====================================
3+
4+
These two demos exercise the full gateway -> MXC processContainer path:
5+
6+
Local inference (Hello World)
7+
powershell -NoProfile -ExecutionPolicy Bypass -File .\run-ollama-test.ps1
8+
9+
Cloud inference (T1)
10+
$env:NV_API_KEY = "nvapi-..."
11+
powershell -NoProfile -ExecutionPolicy Bypass -File .\run-inference-test.ps1
12+
13+
Prerequisites
14+
-------------
15+
16+
- Windows 11 build 26300.8553 or newer with MXC processContainer support.
17+
- openshell-gateway.exe and openshell.exe beside these files, or explicit
18+
-GatewayPath and -CliPath arguments.
19+
- wxc-exec.exe beside these files, on PATH, named by
20+
OPENSHELL_WXC_EXEC_PATH, or passed with -WxcExecPath.
21+
- Local demo: an Ollama-compatible service on 127.0.0.1:11434 by default.
22+
Override -OllamaHost, -OllamaPort, and -Model when needed.
23+
- Cloud demo: NV_API_KEY and outbound HTTPS to integrate.api.nvidia.com.
24+
25+
The runners use a unique temporary share directory and an available loopback
26+
gateway port for each run. They never require C:\mxc-kit, C:\work, a fixed
27+
gateway port, or edits to the checked-in templates. Missing prerequisites fail
28+
before sandbox creation with a diagnostic naming the parameter or environment
29+
variable that can supply them.
30+
31+
Security model
32+
--------------
33+
34+
Both demos use the fail-closed process_container backend. Their rendered policy
35+
grants only the per-run share and the one requested endpoint, and no broad
36+
AppContainer network capability is enabled. Cloud traffic traverses OpenShell's
37+
enforcing CONNECT proxy. For local Ollama only, curl bypasses proxy variables
38+
for the requested loopback hostname because the proxy's SSRF defense rejects
39+
all loopback destinations; MXC still limits direct traffic to host loopback. This
40+
inherits the driver's documented limitation that governed MXC sandboxes can
41+
reach other host-loopback ports and must not be treated as loopback-service
42+
isolation. The cloud key is passed with `--env-from NV_API_KEY`, is not placed in
43+
argv or written to the results directory, and is never printed.
44+
45+
Each run leaves a results-* directory containing the rendered TOML and policy,
46+
gateway logs, response artifacts, and summary.txt. The script exits 0 only when
47+
the sandbox creates successfully and the expected inference response is
48+
observed. Use -KeepArtifacts to retain the temporary share for debugging.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Template rendered by run-inference-test.ps1 into its per-run results directory.
5+
version: 1
6+
7+
filesystem_policy:
8+
include_workdir: false
9+
read_only: []
10+
read_write:
11+
- "__OPENSHELL_DEMO_SHARE__"
12+
13+
network_policies:
14+
nvidia_inference:
15+
name: nvidia-inference
16+
endpoints:
17+
- host: integrate.api.nvidia.com
18+
port: 443
19+
protocol: rest
20+
# Chat completions use POST.
21+
access: read-write
22+
enforcement: enforce
23+
binaries:
24+
- path: '__CMD_EXE__'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Gateway template for the cloud-inference (T1) demo. The runner resolves
5+
# wxc-exec and writes a disposable copy. NV_API_KEY is supplied at sandbox
6+
# creation with --env-from and is never stored in this file.
7+
8+
[openshell]
9+
version = 2
10+
11+
[openshell.drivers.mxc]
12+
wxc_exec_path = "wxc-exec.exe"
13+
backend = "process_container"
14+
default_configuration_id = "composable"
15+
pc_least_privilege = false
16+
pc_capabilities = []
17+
egress_proxy = true
18+
egress_proxy_addr = "127.0.0.1:0"
19+
debug = false
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Gateway template for the local-inference demo. run-ollama-test.ps1 resolves
5+
# wxc-exec and writes a disposable copy; workload command, cwd, and environment
6+
# are sandbox-scoped and passed to `openshell sandbox create`.
7+
8+
[openshell]
9+
version = 2
10+
11+
[openshell.drivers.mxc]
12+
wxc_exec_path = "wxc-exec.exe"
13+
backend = "process_container"
14+
default_configuration_id = "composable"
15+
pc_least_privilege = false
16+
pc_capabilities = []
17+
egress_proxy = true
18+
# The address is a seed. The driver reserves a distinct ephemeral port for each
19+
# sandbox, so this does not claim a machine-specific port.
20+
egress_proxy_addr = "127.0.0.1:0"
21+
debug = false
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Template rendered by run-ollama-test.ps1 into its per-run results directory.
5+
version: 1
6+
7+
filesystem_policy:
8+
include_workdir: false
9+
read_only: []
10+
read_write:
11+
- "__OPENSHELL_DEMO_SHARE__"
12+
13+
network_policies:
14+
local_ollama:
15+
name: local-ollama
16+
endpoints:
17+
- host: "__OLLAMA_HOST__"
18+
port: __OLLAMA_PORT__
19+
protocol: rest
20+
# Both /api/tags (GET) and /api/generate (POST) are required.
21+
access: read-write
22+
enforcement: enforce
23+
binaries:
24+
- path: '__CMD_EXE__'

0 commit comments

Comments
 (0)