Repository navigation
fix(hermes): classify exhausted continuations and reasoning budgets as output limits - #6204
Merged
yaoyu-33 merged 3 commits intoNov 17, 2026
Conversation
Signed-off-by: yaoyu-33 <[email protected]>
Pinned Hermes also ends a run with `partial: true` and "Model used all output tokens on reasoning with none left for the response. ..." when a length stop leaves no visible text, which is the usual shape for a reasoning model cut off mid-reasoning. Classify it as `agent_limit` beside the exhausted-continuation case. Keep every Hermes output-limit error in one `_OUTPUT_LIMIT_ERRORS` set, the name NVIDIA-NeMo#5879 also defines, so its rebase conflicts on one list instead of merging two. Add an episode-level test through `_run_sandbox_episode` that pins the reported `ng_agent_outcome`, and check the attached outcome in the classification test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 5689fd0 |
weijiac0619
approved these changes
Nov 17, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44147100415 |
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.
Pinned Hermes ends a run with
partial: trueand a fixed error string when the model's output reachesmax_tokens. Gym classified two of those results asagent_invalid_output, although the model had exhausted its output budget:Response remained truncated after 3 continuation attempts: three length stops with visible text and no tool calls (run_agent.py#L7166).Model used all output tokens on reasoning with none left for the response. Try lowering reasoning effort or increasing max_tokens.: a length stop that leaves no visible text, the usual shape for a reasoning model cut off mid-reasoning (run_agent.py#L7090-L7127). Hermes checks this before it tries a continuation, and Gym's defaultcompression_enabled: truemakes it reachable.An outcome policy that treats invalid output differently from limits therefore took the wrong action. Both results now classify as
agent_limit, like the two truncation results that #4742 already maps there.All four Hermes output-limit errors now live in one
_OUTPUT_LIMIT_ERRORSset. #5879 defines the same name with only the two older strings. When #5879 is rebased, it conflicts on that line and must keep the four-string set, because there the set decidesincomplete/output_limitversusfailed.Scope and compatibility
ng_agent_outcome. The legacy/runpath never consults this classifier and is unchanged.by_failure_kindoverrides and failure-kind metrics.No separate issue is needed for this focused smoke finding. Broader lifecycle token accounting remains separate work in #3981.
Validation (Linux, Python 3.13.14, pinned Hermes 26bb847a)
gym env test +entrypoint=responses_api_agents/hermes_agent +should_validate_data=true: 376 passed (372 before, plus the 4 new cases).app.py: 4 failed, 10 passed. Only the two newly covered strings fail.pre-commit run --fileson both changed files: passed.Rollout evidence
Before this PR, a real SWE-bench Pro Flipt episode with 15 captured model calls, including three output-length stops, ended with the continuation result and carried
agent_invalid_output. A patched-source rerun with Qwen3-VL-8B-Instruct (31 captured model calls, real tools, official verification, reward 0, clean shutdown) reached the turn limit instead.Scripted-model smoke (no real model) through the real agent-session route:
HermesAgent.responses→ process supervisor →sandbox_runner.py→ pinned Hermes, with commands run as local subprocesses instead of a remote sandbox. A stub chat-completions server always answersfinish_reason: "length":ng_agent_outcomeon mainResponse remained truncated after 3 continuation attemptsagent_invalid_outputagent_limitcontent: null+reasoning_contentModel used all output tokens on reasoning ...agent_invalid_outputagent_limitIn every run the response status was
failedand the default policy returnedverify. With overridesagent_limit: retry, agent_invalid_output: fail, main returnedfailand this PR returnsretry. Cleanup was confirmed every time.