feat(sandbox): native Apple Container, WSL, OrbStack, Podman runtime support#6611
Open
KooshaPari wants to merge 3 commits into
Open
feat(sandbox): native Apple Container, WSL, OrbStack, Podman runtime support#6611KooshaPari wants to merge 3 commits into
KooshaPari wants to merge 3 commits into
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…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>
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
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:wslc.exe) — Windows-native container CLI via WSL 2 (https://learn.microsoft.com/en-us/windows/wsl/wsl-container?tabs=csharp)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
ContainerProviderinterface and five concrete implementations:AppleContainerProviderapplecontainerOrbStackProviderorbstackorbstackWslContainerProviderwslwslcPodmanProviderpodmanpodmanDockerProviderdockerdockerAuto-detection order per platform:
apple->orbstack->podman->dockerwsl->docker->podmanpodman->dockerEach 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+--versionprobe viaspawnSync(no spawn, so it doesn't interfere with mocked test spawns).Modified:
src/lib/skills/sandbox.ts(91 lines changed)resolveProvider(),buildKillCommand(), and types fromcontainerProvider.tsSandboxRunnergainscachedProviderfield + asyncgetProvider()methodrun()awaits provider resolution (cached after first call) and delegates toprovider.buildRun()kill()/killAll()delegate toprovider.buildKillArgs()SandboxResult.runtimeexposes which runtime was used (useful for telemetry/debugging)run(),kill(),killAll(),setConfig(),getInstance()retain existing signaturesModified:
tests/unit/skills-builtins-sandbox.test.ts(+177 lines)SKILLS_SANDBOX_RUNTIME=dockerinsidewithSandboxModuleso existing Docker-focused assertions remain deterministicplatformPriority()returns correct order per OS (darwin/win32/linux)buildRun()producesrunasargs[0]for all providers (preserves contract)buildKillArgs()returnskill|stopfor cleanupbuildKillCommand()utilityresolveProvider()respectsSKILLS_SANDBOX_RUNTIMEoverrideresolveProvider()falls back to docker when no runtime installedModified:
.env.example(+11 lines)Documents
SKILLS_SANDBOX_RUNTIMEwith valid values and per-platform behavior.Verification
t11-any-budgetpre-commit hookTest summary: 12 tests, 11 pass, 1 fail. The single failure is the pre-existing
EPERMon Windows temp-dir cleanup intests/unit/skills-builtins-sandbox.test.ts:176(aremovePathteardown race) — unrelated to this PR; it fails identically onmain.User-Facing Behavior
Users get the optimal native runtime automatically. No configuration required. Override is opt-in:
Backward Compatibility
SandboxRunnerpublic API is unchangedSKILLS_SANDBOX_RUNTIMEunset =auto) is opt-in: on hosts where only Docker is installed, behavior is identical to before