Skip to content

fix(hermes): retain session evidence and report provider errors - #4742

Merged
giuliolovisotto merged 7 commits into
glovisotto/env-reported-agent-failurefrom
glovisotto/hermes-session-conformance
Oct 22, 2026
Merged

giuliolovisotto merged 7 commits into
glovisotto/env-reported-agent-failurefrom
glovisotto/hermes-session-conformance

Conversation

@giuliolovisotto

@giuliolovisotto giuliolovisotto commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review follow-up on 128f5fe (2026-10-22)

Match known transport-error prefixes even when the message appends diagnostic details; keep unrelated messages unknown. Clarify that the masking comment describes legacy /run, while agent sessions defer routing to the Environment Server.

Validation: 174 Hermes session tests passed, 2 skipped; scoped pre-commit passed. Default routing is unchanged.

Follow-up on 12ce961 (2026-10-22)

170 Hermes session tests passed, 2 skipped; scoped pre-commit passed. Explicit “Context length exceeded” reports use model_context_limit; generic HTTP 400/413 retains model_request_error. Agent limits and context limits can be configured independently.

Rebase validation before the label/formatter follow-up: the combined tip e5240e16e passed 28/28 Linux conformance scenarios, seven per harness. The policy-only head a928f859e passed 4/7 Hermes scenarios; the dependent stack fixes its evidence gaps. Both returned seven Hermes rollout records with no episode-failure rows; these scenarios do not establish exhausted-provider retry counts. These results are pinned to those revisions, not a claim of fresh CI or a new live-model run on the latest heads.

Restore Hermes agent-session evidence and classify native failures for the shared Environment Server policy. Send invocation correlation headers from the sandbox observer, retain runtime token counters on early returns, and isolate observation failures from execution.

Recognize Hermes 26bb847a's Error code: NNN/HTTP NNN errors and Request timed out.. Distinguish explicit max_iterations, context and output limits from complete-but-invalid output so benchmark policy overrides receive the correct cause.

This follows the session migration in #4489; no separate issue is needed.

Stack: #4834 (policy) → #4742 (Hermes) → #4739 (Pi) → #4741 (OpenCode) → #4740 (Codex), registered as GitHub stack #4899. These changes must land together. Do not merge #4834 alone: the Hermes and Codex classifier fixes are in #4742 and #4740.

Validation on 04498f0

  • Hermes suite: 331 passed, 6 skipped; scoped pre-commit passed.
  • Fresh Linux agent-session conformance: 7/7, compared with 4/7 on feat(agent): report native causes for shared grading policy #4834 alone at c998df7. Both verified seven episodes; this fixes ownership and token-evidence failures without changing those grading counts.
  • Real pinned Hermes runtime against controlled HTTP endpoints: 400 and 422 classified as model request errors; 413/context overflow/output truncation classified as agent limits. The 422 probe reproduced the SDK's Error code: 422 text.
  • One fresh live-model task through Gym's collector and Environment Server against inference-api.nvidia.com: reward 1, three captured model calls, two tools, verification completed. Linux local sandbox exercised; remote sandbox providers and Slurm were not exercised.
  • Focused tests distinguish limit vs invalid-output routing with different policy overrides and verify timeout/provider failures preserve replay and cleanup behavior.

Historical CI for c998df7b6; see individual job outcomes rather than treating prior combined runs as current-head CI.

Serial-stack validation (2026-10-21)

Fresh Linux conformance on combined stack tip fb92b1231: 28/28, including hermes 7/7; this combined result supplements rather than replaces each branch's own unit tests.

.venv/bin/pytest responses_api_agents/hermes_agent/tests -q --no-cov
python scripts/run_harness_conformance.py --harness hermes --harness pi --harness opencode --harness codex --timeout 300 --output /tmp/serial-stack-conformance-oct21

Portable live-model smoke reproduction for the combined stack is available here; the latest follow-up is limited to agent sessions, with legacy execution explicitly outside scope.

Fresh CI on combined stack tip d0b6b950a: this harness passed 7/7 (download its report/tests/logs); all four stack harnesses passed, while the separate Kilocode model_error failure keeps the non-blocking aggregate red (full CI summary).

@giuliolovisotto giuliolovisotto added bug Something isn't working area:agent Agent harnesses and Responses API agent behavior labels Oct 19, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

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.

@giuliolovisotto
giuliolovisotto marked this pull request as ready for review October 19, 2026 14:46
@giuliolovisotto giuliolovisotto added the needs-review PR is ready for code review and waiting on a reviewer label Oct 19, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team October 19, 2026 14:47
@yaoyu-33 yaoyu-33 added the complexity:low Localized change in one scope with a small, straightforward review surface label Oct 19, 2026
@giuliolovisotto giuliolovisotto changed the title fix(hermes): retain session model-call evidence fix(hermes): retain session evidence and report provider errors Oct 20, 2026
@giuliolovisotto
giuliolovisotto changed the base branch from main to glovisotto/conformance-terminal-errors October 20, 2026 09:58
@giuliolovisotto
giuliolovisotto force-pushed the glovisotto/hermes-session-conformance branch from e587b65 to 789c8b0 Compare October 20, 2026 09:58
Base automatically changed from glovisotto/conformance-terminal-errors to main October 20, 2026 11:41
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 20, 2026

@yaoyu-33 yaoyu-33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the Hermes fix. The token-counter backfill and header injection check out against the pinned Hermes revision (414 passed, 8 skipped locally). Main points: on the session path provider failures now reach the verifier unmasked, a regression from legacy /run, plus a stale README line. Optional: a transport timeout on the session path still raises 500 (please say whether that's intended), and the token-counter backfill is duplicated between host and sandbox runner.

Review context: these five PRs (#4782 contract; #4739 Pi, #4740 Codex, #4741 OpenCode, #4742 Hermes) are a split of one change. This PR's diff vs main also contains #4782's conformance files, so please retarget/rebase once #4782 merges. Note that harness_conformance runs all four probes for any shared-file change, so model_error should fail for every harness until its fix lands; if that check is required, #4782 and the siblings need to land together.

PR hygiene: the validation commands and live-smoke artifacts reference an author-local path, and current-head CI isn't in the evidence (the combined 28/28 run is for 118f1de37). Could you attach the exact commands and the CI run for this head?

Generated by Claude Code

model_name=self._model_name(),
n_input=len(params["history"]) + 1,
# Report the failed model exchange to the EnvironmentServer; it owns grading policy.
retain_provider_failure=True,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.py:669

This now returns provider errors (401/403/429/5xx included) on the sandbox session path as a failed response that goes on to /verify, which matches the #4782 contract. But I couldn't find anything on the environment-server side that masks it: single_agent_turn forwards the response unconditionally and mask_sample is only set by individual verifiers. Before this change the legacy /run path masked these via provider_failed (app.py:1103); nothing on the session path reads that metadata, so this is a regression from the masked behavior, so a transient provider error can now become an unmasked reward-0 sample. Could you point to where that is masked, or land the masking/retry policy first (or limit this to model-caused statuses, as Hermes does for 400/413/422)? The comment at app.py:84-86 ("stay provider failures and are masked") is also stale for sessions, and test_sandbox.py:273 could assert provider_failed vs model_rejected metadata per status.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inherited #4834 policy now excludes provider execution failures before verification and controls retries, although the legacy masking comment still needs its scope clarified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done—the comment now limits masking to legacy /run, while agent sessions use #4834’s configurable verification/retry/failure policy before verification.

response = self._response_from_result(
body=body,
result=result,
model_name=self._model_name(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs: README.md:166

This line still says sandbox sessions "retain their existing retryable failure path", but a recognized terminal provider error now returns a failed response that can reach verification. Could you update it to describe that, and that execution/cleanup failures still raise?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done—the README distinguishes classified session responses governed by the Environment Server from worker and cleanup failures that remain execution errors.

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 20, 2026
lafrancef
lafrancef previously approved these changes Oct 22, 2026
if match and 400 <= int(match[1]) <= 599:
return AgentOutcome(failure_kind=MODEL_REQUEST_ERROR, status_code=int(match[1]))
if error in {"Connection error.", "Connection error", "All connection attempts failed"}:
if error in {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something like if any(error.startswith(x) for x in ('Connection error' , ...))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 128f5fe58: the classifier uses startswith for the three known transport-error prefixes. Regression cases cover appended diagnostic details and an unrelated message that must remain unknown.

@giuliolovisotto
giuliolovisotto force-pushed the glovisotto/hermes-session-conformance branch from 128f5fe to 7e870d2 Compare October 22, 2026 10:10

@mlazuka mlazuka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@giuliolovisotto
giuliolovisotto added this pull request to the merge queue Oct 22, 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/39782168972

Merged via the queue into main with commit ce49777 Oct 22, 2026
45 of 49 checks passed
@giuliolovisotto
giuliolovisotto deleted the glovisotto/hermes-session-conformance branch October 22, 2026 13:43

This branch was previously deployed

1 inactive deployment
public — 10c6dd1b Deployed Oct 22, 2026 by copy-pr-bot[bot] via release / finalize / notify #6602
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 complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants