feat(compute): revive apple-container driver (rebased, review-clean, e2e on container 1.5) - #3896
Closed
potable-anarchy wants to merge 1 commit into
Closed
potable-anarchy wants to merge 1 commit into
potable-anarchy wants to merge 1 commit into
Conversation
Cherry-pick revival of stale PR NVIDIA#1888 by @shiju-nv against current main, with porting work for the ComputeDriverRegistry refactor and guest-TLS centralization, plus adversarial-review fixes from codex-astra + claude (+ GLM-5.3-flash verification) and e2e validation on Apple Container 1.5: - Port driver to main's ComputeDriverRegistry + AppleContainerFactory in openshell-gateway (feature-gated 'compute-driver-apple-container', macOS-only, explicit-only — never auto-detected). - Drop SupervisorReadiness trait + AlwaysReadySupervisor in favor of main's gateway-owned readiness via ComposedPhase. - Keep openshell-server backend-agnostic (no driver deps). - Revert ComputeDriverKind resurrection (upstream removed in NVIDIA#2823). - Scope host.container.internal SAN to macOS so Linux/Podman installs skip the one-time CA rotation (certgen.rs missing_required_server_sans). - Unify gateway registry test cfg gates (macos + feature aware). - workspace field on DriverSandbox test inits. - Partial-launch cleanup deletes container before volume/staging dirs. - Watch poll loop guards tx.is_closed(). - Fix Apple Container name limit: generated container name uses prefix:name:uuid totaling 64 chars, but Apple's ID cap is 63 (found in e2e on container 1.5.0). E2E validation (macOS 27, Apple Container 1.5.0): openshell-gateway boots clean with compute_driver=apple-container, CLI registers + mTLS authenticates, driver mounts supervisor/TLS/JWT into the guest, container starts. Supervisor exits immediately with `unexpected argument 'sleep' found` from clap; the sandbox enters phase=Error ContainerStopped. This is the documented B1: the supervisor binary no longer accepts the legacy argv. Rebuilding the launch path against main's supervisor/workload split is intentionally out of scope; this commit establishes a buildable, tested base for that follow-up work. Known gaps flagged for followup: - Launch model is the June all-in-one privileged sandbox; needs port to main's supervisor/workload split (see podman/container.rs for the current reference model). - Bounded subprocess/cancellation in cli.rs (container CLI invocations have no timeout / kill_on_drop). - Workspace identifiers woven into container/volume names/labels. - Per-driver config section in docs/how-it-works/gateways/configuration.mdx. - supervisor_bin_dir Linux build instructions live in this crate's README. Co-authored-by: Shiju <shiju@nvidia.com>
|
Thank you for your interest in contributing to OpenShell, @potable-anarchy. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Revives the
apple-containercompute driver originally proposed as #1888 by @shiju-nv, rebased onto currentmainand hardened in response to three adversarial reviews (codex-astra, claude-code, GLM-5.3-flash) and e2e testing on macOS 27 with Apple Container 1.5.0.Marked Draft deliberately: the launch model predates main's supervisor/workload split (see B1 limitation below). The driver compiles, the gateway registers it, sandboxes boot and fail deterministically in the expected place — establishing a tested, review-clean base from which the supervisor/workload port can be done as a follow-up. Opening now for upstream direction.
Related Issues / PRs
What this PR does
Adds an opt-in
apple-containercompute driver for local macOS gateways. The driver shells out to Apple'scontainerCLI, wires theOpenShellsupervisor into Apple Container guests, and keeps the runtime explicit-only so existingkubernetes/podman/dockerauto-detection behavior is unchanged.Porting work to current main since #1888
main'sComputeDriverRegistry/ factory composition model (refactor(compute): decouple gateway driver composition #2823 and successors).AppleContainerFactoryinopenshell-gateway/src/lib.rsregisters"apple-container"(priority 400, no auto-detection,with_local_singleplayer(), telemetry categoryapple-container).require_guest_tls_for_local_driver+apply_guest_tls+context.guest_tls_paths()) rather than the original's per-driver gateway-TLS inheritance.[openshell.drivers.apple-container]) introduced with schema v2.start_sandbox,ensure_workspace,delete_workspace,authenticate_sandbox(unimplemented —supports_sandbox_authentication = false).runtime_identityandfencefields per the currentCreateSandboxResponse/StartSandboxResponseprotos.spec.resource_requirements.gpu.is_some()(thespec.gpubool was removed on main).Review-driven hardening
SupervisorReadinesstrait and its soleAlwaysReadySupervisorimpl. Main'sComposedPhasealready gates Ready on supervisor-session presence driver-side; the additional trait was unreachable dead code.openshell-server's dependency on the driver crate, restoring the backend-agnostic layering documented inopenshell-gateway.ComputeDriverKind(removed upstream in refactor(compute): decouple gateway driver composition #2823); first-party drivers register telemetry categories viaTelemetryComputeDriver::anonymous_category, as does this one.host.container.internalSAN to#[cfg(target_os = "macos")]. Without this guard,certgen::missing_required_server_sanswould trigger a one-time local-CA rotation on every existing install on every OS (Linux/Podman included) the first time the upgraded package boots. This is the largest blast-radius fix in the PR.cfg(all(target_os = "macos", feature = "compute-driver-apple-container"))on every reference (decl, factory, registration, tests).apple-containerin the allowed set on macOS only). Previously broken by the merge.Cargo.lockdeltas are limited to the new crate and its direct path deps (no incidental aws/tokio/landlock churn).container run --detachfailure now deletes the container before deleting its volume and staged credentials.tx.is_closed()each tick so a dropped watcher terminates the spawned task.MAX_CONTAINER_NAME_LENcorrected from 64 → 63. Apple's container ID cap is 63; at 64 the gateway emitted container names that the runtime rejected (found in e2e).B1 limitation (known, intentional, and not hidden)
This driver cannot fully start a working sandbox on current main. The entrypoint it mounts (
openshell-sandbox) no longer accepts the legacysleep infinityargv model that #1888 was written against. Today'sopenshell-sandboxexpectsBoundaryArgs { --bootstrap <path> }and runs capability-probe subcommands next to a separately launched trusted/openshell-supervisor, with the workload innetwork=none. That model is whatopenshell-driver-podman/src/container.rs:1515-1640implements.E2E evidence (macOS 27, container CLI 1.5.0, gateway
0.0.1-dev.1564+g<sha>):openshell-gateway --compute-driver apple-containerboots clean, logsCompute driver connected configured_driver=apple-container advertised_driver=apple-container.openshell gateway add+openshell statusestablish mTLS transport successfully.openshell sandbox create --name ais accepted, the gateway stages volume/JWT/guest-TLS, mountssupervisor_bin_dir, and invokescontainer run --detach … --entrypoint /opt/openshell/bin/openshell-sandbox … debian:bookworm-slim sleep infinity. The Apple Container guest launches.openshell-sandboxexits via clap witherror: unexpected argument 'sleep' found— visible by running the same entrypoint locally on macOS.phase=Error(ContainerStopped: Apple container is stopped) andopenshell sandbox listreports it as such. Not silent, credential-inconsistent, or restart-churning.So the failure surface is exactly what reviewers predicted for the June model being revived onto the post-split supervisor/workload architecture: compile-clean, integration-clean, runtime-blocked.
Why open it anyway
feat(compute): add apple-container driver) matches what we want the merged end-state to be; a Draft PR is the honest way to mark intermediate progress.How to test on a Mac (today)
Follow-up work (post-merge or follow-on PRs)
network=none, the supervisor runs as a separate trusted process with networking, bootstrap via--bootstrap <path>). Reference:openshell-driver-podman/src/container.rs:1515-1640.cli.rs(eachcontainerinvocation has no timeout and nokill_on_drop).DriverSandbox.workspace).[openshell.drivers.apple-container]and a runtimes entry underdocs/how-it-works/sandboxes/runtimes.SupervisorSessionRegistrythroughComputeDriverBuildContextso driver-reported conditions can reflect supervisor-readiness honestly. (Currently the driver reports a constant "running" condition and lets the gateway'sComposedPhasedo the gating, which is consistent with docker's behavior.)Verification done by the author
cargo check --lockedclean on macOS arm64 (aarch64-apple-darwin).cargo test --libgreen acrossopenshell-{core, bootstrap, gateway, server, driver-apple-container}(≥2,534 tests passing, including new registry tests).cargo fmt --checkclean on all touched crates.Co-authored-by: Shiju shiju@nvidia.com