Repository navigation
fix(sandbox): support borrowed Enroot sandboxes and image digests - #6105
Conversation
Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 0127f1c |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found. I reviewed all three changed files and traced descriptor reconstruction, borrowed-sandbox cleanup, file transfers, and digest translation through their affected callers and tests.
The handoff implementation preserves the state needed by the borrower, and disconnect leaves teardown with the creator. Digest translation retains the original image reference as the cache key.
This was a static review; I didn't execute tests or independently reproduce the reported Enroot smoke runs. Two delegated review payloads were unavailable, so I independently inspected their descriptor and digest-translation topics.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Signed-off-by: yaoyu-33 <[email protected]>
The Enroot descriptor carried the sandbox env, which can hold task secrets and travels to the agent server. `enroot exec` builds each command's environment from the init's /proc/<pid>/environ, so the borrower does not need it; drop it, as AsyncSandbox.serialize() does for sidecar env. A borrowed handle has no start process to reap, so close() could signal a process-group ID the creator already reaped and the kernel reused. Signal it only while the group leader still carries the container marker. Translate only a sha256 digest after the last '@', so Enroot's own USER@REGISTRY prefix is left as before. Say that the '@' spelling fails only on Enroot before 4.0. Reject a non-Gym sandbox_id as a malformed descriptor rather than a stale PID. Move the README text under its own headings after the config example, and update the Harbor README line that said Enroot cannot serialize. Cover the new rejection rows, registry ports, the cache key, the process-group guard, a disconnect that leaves the creator's group and staging alone, and the real /proc marker check on Linux. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 26e3956 |
hemildesai
left a comment
There was a problem hiding this comment.
SHIP. Thanks, this is careful, and the real Enroot 3.4.1 owner/borrower runs plus the digest A/B are exactly the evidence I'd want.
I checked:
- Descriptor and
connect():connect()validates host, UID, data and runtime paths, container name, init PID marker, staging dir and mount point before rebuilding the handle. The task env is left out, which is safe becauseenroot execreads/proc/<pid>/environ. - Borrower
disconnect(): it can't affect the creator.AsyncSandbox.disconnect()only callsprovider.aclose(), and Enroot'saclose()is a no-op. - Borrowed
stop()after the owner stopped: the new_kill_start_groupguard means it only signals a process group whose leader still carries the container marker. That closes the reused-PGID hole. - Digest translation: it only fires on a trailing
@sha256:, strips a tag only when the last:is after the last/(sohost:5000/repo@sha256:…keeps its port), and leaves Enroot'sUSER@prefix alone.
CI is green, and test_enroot_provider.py passes locally apart from the macOS-only /proc case you called out.
One NOTE on the #5792 overlap you mention: #5792 is approved and adds a near-identical serialize_handle/connect, but without the stopped-sandbox check in serialize_handle, the stricter start_pgid validation, or the _kill_start_group guard for borrowed handles. If #5792 lands first, please keep those three pieces (and the digest translation) when you rebase, rather than dropping this copy wholesale.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43979064925 |
Harbor environments create a task sandbox and lend it to an agent session. Enroot previously failed that handoff with
does not support serialize()/connect(). Digest-pinned OCI references also failed to import on Enroot before 4.0, whose URI parser reads the text before@as a registry user.This adds same-host, same-UID serialize/connect support with matching data/runtime directories and live-container checks. The descriptor leaves out the sandbox environment, which may hold task secrets:
enroot execbuilds each command's environment from the init's/proc/<pid>/environ, so the borrower still sees it. Borrower disconnect leaves the creator's sandbox running. A borrowed handle signals the creator's process group only while its leader still carries the container marker, so a process-group ID reused after the creator stopped is never signalled. Image references ending in@sha256:<digest>are translated torepository:sha256:<digest>, which Enroot 3.1 and later accept; the original reference remains the squashfs cache key, and Enroot's ownUSER@prefix is left alone. The descriptor is trusted control-plane state; it does not grant a portable lease or cross-host access.environment_servers/harbor/README.mdno longer says Enroot cannot serialize.This is a focused prerequisite found while exercising #5697 / #5794; a separate issue is unnecessary. The PR targets main and contains none of that stack's commits. #5792 also adds Enroot serialize/connect with the same env exclusion; whichever lands second drops its copy.
Validation (head
26e3956446, main39d2bde61emerged in):pytest tests/unit_tests/sandbox/test_enroot_provider.py— 82 passed;pytest tests/unit_tests/sandbox/test_sandbox_connect.py— 7 passed. On macOS the Linux-only/proctest skips and the existingtest_create_start_timeout_cleans_upfails for lack of/proc, as on main.pre-commit run --fileson the four changed files — passed.alpine:3.20@sha256:d9e853e8…anddocker.io/library/alpine@sha256:d9e853e8…: import → owner exec → serialize (noenvkey) → borrower connect → exec sees the env given atenroot start→ upload inside and outside the mount → download → disconnect → owner exec reads the borrower's files → stop.enroot listis empty and the staging folder is gone afterwards; connecting after stop is refused as stale. These runs setbypass_entrypoint: false, because the existing--rc /dev/nulldefault fails on Enroot 3.4.1 (fixed separately in fix(sandbox): support LAB harness sessions across sandbox providers #5792).enroot startprocess-group leader's cmdline carries the container marker; a borrowed close after the owner's stop sends no signal; a borrowerstop()on a live sandbox still tears it down and the owner's later stop succeeds.docker://alpine:3.20@sha256:…fails with "Authenticating with user: alpine:3.20 … 401 Unauthorized".0127f1c9f8(descriptor still carriedenv), with Enroot 4.2.1: imported four original TB4 agent/verifier images pinned by digest; on Harbor stack55f9d566bwith the same provider patch, Claude Code 2.1.108 and OpenCode each completedbun-sourcemap-leakandwal-recovery-orderingwith a real Qwen3-VL-8B-Instruct vLLM endpoint, separate verifier artifacts, no missing/masked/failed rollouts, and no remaining task rootfs. Rewards were zero; this validates the harness/provider path, not benchmark accuracy. Claude Code reached its turn limit on WAL and its output limit on Bun; OpenCode returned completed responses. Model-call capture was disabled.Compatibility: reconnect requires the same host, PID namespace, OS user, data/runtime paths and staging directory. The owner remains responsible for stopping the sandbox; a borrower's
stop()also tears it down, as with the other same-host providers. The smoke evidence covers functional handoff and cleanup; it is not full-benchmark qualification.