Skip to content

fix(hermes): classify exhausted continuations and reasoning budgets as output limits - #6204

Merged
yaoyu-33 merged 3 commits into
NVIDIA-NeMo:mainfrom
yaoyu-33:codex/hermes-continuation-output-limit
Nov 17, 2026
Merged

yaoyu-33 merged 3 commits into
NVIDIA-NeMo:mainfrom
yaoyu-33:codex/hermes-continuation-output-limit

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Pinned Hermes ends a run with partial: true and a fixed error string when the model's output reaches max_tokens. Gym classified two of those results as agent_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 default compression_enabled: true makes 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_ERRORS set. #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 decides incomplete/output_limit versus failed.

Scope and compatibility

  • Only agent sessions report ng_agent_outcome. The legacy /run path never consults this classifier and is unchanged.
  • Default grading is unchanged. The default policy verifies both kinds, and both are model failures, so partial work is still graded and nothing is masked. The change matters for by_failure_kind overrides and failure-kind metrics.
  • Invalid tool calls, think-only output, provider failures, and context limits keep their existing handling. Hermes's Codex-mode continuation error stays out, because Gym's model-server URL never selects that mode.

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).
  • The new classification rows and the episode-level test against main's app.py: 4 failed, 10 passed. Only the two newly covered strings fail.
  • pre-commit run --files on 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 answers finish_reason: "length":

    Stub reply Model calls Hermes error ng_agent_outcome on main With this PR
    Visible text 3 Response remained truncated after 3 continuation attempts agent_invalid_output agent_limit
    content: null + reasoning_content 1 Model used all output tokens on reasoning ... agent_invalid_output agent_limit

    In every run the response status was failed and the default policy returned verify. With overrides agent_limit: retry, agent_invalid_output: fail, main returned fail and this PR returns retry. Cleanup was confirmed every time.

@yaoyu-33 yaoyu-33 added bug Something isn't working area:agent Agent harnesses and Responses API agent behavior needs-review PR is ready for code review and waiting on a reviewer labels Nov 15, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 15, 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.

yaoyu-33 and others added 2 commits November 15, 2026 10:47
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]>
@yaoyu-33 yaoyu-33 changed the title fix(hermes): classify exhausted continuations as output limits fix(hermes): classify exhausted continuations and reasoning budgets as output limits Nov 15, 2026
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 5689fd0

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 15, 2026 19:14
@yaoyu-33
yaoyu-33 requested a review from athitten November 15, 2026 19:34
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 16, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into NVIDIA-NeMo:main with commit bc08d14 Nov 17, 2026
58 of 60 checks passed
@yaoyu-33
yaoyu-33 deleted the codex/hermes-continuation-output-limit branch November 17, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants