Repository navigation
fix(health): preserve provider repetition termination - #5975
Conversation
Accept the known vLLM repetition finish reason using the SDK stop category and retain the native termination cause across conversion, streaming and capture. Explicit repetition remains unhealthy even with partial usable output, while ordinary completion status and unknown-reason validation stay intact. Validate the public-tree patch with 1491 affected tests, all-files pre-commit and Fern docs checks. This passive correction enables no detector and changes no sampling, budgets, grading, retries or health threshold. Signed-off-by: Martyna Patelka <[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. |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE — two RISK findings and one documentation NOTE.
Repetition evidence is still lost through the supported Messages endpoint, and an unrelated call with a missing response can suppress an otherwise conclusive repetition finding. The check catalog also needs to describe the new condition.
I inspected all 13 changed files and their directly affected conversion, streaming, capture, and health paths, then consolidated the three delegated reviews. This was a static review; I couldn't independently execute the reported tests.
Inline comments (escaped v1):
-
nemo_gym/models/anthropic_converter.pyline 535: RISK — Preserve repetition evidence through the Messages endpoint.The new normalization lets a stock choice with
finish_reason="repetition",stop_reason="repetition_detected", and partial answer text reach the supported/v1/messagesroute. However, the shared Messages handler passes the converted Responses reply through this fixed mapping, which drops both native fields. The served and captured message has onlystop_reason="end_turn"; the adapter's execution record also records the normalizedstop. Consequently, an exactly bound call with usable partial output produces neither a runaway finding nor a response fault. Chat and Responses retain the cause, but Messages clients lose it in both render modes.Could you preserve the optional native fields without replacing the ordinary Anthropic stop reason? A small correction at this return is:
payload = message.model_dump(mode="json", exclude_none=True) for field in ("native_stop_reason", "native_finish_reason"): value = getattr(response, field, None) if value is not None: payload[field] = value return payload
The required dependent change is to retain those same fields in the Messages SSE reconstructor's allowlist:
message = { k: msg[k] for k in ("id", "type", "role", "model", "stop_reason", "native_stop_reason", "native_finish_reason") if msg.get(k) is not None }
The Messages SSE synthesizer already copies the complete message shell. These changes would therefore keep the evidence in both JSON capture and reconstructed SSE capture, where the health helper already recognizes top-level native fields. Preserve output, usage, and the existing
end_turn/tool_use/max_tokens/refusalmapping; don't substitute a Chat stop cause into Anthropic'sstop_reason.Proposed acceptance, not executed: use a fake vLLM backend returning the stock choice above, request the correlated
/v1/messagesroute withstream=falseandstream=true, and inspectCaptureStore. Both captures should retain the two native causes and partial text; after binding the call in a saved rollout, expect one runaway finding and that call inresponses.faulted. Also cover repetition finish evidence without a stop cause and a repetition stop with ordinaryfinish_reason="stop". For ordinary stops, preserve integer0, omit absent native fields, and produce no repetition finding. Retain the existing mapping assertions: tool output maps totool_use, output limits tomax_tokens, and content-filter refusals torefusal. Verify the suggested code before adopting it. -
nemo_gym/rollouts/rollout_health.pyline 259: RISK — Don't let an unrelated missing response hide explicit repetition evidence.With two exactly bound calls—
repeatcontainingresponse={"output_text":"kept","native_stop_reason":"repetition_detected"}, andunknowncontainingfinish_reason="length", response=None—thiscontinueskips the entire runaway check. The new repetition branch never runs, so the rollout isunobservedrather thanunhealthydespite conclusive evidence forrepeat. This affects multi-call saved artifacts; the single-call repetition tests pass because they don't encounter this guard.Could you retain the uncertainty marker while evaluating calls with conclusive evidence? The smallest complete correction has two parts:
- Here, retain
unobserved.append(spec.id)but remove thiscontinue. - In
_model_call_runaway_generation, require a saved response only in the length branch:
if _is_repetition_stop(call) or ( not _is_length_refusal(call) and call.get("finish_reason") in _LENGTH_LIMIT_FINISH_REASONS and call.get("response") is not None and not _response_has_usable_output(call.get("response")) )
The invariant is that unknown length-call output must neither fabricate a finding nor hide another call's explicit repetition evidence.
Proposed acceptance, not executed: save the two calls above with distinct IDs, matching turn references, positive token counts, and matching aggregate usage. Expect exactly one runaway finding for
repeat, detail containing only the observed repetition stop, the check also listed as unobserved forunknown, and verdictunhealthy. Retain the existing missing-body assertion: a lone length call without a body remains unobserved with no runaway finding. Retain the length-refusal cases: a refused call stays exempt while a separate saved reasoning-only length call is flagged. Usable length-limited answers/tool calls must remain exempt; repetition-stopped answers/tool calls must remain flagged. Verify the suggested change before adopting it. - Here, retain
-
fern/versions/latest/pages/evaluation/rollout-health.mdxline 136: NOTE — Suggest updating the check catalog to include repetition.This row still defines runaway generation solely as a length-limited call without an answer/tool call, while the new implementation and new section also classify explicit repetition stops with usable output. Someone consulting the catalog alone gets the wrong condition.
Suggested replacement:
| `model_call_runaway_generation` | Policy-model call | An exactly bound policy-model call explicitly stopped for repetition, even with a saved answer or tool call, or reached its output limit and its saved response holds no answer and no tool call. Reasoning alone does not count as usable output; upstream length refusals are excluded. |Static acceptance: confirm the row distinguishes explicit repetition from ordinary length termination, retains exact binding and the reasoning-only rule, and doesn't imply that ordinary stops or usable length-limited answers/tool calls are runaway generations.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Keep existing complete-verdict requirements effective when a provider repetition cause is carried beside the SDK stop category. Preserve the exact repetition signals through SSE replay while keeping ordinary decoded receipts, frozen criteria, cache identity and retry rules unchanged. Add raw-provider regressions for the default chat path and both API endpoints. Final affected checks pass: 1495 core/model/health/stream tests, 55 False Statement, 102 FrontierScience and 305 Agentic IF tests; all-files pre-commit and docs checks pass. Signed-off-by: Martyna Patelka <[email protected]>
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — no eligible findings in this follow-up.
I verified that all three findings from review 5851405374 are fixed:
- Messages conversion and SSE capture reconstruction retain optional native termination evidence without replacing the standard Anthropic stop category, content or usage.
- Health evaluation now retains conclusive findings alongside missing-output uncertainty. The length branch requires a saved response, so unknown output doesn't manufacture a finding.
- The check catalog now distinguishes explicit repetition from length-limited responses without usable output.
I checked the relevant regression assertions, preservation cases and adapter-test collection path. I compared the subsequent changes with the previously reviewed tree and traced their directly affected paths; this wasn't a fresh whole-PR review. I found no introduced regression eligible above the historical moderate-impact ceiling.
This was static review. I couldn't execute tests or independently verify the reported validation, native CI results or downstream compatibility prerequisite. This approval doesn't clear the stated downstream merge hold.
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 findings-only review. Request a full review with /review reset=true.
Use the models, rollouts and trajectory exports for the six capture, health and record imports, as required outside the core library. Preserve all helper bodies, assertions, parameter cases and the private trajectory fixture import. The existing facade contract reproduces one failure before the import correction and passes all 865 cases after it. All 25 adapter regressions pass independently. Final validation passes 2444 affected runtime and API contract tests plus all-files pre-commit. No production behavior or coverage policy changes. Signed-off-by: Martyna Patelka <[email protected]>
|
Corrected the six adapter-test imports in The final eight-module run passed 2,444 tests, including all 865 public API contract checks and 1,579 runtime cases. The 25 adapter cases also passed independently. All-files checks passed; production code, coverage thresholds and exclusions are unchanged. The other 462 component tests retain unchanged source bindings. New-head native CI is required before merge; no aggregate coverage pass is inferred yet. The retained review history and dependent-consumer merge hold remain in effect. |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — no eligible findings in this follow-up.
I compared the adapter-test import changes with the previously reviewed tree and traced the public exports. The six imports resolve to the same underlying implementations. The 25 Messages integration cases retain their helpers, parameters and assertions.
The previously verified fixes remain intact: Messages conversion and SSE reconstruction preserve native termination evidence; the two-call health regression retains conclusive findings alongside missing-output uncertainty; and the catalog distinguishes repetition from length-limited unusable output.
This was a scoped follow-up, not a fresh whole-PR review. I found no introduced regression eligible above the historical moderate-impact ceiling. This was static review: I couldn't execute tests or independently verify the reported validation, native CI or downstream compatibility. This approval doesn't clear the PR's stated downstream merge hold.
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 findings-only review. Request a full review with /review reset=true.
AdamRajfer
left a comment
There was a problem hiding this comment.
🤖 Adam’s AI assistant
I reviewed this for Adam.
Approving. Accepting the stock repetition finish instead of failing validation is the right call: a model that loops is a model result and should be scored and flagged by health, not turned into a 500 and retried as an infra fault. The served status is unchanged, judges keep repetition-stopped replies out of scoring, and the new tests fail with the production changes reverted.
Two non-blocking notes. The "stop but not repetition" check now lives in five places (false_statement_judge/app.py:229, frontierscience_judge/app.py:301, agentic_if_realworld/benchmark/scoring.py:235, transport.py:110, checks.py:911); a shared helper would keep the next judge that checks only finish_reason == "stop" from silently accepting a repetition-stopped verdict. Also, recovery's response-failure causes (truncated/empty/malformed) don't count a repetition stop with usable text while health's faulted does; fine as a follow-up.
Please keep the merge hold until the downstream compatibility change you mention has landed.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43242110023 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/43250557678 |
Include main through 268faf9 after the reviewed provider-repetition health fix (NVIDIA-NeMo#5975) and Slurm allocation bookkeeping (NVIDIA-NeMo#6014) landed. The prior GitHub test-merge reference still used the preceding main revision. Preserve the WebArena layer and the dependent VisualWebArena ancestry. The upstream provider/core additions receive targeted compatibility checks and a rerun of the affected Web integration suites before publication; verification is recorded separately after this source integration. Signed-off-by: Jeff Peng <[email protected]>
…IDIA-NeMo#6093) * feat(eval): count repetition stops in the inspect's failure facts Since NVIDIA-NeMo#5975 Gym keeps vLLM's repetition stop as native_finish_reason "repetition" beside the SDK's "stop", and rollout health flags it. The inspect still could not see it: the evidence collector keeps only a fixed set of finish reasons and none of the response, so a call the serving engine stopped for repetition read as an ordinary "stop". The collector now flags each saved model call it finds stopped for repetition (a "repetition" finish reason or a "repetition_detected" stop reason), and gate_task.failures counts the policy's flagged calls and their rows as repetition_stops; the health verdict line names them when there are any. It is a fact, not a failure: the answer stays scored as produced, nothing is retried, and no detector is enabled. Signed-off-by: Adam Rajfer <[email protected]> * fix(eval): count only the policy's own repetition stops in deciding rows A judge served by the policy's own server sent its calls under the policy's model name, so a looping judge call counted as a policy repetition stop. Calls a verifier invocation owns (by call id, else by model and response id) are no longer counted. Both repetition_stops and output_budget_refits now read only the row that decides each scored trial (the last one saved for it), so an attempt a later one superseded is not counted twice. Signed-off-by: Adam Rajfer <[email protected]> --------- Signed-off-by: Adam Rajfer <[email protected]>
What does this PR do?
A stock vLLM repetition stop can use
finish_reason: "repetition"andstop_reason: "repetition_detected". Gym rejects that finish reason before health can inspect it, and several transport paths lose the optional stop cause.Normalize only the known repetition finish reason to SDK-compatible
stop, retainingnative_finish_reason. Preserve stop/finish evidence through conversion, completions translation, terminal Chat SSE and capture reconstruction. Health classifies explicit repetition as runaway and response-faulted even when partial text or tool output was retained.Preserve the optional native cause through Anthropic Messages JSON, SSE and persisted capture without changing the standard stop category, content or usage. When one call has missing output, retain conclusive runaway findings on other exactly bound calls and keep the missing-output uncertainty. A length limit alone does not prove unseen output was unusable. Update the health catalog to describe both explicit repetition and length-limit cases.
Keep complete-verdict checks effective in False Statement, FrontierScience and Agentic IF. A repetition-stopped judge reply must remain unfinished even when its SDK category is
stopand its partial output looks valid. Agentic IF SSE replay retains only the exact repetition signals; ordinary decoded receipts, frozen policy assets, cache identity and retry rules remain unchanged. Add stock-payload regressions for the default vLLM chat path and both API endpoints.The adapter-specific Messages integration replays live in the VLLM server suite, while generic Messages and zero-value capture checks stay in core. This preserves all route/capture/health assertions and keeps core coverage within its actual test scope. Server tests use the exported models, rollouts and trajectory facades; coverage thresholds and exclusions are unchanged.
The provider contract is documented in vLLM#35451, commit
25e02647c272eeb0ec076884d046816bdb86159e. This independently implemented, directly reproduced compatibility defect needs no separate issue.Validation
2,906 relevant tests passed on the final source, with component source hashes bound to the reviewed patch.
The model, types, converters, Messages transport, streaming, health and public API contract group passed 2,444:
The separate component runs passed:
python -m pytest resources_servers/false_statement_judge/tests/test_app.py -q: 55.python -m pytest resources_servers/frontierscience_judge/tests/test_app.py -q: 102.python -m pytest resources_servers/agentic_if_realworld/tests -q: 305.pre-commit run --all-filesandgit diff --checkpassed on the final test-ownership followup.make docs-checkpassed on the unchanged docs/source (zero errors and one warning). The final 2,444-test run includes 865 public API contract checks and all 1,579 runtime cases. The 25 adapter cases also passed independently; the other 462 component cases retain their exact source bindings. The direct CLI group validates process-pool cases without the initial stdin launcher's serial fallback.Retained negative controls reproduce rejected stock payloads, default-chat failures (4 cases), lost metadata and accepted incomplete judge replies. Agentic IF produced 12 genuine failures while all 13 ordinary metadata/cache controls passed. Additional retained negative controls expose lost Messages metadata (20 failures with 4 absent-metadata controls) and masked conclusive health findings (3 failures with 1 usable-output control). Tests exercise real SDK validation, endpoints, HTTP streaming/capture, SSE replay, raw-receipt binding and completion checks; mocking stays at external provider/config boundaries. Test-quality and independent source reviews passed.
Native CI and actual independent approval remain required before merge.
Rollouts
N/A: this is a provider-type, metadata and completion-check compatibility correction. No environment, agent or generation configuration changes are introduced. Controlled provider replays exercise the explicit termination branches.
Compatibility and benchmark impact
Retain text, usage and ordinary provider completion status. Unknown finish reasons remain invalid. Preserve the length/refusal/answered-overflow behavior from #4921. Consumers requiring complete verdicts must inspect the retained repetition cause in addition to the SDK category.
No repetition detector is enabled. Sampling, budgets, grading criteria, retry policies and health thresholds are unchanged. This does not prevent or repair model reasoning loops; it makes explicit provider stops observable and keeps unfinished verdicts out of scoring.
Review and CI can proceed. Hold merge until the dependent downstream consumer compatibility update is confirmed landed.
Checklist