Skip to content

docs: add gVisor (runsc) integration guide - #6332

Merged
lpcox merged 3 commits into
mainfrom
docs-gvisor-integration
Jul 17, 2026
Merged

docs: add gVisor (runsc) integration guide#6332
lpcox merged 3 commits into
mainfrom
docs-gvisor-integration

Conversation

@lpcox

@lpcox lpcox commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

Adds docs/gvisor-integration.md, a deep-dive on gVisor and how AWF runs the agent under the runsc OCI runtime via --container-runtime gvisor.

Why

Companion to the Docker Sandboxes (sbx) integration doc (PR #6331). Two audiences:

  1. Engineers who want to understand how the existing gVisor integration works.
  2. Ourselves, when evaluating/adding other agent-isolation runtimes (Kata, another OCI runtime, or gVisor's own KVM platform on bare-metal runners).

Contents

  • What gVisor is — application kernel (Sentry) in userspace, memory-safe Go reimplementation of the Linux syscall surface, Gofer, and the netstack userspace network stack; the Systrap (default, no virtualization — works inside GitHub-hosted runners) vs KVM vs legacy ptrace platforms; what it does not protect against. Sourced from the official gVisor architecture docs.
  • How AWF uses it — the compose executionModel in container-runtime.ts (agent stays a compose service, unlike sbx); agent-service.ts setting runtime: runsc; the netstack DNS problem (127.0.0.11 unreachable, Netfilter config is not handled on runsc boot, reopen of: "DNS not working in Docker Compose" google/gvisor#7469) and AWF's two-part workaround (IP-based proxy env vars + static extra_hosts and the chrooted /host/etc/hosts patch in topology.ts); the iptables-DNAT compat requirement verified by test-gvisor-compat.yml; and the Bun-JIT shim for Claude.
  • Adding other compose-model runtimes — registry entry, DNS-model decision (both hosts files), network-fallback check, and install/registration requirements, with a note on Systrap vs KVM vs microVM trade-offs on hosted vs bare-metal runners.
  • A stack-placement mermaid diagram and a responsibility-split table (gVisor owns kernel isolation; AWF owns egress filtering, credential injection, chroot/capabilities).

Notes

  • Docs-only change. markdownlint-cli2 passes on the new file; cross-links use the relative ./file.md style consistent with the rest of docs/.

Explain what gVisor is (application kernel, Sentry, netstack, Systrap/KVM
platforms) and how AWF runs the agent under the runsc OCI runtime: the
compose executionModel, runtime field wiring, the netstack DNS workaround
(extra_hosts + chroot /host/etc/hosts patching), iptables DNAT compat,
and the Bun JIT shim. Includes guidance for adding other compose-model
runtimes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 23717692-af7a-4e03-a156-5b696c3f01bd
Copilot AI review requested due to automatic review settings July 17, 2026 18:36
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit cae437d

@lpcox

lpcox commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Copilot AI 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 a detailed guide explaining gVisor’s architecture, AWF integration, and considerations for additional OCI runtimes.

Changes:

  • Documents gVisor isolation platforms and limitations.
  • Explains AWF runtime, DNS, networking, and compatibility handling.
  • Provides guidance for adding compose-model runtimes.
Show a summary per file
File Description
docs/gvisor-integration.md Adds the gVisor integration guide.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment thread docs/gvisor-integration.md Outdated

:::note
gVisor is the **compose-model** counterpart to the microVM backend documented in
[Docker Sandboxes (sbx) integration](./sbx-integration.md). With gVisor the agent
Comment thread docs/gvisor-integration.md Outdated
- AWF source: `src/container-runtime.ts`, `src/services/agent-service.ts`,
`src/topology.ts`, `src/services/agent-environment/tool-specific-environment.ts`
- CI: `.github/workflows/test-gvisor-compat.yml`, `.github/workflows/smoke-gvisor*.md`
- Related: [Docker Sandboxes (sbx) integration](./sbx-integration.md),
Comment thread docs/gvisor-integration.md Outdated
Comment on lines +164 to +166
fallback to hold. This is verified by
`.github/workflows/test-gvisor-compat.yml`, which confirms iptables DNAT and
proxy reachability inside a `runsc` sandbox.
Comment thread docs/gvisor-integration.md Outdated
Comment on lines +170 to +173
- **Bun JIT crash on Claude** (`tool-specific-environment.ts`) — when the agent
is Claude *and* the runtime is gVisor, AWF sets `BUN_JSC_useJIT=0` to force
Bun's interpreter, avoiding a JIT crash under gVisor
([oven-sh/bun#22901](https://github.com/oven-sh/bun/issues/22901)).
Comment thread docs/gvisor-integration.md Outdated
Comment on lines +222 to +224
That single entry makes `resolveDockerRuntime` set the compose `runtime:` field
and (optionally) turns on the static-DNS workaround — no other code changes are
required for the common case, because the agent remains a compose service.

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@copilot fix this failing ci check https://github.com/github/gh-aw-firewall/actions/runs/29604416738/job/87964101538?pr=6332

Fixed in 0490a63. The failing Link Check job was caused by two relative links to docs/sbx-integration.md, which doesn't exist on this branch yet, so I replaced them with the open PR #6331 URL and re-ran the doc validation locally.

Copilot finished work on behalf of lpcox July 17, 2026 18:47
@lpcox

lpcox commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address the review feedback

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@copilot address the review feedback

Addressed in 9806cfb. I updated the guide to describe test-gvisor-compat.yml as a manual non-gating probe, reframed the Claude/Bun note as an AWF-specific workaround, and documented that /host/etc/hosts patching currently happens only in the topology-attach flow.

Copilot finished work on behalf of lpcox July 17, 2026 19:38
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox
lpcox merged commit 1037a28 into main Jul 17, 2026
15 of 16 checks passed
@lpcox
lpcox deleted the docs-gvisor-integration branch July 17, 2026 19:58
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.

3 participants