Repository navigation
feat(agent): update Hermes to v0.23.2 - #2052
Conversation
ea6a874 to
ceaa05a
Compare
|
the pin is there to support training, i think it should stay until we implement support for blackbox agent training. right now, training will break if you remove the pin |
@cmunley1 got it, thanks for the follow up. Do you have a rough idea of when the blackbox agent training will land? Currently, we are working on a fork of gym just to work around this, it's OK for now but hoping we can converge again one day |
a8d243c to
fa768a2
Compare
|
cherry picking would be fine, it is primarly these changes plus i had to relax an openai version pin in the past which probably has changed too. https://github.com/NousResearch/hermes-agent/tree/nemo-gym-changes |
|
yeah, probably a few weeks for training as some other work is blocking |
|
Thanks @Glorf and @cmunley1 ! I had a quick look at upstreaming the change to hermes. It seems a bit more involved than I hoped: hermes changed quite a bit since the original pin, especially |
6a7e7ac to
965b778
Compare
|
/claude review |
|
/ok to test 0d6bd29 |
yaoyu-33
left a comment
There was a problem hiding this comment.
Team review of the Hermes v0.23.2 upgrade (separate Python 3.14.7 worker with upstream's frozen lock, shared by the host path, task sandboxes and the AnySWE / AnyTerminal / CVDP bundles).
The upgrade itself holds up: the upstream APIs the adapter patches match ae2a81cc, token IDs and log probs follow their exact turn, the four-continuation cutoff is typed as a limit, and the locked Linux wheels and Python 3.14.7 archives resolve.
The review found a few breakages, which are fixed on the branch in four fast-forward commits on top of c4af71b7e6 (4f45e731b4..0d6bd29f10):
- CVDP Hermes scored 0 on every task. The worker now resolves its compression URL with
trained=False, which the two-argument resolver override in the CVDP guest rejected with aTypeError(the CI bot's finding). The override now takes any arguments, and a guest test runs the entrypoint against an agent that asks for the untrained URL. - Token IDs were lost after a transport rebuild. Upstream clears its transport cache when it rebuilds the client after transient errors (
try_recover_primary_transport), so later turns used an unwrapped transport. Every chat-completions transport the agent creates is now wrapped. - MCP tool names. v0.23.2 emits
mcp__<sanitized server>__<tool>, so themcp_<server>_<tool>mapping never fired and a granted server with-or.reached verifiers unstripped. - An unsupported sandbox glibc was a retried 500. It is now a final 422 seed refusal (
HermesPlatformUnsupportedErrormapped toAgentSeedRejectedError). - The MCP toolset-collision check installed Hermes on the Agent Server host (
uv syncof the whole lock just to read toolset names). It now parses theTOOLSETSkeys from the pinned source; the first host install is serialized across request threads. - The host-path warning for the unenforced agent timeout is back;
prepare_portable.pyuses a new publicSandboxPythonRuntime.archives()and an exportedSandboxPlatforminstead of privatesandbox_pythonnames; "native" wording in the new docs and test names is gone; the CVDP README describes the new deps script. - New tests, each checked to fail on revert: host-worker no-output / error-JSON exits and process-group kill on cancel, child-invocation
spawned_by_tool_call_id, summary-retry token ownership, transport-rebuild token capture, glibc seed refusal, CVDP guest resolver.
Validation at 0d6bd29f10: on a Linux workstation, hermes_agent/tests, anyswe_agent/tests/test_portable_dependency_pins.py, cvdp_agent/tests, tests/unit_tests/agents/test_sandbox_python.py all pass (real pinned worker, Python 3.14.7). On macOS, hermes_agent/tests/test_app.py, cvdp_agent/tests, anyterminal_agent/tests (except three Docker-provider tests that also fail on the PR head without Docker) and tests/unit_tests/test_public_api_facades.py pass; pre-commit passes on the changed files. Not run: real-model rollouts after these fixes, stirrup_agent/tests (needs the Stirrup venv; that change is a one-line import move), ARM / musl.
The two remaining asks are inline.
Hermes v0.23.2 returns the compacted list with the summary as its own message, then folds it into the next assistant message. The exported conversation stitched new turns at the compacted list's length and dropped the first assistant message after compaction, so its tool call lost its request. Locate the compacted list's last message instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Hermes v0.23.2 raises compression_threshold to at least 0.75 for windows under 512,000 tokens. compression_threshold_tokens writes compression.threshold_tokens, the only way to compress earlier in such a window. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Hermes no longer installs into the Gym venv, so the runtime check records the pinned source, Python version and upstream lock instead of importing run_agent. The compaction probe uses an absolute trigger that fires once there is history to summarize, and the probe provider recognizes v0.23.2's summary request. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test b3b699f |
|
/ok to test 0c27ed0 |
Signed-off-by: svcnemo-autobot <[email protected]>
|
/ok to test 7ff860f |
|
@j-nolan could you please make the requested changes so that we can get this in ? Thanks! |
Main moved per-harness probe settings and reply schedules into registry.py. The Hermes override left in episode.py set an absolute 27,070-token trigger, which the new schedule's single 27,000-token reply never reaches, so Hermes never compacted and ended on the scripted summary. The registry's 32K window already triggers at the largest reply. Hermes also no longer imports into the Gym venv, so its registry entry drops the run_agent/model_tools runtime modules. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test fd0b90e |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
… data Hermes 0.23.2 ends a turn on a model limit with a structured `failure_reason` and chat-worded error text. Context overflow also sets `failed`, so Gym classified it as an unknown provider failure: agent sessions retried it and `/run` masked it, where the previous pin's "Context length exceeded" ending was graded. A tool call still cut off after four retries became invalid output instead of an agent limit. Classify `truncated` as an agent limit, and `context_overflow` as a model context limit when compression ran out of room or is turned off. A timed-out compression call and a rejected output cap carry the same reason and stay infrastructure failures. At its continuation ceiling Hermes replaces the turn's fragment rows, which carry the sampled token IDs and log probabilities, with one stitched assistant row that has none. Restore the fragments and continuation prompts, as a recovered continuation leaves them. Hermes doubles the output cap on each truncation retry, up to 32,768 tokens. Keep every call within the configured `max_tokens`, the per-call budget runs are compared and trained under. The written config's root `provider: auto` made Hermes drop `model.context_length` as describing another route, so it assumed a 256,000-token window. Omit the provider (a configured one would also become the fallback route for failed compression calls), reject windows below Hermes' 64,000-token minimum at config load, and give the conformance compaction probe a 65,536-token window. Hermes runs `delegate_task` on its sequential tool path, outside the `_invoke_tool` wrapper that recorded the spawning call, so children had no `spawned_by_tool_call_id`. Record each parent's running delegation. Document what a task image needs to run the Hermes worker for the harness_agent, AnySWE, AnyTerminal and CVDP presets. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Hermes' deps script reads the source pin from the agent's pyproject.toml (or HERMES_SPEC), which the prefix cache key did not cover. After a pin-only bump CVDP would reuse the old prefix, which Hermes refuses as built from another source, and score every rollout 0. Add the agent's pyproject.toml, build scripts and HERMES_SPEC to the key. The Hermes deps script builds on the host with uv and the Gym checkout, so the cross-architecture build inside an OpenSandbox task image cannot run it. Refuse that case with a clear error and document it. Run the entrypoint resolver test in its temporary directory: the entrypoint now creates the CVDP task directories in its working directory. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
The harness guide still said Hermes pins `hermes-agent` as a dependency, and the conformance README said Hermes must be importable in Gym's environment. Hermes now pins an upstream commit under `[tool.nemo-gym.hermes]`, runs in its own Python 3.14 worker, and needs `git` and GitHub access on the Agent Server. The job_bench, workspace_bench and SWE Atlas presets that run Hermes inside the task image now also need its worker there, and Alpine images cannot run it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 8a70906 |
yaoyu-33
left a comment
There was a problem hiding this comment.
Team review of the Hermes v0.23.2 upgrade at fd0b90ef2f, with fixes pushed as maintainer edits. The head is now 8a70906065.
What held. These fixes from the earlier rounds hold at the new head:
- CVDP's resolver no longer raises on
trained=. - Token capture survives a transport rebuild.
- The
mcp__names map back to Gym's. - An image with glibc below 2.28 gets a 422 at seed.
- The absolute compaction trigger fires.
- The first turn after a compaction stays in the export.
- The conformance probe runs through the pinned worker.
Each of these has a test that fails when the fix is reverted.
What the new commits change
2dc009c8aamerges current main. It merged without conflicts.36694d89ccfixes the following:- v0.23.2 ends a turn on a model limit with a
failure_reason. Context overflow also setsfailed, so Gym had treated it as a provider failure: sessions retried it and/runmasked it. These endings are now graded:context_overflowasmodel_context_limit(only when compression ran out of room or is off), andtruncatedasagent_limit. - At the continuation ceiling, Hermes replaced the sampled fragments with one stitched row without token IDs. The fragments are now restored.
- The configured
max_tokensnow caps every call. Hermes had been doubling it on each truncation retry, up to 32,768. context_lengthtakes effect again. The rootprovider: automade Hermes drop it, so the window was 256,000, not the 128,000 the docs said. It is now validated at 64,000 or more, which is Hermes' minimum.- Delegated children record the
delegate_taskcall that spawned them. - The docs now say what a task image needs to run the worker.
- v0.23.2 ends a turn on a model limit with a
5cd9d31beaadds the Hermes pin andHERMES_SPECto CVDP's deps cache key. A pin bump now rebuilds the prefix instead of failing every rollout. Hermes cross-architecture builds are refused with a clear error.8a70906065corrects stale docs: the source pin, hostgit, the conformance README, and theharness_agentpresets.
Validation, on a Linux workstation
- Unit tests, on the tree that was pushed:
- Hermes plus the portable-pin tests: 459 passed.
- CVDP: 58 passed under umask 022. One file-mode test is sensitive to umask 002.
- Conformance: 232 passed, 14 skipped.
- Pre-commit passed on the changed files.
- With the old
app.py,model_kwargs.pyandsandbox_observer.py, 13 of the new test cases fail. - Real-model smokes: Nemotron 3.5 Super VL, temperature 0, TB2.1
regex-log, the official verifier, and agent-session seed and close. "Calls" counts model calls.
| Pin | Per-call limit | Reward | Calls | Ending |
|---|---|---|---|---|
| this head | 16K | 1 | 3 | completed |
| this head | 4K | 0 | 7 | agent_limit after four continuations; every call stayed at 4,096 |
| main's 0.6.0 fork | 16K | 1 | 9 | completed |
| main's 0.6.0 fork | 4K | 0 | 1 | agent_limit: reasoning used the whole budget |
CI. Both failing non-blocking jobs at fd0b90ef2f fail the same way on main:
- The mini-SWE probe step times out at 5 minutes, after its tests pass.
- The compliance findings are
run()methods that already exist on main.
Hermes conformance passed all nine scenarios.
Not run
- The full TB2.1 P0 comparison and
gym eval health-check. - An MCP-granted rollout and a CVDP Hermes rollout.
- A GPU token-ID rerun after these changes. Scripted pinned-worker tests cover the token paths.
Merge state
- DCO is green. The description's DCO sentence and test counts predate the rewrite.
- The September change request is still the review decision. The
HERMES_NIX_BUILDandextra="allow"changes it targeted are no longer in the diff.
Leftovers are inline. None blocks this PR.
Signed-off-by: svcnemo-autobot <[email protected]>
|
/ok to test c971216 |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Hermes 0.23.2 runs a top-level delegate_task in the background and delivers the children's results between turns. A Gym run is one turn, so the parent finished without its children's work. Build the worker's agent with Hermes' joined delegate_task, whose children finish inside the call. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test f9adf9e |
Drop HermesAgentObserver and the conformance runtime_modules field, which nothing uses after the worker split; Hermes reports its pinned runtime through a registry hook instead of a harness-name branch. CVDP's guest sends Hermes compression calls to an untrained URL. The host worker reports a Gym shutdown as cancelled and writes its result in one piece. Guests refuse an image whose glibc cannot load the portable runtime. Sandbox bundles skip upstream's tests, docs site and desktop apps, and an unpinned Python version names itself. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 06f74a0 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44925422797 |
|
Follow-up evidence after merge: a graded CVDP run with the shipped Hermes preset (
|
What changed
Revives the existing Hermes upgrade on current Gym. The training and evaluation paths share upstream Hermes v0.23.2 at
ae2a81ccc00e9b7c06301523e5bb09608397149c. Gym keeps its Python 3.13 and OpenAI dependency pins. Hermes runs in a separate Python 3.14.7 worker with upstream's frozen lock, source assets and MCP extra. The host, seeded sandbox and portable dependency builders read the same source pin. The DeepSearchQA and WideSearch Hermes presets still install the previous fork throughharness_exa_search. This PR tracks the upgrade directly.The adapter uses the upstream non-streaming Chat Completions API. It preserves Gym's sampled token IDs and log probabilities across ordinary turns, history replay, iteration-limit summaries and the continuation ceiling, where Hermes would otherwise replace the sampled fragments with one stitched row. MCP tools use their canonical names. Upstream renamed some built-ins, including
todototodo_list. The worker retains the model response IDs and Hermes' own tool-call IDs used to attribute delegated work.Changes in Hermes' own behavior that the adapter now handles:
failure_reason. Gym reportscontext_overflowasmodel_context_limit(when compression ran out of room or is off) andtruncatedasagent_limit, so both are graded rather than retried as provider failures.max_tokenson each truncation retry. The configuredmax_tokensnow caps every call.context_lengthtakes effect; the old rootprovider: automade Hermes drop it and assume 256,000 tokens. Hermes refuses windows under 64,000.delegate_taskin the background and delivers results between turns. The worker uses Hermes' joined variant, so children finish inside the tool call of the one-turn run.CVDP's deps cache now includes the Hermes pin. Presets that run Hermes inside a task image (
harness_agent, AnySWE, AnyTerminal, CVDP) need its worker there; the READMEs say how to provide it. Those images must have glibc 2.28 or newer, and the worker refuses older ones with the same error as the session seed. CVDP sends Hermes compression calls to a URL without the run's sampling values. The sandbox bundle leaves out upstream's tests, documentation site and desktop apps (313 MB down to 131 MB).Cost. Each host rollout (the training path) starts a fresh Python 3.14 worker, where 0.6.0 ran in-process. On the workstation, importing Hermes in that worker took about 1.8 s per rollout (six runs, 1.79 to 2.16 s). The first rollout on a host also syncs the worker environment, and concurrent first rollouts wait for it. That took 2.7 s with a warm uv cache; downloading wheels takes longer.
Before/after on Terminal-Bench 2.1
Main at this PR's merge base (
7cb3ae369e, Hermes 0.6.0 fork) against this PR (06f74a0677, Hermes v0.23.2), on 10 TB2.1 tasks with 4 repeats each. Everything else was identical:7131e437. Each task uses its own agent budget (900 s for all ten) and the official verifier.single_agent_turn_legacy.This is a sample, not the full 89 × 8 evaluation.
gym eval health-checkrollout_token_count_mismatch. In each one, the capture holds exactly one 32,768-token reasoning-only call more than the transcript. That is the known upstream gap: Hermes retries a truncated reasoning-only reply without keeping it.sandbox.present) fails all 40: neither version records the lent sandbox in its agent observations, so this is not a change.Other pairings
get_weatherover MCP throughsingle_agent_turn_legacy. Hermes calledmcp__example_single_tool_call__get_weather, and Gym verified it asget_weather. Result: reward 1 on 2/2, both rollouts healthy, none unobserved, model-call capture on.toolsand adevelopermessage, as on main. The rows therefore relied on the grant and used asystemmessage.hermes-clitoolset the model chose web search, so the run enabledterminalplus the grant.cvdp_agent_generic_hermes, Docker instead of Apptainer, 1 agentic task): Hermes v0.23.2 ran from the portable runtime inside theosvbtask image (glibc 2.31). It made 10 model calls and 12 tool calls, wrote its RTL and completed. The grader then could not load cocotb (libgpi.sois missing from that image), so the reward of 0 comes from the grading image. A graded run needs the CVDP v1.1.0 simulation image.Workstation validation
Unit tests (Linux workstation):
pytest responses_api_agents/hermes_agent/tests responses_api_agents/anyswe_agent/tests/test_portable_dependency_pins.pypassed all 441 tests at06f74a0677, including actual pinned-worker calls. Those cover multi-turn token replay, the continuation ceiling, the output budget, the context window, summary retries, MCP session routing, delegation, multimodal prompts and cancellation.sandbox_pythontests 55.pre-commitpassed on the changed files.TB2.1
regex-logat8a70906065, before the delegation fix and the latest main merge (official verifier, Nemotron 3.5 Super VL, temperature 0, agent-session seed and close; same day, same driver):8a709060658a70906065agent_limitafter four continuations; every call at 4,096agent_limit: reasoning used the whole budgetEarlier evidence, on the tree before the latest fixes:
Harness conformance: CI passed all nine Hermes scenarios.
Qualification
The release's frozen wheels require glibc 2.28 or newer for GNU/Linux. The packaged worker, MCP, Pillow, pillow-heif and psutil imported on glibc 2.28 with container networking disabled. The packaged worker and compiled dependencies also imported offline in all 89/89 published Terminal-Bench 2.1 linux/amd64 task filesystems, each tested at its registry manifest digest. Two used glibc 2.31, 43 used 2.36, 39 used 2.39 and five used 2.41. The minimum is specific to Hermes, so musl images such as Alpine cannot run the worker.
Still open:
Nolan's earlier 62/89 Terminal-Bench 2.1 result used upstream
569b912and Claude Opus. It is historical evidence for that revision.