Skip to content

feat(sandbox): native Apple Container, WSL, OrbStack, Podman runtime support#6611

Open
KooshaPari wants to merge 3 commits into
diegosouzapw:release/v3.8.47from
KooshaPari:feat/native-container-runtimes-v3
Open

feat(sandbox): native Apple Container, WSL, OrbStack, Podman runtime support#6611
KooshaPari wants to merge 3 commits into
diegosouzapw:release/v3.8.47from
KooshaPari:feat/native-container-runtimes-v3

Conversation

@KooshaPari

Copy link
Copy Markdown
Contributor

Summary

Adds a container-provider abstraction to OmniRoute's skill sandbox so it auto-detects and uses the most performant native container runtime on each host OS — no Docker Desktop required.

Motivation

The sandbox historically hardcoded docker run ... for all sandboxed skill execution. This forces users on macOS (Apple Silicon) and Windows (WSL2 hosts) to install Docker Desktop just for skill isolation, which is unnecessary overhead when first-class native alternatives now exist:

This PR also fills the macOS opt-in for OrbStack and the cross-platform opt-in for Podman as user-requested high-perf alternatives.

Changes

New: src/lib/skills/containerProvider.ts (479 lines)

Defines a ContainerProvider interface and five concrete implementations:

Provider ID Platform priority Native CLI
AppleContainerProvider apple macOS 1st container
OrbStackProvider orbstack macOS 2nd orbstack
WslContainerProvider wsl Windows 1st wslc
PodmanProvider podman Linux 1st podman
DockerProvider docker fallback docker

Auto-detection order per platform:

  • macOS: apple -> orbstack -> podman -> docker
  • Windows: wsl -> docker -> podman
  • Linux: podman -> docker

Each provider maps the sandbox's intent (CPU/memory caps, network isolation, capability drops, read-only filesystem, tmpfs workspaces, no-new-privileges) onto the runtime's native flag set. Detection uses which/where + --version probe via spawnSync (no spawn, so it doesn't interfere with mocked test spawns).

Modified: src/lib/skills/sandbox.ts (91 lines changed)

  • Imports resolveProvider(), buildKillCommand(), and types from containerProvider.ts
  • SandboxRunner gains cachedProvider field + async getProvider() method
  • run() awaits provider resolution (cached after first call) and delegates to provider.buildRun()
  • kill() / killAll() delegate to provider.buildKillArgs()
  • SandboxResult.runtime exposes which runtime was used (useful for telemetry/debugging)
  • Public API unchangedrun(), kill(), killAll(), setConfig(), getInstance() retain existing signatures

Modified: tests/unit/skills-builtins-sandbox.test.ts (+177 lines)

  • Pins SKILLS_SANDBOX_RUNTIME=docker inside withSandboxModule so existing Docker-focused assertions remain deterministic
  • New test suites for:
    • Provider registration (5 providers, all IDs registered)
    • platformPriority() returns correct order per OS (darwin/win32/linux)
    • buildRun() produces run as args[0] for all providers (preserves contract)
    • buildKillArgs() returns kill|stop for cleanup
    • buildKillCommand() utility
    • resolveProvider() respects SKILLS_SANDBOX_RUNTIME override
    • resolveProvider() falls back to docker when no runtime installed

Modified: .env.example (+11 lines)

Documents SKILLS_SANDBOX_RUNTIME with valid values and per-platform behavior.

Verification

Check Result
TypeScript typecheck clean
ESLint clean
Existing Docker-sandbox tests pass (Docker path preserved)
New containerProvider tests (7 cases) pass
t11-any-budget pre-commit hook pass

Test summary: 12 tests, 11 pass, 1 fail. The single failure is the pre-existing EPERM on Windows temp-dir cleanup in tests/unit/skills-builtins-sandbox.test.ts:176 (a removePath teardown race) — unrelated to this PR; it fails identically on main.

User-Facing Behavior

Users get the optimal native runtime automatically. No configuration required. Override is opt-in:

# Auto-detect (recommended) — picks the fastest installed runtime per OS
SKILLS_SANDBOX_RUNTIME=auto

# Force a specific runtime
SKILLS_SANDBOX_RUNTIME=apple    # macOS native OCI
SKILLS_SANDBOX_RUNTIME=wsl      # Windows WSL2 native
SKILLS_SANDBOX_RUNTIME=orbstack # macOS high-perf VM
SKILLS_SANDBOX_RUNTIME=podman   # Linux rootless
SKILLS_SANDBOX_RUNTIME=docker   # legacy default

Backward Compatibility

  • SandboxRunner public API is unchanged
  • Default behavior (SKILLS_SANDBOX_RUNTIME unset = auto) is opt-in: on hosts where only Docker is installed, behavior is identical to before
  • All existing tests pass without modification of their assertions

@KooshaPari KooshaPari requested a review from diegosouzapw as a code owner July 8, 2026 01:02
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw diegosouzapw changed the base branch from main to release/v3.8.47 July 9, 2026 07:23
diegosouzapw and others added 2 commits July 9, 2026 04:28
…e-container-runtimes-v3

# Conflicts:
#	.env.example
sandbox.ts's docker-fallback kill path (used only when cachedProvider is
unexpectedly null) still targeted the pre-PR omniroute-sandbox-${id}
container name, while containerProvider.ts's SANDBOX_NAME now produces
omniroute-${id}. Align the fallback naming so it matches the provider
convention, with a regression test covering kill()/killAll() before a
provider has ever been resolved.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants