Repository navigation
feat(sandbox): add optional archive splitting and scaled deadlines - #5365
Conversation
Bound per-request upload size and allow callers to size archive deadlines from payload size. Preserve existing default deadlines and clean up attempted upload parts when a transfer fails or is cancelled. Includes synthetic file-transfer and interruption regression tests. Signed-off-by: yaoyu-33 <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found one RISK in linked-directory deadline sizing and one NOTE in cleanup diagnostics. I inspected both changed files and the affected transfer callers and provider contracts. This was a static review; I did not execute tests or independently verify the reported validation. Verify the suggested edits and proposed acceptance checks before adopting them.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Merge current main and apply the shared provider streaming improvement from #5904. Reopen the file for each retry and close it on every completion path. Keep archive splitting explicit via upload_part_bytes, preserve archive metadata and cleanup, and retain optional size-based deadlines. Validation: 429 focused tests, all-files pre-commit, and live raw/default-archive/multipart checksum smoke passed on the final diff. Signed-off-by: yaoyu-33 <[email protected]>
Follow only the root directory symlink when sizing archive deadlines. Warn on unsuccessful multipart cleanup while preserving the original upload exception or cancellation. Add regressions for symlink semantics and command, provider, and timeout cleanup failures. Validation: reproduced both review findings before the fix; 438 focused tests and all-files pre-commit passed after the fix. Signed-off-by: yaoyu-33 <[email protected]>
yfw
left a comment
There was a problem hiding this comment.
HOLD. With default arguments, archive uploads now fail on Daytona, and a one-line guard fixes it (nemo_gym/sandbox/transfer.py:258-259).
The rename at tests/unit_tests/sandbox/test_opensandbox_provider.py:3073 and the unused method at nemo_gym/sandbox/providers/opensandbox/provider.py:3927 are optional.
The OpenSandbox streaming change in upload_file is correct and well tested. A retry starts again at byte zero, the file closes on every path, and timeout and cancellation behave as on main. Runs with the real OpenSandbox SDK and Gym's HTTP transport against a local server show this. The new tests assert that each retry gets a new open stream, and that the stream closes on failure and on cancellation. Both earlier automated review comments are fixed, with tests.
The branch has no merge conflict with main, and DCO passes. So far, only the lint, DCO, copyright, secrets and lock-freshness jobs ran. The unit tests are still waiting: copy-pr-bot needs a maintainer to post the /ok to test command with the full head SHA (52055611f176283320a57ceec07285bd2160d8a3). Locally, the pre-commit suite passes with no rewrites. The transfer, OpenSandbox provider and OpenSandbox HTTP transport test files pass 438 of 438, also as root. That is 56 tests in the CI Core tests job and 382 in the CI Sandbox tests job.
Gym #5904 carries the same upload_file change. On #5904, cg1177 wrote on 2026-11-17 at 09:52 UTC: "Yu Yao and I agreed to use this PR's streamed upload instead of #5365" (comment). Please land the provider change in only one of the two PRs. Whoever lands second can drop the upload_file hunk by hand. The two retry tests share a name, and git does not flag it.
The title says "make archive splitting opt-in", but main never split archives. Against main, this PR adds splitting as a new option. Can you retitle the PR to what lands on main? Please also correct the body sentence "Existing callers retain one archive upload, file modes, restore behavior, and cleanup". It is false on Daytona until the fix at transfer.py:258-259 lands.
Generated by Claude Code
Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 34d2e31 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44255081417 |
Adds optional bounded archive uploads and size-scaled archive-command deadlines to the shared sandbox transfer helpers. Existing callers keep a single archive upload, file modes, restore behavior, and the integer default extraction deadline of 600 seconds.
upload_dir,upload_path, andupload_archiveacceptupload_part_bytes=Noneby default. A positive value enables sequential upload of bounded parts, reassembly, and removal of the parts. Invalid sizes are rejected before target mutation.download_pathandupload_archiveacceptseconds_per_gib=0.0. An explicit nonzero value extends the packing or restoration deadline based on size; it does not change the provider's upload timeout.tar -Centers, while nested and single-file symlinks keep their existing semantics.For example, a backend that needs bounded archive requests can opt in:
Archive splitting is a new option relative to main. It adds staging and reassembly work, so it is disabled by default. Archive part size is separate from a provider's HTTP streaming buffer.
OpenSandbox raw-file streaming belongs to #5904, following the recorded agreement. The OpenSandbox provider and its test file are unchanged from main in this PR. This removes the overlapping streaming implementation and duplicate retry-test definition; the existing
_write_filehelper retains its caller. The multi-GB raw-upload fix will therefore land through #5904. No separate issue is needed for this focused transfer capability.The Daytona review regression is fixed: when deadline scaling is disabled, the helper skips the floating-point addition. All three default archive-upload entry points now preserve integer
600, which the pinned Daytona SDK'sStrictInttimeout field accepts.Validation of
34d2e31c0fc35fc47ceee616664789e9ec9163b2on a Linux workstation with Python 3.13.14:python -m pytest tests/unit_tests/sandbox/test_opensandbox_provider.py tests/unit_tests/sandbox/test_opensandbox_http_transport.py tests/unit_tests/sandbox/test_sandbox_transfer.py --cpu -p pytest_asyncio.plugin -p no:cacheprovider -o addopts= -q, with plugin autoload disabled. This includes the three new integer-default regressions, existing deadline scaling, byte preservation, file modes, symlink handling, multipart routing, and cleanup behavior.52055611f.python ../evidence/daytona_probe.py: the real Daytona 0.183.0 SDK and Gym provider rejected600.0before the fix and accepted integer600afterward for all three entry points. Only the remote API was replaced with local command execution; restored payloads matched. This validates SDK integration without claiming a live Daytona deployment test.python -m pre_commit run --all-files: passed, including package layering and staged guardword checks.python ../evidence/live_smoke.py: live OpenSandbox transfers of a 64 MiB incompressible payload passed through defaultupload_path(1 upload, 5.0 seconds) and explicit 8 MiB parts (9 uploads, 5.8 seconds). Both SHA-256 checks matched, restored mode was0755, and teardown was confirmed with zero cleanup errors. These are correctness checks, not a throughput comparison.git diff --checkpassed. SHA-256 hashes of all four files touched by this review commit matched the validated checkout. The commit is DCO signed off.Compatibility: existing default calls preserve the prior transfer contract, including Daytona's integer deadline. The new options are opt-in. No agent, verifier, reward, or benchmark-result changes are intended; model rollout is N/A for this shared file-I/O change. Live transfer checks cover the integration boundary. The final PR changes only the transfer helper and its tests; shared-core changes still require the repository's full CI routing.