Repository navigation
fix(eval): retry verifier masks that name infra - #4868
AdamRajfer wants to merge 3 commits into
Conversation
A verifier that masks a row because the environment or a service failed gives no measurement, but the row stayed scored or left the score. In evaluation a masked result that names infra becomes a `masked_sample` failure, is retried, and counts as 0 at the attempt cap. A mask for the model's own budget is unchanged. SWE-bench Pro masks a verification with no verdict and a patch the task sandbox could not return; a test run that outlived its limit is scored as unresolved and is not rerun. OSWorld names its environment, evaluator, model-call and task-timeout masks. verifiers_agent masks a rollout whose policy call failed and was swallowed, also when model-call capture is off. These server changes apply only in `gym eval run`. Moved unchanged from the previous part of the stack. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…verification ceilings Review finding 4339108862, NVIDIA-NeMo#4868 (part 4b, verifier masks). One verification attempt was capped at 1200 s and all attempts at 2700 s, while the test command alone may run 3600 s (evaluation_timeout). A hung test was therefore cancelled by the attempt ceiling, reported as provider_unavailable and retried, instead of scoring unresolved as the official harness's single per-instance timeout does. The attempt ceiling now covers a whole attempt: sandbox readiness (1200 s) + evaluation_timeout (3600 s) + the 60 s parser run after a timeout = 4860 s, rounded up to 5400 s for the unbounded chmod and log reads. The total ceiling is 7200 s, one whole attempt plus room for retries after fast inconclusive ones. evaluation_timeout is unchanged. The episode-timeout example in the agent integration guide is raised to match. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
Review finding 4339108867, NVIDIA-NeMo#4868 (part 4b, verifier masks). A context overflow and a transport failure both end the rollout masked as model_call_failed, so in evaluation both were named provider_unavailable and retried. The runner now keeps the agent's own stop reason (policy_stop_reason) next to the mask reason, and a mask whose stop reason is model_context_overflow gets no infra failure kind: the episode's context depends on its earlier sampled actions, so rerunning it is not a retry of one failed call. Transport failures are still retried. Training is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 128a8dd |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD
Three BLOCKER scoring defects and two RISK retry-classification defects remain. Reviewed all 16 changed files and traced mask propagation through verification, collection, resume, and aggregation.
Static review only: no tests or smoke rollouts were executed. Acceptance checks below are proposed; suggested code must be verified before adoption.
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.
| scored["mask_sample"] = False | ||
| # A masked row's reward is one its verifier called unusable, so it counts as 0, never as it stands. | ||
| if row.get(NG_FAILURE_CLASS_KEY) == MASKED_SAMPLE_FAILURE_CLASS: | ||
| scored["reward"] = 0.0 |
There was a problem hiding this comment.
BLOCKER — Counted OSWorld masks still contribute their original headline score
Failure / blast radius: _counted_failure_row() clears the mask and zeroes reward, but retains verifier_metadata.osworld_score. OSWorldAgent.compute_metrics preferentially reads that metadata for both OSWorld headline rates. Consequently, one healthy success plus one infrastructure-masked result carrying score 1 produces mean/reward=0.5 but OSWorld binary/raw rates of 100%, rather than 50%. This is reachable because the runner evaluates the desktop after a model/action failure and retains the evaluator score independently of runtime admission.
Correction: Make OSWorld's metric hook honor the metrics-only zero. Current OSWorld responses retain runtime_eligible=False in this copy, while measured responses have it true. A small replacement for the score assignment in OSWorldAgent.compute_metrics is:
score = (
0.0
if rollout.get("runtime_eligible") is False
else metadata.get("osworld_score", rollout.get("reward", 0.0))
)The invariant is that an infrastructure mask counted as zero contributes zero to both generic and benchmark-specific quality metrics; the original sidecar and metadata remain unchanged.
Preservation / acceptance: Proposed regression: aggregate a healthy score-1 row and _counted_failure_row() of a masked_sample row with runtime_eligible=False, reward/metadata score 1. Expect reward mean 0.5 and both OSWorld rates 50%. Retain the existing partial-score assertions: ordinary eligible scores 1, 0.5, 0.25 must still total 1.75, including legacy measured dictionaries without runtime_eligible. Genuine budget masks must remain excluded by shared aggregation, not converted to zeros.
| f" > {quote(patch_path)}" | ||
| ) | ||
| except Exception as exc: | ||
| raise SandboxPatchExtractionError(str(exc)) from exc |
There was a problem hiding this comment.
BLOCKER — Patch-extraction runtime failures returned as results are still scored as model failures
Failure / blast radius: The new wrapper recognizes only raised exceptions. The sandbox API also returns runtime failures as SandboxExecResult(error_type="sandbox", return_code=125, ...): for example, the Docker provider does this when a container is no longer running. Such a result falls into the following generic RuntimeError, so extraction_failed_in_sandbox remains false. If verification of the substituted empty patch completes, evaluation persists an unmasked zero and never retries the lost patch.
Correction: Before the ordinary nonzero-exit check in _extract_model_patch, distinguish the API's runtime error from a command exit:
if getattr(result, "error_type", None):
raise SandboxPatchExtractionError(
result.stderr or f"Sandbox execution failed ({result.error_type})"
)Keep the existing generic RuntimeError for a nonzero git exit with no error_type. The invariant is that losing sandbox execution/output is infrastructure, whereas a successfully executed git command rejecting the model-modified repository remains a model zero.
Preservation / acceptance: Proposed parameterized regression: return SandboxExecResult(None, "container is not running", 125, "sandbox") or a timeout result from extraction, then return a completed unresolved verification. Evaluation must return mask_sample=True, failure_kind="provider_unavailable"; training must retain its unmasked zero. A git exit 128 with error_type=None must remain unmasked in both modes. Keep download exceptions retryable, the lossy-log patch-byte assertions, pristine-file filtering, and finally-block cleanup.
| print("Failed to stop verification sandbox", format_exc(), file=sys.stderr) | ||
|
|
||
| reason = inconclusive_reason(result) | ||
| if reason is not None and result.timed_out and is_eval_mode(): |
There was a problem hiding this comment.
BLOCKER — Provider-operation timeouts are treated as completed test-budget failures
Failure / blast radius: result.timed_out does not establish that tests exhausted evaluation_timeout. run_verification sets it for every TimeoutError, including SandboxOperationTimeoutError. The OpenSandbox request wrapper raises that infrastructure-specific subclass when a command submission/status/log request times out. A status-poll outage can therefore terminate verification well before the 3600-second test limit. This new branch stops retries, and the response-mask branch also excludes it, silently recording a model zero instead of an infrastructure failure.
Correction: Preserve command-deadline versus provider-operation evidence in VerificationResult when run_verification catches the exception. Use only confirmed command-deadline evidence for both evaluation's early break here and its not result.timed_out mask exemption below. A SandboxOperationTimeoutError must remain retryable infrastructure. The current result has erased the exception type, so a drop-in change to this condition alone cannot safely fix it; the result representation needs a coordinated change in verification.py and these two consumers.
Preservation / acceptance: Proposed regression: have the evaluation exec raise SandboxOperationTimeoutError("Timed out during OpenSandbox command status after 10s") with evaluation_timeout=3600 and no verdict. With internal retries disabled, evaluation must mask/name infrastructure; with retries enabled, it must retry inconclusive verification. Separately retain the actual command-timeout case: error_type="timeout" from the test command must score unmasked zero after one evaluation attempt. Preserve training's existing mask/reward/retry behavior and the partial-log required-test-failure handling.
| mask_sample=outcome.mask_sample, | ||
| artifact_dir=task_artifacts.directory if task_artifacts is not None else None, | ||
| termination_reason=outcome.termination_reason, | ||
| policy_stop_reason=agent_stop_reason, |
There was a problem hiding this comment.
RISK — The default OSWorld runner still retries context exhaustion as infrastructure
Failure / blast radius: This field is populated only from a native agent's stop_rollout facts. The shipped default runner is gym_pyautogui; its model caller rethrows a context-length HTTP 400. The runner exception branch records that error without setting agent_stop_reason, so policy_stop_reason remains null. The new response validator consequently assigns provider_unavailable and collection retries the entire sampled episode. The intended context-budget exemption currently works only for agents that supply the structured stop fact.
Correction: Recognize context overflow at the model-call exception boundary and propagate the same stop fact. Reuse the inspected adapter classifier rather than introducing another message matcher. In the runner's agent/model exception handler, with imports of MODEL_FAILURE_OUTCOMES and classify_model_failure from adapter_agents, the targeted addition is:
if classify_model_failure(exc, model_call_completed=False) == "context_overflow":
agent_stop_reason = MODEL_FAILURE_OUTCOMES["context_overflow"]
agent_model_call_completed = FalseThis routes the exception-based overflow through the same model_call_failed admission path as the native adapter. Do not classify every model-call exception as a budget stop.
Preservation / acceptance: Proposed regression using the existing fake runtime: default gym_pyautogui, model_fn raising a context-length HTTP 400, successful evaluator, then build the evaluation response. Expect a masked row with policy_stop_reason="model_context_overflow", no infrastructure kind, and _masked_result_names_infra(...) == False. Repeat with APIConnectionError: expect provider_unavailable and retry eligibility. Retain native Nemotron's existing context-overflow exemption, successful default-runner actions, and training masks/rewards/failure kinds.
| if ( | ||
| self.mask_sample | ||
| and self.failure_kind is None | ||
| and self.policy_stop_reason != CONTEXT_OVERFLOW_STOP_REASON |
There was a problem hiding this comment.
RISK — Context overflow suppresses an independent evaluator failure
Failure / blast radius: After an adapter stops for context overflow, the runner still invokes the evaluator. If evaluation then fails, the result carries runtime_admission_reason="evaluator_error" while retaining policy_stop_reason="model_context_overflow"; evaluator failure has priority in outcome classification. This unconditional stop-reason exemption leaves that infrastructure mask unnamed, so it stays outside the score and is not retried. The exemption should apply to a context-overflow model-call mask, not override a later evaluator failure.
Correction: Replace this conjunct with:
and not (
self.policy_stop_reason == CONTEXT_OVERFLOW_STOP_REASON
and self.runtime_admission_reason == "model_call_failed"
)The invariant is that the actual admission failure decides retry eligibility: a pure context-budget stop remains unscored/nonretryable, but independent evaluator or environment failures remain infrastructure.
Preservation / acceptance: Extend the existing context-mask regression with the same context stop reason but runtime_admission_reason="evaluator_error" and evaluation_completed=False. Expect provider_unavailable and _masked_result_names_infra(...) == True. Keep its current model_call_failed + context-overflow case at no failure kind/false, ordinary transport masks retryable, and both cases unchanged in training.
Part 4b of 9, split out of #4846 so each part has one review scope. Merge right after #4846 and before #4847. Stacked on #4846; the diff shows only this part's changes. The mask code is unchanged from what #4846 held before the split, including the verifiers_agent fix; the SWE-bench Pro ceilings and the OSWorld context-overflow fix came after the split.
What and why. A verifier that masks a row because the environment or a service failed gives no measurement, but the row stayed scored or left the score. In evaluation a masked result that names infra becomes a
masked_samplefailure, is retried, and counts as 0 at the attempt cap. A mask for the model's own budget is unchanged. SWE-bench Pro masks a verification with no verdict and a patch the task sandbox could not return; a test run that outlived its limit is scored as unresolved and is not rerun. OSWorld names its environment, evaluator, model-call and task-timeout masks, except a model-call mask where the agent stopped because its prompt no longer fit the context window (policy_stop_reason: model_context_overflow): that is the model's budget, and it is not retried. verifiers_agent masks a rollout whose policy call failed and was swallowed, also when model-call capture is off. SWE-bench Pro's verification ceilings now leave room for a whole attempt (verification_attempt_timeout5400 s,verification_total_timeout7200 s, were 1200 s and 2700 s), so a hung test reaches its ownevaluation_timeoutand scores unresolved instead of being cut and retried as infra. The ceilings apply in both modes; the other server changes apply only ingym eval run(is_eval_mode(), from #4846).Methodology. An infrastructure failure is retried, not scored. The SWE-bench harness reports a timed-out instance as unresolved.
Eval scores. Runs with infra masks move up once retries succeed; at the cap they count as 0. OSWorld rollouts masked for a context overflow are not retried and stay out of the score, as before this series. SWE-bench Pro runs with test timeouts are unchanged in score (still 0), with fewer reruns; a hung test now runs to its own limit, so one verification can take up to 7200 s.
Training and RL: no change to masks, rewards or failure kinds. Every mask and
failure_kindchange is behindis_eval_mode(), which training and RL do not set: the samemask_sample, reward andfailure_kind. The collector's mask routing runs only ingym eval run. Two changes apply in both modes: the higher SWE-bench Pro verification ceilings, so a hung test runs to its ownevaluation_timeoutbefore it is retried, and the newpolicy_stop_reasonfield on OSWorld responses. Checked by running each mask test in both modes; the training-mode expectations equal the code before this series.Unit tests.
resources_servers/swebench_pro/tests/test_app.py(the mask cases in both modes, andtest_a_hung_test_reaches_its_own_deadline_inside_the_verification_ceilingsfor the defaults and the shipped config),responses_api_agents/osworld_agent/tests/test_app.py(test_empty_response_reports_runtime_admissionin both modes,test_a_context_overflow_mask_is_not_named_infra_in_evaluation,test_the_context_overflow_stop_reason_is_the_adapters),responses_api_agents/osworld_agent/tests/test_client.py::test_nemotron_model_transport_failure_stops_and_masks,responses_api_agents/verifiers_agent/tests/test_app.py::TestPolicyOutage(both modes),test_failure_retry_rule.py::TestMaskedRowsInTheCollector,test_failure_retry_rule_evidence.py::TestMaskedRows.Review threads from #4846 that belong here: SWE-bench Pro patch extraction and SWE-bench Pro timeout (no change here), SWE-bench Pro deadlines (fixed here: higher verification ceilings), OSWorld context overflow (fixed here: not retried as infra), and verifiers_agent outage without capture (fixed).
🤖 Generated with Claude Code