Repository navigation
Conversation
…both test streams This brings an existing SWE fix to swe_gym. If the sandbox ends the eval script without an exit status (a dropped stream, a timeout or a provider error), the partial log cannot grade the run. run_verification now returns an inconclusive result, so the run is retried and is not graded as 0. The eval script also captures the stdout and stderr of the test command in full and prints both between the output markers. Some test runners report on stderr, and a provider can return stderr apart from stdout. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
…ultra These three servers lend the agent the sandbox they start in seed_session but had no way to block its egress, so an RL agent could fetch a task's upstream fix. Give them the same enforce_agent_no_network / sandbox_model_server fields as swe_next, swe_internal_v1 and the other SWE servers (resources_servers/swebench/agent_network.py): the sandbox started for a session gets a deny-by-default OpenSandbox policy that allows only the model server's host, the startup check refuses a provider that cannot enforce it, and the evaluation sandbox keeps its network. The flag stays off by default. Tests mirror swe_internal_v1/tests/test_agent_network.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jiaqi Zeng <jiaqiz@nvidia.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Both servers trained an infrastructure failure as a 0. They now mask it (mask_sample, failure_kind verifier_error), as swemer_v1 does, on both the episode-session and the agent /run path. Trained as 0 before, masked now: - The verifier never produced a verdict after its retry: the grading sandbox failed to start or exec raised, the image lacks the repo / runner / conda env, or SWE-Gym's held-out test patch did not apply. - R2E-Gym: the provider ended the eval exec without an exit status (not a timeout). The partial log used to be graded as a completed 0; it is now no verdict, retried, then masked. - Missing task data: an R2E-Gym row without expected_output_json, a SWE-Gym row whose (repo, version) has no SWE-bench spec. - The agent's patch could not be read for an infrastructure reason (provider error or timeout on the capture command, unreachable sandbox). The empty fallback patch used to be graded; now nothing is graded. Still trained, unchanged: - A completed run that does not resolve, a patch that does not apply. - Git itself exiting non-zero on the repository the agent left (empty patch graded as before). - A test run that hit evaluation_timeout: R2E-Gym grades it as before; SWE-Gym still retries it and then scores 0 unmasked (new VerificationResult.timed_out). Signed-off-by: Jiaqi Zeng <jiaqiz@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
The live OpenCode agent verifies through /seed_session + cookie, and on that path scale_swe masked nothing. Before, these were all trained as reward 0 (mask_sample false): - a verification with no verdict (test patch did not apply, verifier exec raised, verifier sandbox never started, inconclusive after the retry); - a verifier exec that ended without an exit status (non-timeout) or an eval script that stopped before pytest started (not reclassified as no verdict); - a failed patch extraction (agent sandbox unreachable, capture ended without an exit status, no base commit, no task sandbox), which graded an EMPTY patch as a completed 0. Now the cookie path uses the episode-session classification: those cases are mask_sample true with failure_kind verifier_error / provider_unavailable / session_lost and a failure_reason, and a lost capture is no longer graded. Unchanged (still trained 0, unmasked): tests that ran and failed, a genuinely empty model patch, a verifier timeout (a hang the patch caused), and git exiting non-zero on a repository the agent broke. The cookie path still does not replay. The now-unused _extract_model_patch is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jiaqi Zeng <jiaqiz@nvidia.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
The cookie path now captures the patch through _capture_model_patch, so its task sandbox stop uses the bounded wait of sandbox_stop_timeout_seconds. Its verifier sandbox stops are still not bounded. The README now says so. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/ok to test 1560b3c |
|
🌿 Preview your docs: https://nvidia-preview-pr-6670-8645c67618fe.docs.buildwithfern.com/nemo/gym |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — agent-caused capture timeouts can now suppress training samples, and Scale-SWE cookie verification can stop a replacement sandbox.
Reviewed all 17 changed files, surrounding consumers, lifecycle handling and tests against the trusted base conventions. Existing feedback contains three issue comments, no formal reviews and no inline comments.
RISK — Representative model-rollout evidence is missing. The PR explicitly reports no model rollout and no live OpenSandbox enforcement test. These changes affect verifier masking and agent connectivity, so the smoke-rollout requirement in AGENTS.md applies. Could you provide representative real model rollouts covering the changed server paths, inspect agent/verifier outcomes, and verify that enabled egress enforcement permits model calls while blocking unrelated destinations? Record the head, configuration and observed outcomes in the PR. A full training run or reward profile is not required for these training environments.
Validation: CI run 45285605716, attempt 1, succeeded on 1560b3c3: core tests, all eight server-suite shards, sandbox tests and final aggregation passed. Lint also passed. Session-routing end-to-end and changed-server jobs were skipped, not passed. I did not rerun CI suites.
Purpose-built probes ran in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline, Python 3.13.14, with checkout import origins verified. Real-Git base/head differential probes reproduced the capture-masking defect. Cookie/episode probes confirmed both affected consumers and episode replay. An endpoint-interleaving probe reproduced the Scale-SWE replacement-sandbox race on head but not merge-base. Generated-shell execution verified both output streams, exit-code preservation and timeout/provider-error classification. Fake-provider seed probes confirmed network-policy wiring in all three servers; they do not establish live network enforcement.
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.
A swe_gym run that hit evaluation_timeout returned reward 0 with no mask, but with evaluation_completed false. Gym's eval recovery reads that row as masked and not measured, so a resubmit stopped with "the run is not complete", and run health counted a trial failure. The reward profile and NeMo RL read mask_sample, so they already scored it as 0. The response now reports the timeout as completed, as the sibling SWE servers do. The retry on a fresh sandbox stays, because the retry loop reads VerificationResult.completed, which does not change. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arts The eval scripts of swe_gym, r2e_gym and scale_swe exit 97 or 96 when the image lacks the repository, the conda env or the hidden tests. They end with the test command's own exit status, and code from the model's patch runs inside the test process. A patch can therefore make pytest exit 97, for example from a root conftest.py, and the server read that as a broken image. With this PR's masks, the row was masked instead of a trained 0. The servers now read 97 and 96 as a broken image only when the output has no begin marker. The scripts exit with these codes before they print the marker, so a real broken image is still masked. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When git fails on the agent's repository, these servers still grade the
empty patch. If that grading has no verdict, the row is masked. Its
failure_reason named the capture ("Failed to extract model patch: ...")
and dropped the verifier's own error, so it read like a patch capture
lost to the provider. The mask now uses the verifier's error as its
failure_reason, as swemer_ultra does. The error field does not change.
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the cookie path, _capture_model_patch read the task sandbox with .get, and its finally looked the session up again to stop it. Two problems followed: - A /seed_session with the same cookie that finished during the capture registered a new sandbox, and the old verification stopped and forgot it. The re-seed also stopped the sandbox that the capture was reading. - A cookie session has no close. After a stop that failed or outlasted sandbox_stop_timeout_seconds, the sandbox, base commit and untracked files stayed in the session maps for good. The cookie path now pops the sandbox, base commit and untracked files at the start, as the removed _extract_model_patch did, and stops that exact sandbox with the bounded _wait_for_stop. The episode path does not change: it holds the session lock for the whole verification. The sandbox_stop_timeout_seconds description and the README now say which cookie path stops are bounded. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A YAML provider_options key whose children are all commented out loads as
null. AgentNetworkConfig read it with .get("provider_options", {}), whose
default applies only to a missing key, so dict(None) raised TypeError on
the first sandbox. This PR made swe_gym, r2e_gym and swemer_ultra build
every sandbox's options through this helper, so they would fail even with
the egress flag off. The seven servers that already use the helper fail
the same way on main. A null value now counts as no options.
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bounded wait - A bash test runs the swe_gym eval script between its markers, with a runner that reports on stderr and one that calls exit itself. It fails against the script from main, without the stderr capture, and without the subshell. - The model's own empty patch stays a graded, unmasked 0 in swe_gym and r2e_gym. - The test of an interrupted grading waits for the grading to start with a 5 s limit, so a regression that skips grading fails instead of hanging the CI job. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/ok to test df91095 |
On the cookie path, _capture_model_patch stops the captured sandbox with _wait_for_stop. That wait removes its entry from _stop_tasks only when the stop is done at the end of the wait. A stop that outlasted sandbox_stop_timeout_seconds stayed in _stop_tasks for the life of the server, and its task held the sandbox object. No close comes for a cookie session, so nothing waited for that stop again. The cookie path now adds a done callback that removes the entry when the stop ends. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/ok to test 8645c67 |
What does this PR do?
This PR brings two SWE changes to more resources servers.
swe_gym,r2e_gymandscale_swe. Before, these servers trained some infrastructure failures as a reward of 0. Now they mask them (mask_sample: true,failure_kind: verifier_error).scale_swealso usesprovider_unavailableandsession_lost, as its episode-session path already does. On main,swemer_v1,swemer_v2,swemer_ultraandswe_nextalready mask these cases.swe_gym,r2e_gymandswemer_ultra. These servers now take theenforce_agent_no_networkandsandbox_model_serverfields that the other SWE servers already have (resources_servers/swebench/agent_network.py). The flag is off by default.These changes were written by Jiaqi Zeng (@HeyyyyyyG), on top of a swe_gym fix by Hemil Desai.
Commits, in order:
fix(swe_gym): grade unfinished test runs as inconclusive and capture both test streamsswe_gymreports the run as inconclusive and retries it. The eval script also captures the stdout and stderr of the test command in full. This PR takes only theswe_gympart of a larger SWE fix that is not public.feat(swe): block agent sandbox egress in r2e_gym, swe_gym and swemer_ultraAgentNetworkConfigto the three server configs and uses its provider options for the agent's sandbox.fix(r2e_gym,swe_gym): mask verifications that produce no verdict/runpath.fix(scale_swe): mask a missing verdict on the Agent /run cookie path_extract_model_patchis removed.docs(scale_swe): say which cookie path stops are boundedfix(swe_gym): report a timed-out test run as a completed 0swe_gymtimeout keeps its retry and stays unmasked, and the response now saysevaluation_completed: true, as the sibling SWE servers do. Before, Gym's eval recovery read the row as masked and not measured.fix(swe): read the reserved exit codes only before the test output startsswe_gym,r2e_gymandscale_sweread exit 97 or 96 as a broken image only when the test output never started. Code from the patch can make the test command exit 97.fix(swe_gym,r2e_gym): name the verifier's error in a no-verdict maskfix(scale_swe): take the captured sandbox out of a cookie sessionfix(swebench): treat a null provider_options as no optionsprovider_options: nullinsandbox_configno longer raisesTypeErrorin the servers that useAgentNetworkConfig.test(swe_gym,r2e_gym): pin the stream capture, the empty patch and a bounded waitfix(scale_swe): drop a cookie session's stop task once it endssandbox_stop_timeout_secondsno longer stays in_stop_tasksfor the life of the server.The last seven commits answer review comments.
No issue is linked. This PR upstreams existing fixes, and the related PRs below give the context.
Training effect
These rows were trained as 0 before. They are masked now:
swe_gymandr2e_gym: the verifier gives no verdict after its retry. Examples are a grading sandbox that did not start, an exec that raised, an image without the repository, runner or conda environment, and a SWE-Gym test patch that did not apply.swe_gymandr2e_gym: a row without its grading data. That is an R2E-Gym row withoutexpected_output_json, or a SWE-Gym(repo, version)without a SWE-bench spec.swe_gymandr2e_gym: the server did not get the agent's patch because of the provider (an error or a timeout on the capture command, or an unreachable sandbox). Before, the server graded an empty patch.swe_gymandr2e_gym: the provider ended the eval exec without an exit status, for a reason other than a timeout. Before, the server graded the partial log.scale_swe, on the Agent/runcookie path: the cases that its episode-session path already masks. These are no verdict after the retry, a verifier exec without an exit status (not a timeout), an eval script that stopped before pytest started, and a patch capture lost to infrastructure.These rows stay trained as 0:
evaluation_timeout.swe_gymnow retries it on a fresh sandbox (inconclusive_verification_retries, 1 by default), then scores 0 without a mask. Its partial log is no longer graded. A run that hangs can hold the verifier for up to1 + inconclusive_verification_retriestimesevaluation_timeout.r2e_gymandscale_swegrade it as before.conftest.pyin the patch. These codes mean a broken image only before the test output starts.The
swe_gymeval script now puts the test command's stderr inside the graded region, after its stdout. Before, when the provider returned stderr apart from stdout, it came after the end marker and was not graded. A grade can change when stderr carries a result line for a required test.In a run with sandbox or provider trouble, expect fewer trained 0 rewards and more masked samples from these servers.
Compatibility
enforce_agent_no_networkisfalsein every config, so the default behavior does not change. If you turn it on, the agent's sandbox gets a deny-by-default network policy that allows only the host ofsandbox_model_server. The evaluation sandbox keeps its network. The flag needs a sandbox provider that can enforce network policies, such as OpenSandbox. At startup, the server refuses a provider that cannot enforce it.mask_sample: true,failure_kindandfailure_reason. The reward of these rows stays 0, andevaluation_completedisfalse. Some of these rows reportedevaluation_completed: truebefore this PR, because the server graded them. One case is a patch capture lost to the provider: the server graded an empty patch. A second case is an eval exec that the provider ended without an exit status: the server graded its partial log. Both cases apply toswe_gym,r2e_gymand thescale_swecookie path. On thescale_swecookie path, an eval script that stopped before the tests started was also graded.swe_gymVerificationResulthas a new fieldtimed_out(defaultfalse).scale_swecookie path, a failed patch capture is no longer graded as an empty patch. The cookie path also takes the task sandbox out of the session before the capture, so a new seed with the same cookie keeps its own sandbox.provider_options: nullinsandbox_confignow counts as no options. Before, it raisedTypeErroron the first sandbox in every server that usesAgentNetworkConfig, also on main._create_sandboxinswe_gym,r2e_gymandswemer_ultraonto the typedSandboxConfig.spec(). Whichever PR merges second must pass the agent sandbox's egress policy throughspec(network_policy=...), becauseAgentNetworkConfigreadssandbox_configas a mapping. It must also update the threetests/test_agent_network.pyfixtures, which patchapp.resolve_provider_metadata, an import refactor(sandbox): build SWE task sandboxes with the typed SandboxConfig.spec #6179 removes. A plain conflict resolution fails the egress tests.Related PRs
swe_agents.resources_servers/swebench/agent_network.pyand theenforce_agent_no_networkflag to seven SWE servers. This PR adds the flag to three more.swemer_v1,swemer_v2,swemer_ultraandswe_next.Validation
All commands ran on CPU.
pre-commitand thescale_swetests ran on the head8645c67618. The other servers ran ondf91095b0b, and the last commit changes onlyscale_swe.I also made sure that the new tests fail without the code change:
swe_gym,r2e_gymandswemer_ultraapp.pyfiles from main,tests/test_agent_network.pygives 7 failed and 3 passed in each server.swe_gymandr2e_gymapp.pyandverification.pyfiles from before the mask commit, 28swe_gymtests and 1r2e_gymtest fail.scale_sweapp.pyfrom main, 9 of the 13 cookie path tests fail. The 4 that pass check behavior that does not change.swe_gym, 2 inr2e_gymand 1 inscale_swe.scale_sweapp.pyfrom before the cookie-path fix,test_reseed_during_capture_keeps_the_new_sandboxandtest_slow_task_stop_leaves_no_cookie_statefail.agent_network.py,test_null_provider_options_are_no_optionsfails in both cases.test_a_mask_after_a_git_failure_names_the_verifier_s_errorfails for both servers without its fix.swe_gymeval script fails with the script from main, without the stderr capture, and with a brace group in place of the subshell.The diff is server-only (
resources_servers/**), so CI runs the core and sandbox tests and the tests of the changed servers.Rollouts
The run below was at head
df91095b0b. The later commit8645c67618changes only thescale_swestop-task cleanup on the cookie path.df91095b0bwith the agent egress block on (enforce_agent_no_network: true), OpenSandbox, a hosted Nemotron model and the OpenCode agent through each server's Agent/runcookie path: 3 example rows each ofr2e_gym,swe_gymandscale_swe. All 9 rows finished with a verdict and no mask: 7 resolved, 2 graded 0./seed_session, commands in the agent's sandbox failed to resolve DNS, to reach pypi.org or github.com, to open TCP to 1.1.1.1:443 and topip download. TCP to the model server worked./verifythen completed in a fresh sandbox (evaluation_completed: true, unmasked).pip installandcurl https://pypi.org/...failed with a name resolution error, and the rows were still graded.scale_swerows on the cookie path whose held-out test patch did not apply after the retry. Before this PR, these rows were trained as a reward of 0.r2e_gym(1,728 rows) andswe_gym(800 rows) had no masks.Checklist
scale_swe/README.md). The other servers have no README text about masks or egress.pre-commit run --all-files).git commit -s).🤖 Generated with Claude Code