Repository navigation
Conversation
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. cli — No explicit risk acceptance foundopenshell-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.
Review details
Advisory review; publication gates are unchanged. |
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. configuration — No explicit risk acceptance found
2. configuration — No explicit risk acceptance found
Review details
Advisory review; publication gates are unchanged. |
matthewgrossman
left a comment
There was a problem hiding this comment.
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.
| tracing: openshell_otel::DeferredDriverTracing, | ||
| ) -> Result<(), StartResult> { | ||
| let settings = read_settings()?; | ||
| check_backend(&settings) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Fixed. An explicitly selected Podman is started again while its backend is unavailable: 6 attempts, 2 s apart (launch_tolerating_unavailable), which covers podman.socket restarting during a package upgrade. Auto-detection does not retry, because an absent backend there should fall through to the next candidate. An invalid table or a crash is final.
There was a problem hiding this comment.
The retry loop handles Podman returning Unavailable. There's still a timeout gap. Podman's first ping can wait 60 seconds, but the launcher kills the child after 30. A daemon that answers in 35 seconds used to work. Now the gateway aborts before it can retry an explicitly selected Podman driver or try Docker in auto mode. Can we give the startup ping a shorter deadline and return Unavailable when it expires?
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<()> { | ||
| if let Some(code) = serve::dispatch().await { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Fixed. The VM driver's table settings fall back to the same environment variables when the table leaves them unset (VmSettings::apply_environment), including OPENSHELL_VM_UPSTREAM_PROXY and OPENSHELL_VM_ROOTFS_TAR_MAX_BYTES, so existing installs keep them. Covered by unset_settings_fall_back_to_the_environment.
There was a problem hiding this comment.
One edge case remains in the VM env fallback. An existing service can set OPENSHELL_VM_UPSTREAM_PROXY_AUTH_ALLOW_INSECURE=false without an auth file. The old VM startup treated that as unset. The new parser stores Some(false), so preflight and startup reject it. OPENSHELL_VM_UPSTREAM_PROXY_CONNECT_BY_HOSTNAME=false has the same issue when no proxy is configured. Can we keep the old behavior for env values and preserve explicit false in TOML?
| ) -> 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>); |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
Partly done. reload::Layer is replaced by a deferred layer that forwards downcast_raw, so set_parent reaches the OpenTelemetry layer. crates/openshell-otel/tests/deferred_driver_tracing.rs exports a span through the deferred layer to a collector and checks the trace ID and the parent span ID. I have not captured a real gateway-to-driver RPC end to end, so I'm leaving this thread open for that check.
6d8bed5 to
72babe8
Compare
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. cli — No explicit risk acceptance found
2. configuration — No explicit risk acceptance found
Review details
Advisory review; publication gates are unchanged. |
3511196 to
cf4f426
Compare
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. configuration — No explicit risk acceptance foundOPENSHELL_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
Advisory review; publication gates are unchanged. |
a974462 to
7a62274
Compare
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
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 <[email protected]>
7a62274 to
e5ae9cd
Compare
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
The gateway launches these drivers as subprocesses, so an image that runs the Docker or Podman driver needs their binaries. Stage them beside the gateway, install them under /usr/libexec/openshell, one of the directories the gateway searches, and build them in the image workflow and the local image tasks. Signed-off-by: Evan Lezar <[email protected]>
e5ae9cd to
c23213a
Compare
|
On:
This is not the case. The podman driver still respects the |
| .add_service(launch.into_server()) | ||
| .add_service(compute) | ||
| .add_service(configuration_updates) | ||
| .serve_with_incoming_shutdown( |
There was a problem hiding this comment.
A normal systemctl --user stop sends SIGTERM to both the gateway and its driver. The driver can stop accepting RPCs before the gateway sends StopSandbox, leaving Docker or Podman sandboxes running after the service stops. Can we have the gateway finish sandbox cleanup before the driver starts shutting down?
There was a problem hiding this comment.
Just as a note: This was already an issue with the VM on main, but I don't think we want to extend this behaviour to Docker and Podman with thsi PR.
To address this, I'm going to add a Shutdown RPC to the DriverLaunch service. This should allow a launched driver to stop only when the gateway releases it, not when an outside signal arrives. This includes signals sent by systemd and other mechanisms such as Ctrl-C in a terminal.
| protocol_version: PROTOCOL_VERSION, | ||
| ..configure | ||
| }); | ||
| request.set_timeout(CONFIGURE_TIMEOUT); |
There was a problem hiding this comment.
The two-minute Configure timeout now includes pulling the supervisor and sandbox runtime images one after the other. On a fresh install, both pulls can be working normally and still take more than two minutes combined. The old startup path had no shared deadline around those pulls. Can we give image preparation its own time budget?
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<()> { | ||
| if let Some(code) = serve::dispatch().await { |
There was a problem hiding this comment.
One edge case remains in the VM env fallback. An existing service can set OPENSHELL_VM_UPSTREAM_PROXY_AUTH_ALLOW_INSECURE=false without an auth file. The old VM startup treated that as unset. The new parser stores Some(false), so preflight and startup reject it. OPENSHELL_VM_UPSTREAM_PROXY_CONNECT_BY_HOSTNAME=false has the same issue when no proxy is configured. Can we keep the old behavior for env values and preserve explicit false in TOML?
| dirs | ||
| } | ||
|
|
||
| pub fn driver_search_dirs(driver_dir: Option<&Path>) -> Vec<PathBuf> { |
There was a problem hiding this comment.
The migration docs say to move driver_dir into [openshell.gateway] and say the standard install directories are still searched. If I move a VM-only directory there, lookup skips /usr/libexec/openshell and can miss an installed Docker or Podman driver. Can we search the custom directory first, then fall back to the standard paths when the requested binary is absent?
| let socket = prepare_socket(request.socket_dir)?; | ||
| let stdin = table_stdin(request.table) | ||
| .map_err(|error| Error::execution(format!("failed to stage the driver table: {error}")))?; | ||
| let mut command = std::process::Command::new(request.binary); |
There was a problem hiding this comment.
Both serve and preflight inherit the gateway's environment. When trace headers come from OTEL_EXPORTER_OTLP_TRACES_HEADERS or OTEL_EXPORTER_OTLP_HEADERS, the child still gets those credentials through its environment. Preflight never needs them. Can we remove both variables from the child commands and send the resolved headers to serve through Configure?
| tracing: openshell_otel::DeferredDriverTracing, | ||
| ) -> Result<(), StartResult> { | ||
| let settings = read_settings()?; | ||
| check_backend(&settings) |
There was a problem hiding this comment.
The retry loop handles Podman returning Unavailable. There's still a timeout gap. Podman's first ping can wait 60 seconds, but the launcher kills the child after 30. A daemon that answers in 35 seconds used to work. Now the gateway aborts before it can retry an explicitly selected Podman driver or try Docker in auto mode. Can we give the startup ping a shorter deadline and return Unavailable when it expires?
| resolved.display() | ||
| )) | ||
| })?; | ||
| if metadata.permissions().mode() & 0o022 != 0 { |
There was a problem hiding this comment.
This rejects locally built drivers under umask 0002, a common Linux desktop default
Could the dev scripts chmod go-w the drivers after building?
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
ConfigureRPC. 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, #5935 (socket paths that exceed the Unix limit), #5936 (driver binary trust), #5940 (non-blocking detection), #5941 (gateway-level, typed admission).
Changes
The commits are grouped so each group can be reviewed on its own.
proto/driver_launch.protoandopenshell-driver-launch:GetLaunchInfoandConfigure, once only and retryable on failure, with a generic wrapper that answersUNAVAILABLEuntil 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, and a parent guard that stops a driver when its gateway is gone (by PID, and by a changed parent when the gateway started it directly).serve,preflightandConfigure(strict table, environment fallbacks kept, includingbootstrap_extraction_max_bytesfrom fix(vm): bound OCI bootstrap image extraction #5943); server plumbing (raw driver table,driver_dir, process state,poll_exit); the generic gateway launcher and VM launch. Each launch gets its own private socket directory, and the exit status decides the result while the JSON line only explains it. The driver is spawned from one long-lived thread, because a driver may arm a parent-death signal that Linux ties to the spawning thread, and a Tokio blocking-pool thread exits after ten idle seconds.openshell-driver-dockerandopenshell-driver-podmanunder/usr/libexec/openshell, because the container deployment docs run the gateway with those drivers.Settings ownership: the gateway supplies the port and CA through
Configure;gateway_port,guest_tls_caand the admission keys are rejected in driver tables so the drivers stay strict. The gateway already read the admission keys from every driver table onmainand gave the VM its policy as--admission-config-json; it now sends the same JSON inConfigureasresource_admission_policy_json(the valueGetCapabilitiesreports, without itsv1:prefix) and strips the keys from the forwarded table.driver_dirmoves to[openshell.gateway]. The gateway drops a legacy Podmangateway_portwith a warning.grpc_endpointstays an optional override checked bypreflight.Sockets: Docker and Podman launch from
<state>/openshell/run/<driver>/<random>/driver.sock; the VM driver keeps its own<state_dir>/run.Driver binaries: the gateway runs a driver binary only if group and others cannot write to it. It does not check the owner.
mainhad no check; an owner check broke packaged installs, because the packaged unit setsPrivateTmp=true, which runs the gateway in a user namespace where root-owned files appear as another uid. Tracked in #5936.Builds: the drivers use the same
*-unknown-linux-gnutargets, toolchain and glibc floor as the gateway. Nothing about how they are built changes; Docker and Podman are now separate artifacts instead of being compiled into the gateway.Known limits:
#[serde(skip)]runtime fields, set inapply_configure, instead of a separateGatewayContextargument.Box<dyn Any>; a typed handoff would be clearer but is a larger refactor.--configis not changed.proxy_config_preflighttest 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 and the gateway image install next to the gateway. Existing driver tables keep working, except that
gateway_port(Podman) andguest_tls_caare rejected in driver tables; the gateway drops a legacygateway_portwith a warning. Movedriver_dirto[openshell.gateway]; the old location still works with a deprecation warning. A driver binary must not be writable by group or others.Testing
Run locally: gateway, server, VM, Podman, Docker, SDK, launch, core socket and OTel crate tests (the driver integration tests run the real binaries; Podman and Docker use a fake API socket), workspace fmt and clippy on the tip,
test-packaging-assets.sh, the Homebrew formula tests, andtest-install-sh.sh. The full conformance family (77 tests) passes against the Docker driver in a tmachine VM with the packaged gateway (ubuntu-docker-rootful,deb).CI: on an earlier head of this branch (
a974462), Branch E2E Checks passed in full, including the VM, Podman and Docker lanes, after the VM lanes failed on a bug that is fixed here. Its one failing job wasRust PostgreSQL tests, which failed while preparing the Nix shell. CI is running on the current head.Not verified: the release workflow changes (
release-devandrelease-publishdo not run on pull requests), the snap build, the Homebrew formula andinstall.shagainst real release assets, a clean-install smoke test, and the Podman conformance family run locally.Checklist