Repository navigation
fix(eval): score a sandbox lost after the model's first command as the model's 0 - #4890
Closed
AdamRajfer wants to merge 15 commits into
Closed
AdamRajfer wants to merge 15 commits into
AdamRajfer wants to merge 15 commits into
Conversation
…nfra Exec-time sandbox errors (SandboxApiException, SandboxTimeoutException, SandboxOperationTimeoutError, SandboxPtyError, a bare TimeoutError raised in nemo_gym.sandbox, AgentInfrastructureError) leave the infra name sets: a model can cause them with a memory or fork bomb, kill -9 -1, or a command that outlives its timeout. Create and start failures stay infra, and SandboxPlatformEvictionError is the one name for independent platform evidence. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…rm ended the sandbox When the exec backend is lost, the OpenSandbox provider reads the control plane's status. An eviction, node loss, drain or preemption raises SandboxPlatformEvictionError, the one sandbox loss that stays infra. An OOM kill within the sandbox's own limit keeps raising SandboxBackendUnreachableError, which is now the model's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
A provider_unavailable, provider_oom_killed or provider_quota_exhausted mask is the producer's claim that its sandbox failed, and a sandbox the model's own commands broke reads the same. Such a mask now names infra only with an explicit _ng_failure_cause: infra, which producers set on platform evidence. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
A scored result masked with no mask_reason is left out of the score by aggregation. In evaluation it now counts in rollouts_infra_unresolved, so a run cannot lose rollouts silently and still read as complete and publishable. Training keeps its behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…-agent sandbox failures for retry In evaluation a trial whose mini-SWE harness died during the agent's run keeps the verifier's grade instead of becoming a retried AgentInfrastructureError: the model can end mini-SWE itself, and Terminal-Bench keeps a graded trial. Platform evidence in the detail still makes it a retry. Failures before the agent ran keep being retried under names that stay infra: a sandbox that could not be created or started (agent or verifier) is SandboxCreateError, and a harness that failed to set up is AgentSetupError. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
… cap every retry The direct-exec wrapper marks the start of the agent's run. In evaluation, a kill (137 is an OOM kill), a failed exec or a missing archive after that mark is the model's final 0, because its own commands can cause each one. Before the mark it stays a retried provider_unavailable with an explicit infra cause. Evaluation no longer routes a kill to kill_shaped, which wrote no sidecar row and so was re-dispatched with no attempt cap. Training keeps its routing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…del's 0 Once the agent ran in the task sandbox, or the eval sandbox ran its patch, a lost sandbox, an exec error or a failed patch extraction is the model's unresolved 0 in evaluation. Only an eval sandbox that never started, or a dependency-network failure before any test ran, stays a provider_unavailable mask, now named with _ng_failure_cause: infra so the retry rule keeps retrying it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
… model's work A provider_* mask no longer retries on its kind alone. tau2's lost harness data, verifiers' policy-endpoint outage and critpt's reference, comparator, create, transfer, deadline and draining categories ran none of the model's work, so they now carry _ng_failure_cause: infra and stay retried. critpt's provider_exec, candidate_no_result and result_invalid can come from the candidate's code and carry no cause. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
… the model's 0 A pod-level OOMKilled sandbox during the agent's turn is graded 0 by the resource-limit detector, with no failure row and no retry, as Harbor scores it. This test drives _finalize_session end to end so that path stays the model's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…very resume Before this change a kill was kill_shaped with NG_NO_PERSIST, so no sidecar row was written and every --resume dispatched the task again. The test drives /run through rollout collection for six hops: a kill after the run started is dispatched once (the model's final 0), a kill before it three times (NEMO_GYM_MAX_ROLLOUT_ATTEMPTS). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…icted as a platform loss Under the sandbox rule a sandbox lost after the model's first command is the model's 0 unless the platform shows it ended the sandbox. A deletion through the OpenSandbox API, or a reaping that leaves no eviction reason, would have become a wrong 0. The provider now raises SandboxPlatformEvictionError (and SandboxPtyPlatformEvictionError on a PTY) when get_info answers 404 or SANDBOX_NOT_FOUND for a sandbox it created, when the state is deleted, or when the reason names an eviction, node loss or preemption. The model has no OpenSandbox API key, so it cannot delete its own sandbox. An eviction for the pod's own storage limit, an OOM kill and a sandbox that still runs stay the model's. TB4 names a relayed platform loss during the agent's run SandboxPlatformEvictionError, so it is retried. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…an none of the model's work A provider_* mask retries only with an explicit infra cause, and OSWorld and swe_agents named none, so in evaluation a real failure before the model's work was left out instead of retried. OSWorld now names it when the environment or proxy failed before the agent's first action (no step taken), or when the policy endpoint failed (a failed or timed-out model call that was not a context overflow); the runner keeps the agent's own stop reason to tell them apart. Masks after the agent acted (the evaluator, the task timeout, a failed action) name none. swe_agents names it when the evaluator never launched; an OOM of the agent, or of the evaluator running the model's patch, names none. Evaluation only: training's masks and rows are unchanged, and each test runs both modes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
A sandbox that never started comes before the model's first command, so the failure rule retries a create error. But a provider could fail inside create or start with its raw SDK error (a 504 ready timeout after the create retries, an upload of the task files) or a timeout, and unless the benchmark wrapped it the failure read as the model's. AsyncSandbox.start, which every provider goes through, now raises any such failure as a SandboxCreateError; a timeout becomes a SandboxCreateTimeoutError, which is still a TimeoutError for callers that catch one, and a provider's own create error passes through unchanged. harness_agent, which creates and connects its box through the provider directly, does the same. Errors after start, such as exec, are unchanged. The failure-cause labels are read only in evaluation, so training is unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…uation When a Harbor trial's sandbox could not be created or started (a SandboxApiException such as 'Create sandbox failed: HTTP 501', a SandboxCreateError, an AgentSetupError), the agent returned a reward of 0 with no failure row, so the model was scored 0 for a run it never started and the job reported completed. In evaluation, a trial whose exception_info names such a failure and that has no agent_execution (Harbor stamps it when the agent starts) is now a harbor_failed row with an infra cause, which the retry rule retries. A failure after the agent ran, including the same exception types, stays the model's 0. Training is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…is missing The parametrized create cases built an opensandbox SDK error at collection time, so the whole module failed to import where the optional sandbox extra is not installed. The SDK error is now built inside the test through pytest.importorskip, as the other sandbox tests do; without the SDK, those cases skip and the rest of the module runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
This was referenced Oct 22, 2026
Contributor
Author
This was referenced Nov 18, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the failure-handling series, stacked on #4851.
What changes. Once the model has run a command in its sandbox, a lost or broken sandbox is the model's failure: final, and scored 0. Terminal-Bench (Harbor) and SWE-bench Pro score errors that happen after the agent starts the same way. Such a failure is retried only before the agent's first command, or when the platform shows that it ended the sandbox: an eviction, a node loss, a preemption, or a deletion through the control plane.
Why. A model can break its own sandbox with a memory or fork bomb,
kill -9 -1, or a command that outlives its timeout. Today these exec-time errors are labelled infra and retried. At the cap they are left out of the score, so a model that breaks its sandbox can avoid a 0.By area
Shared rule (
nemo_gym/failure_kinds.py): exec-time sandbox errors leave the infra sets. They areSandboxApiException,SandboxTimeoutException,SandboxOperationTimeoutError,SandboxPtyError, a bareTimeoutErrorfromnemo_gym.sandbox, andAgentInfrastructureError. Failures to create or start a sandbox stay infra.AsyncSandbox.start, the shared entry point for every provider, raises any create or start failure asSandboxCreateError, a timeout asSandboxCreateTimeoutError, which is still aTimeoutError. That covers a raw SDK error, a ready timeout after the create retries, and a failed upload of the task files. The harness agent creates its box directly, so it converts its failures the same way. Exec errors after start keep their treatment.OpenSandbox provider: raises
SandboxPlatformEvictionError(SandboxPtyPlatformEvictionErroron a PTY), the one sandbox loss that stays infra, when one of three signals shows:get_infoanswers 404 orSANDBOX_NOT_FOUNDfor a sandbox this run created;Deleted;These stay the model's: an OOM kill within the sandbox's own limit, an eviction for the pod's own storage limit, and an exec daemon that died while the sandbox still runs.
Provider masks: a
provider_*mask is retried only with an explicit_ng_failure_cause: infra. Producers set it on platform evidence, or when the masked work ran none of the model's work:exec_user_unsupported, reference, comparator, create, transfer, deadline and draining categories.In evaluation, a scored result masked with no
mask_reasoncounts as infra-unresolved, so a run cannot lose rollouts silently and still read as complete. OSWorld and swe_agents name the infra cause on masks that ran none of the model's work, so those stay retried: OSWorld for an environment that never started or a policy transport failure, swe_agents for an evaluator that never launched. Their other masks keep no cause; an OOM of the agent, or of the evaluation running the model's patch, is the model's.Terminal-Bench 4: a trial whose harness died during the agent's run keeps the verifier's grade. Failures before the agent ran stay retried, as
SandboxCreateErrorandAgentSetupError, and so does a verifier sandbox that could not be created (SandboxCreateError). A harness failure during the agent's run whose detail names platform evidence is recorded asSandboxPlatformEvictionErrorand retried.PinchBench: after the run starts, a kill, a failed exec or a missing archive is the model's final 0. Before it, the failure stays a retried
provider_unavailable. In evaluation, a kill is no longer routed tokill_shaped, which wrote no failures-sidecar row and so was dispatched again on every--resume, with no attempt cap.Harbor agent: in evaluation, a trial whose sandbox create or start failed before the agent started is a retried
harbor_failedrow with_ng_failure_cause: infra, instead of reward 0 with no failure row. Before the agent started means Harbor recorded noagent_execution; the failures areSandboxApiException, any*CreateError,AgentSetupErrorandAgentSetupTimeoutError. A failure after the agent started stays the model's 0. Training keeps reward 0.SWE-bench Pro: once the agent ran in the task sandbox, or the eval sandbox started, three failures are the model's unresolved 0: a lost sandbox, an exec error and a failed patch extraction. So is any other verification with no verdict once the eval sandbox started, such as a parser with no usable output, and it gets no further verification attempt. An eval sandbox that never started, or a dependency-network failure before any test ran, stays a retried mask.
Training keeps its rewards and masks. Some changes apply in both modes: the OpenSandbox provider raises
SandboxPlatformEvictionErroron a platform loss; the shared rule's new causes reach theX-NeMo-Gym-Failure-Causeheader and_ng_failure_cause; Terminal-Bench 4 recordsAgentSetupErrorandSandboxPlatformEvictionErrorinexception_info; critpt sets_ng_failure_cause; and the SWE-bench Pro verify response now keeps every request field (extra="allow").Tests. Each change comes with unit tests that fail without it. Two test-only commits add tests: the Terminal-Bench 4 one pins behaviour the base already had, and the PinchBench one checks the kill change above end to end:
NEMO_GYM_MAX_ROLLOUT_ATTEMPTStimes.The create path is covered by
TestASandboxThatNeverStartedIsInfra(tests/unit_tests/test_sandbox_failure_rule.py: a create 504 ready timeout, a start timeout, an unexpected create error and a failed upload, live and as relayed text) and by harness_agent'stest_a_sandbox_that_never_started_is_a_retried_create_error. The OSWorld and swe_agents mask causes are covered bytest_only_a_mask_before_the_model_acted_or_on_the_policy_transport_names_infra,test_a_rollout_that_never_ran_names_infra_in_evaluationandtest_only_a_never_launched_evaluator_names_an_infra_cause, each run in training and in evaluation. The Harbor agent's create path is covered byTestASandboxThatNeverStartedinresponses_api_agents/harbor_agent/tests/test_app.py, with Harbor's own trial-result shapes.🤖 Generated with Claude Code