Skip to content

fix(rollout_health): see the failed calls and empty turn lists it was skipping - #3427

Merged
wprazuch merged 3 commits into
mainfrom
wprazuch/rollout-health-sees-failed-calls
Oct 2, 2026
Merged

wprazuch merged 3 commits into
mainfrom
wprazuch/rollout-health-sees-failed-calls

Conversation

@wprazuch

@wprazuch wprazuch commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

A rollout whose model calls all failed reports 0 healthy, 0 unhealthy, N unobserved and reward 0 — indistinguishable from a model that scored zero. The gate already knew: rollout_health.py computes ended_on_error for the digest and reports it as a statistic, while the verdict stays unobserved.

before after
invalid-key run 0 healthy, 0 unhealthy, 2 unobserved 0 healthy, 2 unhealthy, 0 unobserved

Two independent causes.

Failed calls cannot bind. Every per-call check reads bound calls, and binding resolves a reference by (model_ref, response_id) or model_call_id — a failed call has none of them. Adds rollout_ended_on_failed_model_call, reading the captured calls directly. It shares _ended_on_failed_call with the existing ended_on_error statistic, so the two cannot disagree. Reading the capture rather than a reference also covers the 45 of 47 agents that publish no trajectory.

Only the last call is judged. The capture records every HTTP attempt, so flagging any failed call would turn ordinary retries unhealthy.

rollout_missing_agent_turns was skipped when turns were missing. turns_unavailable was appended whenever the turn list was empty, and the AGENT_TURNS gate then dropped the check. Now recorded only when no producer published a trajectory, so an agent that publishes one and reports no turns produces a finding; agents that publish nothing stay unobserved.

Testing

End-to-end gym eval run, 2 tasks, observability on:

run agent before after
invalid key stock 0/0/2 unobserved 0/2 unhealthy/0
invalid key publishes trajectory (#3403) 0/0/2 unobserved 0/2 unhealthy/0
passing stock 0/0/2 unobserved unchanged
passing publishes trajectory (#3403) 2 healthy/0/0 unchanged

Also replayed over five stored rollouts from earlier real runs, two of which contain a genuine error_category: exception call mid-rollout followed by successful calls. Verdicts are byte-identical to main — the retry tolerance holds on real captured data, not just a fixture.

6 unit tests, each mutation-checked: the invariant was broken in the source and the test confirmed to fail. pre-commit --all-files clean. tests/unit_tests/ has 13 pre-existing sandbox-provider failures, identical on unmodified main.

Context

Found while closing the agent-side half in #3403. That PR makes verifiers_agent publish the evidence; this one lets the gate act on evidence it already had. They are independent — each is useful alone.

Real impact: a 600-task run had 75 failed calls across 61 rollouts, 25 of which ended on error, all reported as ordinary zeros.

@copy-pr-bot

copy-pr-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

@yaoyu-33 yaoyu-33 added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters bug Something isn't working complexity:medium Single-domain change with interacting parts or a moderate review surface needs-review PR is ready for code review and waiting on a reviewer labels Sep 16, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 17, 2026
Comment thread nemo_gym/health/checks.py Outdated
stays healthy -- the signal is that the rollout ENDED on a failure, which is
what makes its reward indistinguishable from a genuine zero.
"""
calls = _normalized_trajectory_calls(trajectory)

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.

These calls also include unowned auxiliary/judge requests. In a local fixture, policy 403 followed by an unrelated auxiliary 200 changes the verdict from unhealthy to unobserved, hiding the policy failure. Could recovery be determined within the same policy/invocation chain instead of across all captured calls?

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.

@yaoyu-33 Fixed. Calls are now grouped by model_ref and each model's own last
call is judged, so a judge 200 landing after a policy 403 no longer reads as the
policy recovering. One finding per model, naming which.

One thing I could not do as literally asked. Scoping to the policy chain needs
to know which model is the policy, and when every policy call fails there is
nothing that says so - a failed call has no response id, so the trajectory
references nothing, and the schema carries no policy identity otherwise.

Comment thread nemo_gym/health/checks.py Outdated

def _ended_on_failed_call(calls: Sequence[dict[str, Any]]) -> bool:
"""Whether the rollout's last observed model call failed."""
return bool(calls and _is_failed(calls[-1]))

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.

The canonical list is not necessarily chronological. If the producer already contains the successful retry, _build_trajectory_record() merges capture [failed attempt, successful retry] into [successful retry, failed attempt]. I reproduced an unhealthy verdict despite the retry succeeding. Could we resolve execution order before relying on the last element?

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

@yaoyu-33 yaoyu-33 added waiting-on-customer Waiting on the original author to respond and removed needs-review PR is ready for code review and waiting on a reviewer labels Sep 19, 2026
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 21, 2026
@wprazuch

wprazuch commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f3b26b5

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 1, 2026 10:31
… skipping

Two blind spots made a run whose model calls all failed report
`0 healthy, 0 unhealthy, N unobserved` with reward 0 -- indistinguishable from a
model scoring zero. Measured on a run with an invalid API key: six `403 auth`
rows in the capture, nothing flagged.

Every per-call check reads bound calls, and binding resolves a reference by
`(model_ref, response_id)` or `model_call_id`. A failed call comes back with
none of them, so it can never bind. Adds `rollout_ended_on_failed_model_call`,
which reads the captured calls directly. Only the last call is judged, so a
failure the client retried successfully stays healthy; reading the capture
rather than a reference also covers the 45 of 47 agents that publish no
trajectory.

`turns_unavailable` was appended whenever the turn list was empty, and the
AGENT_TURNS gate then skipped `rollout_missing_agent_turns` -- the check exists
to catch a rollout with no turns, and was disabled in exactly that case. Now
recorded only when no producer published a trajectory at all, so an agent that
publishes one and reports no turns produces a finding. Agents that publish
nothing stay unobserved as before.

Same invalid-key run, before and after:

  before: 2 checked, 0 healthy, 0 unhealthy, 2 unobserved
  after:  2 checked, 0 healthy, 2 unhealthy, 0 unobserved

Verified on a passing run too, with both a publishing and a non-publishing
agent: no verdict changed.

Signed-off-by: Wojciech Prazuch <[email protected]>
The digest already computed `bool(calls and _is_failed(calls[-1]))` and reported
it as the `ended_on_error` statistic while the verdict stayed unobserved -- the
gate knew the rollout ended on a failure and said nothing. The new check repeated
that expression; both now call `_ended_on_failed_call`, so the statistic and the
finding cannot disagree.

Signed-off-by: Wojciech Prazuch <[email protected]>
Two problems with judging the last element of the canonical call list.

The list is not chronological: _build_trajectory_record puts producer calls
first and appends unmatched capture rows, so a successful retry can precede
the attempt it retried and the rollout reads as ending on a failure. Order by
started_at instead. A chain that mixes failures and successes and carries no
timestamps cannot be ordered, so it produces no finding.

The list also spans every model: a judge request landing after a failed policy
call read as the policy recovering. Group by model_ref and judge each model's
own last call, one finding per model.

Signed-off-by: Wojciech Prazuch <[email protected]>
@wprazuch

wprazuch commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test faba34d

@wprazuch
wprazuch enabled auto-merge October 1, 2026 10:45
@wprazuch
wprazuch added this pull request to the merge queue Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 1, 2026
@wprazuch
wprazuch added this pull request to the merge queue Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit b2611bf Oct 2, 2026
44 checks passed
@wprazuch
wprazuch deleted the wprazuch/rollout-health-sees-failed-calls branch October 2, 2026 11:23
khazic pushed a commit to khazic/Gym-lao that referenced this pull request Oct 5, 2026
A model call that fails and is then retried successfully can still make
a rollout unhealthy because `model_call_failed` flags every bound
failure. Remove that check and use `rollout_ended_on_failed_model_call`
from NVIDIA-NeMo#3427 unchanged. Earlier failures remain in diagnostic counts.
Existing ignore settings using `model_call_failed` map to the retained
check.

Keep the explicit context-overflow exemptions from this follow-up to
NVIDIA-NeMo#3761: rejected requests do not trigger missing-token,
zero-completion-token, or runaway-generation findings. The vLLM adapter
records the rejection category with propagation enabled or disabled;
HTTP behavior is unchanged. A final rejection still counts as a failure
under the retained check. Its existing per-model semantics apply,
including to subagent and auxiliary calls.

No separate issue is needed for this focused follow-up. Rewards and
benchmark scores are unchanged.

Validation:

- `python -m pytest tests/unit_tests/test_rollout_health.py
responses_api_agents/opencode_agent/tests/test_trajectory.py
tests/unit_tests/test_fern_docs_links.py --no-cov -q`: 173 passed, 17
subtests passed.
- `python -m pytest responses_api_models/vllm_model/tests/test_app.py -k
context_overflow_propagation_flag --no-cov -q`: 4 passed.
- `python -m pre_commit run --all-files`: passed.
- `cd fern && npm run check`: passed (0 errors, 1 warning).
- MiniSWE/Terminus observability tests are delegated to full server CI;
the combined local harness test command could not collect because
`minisweagent` is not installed in the core environment.
- [GitHub
CI](https://github.com/NVIDIA-NeMo/Gym/actions/runs/37276179587) on
rebased head `0dbbd3772`: passed, including the core coverage gate and
all eight server shards. No unresolved CodeRabbit review threads.

Live-model rollout: N/A. Changes are limited to postprocessing and
captured error metadata; inference and agent execution behavior are
unchanged.

Signed-off-by: Giulio Lovisotto <[email protected]>

This branch was previously deployed

1 inactive deployment
public — faba34de Deployed Oct 1, 2026 by copy-pr-bot[bot] via release / finalize / notify #4094
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 complexity:medium Single-domain change with interacting parts or a moderate review surface waiting-on-customer Waiting on the original author to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants