Skip to content

chore(configs): move simple_agent configs off the legacy_agent relay - #4953

Merged
cmunley1 merged 17 commits into
mainfrom
yuya/gymint-549-switch-configs
Oct 30, 2026
Merged

cmunley1 merged 17 commits into
mainfrom
yuya/gymint-549-switch-configs

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Stack — environment server migration, phase 1 (bottom → top): main → #4952 (generator) → this PR → #4954 (retire agents) → #5108 (resources bindings) → #5003 (DeepAgents). #4952 is merged (166af7d0d).

What and why

This PR runs #4952's scripts/add_legacy_agent_environment_servers.py --switch-simple-agent over the repository. The generated migration changes 289 config files: 296 relays in front of simple_agent become single_agent_turn_legacy servers of the same name. A crash in those episodes then repeats only the current step instead of the whole episode, and simple_agent resumes inside its turn. That is the largest single cut in restart cost in the migration roadmap (phase 1).

Typical diffs:

  • A parent relay (in the resources server's config): the legacy_agent key becomes single_agent_turn_legacy, and the block gains the direct HTTP grant. The migrated timeout defaults live in SingleAgentTurnLegacyEnvironmentServerConfig rather than every YAML block.
  • A benchmark child relay: only legacy_agent: becomes single_agent_turn_legacy:. It keeps _inherit_from and its agent name.

22 relays stay on the relay, as the script reports:

Reason Relays
The resources server's seed_session takes only the legacy body, not ResourcesSeedSessionRequest workplace_assistant (2), openenv (3), newton_bench, indirect_prompt_injection, example_session_state_mgmt, and the SWE example configs denovo_swe, r2e_gym, scale_swe, swe_gym, swe_internal_v1, swe_next, swe_rebench, swemer_oml, swemer_ultra, swemer_v1, swemer_v2
The resources server's /verify reads the row's _ng_rollout_index and cohort keys, which single_agent_turn_legacy does not forward genrm_environment_server, genrm_simple_agent_reasoning_off_environment_server (genrm_compare)
The run cannot load an include (benchmarks/ruler/config_nemotron_3_256k.yaml is missing on main) ruler_benchmark_environment_server in benchmarks/nemotron_3_ultra/benchmarks_no_external.yaml
A required MCP grant, or more than one direct HTTP grant none

The seed group moves once those resources servers accept the typed seed (separate resources-session migrations). genrm_compare moves once the Environment Server forwards rollout coordinates. The broken include is pre-existing and not touched here.

hle and apex_shortlist switch: their opencode/pi recipes keep the original benchmark Environment Server names and explicitly replace the inherited definition with a legacy_agent relay. The two HLE search variants inherit the same overrides. #4952 removes the inherited link and migrated server type before configuration inheritance, so each recipe still resolves exactly one relay for its harness.

Tests and docs that read these configs now use the new key: five indic_* tests, critpt_custom_grader, long_transduction, plus about/architecture, agent-server/index and the system design note, which now say most shipped simple_agent configs use it and why the rest stay. The super35 container build now also covers single_agent_turn_legacy (component count 17 → 18), so its prebuilt check finds 16 core server environments instead of 15.

Design

Markers: green NEW, orange CHANGED, red dashed BROKEN; the label text says the same, so the diagrams read without color.

1. One episode, before and after

Before: legacy_agent relay. The episode is one request.

sequenceDiagram
    autonumber
    participant RC as Rollout collection
    participant LA as legacy_agent (relay)
    participant AG as simple_agent /run
    participant M as Model
    participant RS as Resources server
    RC->>LA: /run (flat row)
    LA->>AG: /run (the whole episode is this one request)
    AG->>RS: /seed_session (flat body)
    loop model and tool turns
        AG->>M: /v1/responses
        AG->>RS: POST /{tool}
    end
    AG->>RS: /verify
    AG-->>LA: result
    LA-->>RC: result
    Note over RC,RS: a crash anywhere repeats the whole /run from its input
Loading

After: single_agent_turn_legacy. The episode runs in steps, with checkpoint boundaries between them.

sequenceDiagram
    autonumber
    participant RC as Rollout collection
    participant ES as single_agent_turn_legacy (CHANGED)
    participant AG as simple_agent session
    participant M as Model
    participant RS as Resources server
    RC->>ES: /run (same flat row, same server name)
    Note over ES: checkpoint boundary: seed
    ES->>RS: /seed_session (typed) → session cookie
    ES->>AG: /v1/agent_sessions (direct_http grant to RS)
    Note over ES: checkpoint boundary: agent turn
    ES->>AG: /v1/responses
    loop model and tool turns (the agent checkpoints inside its turn)
        AG->>M: /v1/responses
        AG->>RS: POST /{tool} through the grant
    end
    Note over ES: checkpoint boundary: agent close
    ES->>AG: /v1/agent_sessions/close
    Note over ES: checkpoint boundary: verify
    ES->>RS: /verify (session cookie)
    Note over ES: checkpoint boundary: return
    ES->>RS: /close_session
    ES-->>RC: flat result row
    Note over RC,RS: a crash repeats only the current step, and simple_agent resumes inside its turn
Loading

2. How the config files change

A parent relay gets the full block, and a benchmark child only renames its key. A benchmark that declares no server reaches the parent through Gym's agent rename (see #4952).

flowchart LR
    subgraph rs["resources_servers/math_with_judge/configs/math_with_judge.yaml"]
        P["math_with_judge_environment_server<br/>CHANGED: legacy_agent → single_agent_turn_legacy<br/>NEW: resources_tool_transports: [direct_http]<br/>agent_server: math_with_judge_simple_agent"]
    end
    subgraph bm["benchmarks/aime24/config.yaml (config_paths: math_with_judge.yaml)"]
        C["aime24_math_with_judge_environment_server<br/>_inherit_from: math_with_judge_environment_server<br/>CHANGED: key legacy_agent → single_agent_turn_legacy<br/>agent_server: aime24_math_with_judge_simple_agent"]
    end
    subgraph ix["benchmarks/indic/math_500/config.yaml (declares no server)"]
        I["indic_math_500_..._simple_agent<br/>_inherit_from: math_with_judge_simple_agent"]
    end
    C -- "_inherit_from (parent is consumed as a template)" --> P
    P -. "Gym follows the agent rename; the server binds this agent's resources server" .-> I
    class P,C changed
    classDef new fill:#e6f4ea,stroke:#1e8e3e,stroke-width:2px,color:#111
    classDef changed fill:#fff4e5,stroke:#e8710a,stroke-width:2px,color:#111
    classDef removed fill:#fce8e6,stroke:#d93025,stroke-width:2px,stroke-dasharray:5 5,color:#111
Loading

3. Which relays switch

flowchart LR
    T["318 legacy_agent relays<br/>in front of simple_agent"] --> S["296 switched<br/>289 files<br/>→ single_agent_turn_legacy"]
    T --> L["19 stay: resources seed_session takes only the legacy body<br/>workplace_assistant ×2, openenv ×3, newton_bench,<br/>indirect_prompt_injection, example_session_state_mgmt,<br/>11 SWE example configs"]
    T --> G["2 stay: verify reads _ng_* rollout coordinates<br/>genrm_compare"]
    T --> I["1 stays: include missing on main<br/>nemotron_3_ultra/benchmarks_no_external.yaml"]
    T --> Z["0 blocked by MCP or by a second direct HTTP grant"]
    class S new
    class L,G,I changed
    classDef new fill:#e6f4ea,stroke:#1e8e3e,stroke-width:2px,color:#111
    classDef changed fill:#fff4e5,stroke:#e8710a,stroke-width:2px,color:#111
    classDef removed fill:#fce8e6,stroke:#d93025,stroke-width:2px,stroke-dasharray:5 5,color:#111
Loading

Validation

Original migration snapshot validation:

  • The YAML is the generator's output: a fresh --switch-simple-agent run on feat(scripts): switch simple_agent relays to single_agent_turn_legacy #4952's head is byte-identical to this PR's 278 files. --switch-simple-agent --check now reports nothing left to switch and 22 staying; the default --check adds nothing.
  • Resolves: gym env resolve on the hle and apex_shortlist default and opencode/pi recipes, aime24 and indic/math_500 gives one Environment Server per run: single_agent_turn_legacy for the benchmarks, legacy_agent for the harness variants.
  • Tests: the changed indic_*, critpt_custom_grader, long_transduction and generator tests, 241 passed. The super35 prebuilt check expects 16 core environments, matching CI's count on Linux.
  • pre-commit run --files <changed files>: clean.

On the first head (b6494e94e, before genrm_compare stayed on the relay):

  • Every config resolved as before: gym env resolve on all 638 server configs, paired with openai_model with dummy ++keys and NEMO_GYM_ALLOW_UNSUPPORTED_PAIRING=1. The same 128 failed on both sides, needing judge models or values not supplied. This check missed the six variant recipes, which needed sandbox env vars and so already failed on both sides.
  • Structural check on the 510 that resolved: every simple_agent behind exactly one Environment Server, and every switched server able to bind its agent's resources server.
  • Core unit tests: the same environmental failures as the feat(scripts): switch simple_agent relays to single_agent_turn_legacy #4952 base (OpenSandbox, Docker, CI environment, GitLab), no new ones.

Preserved-name restack validation

Rollout evidence

The runs used real Gym servers with a stub Responses model, not a real one: it calls the first offered tool once, then answers. Each run started with gym env start, logged requests with +uvicorn_logging_show_200_ok=true, and collected two rows with gym eval run --no-serve.

Config Rewards Calls per row
example_single_tool_call (stateful, tool call) 1.0, 1.0 env /run → seed → agent session → turn (POST /get_weather through the direct HTTP grant) → agent close → /verify → resources close
benchmarks/gpqa (child relay, no resources_server set) 0.0, 0.0 same flow, bound to gpqa_mcqa_resources_server through the agent
benchmarks/indic/math_500 (reached through Gym's agent rename) 0.0, 0.0 math_with_judge_environment_server seeded and verified indic_math_500_math_with_judge_resources_server

Real-model smoke (first heads). A paired baseline-vs-migrated run on the earlier heads (#4952 2a31fc20d as baseline, #4953 b6494e94e migrated), with real benchmark data, model generation, tools and verifiers, on a workstation and HSG:

  • Attempted 249 of the 279 changed configs then, across all 105 resource families. 205 of 289 Environment Server instances, in 89 families, reached paired admissible scoring: 1,009 rows, 898 scored, 1,579 model requests, 975 verifier calls, 148 resource-tool calls.
  • Matching results where compared, for example GSM8K through gym eval run and gym eval profile, IFEval, HumanEval+ and MBPP+, LiveCodeBench v5, ASR Leaderboard / LibriSpeech-PC / Numb3rs, DAPO and LongCodeBench.
  • It confirmed two migration regressions, both fixed since: genrm_compare verifiers returned 422 after 32 successful policy calls (now on the relay), and the six hle / apex_shortlist harness recipes stopped resolving (now behind their own relay).
  • The remaining failures are outside the migration: judge errors (Arena, AALCR), the MUSAN converter's id type, VLMEvalKit startup, XSTest / Spider2 Lite harness ordering, and inputs over 131k tokens.

Re-check on the fixed heads (#4952 52e2e2c, this PR 4b93cc1, #4954 521205f), by an independent reviewer:

Check Result
Six hle / apex_shortlist harness recipes 6/6 resolve, all failed before the fix
Benchmark catalog 212 entries again, was 208
genrm_compare rollout and cohort coordinates 32/32 saved-policy replays keep them; all were rejected before
Generator output all 278 YAML files match this PR
Focused Linux tests 309 passed

Not done: a full reward-profile comparison per batch with a real model, which the roadmap asks for; a rerun of the full smoke matrix on the fixed heads; and genrm_compare judge scoring, which needs a compatible judge model.

Compatibility

Review fixes included (2026-10-23):

These commits address the two outstanding inline comments. Separate migration gates remain: the rebased MMRB child overlays and full reward-profile qualification. Session support alone also does not establish compatibility with every required tool grant: Kilo's default GPQA pairing still rejects the required direct HTTP grant; this follow-up does not qualify that pairing.

Review follow-up validation (2026-10-23)

At da8dc7b80a1c286da6dfd7de911c223d505a99c4, in an isolated checkout with Python 3.13.14 and all 31 direct dependency constraints satisfied:

  • python -m pytest --import-mode=importlib tests/unit_tests/test_global_config.py tests/unit_tests/test_add_legacy_agent_environment_servers.py environment_servers/single_agent_turn/tests/test_app.py environment_servers/single_agent_turn_legacy/tests/test_app.py responses_api_agents/simple_agent/tests/test_app.py tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_checkpoint_agent.py tests/unit_tests/test_harness_conformance_ci.py -o addopts='-q --tb=short' -o log_cli=false: 1,147 passed.
  • The two session-less composition cases and the session tool-observation integration case fail on the previous head 9fe6a1a4c and pass with the repairs. The previous collector result was ([], 0); the fixed result retains the completed lookup tool and output 42, with one tool call.
  • Production gym env resolve with GPQA, opencode_sandboxed_agent, and dummy OpenAI model settings now selects legacy_agent; the same command on the previous head selected single_agent_turn_legacy.
  • pre-commit run --all-files: passed without source changes. git diff --check and DCO trailers checked. An independent reviewer inspected both imported fixes and identified the remaining Kilo pairing limitation above.
  • No new real-model rollout was run for this follow-up. The composition repair restores the pre-migration /run route; the capture repair changes observation metadata. The integration test exercises the real agent, environment, and collector with scripted model/tool replies. Existing broad rollout qualification gaps remain.
  • New-head CI is still required; the prior head's static checks do not validate these commits.

Update (2026-10-29): after #4952 merged

The branch was updated by merging main, not by rebasing, so the ten existing commits are unchanged. Three commits are added:

Validation at 35ffded88 on main c5a86197b, unless noted:

  • Generator output: a from-scratch --switch-simple-agent run on main is byte-identical to all 289 changed YAML files. --switch-simple-agent --check reports nothing left to switch and 22 staying; the default --check adds nothing.
  • Merge: for every file, the merge's change against main equals the change made by this branch's own commits (07650ac23..00788d932), except simple_agent, as described above. No content from the pre-merge feat(scripts): switch simple_agent relays to single_agent_turn_legacy #4952 commits came back.
  • No mixed instances: across all configs, no instance merges more than one Environment Server type. Gym's parser resolves hle_diamond (config, text, opencode), genrm_mmrb1 (dataset, genrm), genrm_mmrb2, beam, vision_arena_v1, hle/opencode and gpqa to one Environment Server each. hle_diamond/text.yaml resolves to the same server settings as config.yaml except the agent name.
  • Tests:
    • The generator, single_agent_turn, single_agent_turn_legacy, simple_agent tests and every test file this branch changes: 758 passed, 6 skipped.
    • Full tests/unit_tests: 12,122 passed. The other 34 failed and 40 errored on clean main c5a86197b as well (git, Harbor, OpenSandbox and wandb in this environment). tests/unit_tests/telemetry was skipped because opentelemetry is not installed here.
    • mimo_music's test_review_regressions.py (at a50d676a2): 8 passed; without the fix, the CI failure reproduces.
  • ruff check and ruff format --check on the changed Python files: clean.

Rollout evidence for this update: N/A. The 11 configs get the same generator rewrite as the configs rolled out above, and were checked with Gym's parser. No new model run was made for them.

Timeout defaults cleanup (2026-10-29)

Commit 150748ac2 centralizes default_episode_timeout_seconds: 21600 and cleanup_timeout_seconds: 180 in SingleAgentTurnLegacyEnvironmentServerConfig. The 161 migrated parent blocks, the canonical example, and the migration generator now use these defaults. The generic single_agent_turn config is unchanged.

Explicit overrides remain supported, including callers passing a typed parent config. Eight existing Partner IF configurations now explicitly set the episode timeout to null, preserving their previously uncapped behavior. GDPval's explicit timeout remains unchanged.

Validation:

  • Compared all 160 changed YAML files with the previous head: all 170 affected environment configs have identical effective settings, and the remaining YAML content is unchanged. Removed 324 redundant timeout fields while preserving eight uncapped configs.
  • 481 focused tests passed: generator, global config, both environment-server suites, Partner IF config checks, and the Codex/OpenClaw independent-config integration cases.
  • pre-commit run --all-files, git diff --check, and scripts/add_legacy_agent_environment_servers.py --switch-simple-agent --check passed. The generator reports zero files to touch, zero relays to switch, and 22 remaining on the relay.
  • Real-model rollout evidence for this cleanup: N/A. Effective timeout settings are unchanged; the tests exercise config loading, overrides, and environment execution. The migration's broader rollout qualification gaps above remain.

Hermes CI regression fix (2026-10-30)

Commit 20f275b5b updates the Hermes recipe test to validate single_agent_turn_legacy settings with SingleAgentTurnLegacyEnvironmentServerConfig, matching the runtime loader. The generic config still requires an explicit cleanup timeout, so using it after the canonical YAML deduplication caused both parameterized recipe cases to fail in server shard 5 and Hermes conformance.

Validation: all four tests in responses_api_agents/hermes_agent/tests/test_recipe.py passed with the pinned Hermes dependency (26bb847a); pre-commit run --all-files and git diff --check passed. This changes only the test's config type, so real-model rollout evidence is N/A. Kilo's separate model_error conformance failure was already present at a50d676a2 and is unchanged by this fix.

Main merge and conflict resolution (2026-10-30)

Merge commit 77a482fff brings in main at 85193811b while preserving the PR's existing commits. The four conflicts were import changes in the Codex, OpenClaw, Hermes, and global-config tests. The resolution keeps the specific legacy config class and session-agent registry while adopting main's new nemo_gym.config paths. Three automatically merged references also needed updates: the generator's public config import, the environment test's config import, and the agent-registry test's repository-root lookup after global_config.py moved. The registry constant is exported through the new config public API.

Validation on the merged tree:

  • 538 tests passed: global-config, migration-generator, import-layering/migration tests, both single-agent environment suites, and the Codex/OpenClaw independent-config integration cases.
  • 242 public API and facade tests passed.
  • 4 Hermes recipe tests passed with the pinned Hermes dependency (26bb847a).
  • pre-commit run --all-files passed, including the new import-linter hook. The PR diff against merged main passes git diff --check.
  • Generator --switch-simple-agent --check: zero files to touch, zero relays to switch, 22 remaining on the relay.
  • Independent review found no further merge-specific issue. Real-model rollout evidence for this resolution: N/A; the resolution adapts imports and a test path without changing the migrated episode behavior.

🤖 Generated with Claude Code

@yaoyu-33 yaoyu-33 added Config area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers area:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation labels Oct 23, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 23, 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

Copy link
Copy Markdown
Contributor Author

/ok to test b6494e9

@yaoyu-33 yaoyu-33 left a comment

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.

Team review of the regenerated configs. The YAML diff is exactly the generator's output (byte-identical on a fresh run), comments are preserved, every switched block validates against SingleAgentTurnEnvironmentServerConfig, and the three switched servers that override seed_session (critpt, example_single_tool_call, interactive_browser) handle the typed body.

Three switched configs break in ways the resolve-before/after check did not catch (the affected recipes were already failing for unrelated reasons on both sides, or only fail at runtime). There is also one opt-in observability regression that applies to every switched config.

Not inline:

  • Behavior changes users will see (episode timeout now enforced, agent outcome policy, server-owned close) have no release-notes entry.
  • The real-model reward-profile comparison is still pending, as the body says.

Comment thread benchmarks/hle/config.yaml Resolved
Comment thread benchmarks/gpqa/config.yaml Resolved
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test ae44e0c

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 4b93cc1

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 23, 2026 17:23
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 77a482f

…_turn_legacy

The main merge brought in two benchmarks that override `legacy_agent` on a parent environment server this PR
already switched, so each resolved to both keys and failed as an almost-server. Point their overrides at
`single_agent_turn_legacy`, and update the tests from main that still expect the relay or the generic config class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
@weijiac0619

Copy link
Copy Markdown
Contributor

/ok to test 51c3dee

@cmunley1
cmunley1 added this pull request to the merge queue Oct 30, 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/41124380501

@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/41129254996

@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/41130480746

This branch was previously deployed

1 inactive deployment
public — 51c3dee1 Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8765
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers blocked Work cannot move forward until an external dependency is cleared Config feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants