Skip to content

fix(terminal_bench_4): score a verifier that times out or leaves no reward as 0, as Terminal-Bench does - #5038

Merged
lafrancef merged 3 commits into
NVIDIA-NeMo:mainfrom
AdamRajfer:fix/tb4-verifier-scored-zero
Oct 24, 2026
Merged

lafrancef merged 3 commits into
NVIDIA-NeMo:mainfrom
AdamRajfer:fix/tb4-verifier-scored-zero

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Terminal-Bench 4 verifier timeouts and missing, empty or malformed reward files were recorded as infrastructure failures, removing tasks from the pass-rate denominator. Harbor 0.22.0 excludes those four exceptions from retries and counts a trial without a reward as zero.

This change follows that benchmark-native behavior: those verifier outcomes remain measured zeros with failure_kind: verifier_error, evaluation_completed: false and mask_sample: false. An earlier agent infrastructure failure, verifier startup failure, provider timeout or sandbox result without a command outcome remains an infrastructure failure.

Configuration preflight

environment.default_exec_timeout_s must cover the effective verifier budget. Known incompatible overrides are rejected at startup; a task-specific incompatibility is rejected before sandbox creation or policy execution and reported as a terminal configuration failure. The configured command limit and native verifier budget are preserved.

This prevents a shorter command limit from making an interrupted verifier look like a benchmark-native missing-reward zero. Exit-code sign and elapsed transport time are not used to infer the cause.

Validation

  • Affected Terminal-Bench 4 tests cover native verifier zeros, preceding agent infrastructure failures, provider timeouts, sandbox command failures and configuration preflight.
  • A connected regression uses the actual seed, agent and verification control flow, with external boundaries faked. It verifies rejection before harness/provider use and propagation of the terminal marker to the collector's terminality predicate.
  • The connected regression was run with the pinned mini-SWE agent dependencies; it skips when those optional dependencies are absent.
  • Changed-file pre-commit checks passed. Final-head CI is tracked separately.

Fixes #4986.

AI-assisted update prepared for Adam Rajfer.

…eward as 0, as Terminal-Bench does

A verifier can run but time out, or leave no reward file, an empty one or
one that cannot be parsed. Each was reported as an infrastructure error,
so collection sent the task to the failure sidecar and the task left the
pass-rate denominator (NVIDIA-NeMo#4986). Terminal-Bench's harness, Harbor, never
retries these four outcomes and counts a trial without a reward as 0.

Such a task now scores 0 and stays in the denominator. The response
keeps evaluation_completed false, names the exception in failure_reason,
and sets failure_kind verifier_error. The outcome is read from the
verifier's own diagnostic, because an agent that exited on a timeout or
a nonzero code is recorded first, as the trial's exception. A verifier
that fails to start stays an infrastructure error.

Fixes NVIDIA-NeMo#4986.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Oct 24, 2026
@AdamRajfer
AdamRajfer requested a review from lafrancef October 24, 2026 03:05
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test f0f6910

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team October 24, 2026 03:06
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer labels Oct 24, 2026
@cmunley1

Copy link
Copy Markdown
Contributor

/review

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

HOLD — Three BLOCKERs can turn infrastructure failures into permanent, unmasked scored zeros.

Reviewed all three changed files and traced verifier diagnostics, agent-response serialization, collector routing, and aggregate masking. The intended four-outcome classification works for the supplied unit-test cases, but the new scoring branch also admits the infrastructure cases detailed inline.

Validation was static only; no tests or rollouts were executed. Suggested patches require author verification 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.

if not completed:
failure = (result.get("exception_info") or {}).get("exception_type", "MissingOfficialReward")
failure_type = failure
verifier_failure = _scored_verifier_failure(session.diagnostics)

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.

BLOCKER — Preserve independent agent infrastructure failures

Failure: A started agent can terminate with infrastructure_error after a model/provider failure and still be graded. If the verifier then raises any whitelisted exception, this branch suppresses the earlier AgentInfrastructureError and returns an unmasked zero without _ng_failure_class. The infrastructure check below is an elif, so it never runs. This silently lowers the benchmark score and makes collection consider the attempt permanently done. The reachable path is in agent finalization; the existing agent-outcome regression explicitly retains infrastructure classification for this termination reason.

Correction: In _verified_response, only apply the whitelist when there is no independent agent infrastructure termination. Replace this assignment with:

verifier_failure = (
    _scored_verifier_failure(session.diagnostics)
    if session.termination.reason != "infrastructure_error"
    else None
)

This retains the existing exception_info fallback and its infrastructure markers. Invariant: an inconclusive verifier must not erase an independently established agent infrastructure failure.

Preservation / acceptance: Proposed regression: supply termination infrastructure_error, result exception_info.exception_type='AgentInfrastructureError', and a verifier_execution diagnostic for each of the four exceptions. Expect _ng_failure_class='infrastructure_error', _ng_failure_type='AgentInfrastructureError', and non-null infrastructure_error. Retain scored-zero behavior for the same verifier exceptions after completed, timeout, nonzero_exit, or cancelled terminations. Completed official rewards must retain their existing agent-infrastructure classification; completed sandbox-resource-limit zeros must remain unmarked. These checks are proposed, not executed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, thanks. Fixed in ddec2a3 as you suggested: the scored verifier outcomes now apply only when the agent did not end on an infrastructure failure. Such a trial keeps AgentInfrastructureError and stays retryable, as on main. This also matches Harbor, which decides a retry from the trial's first exception, here the agent's.

A new test covers the four verifier outcomes after an agent infrastructure failure. The scored-zero test now runs after completed, timeout, nonzero_exit and cancelled terminations.

… verifier zeros

Three paths could still turn an infrastructure failure into a scored 0:

- An agent that ended on an infrastructure failure, followed by a
  verifier that timed out or left no reward. Harbor decides a retry from
  the trial's first exception, here the agent's, so the trial stays an
  infrastructure failure.
- A provider call that timed out within the verifier's budget. Only
  that budget now makes a VerifierTimeoutError; the provider's
  TimeoutError propagates as raised.
- A sandbox that reported no command outcome (error_type set) for the
  verifier's commands. The verifier now fails instead of reading the
  reward files as missing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test ddec2a3

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/review reset=true

@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 — No material findings.

Completed a fresh light review of all five changed files, including lifecycle diagnostics, response serialization, collection routing, and aggregate masking.

The three prior BLOCKERs are resolved: agent infrastructure failures remain classified as infrastructure, and the verifier distinguishes nested provider timeouts and rejects command-outcome errors. Inspected regression assertions cover these repairs and preserve scored verifier zeros and official rewards after nonzero process exits.

Validation was static source and test inspection only; no tests or smoke rollouts were executed.

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.

Validate known overrides at startup and effective task budgets before
sandbox creation or policy execution. Report incompatible settings as a
terminal configuration failure without changing either configured limit.
Cover the seed, agent and verification response boundary.

Signed-off-by: Adam Rajfer <[email protected]>
@lafrancef
lafrancef added this pull request to the merge queue Oct 24, 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/40107460375

Merged via the queue into NVIDIA-NeMo:main with commit c05139d Oct 24, 2026
52 of 55 checks passed
@athitten athitten mentioned this pull request Oct 28, 2026
7 tasks done

This branch was previously deployed

1 inactive deployment
public — 37f7995f Deployed Oct 24, 2026 by copy-pr-bot[bot] via release / finalize / notify #7084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working 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.

TB4: define and surface verifier execution-timeout outcome

4 participants