Skip to content

fix(sandbox): accept mini_swe_agent_2's resource_requests on E2B - #5597

Merged
yfw merged 4 commits into
NVIDIA-NeMo:mainfrom
max-sudolabs:fix/e2b-resource-requests
Nov 17, 2026
Merged

yfw merged 4 commits into
NVIDIA-NeMo:mainfrom
max-sudolabs:fix/e2b-resource-requests

Conversation

@max-sudolabs

Copy link
Copy Markdown
Contributor

What does this PR do?

The stock mini_swe_agent_2 config sets sandbox_spec.provider_options.resource_requests, a scheduling hint for OpenSandbox. The E2B provider rejected any provider option except template, so the agent could not start on E2B without copying and editing its config. A Hydra override can't remove the key, and setting it to null breaks the provider.

E2B fixes CPU and memory when a template is built, so the provider now treats scheduling resource_requests the same way it already treats SandboxSpec.resources: it logs a warning, or raises when create.strict_resources is true. resource_requests: "limits" (requests equal to resources) is accepted without an extra warning. Other unknown keys and invalid values are still rejected before a sandbox is created.

The E2B provider README and the Fern page document the option.

Validation

  • New unit tests in tests/unit_tests/test_e2b_provider.py: warns when not strict, raises when strict, "limits" adds no extra warning, invalid values are rejected before create. The new tests fail on main.
  • Rebased on current main: test_e2b_provider.py and test_sandbox.py pass (214 passed, 2 skipped).
  • pre-commit run on the changed files: passed.

Rollouts

Ran the stock mini_swe_agent_2.yaml + nemo_gym/sandbox/providers/e2b/configs/e2b.yaml against hosted E2B, with one E2B template per SWE-bench image built by python -m nemo_gym.sandbox.providers.e2b.build (2 vCPU, 8192 MB). Driver: radixark/miles' eval_nemogym_via_api.py.

Run Result
Golden scan, 5 SWE-bench Verified tasks from data/example.jsonl, 5 concurrent 5/5 reward 1.0
Golden, E2B Pro, stock ttl_s: 18000 reward 1.0
API policy (gemini-3.5-flash-lite), 2 tasks 2/2 episodes completed; 1 resolved

On main the same command fails at sandbox creation with Unknown E2B provider option(s): resource_requests. Results and trajectories: https://gist.github.com/max-sudolabs/60db49c420fa292fb7dbdbb0a1575d9e

Compatibility and benchmark impact

Configs that set resource_requests and failed on E2B now start, with a warning. With create.strict_resources: true they still fail, now with the resource error instead of the unknown-option error. No change for other providers.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally.
  • Documentation added or updated.
  • Pre-commit checks pass locally.
  • New source files include the required Apache-2.0 SPDX header. (N/A: no new files.)
  • All commits have DCO sign-off (git commit -s).

mini_swe_agent_2 ships OpenSandbox scheduling hints under
sandbox_spec.provider_options.resource_requests. The E2B provider rejected
them as unknown options, so the stock agent config could not run on E2B
and the key cannot be removed with a Hydra override.

E2B fixes resources when the template is built, so handle these hints the
same way as SandboxSpec.resources: warn once per template, or raise with
create.strict_resources. Other unknown options are still rejected before
allocation.

Signed-off-by: Maksim Obukhov <[email protected]>
OpenSandbox also accepts resource_requests: "limits" (requests equal to
the limits). On E2B that adds nothing beyond SandboxSpec.resources, which
already warn, so accept it without a second warning. Check the type with
'is not None' so falsy non-mappings such as [] or 0 are rejected too.

Signed-off-by: Maksim Obukhov <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 4, 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.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Nov 4, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 5, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added waiting-on-maintainers Waiting on maintainers to respond bug Something isn't working area:sandbox Sandbox providers, isolation, and sandbox runtime contracts labels Nov 6, 2026
@OndrejDrapalik

Copy link
Copy Markdown

hey @hemildesai, could you give this an /ok to test and a look? it unblocks the NeMo Gym recipe on E2B in radixark/miles#4663. thanks!

@svcnvidia-nemo-ci svcnvidia-nemo-ci added waiting-on-maintainers Waiting on maintainers to respond and removed waiting-on-maintainers Waiting on maintainers to respond labels Nov 13, 2026

@hemildesai hemildesai 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.

Thanks! This is a sensible fix, and the end-to-end SWE-bench runs on hosted E2B are much appreciated.

Treating scheduling resource_requests like SandboxSpec.resources (warn by default, raise under create.strict_resources) is consistent with how E2B already handles template-fixed resources. Validation also matches the OpenSandbox provider: a mapping or "limits", rejected before any sandbox is created. The tests cover the warning, strict, "limits" and invalid-value paths, and the README and Fern docs are updated in both places.

No changes requested. One heads-up: #5509 also touches e2b/provider.py and tests/unit_tests/test_e2b_provider.py, so whichever lands second may need a small rebase.

tests/unit_tests/test_e2b_provider.py passes locally on this head (144 passed, 9 skipped). CI hasn't run yet; I'll approve once it has been triggered and is green.

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 16, 2026
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 16, 2026
@hemildesai

Copy link
Copy Markdown
Contributor

/ok to test b186e2d

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

hemildesai
hemildesai previously approved these changes Nov 16, 2026

@hemildesai hemildesai 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.

CI is green on b186e2d. The only failures are the non-blocking harness conformance (kilocode) probes, which this PR doesn't touch. Approving. Thanks for the fix and the thorough validation!

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the ready-to-merge PR is approved, current, and waiting for final CI or merge label Nov 16, 2026
Merge captured base 95c841b into captured PR head b186e2d. Keep the automatic merge unchanged, including the relocated E2B resource-request tests.

Signed-off-by: svcnemo-autobot <[email protected]>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 45bbee6

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 16, 2026 20:24

@hemildesai hemildesai 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.

Re-approving after the merge from main (45bbee6), which dismissed my earlier approval. The PR's own changes are the same as the version I reviewed (only the tests moved to tests/unit_tests/sandbox/ along with main), and CI is green on this head.

@yfw
yfw added this pull request to the merge queue Nov 17, 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/43989403627

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 17, 2026
@max-sudolabs

Copy link
Copy Markdown
Contributor Author

@hemildesai thanks for the approval. The merge queue dropped this PR on responses_api_agents/stirrup_agent/tests/test_sessions.py::test_an_agent_that_runs_out_of_wall_time_answers_with_its_partial_run_as_incomplete (run). That's a wall-clock test in stirrup_agent, which this PR doesn't touch. I don't have permission to re-queue it; could you add it to the merge queue again?

@OndrejDrapalik

Copy link
Copy Markdown

@hemildesai the merge queue removed this at 00:56 UTC on one failure in test_sessions.py::test_an_agent_that_runs_out_of_wall_time_answers_with_its_partial_run_as_incomplete (run 43989403627, assert 0 == 1).

It looks flaky. The test passes on our machine with this PR's head (8 of 8 runs when idle), and fails with the same assertion when I load the CPU. The PR only touches the E2B sandbox provider.

Could you re-add it to the merge queue? Thanks!

@yfw
yfw added this pull request to the merge queue Nov 17, 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/44174092933

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 17, 2026
@yfw
yfw added this pull request to the merge queue Nov 17, 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/44189824446

Merged via the queue into NVIDIA-NeMo:main with commit 3338ebc Nov 17, 2026
79 checks passed
osoblanco added a commit to osoblanco/Gym that referenced this pull request Nov 17, 2026
Main's NVIDIA-NeMo#6165 adds a resources_servers/ether0 entry to
scripts/component-lock-policy.json next to this branch's
resources_servers/critpt_custom_grader entry. Both entries are kept, in
sorted order. Main's NVIDIA-NeMo#5597 changes no file this branch changes.

Signed-off-by: Erik Arakelyan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 bug Something isn't working community-request Issue reported or requested by someone from the community ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants