Skip to content

feat(sandbox): pluggable sandbox seam with snapshot, rewind, and teleport #554

Description

@justrach

Inspired by exoharness/exo's sandbox system — the one piece of its architecture we clearly lack.

Design sketch:

  • src/sandbox.zig: vtable seam with two roles — a backend (acquire a sandbox, acquire-from-snapshot) and a handle (exec, start process, snapshot). Mirrors the ManagedSandboxBackend/ManagedSandboxHandle split.
  • First backend: Docker via CLI only (no SDK): snapshot = docker commit -p <ctr> graff-snap-<id> + docker save to a tar blob; restore = docker load + docker run with the image swapped in; evict any warm container for the key first. AppleContainer (container CLI) is the same wire with a different binary.
  • Snapshots persist under .graff/sessions/<id>/snapshots/<snap>/{manifest.json,payload.bin}; the conversation log stays canonical and is never rewound with the sandbox — filesystem state only, processes relaunch.
  • REPL: /snapshot and /rewind <id>.
  • Teleport = restore a DockerImageTar snapshot on a different backend (e.g. Daytona), which we already use by hand for Windows verification.

Why we want it: the bot sandbox runner (zigrepper#136 phase 2), DGM trial isolation beyond git worktrees, and try-risky-thing-then-rewind workflows.

Known exo limitations to avoid repeating: whole payload held in memory during capture/restore; no snapshot GC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions