Bubblewrap Provider
The bwrap provider runs each sandboxed command under bubblewrap on the host of the Gym process. In practice that host is usually a Slurm/pyxis container of the task image. A sandbox is a directory, <base_dir>/<id>/{workspace,tmp,home}, so there is no long-lived container process, no daemon and no image unpack. Every exec spawns a fresh bwrap with these properties:
- Namespaces. User, pid, ipc and uts namespaces are new. The network namespace is also new unless
network: host. - Capabilities. All are dropped (
--cap-drop ALL). - Filesystem. The host’s system directories are bound read-only and the root is remounted read-only. Only the sandbox’s own workspace,
/tmpand home are writable.
Setup
Use a pinned bwrap binary and pass its absolute path. Sandboxes need unprivileged user namespaces. Inside pyxis, add /proc:/proc to --container-mounts. Otherwise bwrap fails with “Can’t mount proc … Operation not permitted”.
The provider README (nemo_gym/sandbox/providers/bwrap/README.md) has the full config reference: read-only bind lists, environment whitelist, concurrency and timeouts.
Behavior
bwrap still reports setup failures through the compatibility classes (SandboxCreateError, error-valued exec results); it is listed under Required provider migrations for the failure-event contract.
Processes never outlive their exec, so there are no background services, endpoints or PTYs. user, entrypoint and resources.gpu are rejected. image, ttl_s and the cpu, memory and disk limits are ignored with a warning.
Sharing a sandbox
serialize() returns {provider, host, uid, base_dir, sandbox_id, workdir, network}. AsyncSandbox.connect with a bwrap provider of the same config accepts it only on the same host and uid, with the same base_dir. The sandbox directory and its state file must also still exist. This lets a resources server create a task sandbox that an agent server in the same container borrows.
Each exec has its own pid namespace, so a pid recorded by one exec cannot be signalled from another exec. Stop sandboxes through the provider rather than with kill commands run in later execs.