Skip to content

fix(pinchbench): retry sandbox and harness failures - #4850

Closed
AdamRajfer wants to merge 2 commits into
NVIDIA-NeMo:arajfer/stack/tau2-failuresfrom
AdamRajfer:eval/pinchbench-failures
Closed

AdamRajfer wants to merge 2 commits into
NVIDIA-NeMo:arajfer/stack/tau2-failuresfrom
AdamRajfer:eval/pinchbench-failures

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Part 8 of 9, merge in order. Stacked on #4849; the diff shows only this part's changes.

What and why. A sandbox that failed to start, an Apptainer exec that failed or wrote no result archive, and a host-side FileNotFoundError were classified legitimate and made final. In evaluation they are provider_unavailable, retried. So is a sandbox-level exec error on the managed sandbox path, which now raises SandboxExecError as the direct Apptainer path does. The host side of a run reads only harness files; the task's grader runs inside the sandbox, so a deliverable the model did not write is graded there and never surfaces as these errors.

Methodology. An infrastructure failure is retried, not scored.

Eval scores. PinchBench runs with sandbox failures move up once retries succeed.

Training and RL: no change. The classification is behind is_eval_mode(); outside it these stay legitimate. SandboxNoOutputError and SandboxExecError are RuntimeError subclasses with the same messages. Checked by test_classify_task_failure in both modes.

Unit tests. responses_api_agents/pinchbench/tests/test_app.py.

🤖 Generated with Claude Code

A sandbox that failed to start, an Apptainer exec that failed or wrote
no result archive, and a host-side `FileNotFoundError` were classified
`legitimate` and made final. In evaluation they are
`provider_unavailable`, retried. The host side of a run reads only
harness files; the task's grader runs inside the sandbox, so a
deliverable the model did not write is graded there and never surfaces
as these errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Oct 21, 2026
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 18c5f11

@copy-pr-bot

copy-pr-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters bug Something isn't working labels Oct 21, 2026
@AdamRajfer
AdamRajfer changed the base branch from main to arajfer/stack/tau2-failures October 21, 2026 14:49
@AdamRajfer
AdamRajfer marked this pull request as ready for review October 21, 2026 15:00
@AdamRajfer
AdamRajfer requested a review from ananthsub October 21, 2026 15:00
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Oct 21, 2026

@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 — one RISK: managed Apptainer execution failures still bypass the new evaluation retry classification.

The direct-exec changes preserve RuntimeError compatibility and existing signal/timeout handling. However, the shipped managed-sandbox configuration retains a path that makes provider failures final rather than retryable.

Reviewed all three changed files and traced sandbox producers, response routing, and collector retry decisions. Validation was static only; unit tests and model smoke rollouts were not 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.

if isinstance(exc, TimeoutError):
return "timeout_exceeded"
if is_eval_mode() and isinstance(
exc, (SandboxCreateError, SandboxNoOutputError, SandboxExecError, FileNotFoundError)

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.

RISK — the managed Apptainer path still makes infrastructure exec failures final.

Failure: With evaluation enabled and the shipped managed configuration, an instance disappearing after readiness makes ApptainerProvider.exec return SandboxExecResult(return_code=125, error_type="sandbox", ...). But _run_in_sandbox converts that into a plain RuntimeError, which misses this new tuple and remains legitimate. The resulting row is terminal to the collector, so affected evaluations permanently count a provider failure as zero instead of retrying it. The direct-exec path is fixed, but the default managed path is not.

Correction: In _run_in_sandbox, replace the non-timeout exec_result.error_type branch's raise at line 312 with:

raise SandboxExecError(
    f"PinchBench sandbox execution failed ({exec_result.error_type}): {detail}"
)

This restores the invariant that an explicitly reported sandbox-runtime exec failure reaches the evaluation-only provider retry route. The existing timeout branch must remain first; ordinary nonzero process exits with error_type=None must still download and grade their archive. This suggested change is source-traced, not executed; verify it before adoption.

Preservation and acceptance — proposed checks, not run:

  • Extend test_managed_sandbox_exec_errors_skip_download so its error_type="sandbox" case requires SandboxExecError, still skips download, and calls stop. Run that fake sandbox through agent.run: evaluation must return _ng_failure_class="provider_unavailable" with is_terminal_failure(row) == False; training must retain legitimate and a terminal row.
  • Keep its error_type="timeout" case raising TimeoutError; run must retain timeout_exceeded and the terminal marker in both modes. Keep generic task RuntimeError classified legitimate.
  • For return_code=1, error_type=None, supply a downloadable archive containing a valid task result with mean 0.0: retain status="success", reward 0.0, and no failure-routing key. A legitimate failed task must not gain a retry.
  • Retain direct-exec no-archive classification and the existing signal cases -15, 137, and 143 as SandboxKilledError/kill_shaped; the proposed producer-only change leaves those branches untouched.

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.

Fixed in f9c40a7: the managed path now raises SandboxExecError for a sandbox-level exec error, as the direct path does, so evaluation routes it to provider_unavailable and retries it; training keeps legitimate. test_managed_sandbox_exec_errors_skip_download[sandbox] now expects SandboxExecError and fails on the previous code.

…th too

The managed sandbox path turned an exec that the provider reports as a
sandbox failure (an error_type other than timeout) into a plain
RuntimeError, which is classified legitimate and final. The direct
apptainer path already raises SandboxExecError for the same event, so
evaluation routes it to provider_unavailable and retries it. Both paths
now agree; training still keeps legitimate.

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

Copy link
Copy Markdown
Contributor Author

Closing this version to consolidate review on #5072 (failure reporting) and #5073 (saved-state recovery). This does not mean those PRs implement every proposal from this earlier stack; scoring policy and persistence follow-ups remain separate.

@AdamRajfer AdamRajfer closed this Oct 26, 2026

This branch was previously deployed

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

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants