Repository navigation
fix(health): stop flagging recovered model calls - #3769
Conversation
984e710 to
25a5da4
Compare
7554a0a to
9e73096
Compare
9e73096 to
13bfdcf
Compare
|
/claude review |
|
SHIP — no reliability concerns. Reviewed the rename of What's solid:
One deliberate behavior change to be aware of (not a defect): this narrows failure detection — an intermediate policy call that failed hard but was recovered (agent continued, final call succeeded) no longer flips a rollout to Validation note for the author: per the quality bar, confirm a representative real smoke rollout was inspected (not just the green unit tests) since this changes health-reporting behavior. |
|
/claude review |
|
SHIP — no reliability concerns. Reviewed the full diff and traced the capture→health data flow. This is a coherent, well-tested consolidation of Correctness points I verified:
Docs, reference table, and the three agent observability tests are all updated to match. 🤖 Generated with Claude Code |
Signed-off-by: Giulio Lovisotto <[email protected]>
8dead72 to
0dbbd37
Compare
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37282355529 |
…ecks (NVIDIA-NeMo#4229) ## What changed `model_call_missing_token_counts` and `model_call_zero_completion_tokens` now skip a failed model call that produced no generation: a cancelled call or an HTTP error reply, which has no finish reason. `rollout_token_count_mismatch` no longer becomes unobserved because of such a call; it contributes zero tokens to the sum. ## Why A failed attempt has no usage to account for, so missing token counts on it say nothing about token accounting. Before this change, a rollout that hit a failed call and then retried successfully was still unhealthy because of the failed attempt's null counts. NVIDIA-NeMo#3769 had already stopped calling these rollouts "ended on a failed call". Observed on a Terminal-Bench 2.1 run with Terminus 2: each model call has a 600 s client limit, after which the call is cancelled and retried. 373 cancelled calls across 183 rollouts; about 115 of those rollouts recovered and were unhealthy only through `model_call_missing_token_counts`. Controlled conformance scenarios show the same pattern for HTTP 429/500 retries in OpenCode and Codex. ## What stays the same - A rollout that ends on a failed call stays unhealthy through `rollout_ended_on_failed_model_call` (NVIDIA-NeMo#3769). Whether a rollout recovered is decided there, per model and in start-time order; this change does not infer retries. - A failed call that did generate (it has a finish reason) keeps every check. This preserves NVIDIA-NeMo#3769's rule that an empty length-limited generation without explicit overflow evidence keeps its quality findings (`test_uncertain_or_real_generations_keep_quality_checks` is unchanged). - A 2xx body that capture could not parse (`capture_parse_error`) is a capture defect, not a failed call, and stays checked. - A missing count on a successful call is still a finding. - `run.stats.model_call_errors` still counts every failed attempt. Capture stores an HTTP error reply's JSON body as the call's `response`, so the rule keys on the missing finish reason rather than on a missing response. ## Issue No public issue; this follows NVIDIA-NeMo#3769. ## Validation - `pytest tests/unit_tests/test_rollout_health.py responses_api_agents/opencode_agent/tests/test_trajectory.py`: 169 passed. - New tests cover a cancelled, HTTP 429 and HTTP 500 attempt followed by a successful call (healthy, with missing or zero counts), a rollout ending on each of them (unhealthy for `rollout_ended_on_failed_model_call` only), and an unparsed capture body (still flagged). Nine of the ten fail without the fix; the `capture_parse_error` test pins unchanged behaviour. - `test_invocation_bound_failed_call_remains_evaluable` (OpenCode) expected a token finding on a 503 without a generation; it now asserts the final-call finding and no token findings. - `scripts/harness_conformance/scenarios.py`: the `retry_429` and `retry_500` scenarios now expect a healthy rollout. `model_error` keeps `rollout_ended_on_failed_model_call` and an unobserved token reconciliation, and no longer expects a missing-token finding. `pytest tests/unit_tests/harness_capabilities` passes with these expectations. - `pytest tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_cli_main.py`: 654 passed. - `pre-commit run` on the changed files: passed. - Not run locally: the Terminus 2 and mini-SWE observability tests (their dependencies are not installed here). Their expectations only require the token checks to be evaluated, which they still are. ## Rollout evidence Health-only rerun of the saved Terminal-Bench 2.1 run with Terminus 2 described above: 712 rollouts, 89.3 GiB. No model compute: the same saved records were judged three times. Fields that no health check reads (request payloads, turn inputs, raw capture) were dropped to make the file portable. Health at the run's own Gym commit (`832d1cb`) still reproduces the run's original result exactly, so the trimming did not change any verdict. | | main (`ea8c013f4`) | this PR | |---|---:|---:| | unhealthy | 183 | **68** | | unobserved | 529 | 644 | | healthy | 0 | 0 | | `rollout_ended_on_failed_model_call` findings | 68 | 68 | | `model_call_missing_token_counts` findings | 373 | 0 | | `run.stats.model_call_errors` | 373 calls / 183 rollouts | unchanged | - **The 68 rollouts that ended on a cancelled call stay unhealthy.** They are the same 68, flagged only by `rollout_ended_on_failed_model_call`. - **The 115 that recovered are no longer unhealthy.** They become unobserved, not healthy, because their only open check is `rollout_token_count_mismatch`. This adapter does not link turns to model calls, so token reconciliation is unavailable, and the other 529 rollouts are unobserved for the same reason. - **No other rollout changed verdict.** The other 597 rollouts have the same verdict under main and this PR. ## Compatibility Health verdicts only: fewer `model_call_missing_token_counts` / `model_call_zero_completion_tokens` findings on failed attempts, and fewer `rollout_token_count_mismatch` unobserved results. Rewards, collection outputs and aggregate metrics are unchanged. 🤖 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]>
A model call that fails and is then retried successfully can still make a rollout unhealthy because
model_call_failedflags every bound failure. Remove that check and userollout_ended_on_failed_model_callfrom #3427 unchanged. Earlier failures remain in diagnostic counts. Existing ignore settings usingmodel_call_failedmap to the retained check.Keep the explicit context-overflow exemptions from this follow-up to #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).minisweagentis not installed in the core environment.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.