Repository navigation
feat(rollout): keep captured model calls on failure records - #4292
Closed
giuliolovisotto wants to merge 1 commit into
Closed
giuliolovisotto wants to merge 1 commit into
giuliolovisotto wants to merge 1 commit into
Conversation
A harness that raises instead of returning left only a failure record, and the model calls it made before failing were dropped: collection skipped the capture merge for every no-result failure. It now attaches the calls' metadata (no payloads, no trajectory) to agent_run_error, agent_request_failed and environment-server failure rows. Drained rows never started and stay bare. Aggregation already strips ng_model_call_capture, so failure rows counted as zero are unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Giulio Lovisotto <[email protected]>
|
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. |
ehosseiniasl
pushed a commit
to ehosseiniasl/Gym
that referenced
this pull request
Oct 9, 2026
…en-total rule (NVIDIA-NeMo#4287) ## What changed - **New run statistic `run.stats.model_call_errors.usage_unknown`.** It counts failed calls that returned no finished response and carry no token counts. Since NVIDIA-NeMo#4229 the token checks skip these calls, so any tokens the server spent on them (a cancelled or timed-out call may have generated before it was cut) were not counted anywhere. - **Docs: the token-total rule.** - The agent's top-level response `usage` counts tokens from model responses that finished. - A rollout whose every call was rejected reports usage of zero, not missing usage. - Missing usage means a finished response's usage was lost, and only that makes `rollout_token_count_mismatch` unobserved. It is stated in the custom-agent guide (`observability/rollout-evidence`) and next to the check (`evaluation/rollout-health`). - **`_is_failed_attempt` docstring.** It no longer claims a skipped call generated nothing; it means the client got no finished response. ## Why The same rejected model call leaves different evidence depending on the harness. In the conformance scenario's scripted HTTP 400, Pi and OpenCode report the agent's usage as zero, while Hermes, NOOA and Simple Agent leave it missing. Health therefore gives different token verdicts for the same failure: healthy for the first group, unobserved for the second. This PR writes down one rule that harness adapters and the conformance scenario can target. Per-harness fixes and the strict conformance expectation follow separately; until then, NVIDIA-NeMo#4286 accepts either verdict. ## Split from The failure-record half of the original NVIDIA-NeMo#4287 is now a separate PR, because it needs reviewers from the rollout-collection side: NVIDIA-NeMo#4292. The two PRs are independent and can merge in either order. ## What stays the same - No health verdict changes: the token checks behave exactly as after NVIDIA-NeMo#4229. - The existing `model_call_errors` fields are unchanged. ## Not done - **Re-applying the token checks to a cancelled stream that had already delivered output.** The only "output arrived" signal capture records is the time to the first byte. In Responses-API streams the first event (`response.created`) arrives before any token is generated, so this would flag recovered retries again. All 373 cancelled calls in the Terminal-Bench 2.1 run that motivated NVIDIA-NeMo#4229 were cut before any byte arrived, and no harness is known to keep partial output. ## Issue No public issue; follows NVIDIA-NeMo#4229. ## Validation - `usage_unknown` assertions in the NVIDIA-NeMo#4229 health tests: counted for a skipped attempt, and not for a body capture could not parse. - `pytest tests/unit_tests/test_rollout_health.py tests/unit_tests/test_rollout_collection.py tests/unit_tests/harness_capabilities`: 760 passed. - **Full `tests/unit_tests` locally, before the split:** 7554 passed, 25 failed plus 1 collection error. None are in the changed areas: they are sandbox, telemetry, dataset and exporter tests that need dependencies or services not available locally. The same set failed locally for NVIDIA-NeMo#4229 and passed on CI. - `pre-commit run` on the changed files: passed. ## Rollout evidence N/A: a new run statistic and documentation only. No health verdict, check or rollout output changes, so there is nothing for a rollout to exercise. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Giulio Lovisotto <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
What changed
When an agent's
/runfails (agent_run_error,agent_request_failed) or its environment server fails, rollout collection now attaches the rollout's captured model calls to the failure record in<output>_failures.jsonl, asng_model_call_capture.ng_perf, no token-ID capture. A failure record still has no reward and no response._ng_dispatch_drained) get nothing, since they made no calls.callsis empty and amodel_call_capture_no_recordsgap says so.Why
Collection skipped the capture merge for every no-result failure, on the grounds that no rollout happened. But an agent whose
/runfails has usually made model calls first. Some harnesses (NOOA, Simple Agent) raise when the model rejects a request instead of returning a rollout. For them the failure record was the only artifact, and it showed that the agent raised but not that a model call came back as, for example, HTTP 400.Capture already files every call under the rollout's ID whatever the harness does, so attaching them in collection keeps this evidence for every harness without per-adapter changes.
Split from
This is the failure-record half of #4287, split out because it needs reviewers from the rollout-collection side. The two PRs are independent and can merge in either order.
Compatibility
_load_from_cache) and judge-failed re-verification read failure rows by class and index, and ignore the new key.ng_model_call_capturebefore scoring (_fetch_agent_metrics), so failure rows counted as zero (count_failure_classes_as_zero) are unaffected.Issue
No public issue. Rules for rollout failures: #2750.
Validation
New test
test_run_from_config_keeps_captured_calls_on_a_failure_record:It fails without the change.
pytest tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_rollout_health.py: 542 passed.Full
tests/unit_testslocally, before the split: 7554 passed, 25 failed plus 1 collection error. None are in the changed areas: they are sandbox, telemetry, dataset and exporter tests that need dependencies or services not available locally. The same set failed locally for fix(health): skip failed calls without a generation in token-count checks #4229 and passed on CI.pre-commit runon the changed files: passed.Rollout evidence
Not yet: no real failed rollout has been collected with this change. A natural candidate is the harness conformance
model_errorscenario with NOOA or Simple Agent. It changes only what the failures file records, not scores or rollouts.🤖 Generated with Claude Code