Skip to content

feat(health): flag failed harness tool calls; say when a resource limit explains missing turns - #5600

Merged
AdamRajfer merged 2 commits into
mainfrom
arajfer/sandbox-health-labels
Nov 4, 2026
Merged

AdamRajfer merged 2 commits into
mainfrom
arajfer/sandbox-health-labels

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Two rollout health findings for sandboxed agents. They change no scoring, retry or gate logic. Each finding marks its rollout unhealthy, so a run with an explicitly set --max-unhealthy-fraction can get a different result from that criterion.

rollout_tool_call_failed

A harness that cannot run a tool returns a fixed text to the model in place of the tool's result (today the coding agent's ripgrep execution failed). Such rollouts look like ordinary agent turns, so a run where search never worked was indistinguishable from one where the model chose not to search. The new check emits one finding per rollout with the number of tool outputs that open with a known harness tool-failure marker. A marker counts only from the tools known to return it (today OpenCode's built-in grep and glob), and a call the trajectory records as completed is not counted: a command that succeeded can print the same text, for example when it reads a log. A tool that ran and reported an error of its own is not counted either. New markers go into _TOOL_FAILURE_MARKERS with their producing tools once a harness is known to return one.

Resource limit on rollout_missing_agent_turns

When a rollout has no agent turn with model activity, the finding stays. If the record carries a sandbox_resource_limit (Terminal-Bench 4 writes it when the provider ended the sandbox at a memory or storage limit), the detail now also says expected_absence: sandbox_resource_limit:<resource>, so a sandbox killed at its limit is told apart from an agent that never produced a turn.

The rollout-health page lists both.

Validation

  • A regression test for a completed bash call whose output quotes ripgrep execution failed (no finding), next to a failed grep call (counted) and a failed bash call with the marker (not counted).
  • New tests for both findings; with checks.py at main they fail, and with this change they pass (351 tests across the rollout-health, evaluation-health and harness health tests).
  • Full unit suite: the same failure set as main.
  • ruff check and format, import-linter: clean.

🤖 Generated with Claude Code

…it explains missing turns

Two rollout health findings, with no scoring or retry change:

- `rollout_tool_call_failed`: one finding per rollout counting the tool
  outputs that open with the text a harness returns when a tool could not
  run at all (today `ripgrep execution failed`). A tool that ran and
  reported its own error is not counted.
- `rollout_missing_agent_turns` keeps its finding, and its detail now names
  the sandbox resource limit (`expected_absence`) when the record carries a
  `sandbox_resource_limit`, so a run that ended at a memory or storage limit
  is told apart from one that never produced a turn.

The rollout-health page lists both.

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

Copy link
Copy Markdown
Contributor Author

/ok to test e3c6732

@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

LGTM — no concerns found. I reviewed all three changed files and traced tool-output projection, resource-limit records, and health-report consumers. The new findings preserve the existing reward, retry, and acceptance-gate behavior.

Static review only; I couldn't execute tests in this read-only environment.

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.

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

Two small changes before landing:

  1. Do not let output text override an explicit successful tool outcome. _rollout_tool_call_failed currently ignores status and tool_name. I reproduced a bash call with status="completed" and output ripgrep execution failed: example from a log file being reported as rollout_tool_call_failed, making the rollout unhealthy. A successful command reading a log can legitimately return that text. Please exclude explicitly completed calls from this failure detection and add a regression test for this case; constrain the marker to its known producer where appropriate.

  2. Clarify the health-gate effect. The new finding does not change rewards or retry decisions, but it marks the rollout unhealthy and therefore contributes to an explicitly configured --max-unhealthy-fraction gate. Please state that in the docs and adjust the PR description's “no gate change” wording to distinguish unchanged gate logic from a potentially changed gate result.

The incremental coverage and the annotation-only missing-turn change are fine. All 351 focused rollout-health, evaluation-health and harness-capability health tests passed at this head. The false-positive case above was checked separately.

A command that ran and succeeded can print the harness tool-failure
marker, for example when it reads a log, so `rollout_tool_call_failed`
no longer counts a call the trajectory records as `completed`.

The rollout-health page now says the finding marks the rollout
unhealthy, so it counts toward `--max-unhealthy-fraction` when that
criterion is set, while the gate logic itself is unchanged.

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 10efcdb

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

Done, both in the latest commit. Calls recorded as completed are excluded, and the marker now counts only from the tools that return it (OpenCode's grep and glob). Your case, a completed bash call quoting the text, is now a regression test. The docs and the description now say the gate logic is unchanged, but a run with --max-unhealthy-fraction set can get a different result.

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

Both review points are addressed: explicitly completed tool calls are excluded, marker matching is restricted to the producing tools, and the docs explain the effect on an explicitly configured unhealthy-fraction gate. The regression test covers the reported false positive. Re-ran the focused health suites: 352 passed. LGTM.

@giuliolovisotto
giuliolovisotto added this pull request to the merge queue Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41888803470

@giuliolovisotto
giuliolovisotto removed this pull request from the merge queue due to a manual request Nov 4, 2026
@AdamRajfer
AdamRajfer added this pull request to the merge queue Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41889292519

Merged via the queue into main with commit 6bb866a Nov 4, 2026
62 of 66 checks passed
@AdamRajfer
AdamRajfer deleted the arajfer/sandbox-health-labels branch November 4, 2026 19:01

This branch was previously deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants