Skip to content

feat(drivers): launch VM and Podman drivers with serve and Configure - #5914

Open
elezar wants to merge 14 commits into
mainfrom
feat/5385-driver-launch-serve/elezar
Open

elezar wants to merge 14 commits into
mainfrom
feat/5385-driver-launch-serve/elezar

Conversation

@elezar

@elezar elezar commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The gateway launches the VM, Podman, and Docker compute drivers as subprocesses through one contract: a fixed bootstrap command line, the driver's own table on stdin, and gateway metadata in a versioned Configure RPC. This is an alternative to #5838, which writes a startup document instead. It follows the design discussed on #5384, including its answers on settings ownership.

Related Issue

Closes #5385. Related: #5384, #5200. Follow-ups: #5933, #5934.

Changes

The commits are grouped so each group can be reviewed on its own. Every commit builds and passes fmt and clippy.

  1. Prefactors (no behaviour change): ETXTBSY-safe test fixtures; the VM driver's socket and peer checks moved into a module; the managed driver's child held in an enum.
  2. Contract:
    • Deferred OTel export. The deferred layer forwards downcasts, so a span's parent trace context still reaches the exporter. A collector-backed test checks trace and parent span IDs.
    • proto/driver_launch.proto and openshell-driver-launch: GetLaunchInfo and Configure, once only and retryable on failure, with a generic wrapper that answers UNAVAILABLE until configured.
    • openshell-driver-sdk: stdin table reader, start-up exit codes (69, 78) with one JSON line on stdout, staged network-trust loader, telemetry and admission conversion, gateway context.
  3. Launcher and VM: VM serve, preflight and Configure (strict table, environment fallbacks kept); server plumbing (raw driver table, driver_dir, process state, poll_exit); the generic gateway launcher and VM launch. Each launch gets its own socket directory. The exit status decides the result and the JSON line only explains it.
  4. Podman and detection: detection starts the driver with the operator's table and keeps the first one that binds its socket (invalid table or unreachable backend falls through, a crash stops startup); the Podman driver side; Podman launch with its docs and packaging.
  5. Docker: the Docker driver side (both gRPC services deferred until configured); Docker launch replacing the in-process driver, with docs and packaging including the snap.

Settings ownership: the gateway supplies the port and CA through Configure; gateway_port, guest_tls_ca and the admission keys are rejected in driver tables so the drivers stay strict. The gateway owns the admission policy: it validates it, strips it from the forwarded table, and sends it in Configure. driver_dir moves to [openshell.gateway]. The gateway drops a legacy Podman gateway_port with a warning. grpc_endpoint stays an optional override checked by preflight.

Known limits:

  • The driver config structs keep their #[serde(skip)] runtime fields, set in apply_configure, instead of a separate GatewayContext argument.
  • Drivers still apply the admission policy; the gateway only supplies it.
  • Standalone --config is not changed.
  • The proxy_config_preflight test is removed because the drivers validate their own tables. test: add a gateway integration test for launched-driver failures #5934 adds a gateway-level test with a fake driver.

Release Notes

VM, Podman, and Docker sandboxes run through separately launched driver binaries, which the packages install next to the gateway. Existing driver tables keep working, except that gateway_port (Podman) and guest_tls_ca are rejected in driver tables; the gateway drops a legacy gateway_port with a warning. Move driver_dir to [openshell.gateway]; the old location still works with a deprecation warning.

Testing

  • Checks appropriate to the affected code and behavior pass
  • Unit tests added/updated (if applicable)
  • E2E tests added/updated (if applicable)

Run locally: gateway, server, VM, Podman, Docker, SDK, launch, and OTel crate tests (the driver integration tests run the real binaries; Podman and Docker use a fake API socket), workspace clippy for every commit, test-packaging-assets.sh, the Homebrew formula tests, and test-install-sh.sh. Not run: sandbox E2E against real Podman, Docker, or VM; a clean-install smoke test; the new CI jobs and release workflow changes; the macOS and snap packaging in CI; and 7 VM driver tests that need mke2fs, which is not installed on my machine.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@elezar
elezar requested a review from a team as a code owner November 23, 2026 21:55
@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 23, 2026
@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Compatibility review (advisory)

New or updated breaking changes; see the full report for all findings.

1. cli — No explicit risk acceptance found

openshell-gateway --compute-driver podman previously ran in-process but now requires openshell-driver-podman serve, which the gateway image, Snap and Homebrew packages do not install.

2. configuration — No explicit risk acceptance found

[openshell.drivers.podman].gateway_port was always overwritten by the gateway's listening port but now overrides it when explicitly present.

  • Impact: Existing TOML with a stale gateway_port and omitted grpc_endpoint now directs sandbox callbacks to the stale port, preventing sandbox connectivity.
  • Action: Restore the gateway listening port's precedence for v0.1.10 and defer table-first semantics to a permitted train with guidance to remove or synchronize gateway_port.
  • PR: feat(drivers): launch VM and Podman drivers with serve and Configure #5914
Review details
  • Execution: complete
  • Candidate: PR #5914 (b1d9d2e30e37acefc30620d13688c7045c715818)
  • Baseline: ee8457d89bc67c5d5cc16d89c6e57a7a859b43bd (ee8457d89bc67c5d5cc16d89c6e57a7a859b43bd)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

@github-actions

Copy link
Copy Markdown

Compatibility review (advisory)

New or updated breaking changes; see the full report for all findings.

1. configuration — No explicit risk acceptance found

[openshell.drivers.podman].gateway_port was accepted and overwritten with the gateway listening port but is now rejected.

  • Impact: Existing TOML copied from the baseline documentation fails startup and configuration preflight, even when gateway_port matches the listening port.
  • Action: For v0.1.10, accept and discard the legacy gateway_port key before forwarding the table, preserving the gateway listening port's precedence.
  • PR: feat(drivers): launch VM and Podman drivers with serve and Configure #5914

2. configuration — No explicit risk acceptance found

[openshell.drivers.podman].additional_ca_bundle previously worked with automatic driver selection but now reaches the driver parser before legacy-key normalization.

  • Impact: Existing gateways using this supported alias without an explicit driver selector skip reachable Podman and either fail startup or select another backend.
  • Action: Preserve alias support during Podman detection by normalizing a candidate-local configuration before parsing, while leaving inactive driver settings inert.
  • PR: feat(drivers): launch VM and Podman drivers with serve and Configure #5914
Review details
  • Execution: complete
  • Candidate: PR #5914 (1205fdba6a35d7eae3e8d5c207061ebc52275675)
  • Baseline: ee8457d89bc67c5d5cc16d89c6e57a7a859b43bd (ee8457d89bc67c5d5cc16d89c6e57a7a859b43bd)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

@matthewgrossman matthewgrossman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared launcher looks like the right direction for moving the desktop drivers out of core. The follow-up commits address the ownership split and separate startup output from logs. The main remaining concern is preserving existing installs when Podman stops being linked into the gateway.

Can we ship the matching Podman executable through the existing macOS install paths (Homebrew and install.sh) and provision it for mise run gateway:podman and the managed Podman E2E lanes? The Linux deb/RPM/Nix paths stage it, but the branch workflow also has two producers for the same x86-64 Podman artifact. Please clarify the migration for Podman-backed snap installs. Before merge, I’d like to see a clean-install smoke test and real managed VM and Podman E2E, including additional CA coverage; those lanes were skipped on this revision.

normalize_compute_driver_socket_args(args)?;
let compute_driver = compute_drivers
.select(args.compute_driver.as_deref())
.select_with_file(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-detection starts Podman with the raw table before the gateway normalizes additional_ca_bundle. The driver rejects that key, so an existing config can pass preflight but then skip a working Podman backend (or fail startup if there’s no fallback). Can we normalize a copy of the Podman candidate’s config before launching it, without affecting the trust config for other candidates?

let keys: toml::Table =
toml::from_str(table).map_err(|error| format!("invalid podman driver table: {error}"))?;
if let Some(key) = GATEWAY_SUPPLIED_KEYS
.iter()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gateway correctly owns the port now, but the previous docs included gateway_port in the Podman table. main accepted and overwrote it; this now rejects the whole table, even if the value matches the actual listener. Can the gateway warn and strip the legacy key before forwarding the table, without treating it as an override?

Comment thread crates/openshell-gateway/src/podman.rs Outdated
}

/// The private directory for the launched driver's socket.
fn socket_dir() -> PathBuf {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we allocate this socket per launch and tie its lifetime to the child handle? A second startup under the same account can unlink the running driver’s socket before the new child even starts, including when that second startup ultimately fails. This isn’t about supporting multiple gateways; it’s about making sure a launch only configures and cleans up its own child.

status: std::process::ExitStatus,
report: Option<StartReport>,
) -> Result<StartOutcome> {
let kind = report

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stdout is fixed, but the JSON report can still override the exit status, and podman::detect_in maps unexpected launcher errors to Unavailable. Can we use the exit status to classify the result and JSON only to explain it? A crash or timeout shouldn’t silently look like an absent backend and trigger fallback.

tracing: openshell_otel::DeferredDriverTracing,
) -> Result<(), StartResult> {
let settings = read_settings()?;
check_backend(&settings)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An explicitly selected Podman driver now exits on the first failed ping, before reaching the existing bounded retry loop in PodmanComputeDriver::new. That loop handles cases like podman.socket briefly restarting during a package upgrade. Can we preserve that startup tolerance on the new path?


#[tokio::main]
async fn main() -> Result<()> {
if let Some(code) = serve::dispatch().await {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Managed VM launches now bypass the CLI environment fallbacks that applied when the old gateway omitted a flag. An install using OPENSHELL_VM_UPSTREAM_PROXY or OPENSHELL_VM_ROOTFS_TAR_MAX_BYTES can silently lose those settings. Can we preserve those fallbacks for existing installs, or make the config migration explicit instead of ignoring them?

Comment thread crates/openshell-otel/src/driver.rs Outdated
) -> DeferredDriverTracing {
// The span filter stays outside the reloadable slot: a per-layer filter
// inside `reload::Layer` is never registered and panics.
let (export, reload) = tracing_subscriber::reload::Layer::new(None::<ExportLayer>);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can export spans, but reload::Layer doesn’t expose the downcast that OpenTelemetrySpanExt::set_parent needs. The driver RPC layer ignores that error, so launched VM spans can end up in a separate trace from the gateway, unlike before. Can we preserve parent-context propagation and verify it with a real gateway-to-driver RPC and collector capture (same trace ID, correct parent span ID)?

Write each fixture script to a temporary file, close it, and rename it
into place. A script another test's fork still holds open for writing
fails to execute with ETXTBSY.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Move socket preparation, peer authorization by uid and gateway PID, and
the shutdown signal out of main.rs. No behaviour change.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Wrap the managed driver's child process in DriverChild so a later change
can manage a process started another way. No behaviour change.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
A launched driver logs first and starts OTLP export when the gateway
configures it. The deferred layer forwards downcasts to the installed
OpenTelemetry layer, so a span's parent trace context still reaches the
exporter, which a reloadable slot would drop. Export starts once and a
repeat call is a no-op.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Add proto/driver_launch.proto and the openshell-driver-launch crate. A
launched driver serves GetLaunchInfo and Configure and answers UNAVAILABLE
on its other services until Configure succeeds once. Configure carries the
gateway context (including its bind address), network trust, image
overrides, telemetry, and the admission policy the gateway owns.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Add openshell-driver-sdk with the stdin table reader, the start-up exit
codes and stdout report line, the staged network-trust loader, telemetry
and admission conversion from Configure, grpc_endpoint checks, the gateway
context, and a parent-death guard.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Add settings_from_table as the single parse and validation point for the
vm driver table, a serve command that binds the socket and applies
Configure before serving ComputeDriver, and a preflight command. The table
holds only what the operator owns: the gateway port and CA come from
Configure, the admission policy arrives in Configure, and grpc_endpoint is
an optional override checked for syntax and scheme. A setting the table
leaves unset still falls back to the driver's environment variable. The
argv mode keeps working.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
…iver_dir

Let a factory read the selected driver's raw merged table, report whether
a managed driver process is running or has exited on its own
(DriverProcessState and poll_exit), manage a driver started with std,
and read driver_dir from [openshell.gateway].

Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar
elezar force-pushed the feat/5385-driver-launch-serve/elezar branch from 6d8bed5 to 72babe8 Compare November 24, 2026 09:33
@elezar elezar added the test:e2e Requires end-to-end coverage label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

Compatibility review (advisory)

New or updated breaking changes; see the full report for all findings.

1. cli — No explicit risk acceptance found

openshell-gateway --compute-driver docker and --compute-driver podman now require separate driver subprocesses, but gateway images and standalone gateway archives omit those executables.

  • Impact: Existing docker compose up -d deployments and gateway-only Docker/Podman upgrades fail startup or preflight with compute driver binary openshell-driver-&lt;name&gt; not found.
  • Action: For v0.1.10, bundle matching helpers in gateway images and standalone gateway archives, or retain in-process Docker/Podman support.
  • PR: feat(drivers): launch VM and Podman drivers with serve and Configure #5914

2. configuration — No explicit risk acceptance found

[openshell.drivers.vm].driver_dir previously accepted any OS-executable driver, but now rejects binaries owned by another non-root account or writable by group or others.

  • Impact: Existing shared VM driver installations, such as a deployment-account-owned executable used by a different gateway service account, now fail startup and configuration preflight.
  • Action: Preserve existing VM executable eligibility for v0.1.10, or defer the restriction to a permitted minor train with actionable ownership and permission migration guidance.
  • PR: feat(drivers): launch VM and Podman drivers with serve and Configure #5914
Review details
  • Execution: complete
  • Candidate: PR #5914 (0232ef2e4a44b3928fa67d0df17efb4dd68a3209)
  • Baseline: 152c59d3178039e3fbb4a5595f9fff7216a6be92 (152c59d3178039e3fbb4a5595f9fff7216a6be92)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

@elezar
elezar force-pushed the feat/5385-driver-launch-serve/elezar branch from 72babe8 to 3511196 Compare November 24, 2026 10:10
Add a generic subprocess launcher: it resolves and trust-checks the driver
binary, gives each launch its own private socket directory, starts serve
with the table on stdin, reads GetLaunchInfo, sends Configure, and reports
an unexpected exit. The exit status decides the result and the JSON line
only explains it. The VM driver is launched through it, the VM argv
builder and OTLP flags are removed, and config preflight runs the driver's
preflight command. The gateway owns the admission policy and driver_dir:
it strips the admission keys from the forwarded table and reads driver_dir
from [openshell.gateway], warning about the old driver-table location.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
…at starts

Let a registration detect its driver with the operator's merged table
instead of an environment probe. A probe returns whether the driver is
available, unavailable, has an invalid table, or failed outright. The
first available driver's running process is stashed for the factory's
build step, so detection never starts a driver it then stops; an unused
one is stopped when dropped. An invalid table or unreachable backend falls
through to the next candidate, a crash or timeout stops startup, and the
no-driver error lists each candidate's reason. Legacy keys are normalized
in a copy of the configuration for each candidate.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Add settings_from_table as the single parse and validation point for the
podman driver table, a serve command that checks the Podman socket
(honouring socket_path and OPENSHELL_PODMAN_SOCKET) before it binds and
applies Configure before serving ComputeDriver, and a preflight command.
The table holds only what the operator owns: the gateway port, the CA and
the admission policy come from Configure, and grpc_endpoint is an optional
override checked for syntax and scheme. The standalone flags still work.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Launch openshell-driver-podman through the shared launcher and stop
linking it into the gateway. Auto-detection starts the driver with the
operator's table, so a configured socket_path is honoured, and keeps the
first driver that binds its socket. An invalid table or unreachable socket
falls through to the next candidate; a crash stops startup. A named
Podman is started again while its socket is unreachable, as the in-process
driver retried. The gateway drops a legacy gateway_port from the table
with a warning, so the driver can stay strict. config preflight runs the
driver's preflight command.

Ship the driver: build it for both Linux targets and macOS, install it in
/usr/libexec/openshell through the deb, RPM and Nix packages and the
Homebrew formula, publish its release assets, and provision it for the
dev gateway task and the managed Podman E2E lanes.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Add settings_from_table as the single parse and validation point for the
docker driver table, a serve command that checks the Docker socket before
it binds and applies Configure before serving both ComputeDriver and
ComputeDriverConfigurationUpdates, and a preflight command. The table
holds only what the operator owns: the CA and the admission policy come
from Configure, and grpc_endpoint is an optional override checked for
syntax and scheme. The standalone flags still work.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Launch openshell-driver-docker through the shared launcher and stop
linking it into the gateway, replacing the in-process Docker driver. The
driver's ComputeDriverConfigurationUpdates service is served through the
same launched process. Auto-detection starts the driver with the
operator's table and keeps the first one that binds its socket, as for
Podman, and config preflight runs the driver's preflight command. Move the
detect, launch and preflight logic Podman and Docker share into one
module. The gateway keeps checking its own bind port and the admission
policy.

Ship the driver: build it for both Linux targets and macOS, install it in
/usr/libexec/openshell through the deb, RPM and Nix packages, in
libexec/openshell in the snap, and through the Homebrew formula, publish
its release assets, and provision it for the dev gateway task and the
Docker E2E lanes.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar
elezar force-pushed the feat/5385-driver-launch-serve/elezar branch from 3511196 to cf4f426 Compare November 24, 2026 10:15
@github-actions

Copy link
Copy Markdown

Compatibility review (advisory)

New or updated breaking changes; see the full report for all findings.

1. configuration — No explicit risk acceptance found

OPENSHELL_PODMAN_SOCKET previously overrode [openshell.drivers.podman].socket_path, but now the TOML value wins and the environment variable is consulted only during fallback discovery.

Review details
  • Execution: complete
  • Candidate: PR #5914 (868822e467a0abf3ebd0803ee73565f84ca76cfe)
  • Baseline: 152c59d3178039e3fbb4a5595f9fff7216a6be92 (152c59d3178039e3fbb4a5595f9fff7216a6be92)
  • Reviewed: rust-sdk, python-sdk, api-behavior, cli, configuration, policy, helm, state

Advisory review; publication gates are unchanged.

Branch check run

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:accepted A maintainer decided OpenShell should pursue this issue test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: pass launched drivers a versioned startup document

2 participants