Repository navigation
feat(health): count failed calls with unknown usage and state the token-total rule - #4287
Merged
Merged
Conversation
|
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. |
…en-total rule Health gains run.stats.model_call_errors.usage_unknown: failed calls with no finished response and no token counts. The token checks skip these calls (#4229), so any tokens the server spent on them were counted nowhere. The docs now state the token-total rule: response usage counts tokens from responses that finished, so a rollout whose every call was rejected reports zero, and only lost usage of a finished response leaves the comparison unobserved. The _is_failed_attempt docstring no longer claims a skipped call generated nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Giulio Lovisotto <[email protected]>
giuliolovisotto
force-pushed
the
glovisotto/fea-460-failed-call-evidence
branch
from
October 9, 2026 13:52
36ea9b3 to
f7ff204
Compare
giuliolovisotto
marked this pull request as ready for review
October 9, 2026 14:05
Contributor
giuliolovisotto
enabled auto-merge
October 9, 2026 14:16
lafrancef
approved these changes
Oct 9, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37963368768 |
ananthsub
pushed a commit
to ananthsub/Gym
that referenced
this pull request
Oct 12, 2026
The main/merge-queue [run 38069955548](https://github.com/NVIDIA-NeMo/Gym/actions/runs/38069955548/job/114266522363) completed all probe jobs but failed the P0 measurement: Codex 0/7, OpenCode 5/7, Pi 6/7, Hermes 7/7. The reporter is correctly exposing retained-evidence failures. This integrates the applicable existing fixes with the current native-session adapters: - Port NVIDIA-NeMo#4047's temporary Codex session reader and bounded 429 forwarding retries, including its timeout result preservation. Keep invocation ownership, original tool IDs/arguments/results and shell exit status before removing the temporary session. Native sandbox-session execution remains as implemented on main. - Port the shell-outcome portion of NVIDIA-NeMo#4046 into the shared OpenCode artifact parser. Nonzero exits fail; absent/null/invalid exits remain unknown. Preserve native turn semantics, per that PR's review discussion. - Require one terminal-400 token reconciliation outcome: `healthy`, with a known zero aggregate for zero finished responses. Preserve Hermes' actual runtime counters when early error returns omit them. Failed model termination still must be `unhealthy`; missing aggregate usage and incorrect nonzero totals fail. The health engine is unchanged. The token-total rule follows merged NVIDIA-NeMo#4287. This deliberately does not revive closed NVIDIA-NeMo#4286's proposal to accept either healthy or unobserved. No separate issue is necessary: the linked run is the reproduction, and NVIDIA-NeMo#4046/NVIDIA-NeMo#4047 plus FEA-461 track the underlying gaps. Existing PRs are left intact for author/maintainer coordination. Codex work is attributed to Frederic Lafrance and Giulio Lovisotto; OpenCode's nonzero-exit correction derives from Frederic's patch. Validation on macOS arm64 / Python 3.13.14, OpenAI SDK 2.44.0; base `728ac3395d1bc26b995b03ffb9aa6f0362b768ea`: - **2,050 passed, 113 skipped** in the final selected suite; skips are platform/optional-runtime cases. - Full `pre-commit run --all-files` and staged/working-tree `git diff --check` pass. Commit has DCO sign-off. - **28/28 conformance scenarios pass** across all four pinned harnesses; final Codex-only rerun is also 7/7. - Real `nvidia/nemotron-3-super-120b-a12b` model smoke: Codex, OpenCode and Hermes each have four captured model calls, one failed tool followed by two successful tools, and reward **1.0**. A local verifier independently checked the file contains `391` and the final answer contains `CONFORMANCE_DONE`. OpenCode's initial attempt was denied by its native external-directory permission; the rerun explicitly granted only the smoke's temporary artifact directory. Both attempts are retained. Exact test selection: ```bash python -m pytest --import-mode=importlib -q -o addopts='' -o log_cli=false \ scripts/harness_conformance/tests tests/unit_tests/harness_capabilities \ tests/unit_tests/test_harness_conformance_ci.py tests/unit_tests/test_harness_conformance_checks.py \ tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_rollout_health.py \ responses_api_agents/codex_agent/tests responses_api_agents/opencode_agent/tests \ responses_api_agents/opencode_sandboxed_agent/tests responses_api_agents/pi_agent/tests \ responses_api_agents/hermes_agent/tests python scripts/run_harness_conformance.py --harness codex --harness opencode --harness pi --harness hermes --output <NEW_DIRECTORY> ``` Runtime pins: Codex 0.144.4, OpenCode 1.17.11, Pi 0.80.2, Hermes 26bb847a. Source imports were verified against the repair worktree; an early mixed-source/SDK setup attempt was discarded. The final Codex suite was rerun after adding malformed-record protection. Compatibility: correlated local Codex runs temporarily persist a session and can retry 429 twice; OpenCode shell-status evidence becomes accurate; terminal-rejection aggregate usage is strict. No dataset, reward policy, model settings, or benchmark-score claim changes. These probes qualify local adapter evidence; remote sandbox lifecycle qualification, Linux-only skipped tests and full repository CI remain separate. CI classification is **full**, because runner/shared test paths changed. No CI trust-gate comment was posted. Follow-up validation (`daab232a8`): Codex returns observations and timeout state directly instead of encoding synthetic stdout events. All 227 Codex tests passed (45 skipped), all-file pre-commit passed, and all seven fresh Codex conformance scenarios passed. Retry behavior is unchanged. --------- Signed-off-by: yaoyu-33 <[email protected]> Signed-off-by: Giulio Lovisotto <[email protected]> Co-authored-by: Frederic Lafrance <[email protected]> Co-authored-by: Giulio Lovisotto <[email protected]>
This branch was previously deployed
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
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 fix(health): skip failed calls without a generation in token-count checks #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.
usagecounts tokens from model responses that finished.rollout_token_count_mismatchunobserved.It is stated in the custom-agent guide (
observability/rollout-evidence) and next to the check (evaluation/rollout-health)._is_failed_attemptdocstring. 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, #4286 accepts either verdict.
Split from
The failure-record half of the original #4287 is now a separate PR, because it needs reviewers from the rollout-collection side: #4292. The two PRs are independent and can merge in either order.
What stays the same
model_call_errorsfields are unchanged.Not done
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 fix(health): skip failed calls without a generation in token-count checks #4229 were cut before any byte arrived, and no harness is known to keep partial output.Issue
No public issue; follows #4229.
Validation
usage_unknownassertions in the fix(health): skip failed calls without a generation in token-count checks #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.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
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