Skip to content

feat(sandbox): support Docker Compose on E2B-compatible gateways - #3377

Draft
hemildesai wants to merge 2 commits into
mainfrom
codex/sandbox-compose-e2b
Draft

hemildesai wants to merge 2 commits into
mainfrom
codex/sandbox-compose-e2b

Conversation

@hemildesai

@hemildesai hemildesai commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Stacked on #3332. Enable the Compose adapter to launch services through E2B-compatible gateways, including AgentENV, without changing infrastructure or the public sandbox API.

The provider runs opt-in, authenticated TCP-over-WebSocket relays inside Linux guests. Configurable endpoints preserve service names and declared TCP ports; localhost forwarding supports network_mode: service:.... Runtime probes validate capabilities and shared-memory requests. Optional shell selection supports images without Bash, and chunked uploads accommodate gateway request limits. Empty gateway 404 responses are normalized for idempotent cleanup.

Templates are built explicitly from official images using the existing E2B builder. Guests need Python, aiohttp, pyroute2, root, and NET_ADMIN. Duplicate declared service ports, UDP, and shared writable volumes are rejected. The guide covers configuration and reconnect ownership.

Configuration and scope

Image mapping, template resources, guest package setup, gateway routing, service users, startup commands, and environment variables remain configuration or upstream provisioning. No controller dependencies, Docker executable, image inspection, or benchmark-specific provider logic are added.

The simplification review retained the runtime implementation: AgentENV denies direct VM peer traffic before configurable egress rules, so gateway configuration alone cannot provide Compose TCP networking. Non-loopback guest addresses keep peer names distinct from localhost. The SDK hardcodes Bash and has no shell-selection parameter; multipart streaming still sends one request and cannot bypass gateway request-size limits. The entrypoint supports the adapter's keepalive process; runtime checks enforce requested capabilities and shared memory. Removing these pieces would change supported behavior. The follow-up edit only shortens duplicated and benchmark-specific guide text; it removes no runtime code or configuration.

Validation:

  • Fresh validation on the unchanged runtime: 258 E2B/Compose/reconnect regression tests passed, with 98% E2B coverage using SDK 2.49.1; 166 E2B tests passed with the minimum supported SDK, 2.36.0.
  • Fresh AgentENV service discovery, endpoint routing, serialize/connect, and cleanup checks passed, including repeated cleanup with empty gateway 404 responses.
  • All 11 official TB4 Compose golds passed in one concurrent AgentENV run on commit 24c9cdca6 (2026-09-14): each reward was 1 and every verifier exited successfully. The E2B runtime is unchanged from that run; the subsequent merge brought in parent shared-memory metadata support. KV reached 7.13x speedup with four-vCPU templates. The paginated cleanup audit found no remaining validation sandboxes.
  • Benchmark launch setup uses resolved image users/environment, 64 MiB shared memory, a PostgreSQL runtime directory, four-vCPU KV main/loadgen templates for relay overhead, and an 8 GiB Next.js verifier. Gold patches and verifier assertions are unchanged.
  • pre-commit run --all-files passed. Fern check: zero errors, one existing warning.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated edits are excluded.
  • Tests added or updated and pass locally.
  • Pre-commit checks pass locally (pre-commit run --all-files).
  • All commits have DCO sign-off (git commit -s).

@copy-pr-bot

copy-pr-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@hemildesai
hemildesai added this pull request to stack #3378 September 14, 2026 20:00
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

🌿 Preview your docs: https://nvidia-preview-codex-sandbox-compose-e2b.docs.buildwithfern.com/nemo/gym

Here are the markdown pages you've updated:

Base automatically changed from codex/sandbox-compose-adapter to main September 15, 2026 00:14
hemildesai and others added 2 commits September 14, 2026 17:14
Add opt-in guest TCP relays, configurable service endpoints and runtime checks, plus shell and upload controls for compatible gateways. Keep the Compose adapter and public sandbox API unchanged.

Co-Authored-By: Codex <noreply@openai.com>
Signed-off-by: Hemil Desai <hemild@nvidia.com>
Keep deployment requirements and configuration in the guide; move benchmark-specific validation details to the PR record. Clarify that peer names resolve outside the loopback address range.

Signed-off-by: Hemil Desai <hemild@nvidia.com>
@hemildesai
hemildesai force-pushed the codex/sandbox-compose-e2b branch from 58c8a4f to e56079f Compare September 15, 2026 00:14
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.

1 participant