Skip to content

feat(sandbox): add optional archive splitting and scaled deadlines - #5365

Merged
yaoyu-33 merged 4 commits into
mainfrom
sync/sandbox-large-transfers-20261030
Nov 18, 2026
Merged

yaoyu-33 merged 4 commits into
mainfrom
sync/sandbox-large-transfers-20261030

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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, and upload_archive accept upload_part_bytes=None by default. A positive value enables sequential upload of bounded parts, reassembly, and removal of the parts. Invalid sizes are rejected before target mutation.
  • download_path and upload_archive accept seconds_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.
  • Directory sizing follows a symlink at the root that tar -C enters, while nested and single-file symlinks keep their existing semantics.
  • Interrupted multipart cleanup is bounded and shielded. Command, provider, and timeout failures during cleanup are logged without replacing the original upload failure or cancellation.

For example, a backend that needs bounded archive requests can opt in:

await upload_path(sandbox, source, target, upload_part_bytes=256 * 1024**2)

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_file helper 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's StrictInt timeout field accepts.

Validation of 34d2e31c0fc35fc47ceee616664789e9ec9163b2 on a Linux workstation with Python 3.13.14:

  • 438 tests passed: 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.
  • All three new integer-default regression cases fail against the previous implementation at 52055611f.
  • python ../evidence/daytona_probe.py: the real Daytona 0.183.0 SDK and Gym provider rejected 600.0 before the fix and accepted integer 600 afterward 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 default upload_path (1 upload, 5.0 seconds) and explicit 8 MiB parts (9 uploads, 5.8 seconds). Both SHA-256 checks matched, restored mode was 0755, and teardown was confirmed with zero cleanup errors. These are correctness checks, not a throughput comparison.
  • git diff --check passed. 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.

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]>
@yaoyu-33 yaoyu-33 added the internal_sync Public PR created by internal-to-public sync automation label Oct 30, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:sandbox Sandbox providers, isolation, and sandbox runtime contracts feature New capabilities, enhancements, or enablement work labels Oct 30, 2026
@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 17, 2026 16:01

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread nemo_gym/sandbox/transfer.py Resolved
Comment thread nemo_gym/sandbox/transfer.py Resolved
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]>
@yaoyu-33 yaoyu-33 changed the title feat(sandbox): chunk large uploads and scale archive deadlines fix(sandbox): stream uploads and make archive splitting opt-in Nov 17, 2026
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]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 17, 2026

@yfw yfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread nemo_gym/sandbox/transfer.py Resolved
@yaoyu-33 yaoyu-33 changed the title fix(sandbox): stream uploads and make archive splitting opt-in feat(sandbox): add optional archive splitting and scaled deadlines Nov 18, 2026
@yaoyu-33
yaoyu-33 enabled auto-merge November 18, 2026 04:11
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 34d2e31

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 18, 2026 04:13
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44255081417

Merged via the queue into main with commit 71f491e Nov 18, 2026
168 of 174 checks passed
@yaoyu-33
yaoyu-33 deleted the sync/sandbox-large-transfers-20261030 branch November 18, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:sandbox Sandbox providers, isolation, and sandbox runtime contracts feature New capabilities, enhancements, or enablement work internal_sync Public PR created by internal-to-public sync automation needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants