Skip to content

feat(rollout): keep captured model calls on failure records - #4292

Closed
giuliolovisotto wants to merge 1 commit into
mainfrom
glovisotto/failure-record-model-calls
Closed

giuliolovisotto wants to merge 1 commit into
mainfrom
glovisotto/failure-record-model-calls

Conversation

@giuliolovisotto

Copy link
Copy Markdown
Contributor

What changed

When an agent's /run fails (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, as ng_model_call_capture.

  • Metadata only: status, error category, timing and token counts. Request and response bodies stay in the capture store.
  • No trajectory, no ng_perf, no token-ID capture. A failure record still has no reward and no response.
  • Rows the dispatch budget never started (_ng_dispatch_drained) get nothing, since they made no calls.
  • If the rollout made no calls, calls is empty and a model_call_capture_no_records gap says so.

Why

Collection skipped the capture merge for every no-result failure, on the grounds that no rollout happened. But an agent whose /run fails 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

  • Additive. Failure rows gain one key.
  • Resume (_load_from_cache) and judge-failed re-verification read failure rows by class and index, and ignore the new key.
  • Aggregation already strips ng_model_call_capture before scoring (_fetch_agent_metrics), so failure rows counted as zero (count_failure_classes_as_zero) are unaffected.
  • Size: the failures file grows by the call metadata of each failed rollout.
  • feat(eval): persist failures and resume unfinished evaluations #3302 reshapes failure records. Whichever PR lands second needs a small rebase.

Issue

No public issue. Rules for rollout failures: #2750.

Validation

  • New test test_run_from_config_keeps_captured_calls_on_a_failure_record:

    • a raising agent's failure row carries the call's metadata, without payloads or a trajectory;
    • a drained row gets nothing.

    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_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 fix(health): skip failed calls without a generation in token-count checks #4229 and passed on CI.

  • pre-commit run on 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_error scenario with NOOA or Simple Agent. It changes only what the failures file records, not scores or rollouts.

🤖 Generated with Claude Code

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]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 9, 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.

@giuliolovisotto giuliolovisotto added the area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters label Oct 9, 2026
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]>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant