Skip to content

feat(sandbox): publish E2B and Cube Session files - #169

Merged
yanpgwang merged 1 commit into
mainfrom
codex/e2b-cube-session-files
Aug 21, 2026
Merged

feat(sandbox): publish E2B and Cube Session files#169
yanpgwang merged 1 commit into
mainfrom
codex/e2b-cube-session-files

Conversation

@yanpgwang

Copy link
Copy Markdown
Owner

Problem, rationale, and scope

E2B and CubeSandbox preserve durable Session workspaces and run package-configured tools, but they reject File-backed Session Resources and /mnt/session/outputs. Switching an otherwise identical cloud Environment to either provider therefore removes input and deliverable workflows that Docker, OpenSandbox, and Daytona already support.

Acceptance criteria:

  • E2B and Cube materialize, validate, replace, reattach, and remove File Resources through the pinned provider SDK.
  • File tools and shell commands share /mnt/session/outputs, and idle publication receives a repeatable validated archive.
  • Provider-owned markers, output staging, cleanup, resource locking, timeout, and retry semantics match the existing remote contract.
  • Capability admission, offline conformance, opt-in live conformance, deployment guidance, and capability documentation agree.

Non-goals: streaming E2B/Cube SDK transfers, read-only remote copies, remote Skills or Memory, heterogeneous-worker routing, Environment Work, or changing the Files HTTP API.

What changed

  • Extend the shared E2B-compatible sandbox with File Resource, Session Output, and resource-synchronization capabilities.
  • Adapt the pinned CubeSandbox Go SDK whole-value filesystem operations to Mango internal Reader interfaces for both E2B and Cube.
  • Reuse the existing random tar snapshot, operation-deadline, retry, validation, and cleanup path.
  • Add both providers to shared offline File/output conformance and their credential-gated live suites.
  • Document the accepted Preview limitation: each File Resource and output archive is buffered in worker memory, uses provider-default modes, and is writable inside the sandbox.

Verification

  • make verify
  • make docs-check
  • make security
  • make local-config
  • make image-smoke
  • make test-service
  • E2B/Cube live conformance is credential-gated and was not run locally; both live suites now include File Resources and Session Outputs.

API and migration impact

No route, JSON shape, OpenAPI schema, database schema, or migration changes. On the existing /v1 contract, cloud Environments backed by E2B or Cube now admit File Session Resources and publish Session outputs instead of returning an unsupported-capability error. Mango remains pre-release, so this capability change is made in place.

Durability and security

  • Imports retain size/SHA-256 validation, pending/final identity markers, stale-delete protection, and attach recovery.
  • Output snapshots use fixed tar arguments, random adapter-owned paths, operation-level deadlines, repeatable reads under the resource lock, close-time deletion, and Mango two-pass archive validation.
  • File tools cannot address adapter-owned marker or staging roots.
  • The E2B/Cube compatible Go SDK currently buffers whole files and does not expose per-operation modes. This is an explicit Preview resource-consumption and permissions limitation accepted for this slice; operators must size worker memory for the largest admitted transfer.
  • Provider credentials remain worker-local and never enter public resources or PostgreSQL.

Design provenance

This change reuses Mango existing File Resource and Session Output contracts rather than adding provider-shaped public fields. The CubeSandbox Go SDK and E2B-compatible envd filesystem API are implementation data planes only. Adopted behavior, provider-specific buffering, and rejected compatibility obligations are recorded in docs/provenance.md and docs/sandboxes.md.

Checklist

  • User-visible problem, acceptance criteria, and non-goals are recorded.
  • Tests cover behavior that failed before this change.
  • Documentation and capability claims are updated.
  • Material provider influences and Mango-owned decisions are recorded.
  • No credentials, generated artifacts, or local databases are included.

@yanpgwang
yanpgwang merged commit 3961cd0 into main Aug 21, 2026
6 checks passed
yanpgwang added a commit that referenced this pull request Aug 21, 2026
## Problem

Custom Skills were closed-loop only on Docker. Sessions using E2B,
CubeSandbox, OpenSandbox, or Daytona could not materialize their
immutable Skill Version trees, which prevented the same Agent workflow
from running across the supported remote sandbox backends.

## Solution

- add one provider-neutral remote Skill materializer over the existing
official SDK file data planes
- validate the canonical archive with the same bounded extraction and
SHA-256 checks used by Docker
- upload a sibling staging tree, restore executable bits, remove write
bits, and publish with rollback
- isolate primary/self and roster Agent Skill paths
- reconcile the adapter marker and `SKILL.md` bytes before relevant tool
steps
- deny ordinary write/edit operations beneath `/workspace/skills` while
preserving read and shell execution
- repair corrupt, partial, directory, and symlink marker states through
staged marker publication
- self-heal Mango-owned Skill directories after permission, symlink, or
non-directory drift
- preserve provider command diagnostics when Daytona returns combined
output
- advertise the capability for E2B, CubeSandbox, OpenSandbox, and
Daytona and document the remote-copy trust boundary
- restore the E2B and CubeSandbox FileResources and SessionOutputs
registry flags implemented and documented in #169 but omitted from the
command registry; this PR does not introduce those underlying
capabilities

## Acceptance criteria

- all four remote adapters import, execute, attach, and repair the same
immutable Skill bundle contract
- interrupted archive imports are not visible
- equal Skill names in primary and child Agent scopes do not collide
- executable helpers retain execution mode even when the provider upload
SDK ignores modes
- marker, main-instruction, and adapter-owned directory drift is
detected and repaired without following existing symlink targets
- Runtime Skill reads use the canonical absolute sandbox path, including
Daytona
- non-zero remote commands retain useful provider diagnostics

## API and migration impact

No HTTP route, schema, database migration, or LLM adapter change. The
existing `/v1` Skill contract is extended to additional sandbox
capabilities.

## Security and durability

Archive validation rejects traversal, absolute paths, links, duplicate
entries, and invalid canonical roots. Remote adapters publish only
validated regular files. Marker and tree cleanup unlinks symlinks
without recursively changing their targets. The canonical object-store
archive remains immutable. Remote providers do not expose a native
read-only bind mount, so sufficiently privileged sandbox shell code can
change the hardened copy; the documented pre-tool reconciliation repairs
detectable `SKILL.md` and layout damage.

## Design provenance

The current public Claude Managed Agents Skills design was reviewed for
version-pinned filesystem bundles, `SKILL.md`, progressive disclosure,
and trust-boundary lessons. Mango keeps its own self-hosted lifecycle
and rejects Anthropic headers, authentication, hosted catalogs, rollout
identifiers, and hosted-runtime dependencies. The adopted and rejected
decisions are recorded in `docs/provenance.md`.

## Verification

- `make verify`
- `make docs-check`
- `make security`
- targeted remote Skill conformance and race tests
- focused Claude Opus review of the final repair diff

The opt-in live provider suite is wired for all four adapters but was
not run because it requires external credentials and billable sandboxes.

## Non-goals

Environment Worker activation, Memory Store expansion, hosted catalog
integration, and LLM/model adapter changes are intentionally outside
this slice.
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