Skip to content

feat: Add docker-sbx runtime support to compiler - #45006

Merged
lpcox merged 5 commits into
mainfrom
copilot/feat-add-docker-sbx-runtime-support
Jul 12, 2026
Merged

feat: Add docker-sbx runtime support to compiler#45006
lpcox merged 5 commits into
mainfrom
copilot/feat-add-docker-sbx-runtime-support

Conversation

CopilotAI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Adds docker-sbx as a sandbox.agent.runtime option, 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

sandbox:
agent:
id: awfruntime: docker-sbxsudo: true # required

Compiler changes

New step generators (docker_sbx_install.go):

  • KVM availability fail-fast (lsmod | grep kvm, /dev/kvm writable)
  • Docker secrets fail-fast (DOCKER_PAT, DOCKER_USERNAME non-empty)
  • sbx install via Docker apt repo + sudo apt-get install -y docker-sbx
  • Daemon startup + Docker Hub auth (secrets via env: block, never inline) + policy reset + image pre-pull
  • Pre-flight smoke test: sbx createsbx exec uname -asbx rm

MCP gateway routing — microVM cannot reach 127.0.0.1; for docker-sbx:

  • Port binding changed to 0.0.0.0
  • Gateway domain set to host.docker.internal
  • MCP_GATEWAY_HOST_DOMAIN=host.docker.internal injected into environment

AWF config:

  • --container-runtime sbx added to AWF CLI invocation
  • host.docker.internal added to network.allowDomains
  • network.isolation: true always forced (regardless of sudo: 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: true deprecation warning suppressed for docker-sbx (root is a hard requirement, not a choice).

Schema

docker-sbx added to the sandbox.agent.runtime enum in main_workflow_schema.json.

CopilotAI linked an issue Jul 11, 2026 that may be closed by this pull request
13 tasks
CopilotAIand others added 2 commits July 11, 2026 20:26
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
CopilotAI changed the title [WIP] Add docker-sbx runtime support to compilerfeat: Add docker-sbx runtime support to compilerJul 11, 2026
CopilotAI requested a review from lpcoxJuly 11, 2026 20:33
@github-actions

Copy link
Copy Markdown
Contributor

Hey @copilot-swe-agent 👋 — great work adding docker-sbx as a sandbox.agent.runtime option! The implementation looks well-scoped, covering the new step generators, schema update, validation logic, and a dedicated test file (docker_sbx_test.go). This is exactly the kind of focused, agentic contribution the project is built around. The PR looks ready for review! 🚀

Generated by ✅ Contribution Check · 97 AIC · ⌖ 12.9 AIC · ⊞ 6.2K ·

@lpcox
lpcox marked this pull request as ready for review July 11, 2026 23:27
CopilotAI review requested due to automatic review settings July 11, 2026 23:27

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.internal and adds tests.
Show a summary per file
FileDescription
.changeset/minor-docker-sbx-runtime-support.mdDocuments the new runtime.
pkg/parser/schemas/main_workflow_schema.jsonAdds the runtime schema option.
pkg/workflow/awf_config.goConfigures microVM network access.
pkg/workflow/awf_helpers.goAdds the AWF sbx runtime argument.
pkg/workflow/codex_engine.goInstalls sbx for Codex workflows.
pkg/workflow/docker_sbx_install.goGenerates sbx setup steps.
pkg/workflow/docker_sbx_test.goTests runtime compilation and setup.
pkg/workflow/firewall.goAdds sbx runtime helpers and isolation.
pkg/workflow/mcp_setup_generator.goRoutes MCP traffic to the microVM.
pkg/workflow/nodejs.goInstalls sbx for npm engines.
pkg/workflow/sandbox.goDefines the new runtime.
pkg/workflow/sandbox_validation.goValidates sudo and runner topology.
pkg/workflow/strict_mode_sandbox_validation.goExempts 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

Comment threadpkg/workflow/awf_helpers.go Outdated
Comment on lines +617 to +618
if isDockerSbxRuntime(config.WorkflowData) {
awfArgs = append(awfArgs, "--container-runtime", "sbx")
Comment on lines +94 to +95
" set -euo pipefail",
` echo "::group::Start sbx daemon"`,
Comment threadpkg/workflow/docker_sbx_install.go Outdated
Comment on lines +29 to +33
` 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 ✅"`,
Comment threadpkg/workflow/docker_sbx_install.go Outdated
Comment on lines +140 to +143
` 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`,
Comment on lines +731 to +734
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}")
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, make sure the branch is up to date with the base branch, and rerun checks once everything is green.

Generated by 👨‍🍳 PR Sous Chef · 12.6 AIC · ⌖ 7.9 AIC · ⊞ 7.5K ·
Comment /souschef to run again

@lpcox

Copy link
Copy Markdown
Collaborator

@copilot run the pr-finisher skill

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@lpcoxlpcox added the smoke label Jul 11, 2026
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

CopilotAI commented Jul 12, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot please run the pr-finisher skill, make sure the branch is up to date with the base branch, and rerun checks once everything is green.

...

Addressed in b7feffc. The branch is up to date with main and local make fmt, make lint, make test-unit, and make test all pass. CI on this new head still needs a maintainer re-trigger because agent pushes here do not start a fresh checks run.

CopilotAI requested a review from gh-aw-botJuly 12, 2026 00:00
@lpcox
lpcox merged commit b4f3c45 into mainJul 12, 2026
29 of 30 checks passed
@lpcox
lpcox deleted the copilot/feat-add-docker-sbx-runtime-support branch July 12, 2026 00:07
Copilot stopped work on behalf of lpcox due to an error July 12, 2026 00:07
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.9

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add docker-sbx runtime support to compiler

4 participants

@gh-aw-bot@lpcox