feat: Add docker-sbx runtime support to compiler#45006
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
docker-sbx runtime support to compiler
|
Hey
|
There was a problem hiding this comment.
Pull request overview
Adds compiler support for running agents in KVM-isolated Docker sbx microVMs.
Changes:
- Adds runtime validation, schema support, and AWF configuration.
- Generates Docker sbx installation, authentication, and smoke-test steps.
- Routes MCP gateway traffic through
host.docker.internaland adds tests.
Show a summary per file
| File | Description |
|---|---|
.changeset/minor-docker-sbx-runtime-support.md |
Documents the new runtime. |
pkg/parser/schemas/main_workflow_schema.json |
Adds the runtime schema option. |
pkg/workflow/awf_config.go |
Configures microVM network access. |
pkg/workflow/awf_helpers.go |
Adds the AWF sbx runtime argument. |
pkg/workflow/codex_engine.go |
Installs sbx for Codex workflows. |
pkg/workflow/docker_sbx_install.go |
Generates sbx setup steps. |
pkg/workflow/docker_sbx_test.go |
Tests runtime compilation and setup. |
pkg/workflow/firewall.go |
Adds sbx runtime helpers and isolation. |
pkg/workflow/mcp_setup_generator.go |
Routes MCP traffic to the microVM. |
pkg/workflow/nodejs.go |
Installs sbx for npm engines. |
pkg/workflow/sandbox.go |
Defines the new runtime. |
pkg/workflow/sandbox_validation.go |
Validates sudo and runner topology. |
pkg/workflow/strict_mode_sandbox_validation.go |
Exempts required sudo usage. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 13/13 changed files
- Comments generated: 5
- Review effort level: Medium
| if isDockerSbxRuntime(config.WorkflowData) { | ||
| awfArgs = append(awfArgs, "--container-runtime", "sbx") |
| " set -euo pipefail", | ||
| ` echo "::group::Start sbx daemon"`, |
| ` if ! test -w /dev/kvm; then`, | ||
| ` echo "::error::/dev/kvm exists but is not writable. The runner must allow access to /dev/kvm."`, | ||
| ` exit 1`, | ||
| ` fi`, | ||
| ` echo "KVM is available and /dev/kvm is writable ✅"`, |
| ` echo "y" | sbx create shell --name test-sandbox-direct "${GITHUB_WORKSPACE}"`, | ||
| ` sbx exec test-sandbox-direct uname -a`, | ||
| ` sbx stop test-sandbox-direct`, | ||
| ` sbx rm --force test-sandbox-direct`, |
| if isDockerSbxRuntime(workflowData) { | ||
| // docker-sbx: publish to 0.0.0.0 so the microVM can reach the gateway via | ||
| // host.docker.internal (the Docker bridge gateway, 172.17.0.1). | ||
| containerCmd.WriteString(" -p 0.0.0.0:${MCP_GATEWAY_PORT}:${MCP_GATEWAY_PORT}") |
|
@copilot please run the
|
|
@copilot run the pr-finisher skill |
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed in |
|
🎉 This pull request is included in a new release. Release: |
Adds
docker-sbxas asandbox.agent.runtimeoption, running the agent inside a KVM-isolated Docker sbx microVM while infrastructure containers (Squid, api-proxy, MCP gateway) remain on the host via Docker Compose.New frontmatter
Compiler changes
New step generators (
docker_sbx_install.go):lsmod | grep kvm,/dev/kvmwritable)DOCKER_PAT,DOCKER_USERNAMEnon-empty)sudo apt-get install -y docker-sbxenv:block, never inline) + policy reset + image pre-pullsbx create→sbx exec uname -a→sbx rmMCP gateway routing — microVM cannot reach
127.0.0.1; for docker-sbx:0.0.0.0host.docker.internalMCP_GATEWAY_HOST_DOMAIN=host.docker.internalinjected into environmentAWF config:
--container-runtime sbxadded to AWF CLI invocationhost.docker.internaladded tonetwork.allowDomainsnetwork.isolation: truealways forced (regardless ofsudo: true)Compile-time validation — rejects:
runtime: docker-sbx+runner.topology: arc-dind(no nested virt)runtime: docker-sbx+sudo: false(install requires root)Strict mode:
sudo: truedeprecation warning suppressed for docker-sbx (root is a hard requirement, not a choice).Schema
docker-sbxadded to thesandbox.agent.runtimeenum inmain_workflow_schema.json.