Skip to content

feat(isolation): implement the RFC 0012 sandbox architecture - #2942

Open
drew wants to merge 48 commits into
mainfrom
codex/1737-rfc12-supervisor-primitives
Open

feat(isolation): implement the RFC 0012 sandbox architecture#2942
drew wants to merge 48 commits into
mainfrom
codex/1737-rfc12-supervisor-primitives

Conversation

@drew

@drew drew commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implement RFC 0012 as one self-contained core change. This PR defines the isolation interface and adds the OpenShell implementation: the Sandbox Protocol, OpenShellRuntimeBackend, and separate openshell-supervisor and openshell-sandbox binaries.

The compute-driver integrations remain in their own stacked PRs so each runtime can demonstrate the same interface without adding driver-specific behavior to the core implementation.

Related Issue

Part of #1737. Implements the architecture accepted in #2048.

Changes

  • Add the openshell-isolation-interface crate and backend conformance tests.
  • Add the authenticated, transport-neutral OpenShell Sandbox Protocol.
  • Add OpenShellRuntimeBackend, the supervisor-side implementation of the isolation interface.
  • Add the openshell-supervisor policy and access process.
  • Add the openshell-sandbox workload runtime with process ownership, binary identity, TCP and DNS mediation, and fail-closed enforcement.
  • Publish separate glibc supervisor and static musl sandbox images.
  • Add the shared Linux, authentication, and packaging primitives required by the runtimes.

Testing

  • Remote CI is the source of truth for the consolidated branch.
  • Driver-specific E2E coverage remains in the following stacked PRs.

Checklist

  • Follows Conventional Commits
  • Authored commits are signed off (DCO)

Stack

  1. feat(isolation): implement the RFC 0012 sandbox architecture #2942 — RFC 0012 core architecture (this PR)
  2. feat(vm): run the supervisor outside the guest workload #2945 — VM driver
  3. feat(docker): isolate workloads behind the host supervisor #2965 — Docker driver
  4. feat(kubernetes): add proxy-pod isolation topology #3144 — Kubernetes proxy-pod driver
  5. feat(podman): isolate workloads behind the host supervisor #3230 — Podman driver
  6. perf(isolation): add TCP and DNS benchmark harnesses #3229 — performance harnesses

#2941 is superseded by the canonical RFC merged in #2048. #3151 was folded into this PR.

@copy-pr-bot

copy-pr-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@copy-pr-bot

copy-pr-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@drew
drew force-pushed the codex/1737-rfc12-supervisor-primitives branch 2 times, most recently from fbcc382 to efba1d8 Compare September 1, 2026 08:06
@drew
drew marked this pull request as ready for review September 3, 2026 01:46
@drew
drew requested review from a team, derekwaynecarr, mrunalp and sjenning as code owners September 3, 2026 01:46
@drew
drew force-pushed the codex/1737-rfc12-supervisor-primitives branch from 00b12d3 to b06e0b1 Compare September 3, 2026 14:34
@drew drew added the test:e2e Requires end-to-end coverage label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Label test:e2e applied for b06e0b1. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@drew
drew force-pushed the codex/1737-rfc12-supervisor-primitives branch from b06e0b1 to 8e95cd7 Compare September 5, 2026 16:08
@drew

drew commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test

3 similar comments
@drew

drew commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test

@drew

drew commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test

@drew

drew commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test

@drew
drew force-pushed the codex/1737-rfc12-supervisor-primitives branch from e4cc065 to 62a943a Compare September 8, 2026 22:32
drew added 25 commits September 11, 2026 15:12
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
@drew
drew force-pushed the codex/1737-rfc12-supervisor-primitives branch from 57e7b2d to 9b00cb6 Compare September 11, 2026 22:13
Comment thread .github/workflows/build-sandbox-binaries.yml Fixed
Comment thread .github/workflows/build-sandbox-binaries.yml Fixed
Signed-off-by: Drew Newberry <anewberry@nvidia.com>

@johntmyers johntmyers left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

The RFC 0012 core is project-valid and its stacked interface is coherent across the VM, Docker, Kubernetes, Podman, and performance layers, but four concrete obligations remain in the core patch: authentication continuity across gateway replacement, lifecycle rollback preserving active authentication, PID 1 orphan reaping, and synchronization of the shipped runtime split with repository/operator guidance.

Action required: @drew, please address the four blocking findings and push an updated head for a focused follow-up review.

Blocking findings:

  • GATOR-07441545-01: preserve refreshable launch authentication across a gateway restart or supported replica routing.
  • GATOR-07441545-02: do not revoke an active launch when stop/delete rolls back to Ready.
  • GATOR-07441545-03: restore managed-child-aware orphan reaping when openshell-sandbox is PID 1.
  • GATOR-07441545-04: synchronize the new crates and split runtime artifacts with agent/operator workflows.

Carried findings:

  • None

Non-blocking suggestions:

  • None
Gator metadata
  • Validation: Maintainer-authored implementation of accepted RFC 0012 (#2048) for issue #1737; this review is limited to PR #2942 while checking compatibility with its five downstream stack layers.
  • Docs: Architecture documents are updated; driver-specific Fern UX documentation remains owned by the downstream integration layers, while the core runtime split still needs the workflow/skill synchronization in GATOR-07441545-04.
  • Checks: Current-head Branch Checks and Trivy Changes are failing; Helm Lint and DCO pass. Pipeline handoff is not active while review findings remain.
  • E2E: test:e2e is present and the current-head OpenShell / E2E gate is green; no label, /ok to test, or rerun action is needed this cycle.
  • Head SHA: 07441545bab1241ba359eda5154236fbf775adfb
  • Base SHA: 5b57f0d1549677c7547862d26ff9491285ea0fbc
  • Merge base SHA: 5b57f0d1549677c7547862d26ff9491285ea0fbc
  • Patch ID: 7e44fa1b2153c53661068195adc76311e8448d3c
  • Gator payload: 8
  • Review mode: initial
  • Previous reviewed SHA: none
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:in-review

@@ -423,6 +429,10 @@ impl ServerState {
middleware_registry: Arc::new(MiddlewareRegistry::default()),
oidc_cache,
sandbox_jwt_issuer: None,
sandbox_session_jwt_authority: None,
sandbox_auth_sessions: Arc::new(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

Warning — GATOR-07441545-01 · Gateway replacement strands live authentication

Summary: A live externally managed sandbox can survive a gateway restart, but the replacement gateway creates an empty in-memory session registry. Its supervisor’s still-valid refresh request is then rejected as inactive; when the launch tokens expire, the protected channel closes and the healthy workload freezes and is eventually terminated.

Fix: Persist or reconstruct the active session identity, credential epoch, current token identity, and retry-idempotence state so single-gateway restart—and supported replica routing—preserves refresh and revocation semantics. Add a two-ServerState restart regression test over one durable store.

Verify: Create a sandbox, retain its durable row and valid gateway token, replace ServerState, then refresh through the new state. It must rotate credentials successfully rather than return sandbox session is not active.

Agent context
  • Ownership: This PR makes the new process-local registry authoritative for refresh; the base refresh path had no volatile launch-state dependency.
  • Location: crates/openshell-server/src/lib.rs:433

@@ -1374,6 +1400,8 @@ async fn handle_stop_sandbox_inner(
let workspace = super::workspace::resolve_workspace(state.store.as_ref(), &authz.workspace)
.await?
.name;
let current = sandbox_by_name(state, &workspace, &req.name).await?;
state.sandbox_auth_sessions.deactivate(current.object_id());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

Warning — GATOR-07441545-02 · Failed lifecycle calls revoke a still-running sandbox

Summary: If an operator stops or deletes a sandbox and the driver returns an ambiguous/transient error, compute recovery can restore the sandbox to Ready. This line has already deactivated its authentication, however, so the surviving supervisor’s next refresh fails; expiry then disconnects and terminates a workload the API says remains ready. Delete has the same ordering defect.

Fix: Couple deactivation to the durable lifecycle outcome. Preserve or restore the exact prior active session when recovery returns to Ready, and revoke it only after stop, deletion, or an unresolved terminal transition is committed. Cover stop and delete rollback paths.

Verify: Make a fake driver fail stop/delete while its later snapshot remains running. After phase recovery returns Ready, refreshing with the current token must still succeed.

Agent context
  • Sibling site: crates/openshell-server/src/grpc/sandbox.rs:1354
  • Location: crates/openshell-server/src/grpc/sandbox.rs:1404

let bytes = std::fs::read(config_path)
.map_err(|error| format!("read boundary config {}: {error}", config_path.display()))?;
let config: BoundaryConfig = serde_json::from_slice(&bytes).map_err(|error| {
format!("decode boundary config {}: {error}", config_path.display())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

Warning — GATOR-07441545-03 · The replacement PID 1 runtime does not reap orphans

Summary: Ordinary sandboxed code can double-fork background children. When openshell-sandbox is PID 1, exited descendants are adopted by it, but this replacement startup has no SIGCHLD orphan-reaping loop. Zombies can accumulate to the namespace/cgroup PID limit and prevent later fork or exec operations.

Fix: Move the prior managed-child-aware SIGCHLD reaper into boundary startup. Coordinate it with the existing managed-child registry so it reaps only orphan descendants and cannot steal statuses from explicit process waiters. Add a PID-namespace regression test.

Verify: Run the boundary as PID 1, repeatedly double-fork short-lived children, and confirm no adopted zombies remain; simultaneously retain a managed direct child and confirm its explicit waiter receives the correct status.

Agent context
  • Ownership: This PR removes the prior runtime containing the reaper and adds this replacement boundary startup without moving that responsibility.
  • Location: crates/openshell-sandbox/src/boundary_server.rs:119

# SPDX-License-Identifier: Apache-2.0

[package]
name = "openshell-supervisor"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

Warning — GATOR-07441545-04 · Runtime split leaves operational guidance materially stale

Summary: Contributors and operators following repository guidance do not see four new security-sensitive crates, while troubleshooting and release skills still describe the old combined supervisor image—for example, expecting /openshell-sandbox inside it—and omit the separately shipped sandbox artifact. That makes the published operational workflow false for this PR’s topology.

Fix: Add openshell-binary-identity, openshell-isolation-interface, openshell-sandbox-backend, and openshell-supervisor to the architecture inventory. Update debug-openshell-cluster, helm-dev-environment, test-release-canary, and sbom to distinguish and inventory the sandbox and supervisor artifacts, then run the sync-agent-infra checklist.

Verify: Compare crates/* with the architecture table and search the mapped skills for image inventories and /openshell-sandbox; every new crate and separately published image must be represented without the obsolete combined-image diagnostic.

Agent context
  • Location: crates/openshell-supervisor/Cargo.toml:5
  • Sibling sites: skills/debug-openshell-cluster/SKILL.md:216, .agents/skills/helm-dev-environment/SKILL.md:82, .agents/skills/test-release-canary/SKILL.md:95, .agents/skills/sbom/SKILL.md:18

@johntmyers johntmyers added the gator:in-review Gator is reviewing or awaiting PR review feedback label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:in-review Gator is reviewing or awaiting PR review feedback test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants