Repository navigation
feat(gym-v): add visual environments with optional context compaction - #5983
Conversation
Let training frameworks own capture roots and continuation decisions using request replay evidence and committed coordinates. Preserve completion identity, buffered Responses capture, explicit retry controls, and exact measurement through the ordinary vLLM server. Keep the existing compaction agent and model intact in this infrastructure layer. The native agent migration is a separate stacked change. Validation: 618 core/model cases and 56 retained legacy agent/model cases passed on Mac CPU across the documented runs. Combined-head GPU smoke evidence is recorded separately. Co-authored-by: alexandery <[email protected]> Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Preserve concurrent framework capture alongside upstream rollout timing, outbound telemetry, tool-call attribution, and canonical finish reasons. Keep retry suppression effective with metrics and tracing enabled. Validation: 2,475 affected Gym CPU tests and 184 paired RL compatibility tests passed; two optional custom OpenCode exporter cases skipped. Full pre-commit passed. Fern check passed with the unauthenticated redirect check skipped. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Normalize string input as a user message before capture matching and measurement. Verify unchanged history continues while omitted or changed initial questions start new roots. Validation: 840 affected Gym CPU tests, three HTTP prefix checks using the actual RL input decision, and pre-commit checks passed. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Move semantic history, policies and the context client into the reusable context_management package. Return ordinary accepted rollout history from simple_agent_with_compaction and use the ordinary vLLM capture server. Preserve shared termination semantics and remove the replaced legacy compaction session/model with its paired ASR configuration entry. Context management stays optional for external harnesses. The combined source tree exactly matches the qualified Gym PR head cf90856; no dependency or lockfile changes. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Merge main while preserving rollout dispatch tracing. Validate Responses conversion before intent registration, shield cancellation failure writes, reuse connection-safe replay controls, and root ambiguous source candidates without selecting a parent. Validated with 2,279 Gym CPU cases, four paired Gym/RL selection and reconstruction cases, and pre-commit --all-files. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Replace removed _retry arguments in context measurement, generation, and resources calls. Exercise the real ServerClient retry stack against aiohttp's accepted arguments, preserving safe connection retries and refusing ambiguous resends. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
…ements Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Merge Gym main at 4945282. Retain upstream output-budget classification in both backend routes and source-history worker-acknowledged refusal handling. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
…20261026 Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Integrate the validated source tree while retaining the published PR history. Signed-off-by: Ali Roshan Ghias <[email protected]>
Integrate the validated source tree while retaining the published PR history. Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
yfw
left a comment
There was a problem hiding this comment.
Verdict: HOLD. This is not ready to merge yet, but each of the two blockers has a small, tested fix.
The two blockers are the plain 409s that turn the required core test red (resources_servers/gym_v/app.py:169) and the capture key that drops NeMo RL's rollout ID (responses_api_agents/gymv_agent/app.py:436-446). Please also fix the four risks before merge. Each one is small and has a tested fix:
- model failures scored as 0 on the full-history path (
responses_api_agents/gymv_agent/app.py:478-499) - five MiniGrid games masked on a bad action (
resources_servers/gym_v/app.py:346) - the overlay key that does not match the agent instance (
environments/gym_v/config.yaml:42) - the missing
source_historyrequirement (responses_api_agents/visual_context.py:51)
The notes can follow.
The agent's own session path is careful: an abort, a cancellation or a failed /verify call closes the session and discards its reward. The five shipped success predicates match each game's real win condition.
Process: the PR merges with main without a conflict, and all commits have a DCO sign-off. In CI only the early jobs ran (lint, locks, DCO, copyright, secrets), and they pass. The unit and server tests wait for a maintainer's /ok to test on the current head 9549d4236434382014a56013488637727c38d2a4. The PR description names an older SHA, 3ce0e4853920dccbecdd083e6459078dc8a1ee50. The core job will be red until the 409 change lands. Locally, pre-commit run --all-files on main merged with this PR passes every hook, and scripts/component_locks.py passes.
Shared files: the PR adds one core export, NeMoGymMessageForTraining, which is additive and not used by NeMo RL. It also adds two files in shared places, responses_api_agents/visual_context.py and tests/helpers/visual_context_contract.py, and only this agent uses them. With the file move (responses_api_agents/visual_context.py:1) and the union removal (resources_servers/gym_v/schemas.py:45-60), the PR touches no shared file. #5984 has byte-identical copies of all three files, so the same changes apply there.
A faster path, if you want one: move the compaction overlay to a follow-up PR. That takes five comments out of this PR: environments/gym_v/config.yaml:42, responses_api_agents/visual_context.py:51, responses_api_agents/gymv_agent/app.py:163, responses_api_agents/visual_context.py:1 and responses_api_agents/gymv_agent/README.md:12-16. This is a choice, not a requirement. The capture-key fix still applies to the full-history path.
Rollout evidence: the November 10 run covered only the compaction overlay, and it predates main's capture changes. After the fixes, one run of environments/gym_v/config.yaml on the five example rows at the new head will show the default path.
Generated by Claude Code
…tracts Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
|
@yfw, pushed the review fixes in 304f3b1 and 4eb7dc1; the current head is The fixes cover the conflict exception contract, capture owner/sampling/skip propagation, model-infrastructure failure handling, all seven MiniGrid invalid-action wrappers, overlay instance naming, source-history admission, call/token caps, caller instructions and nested boxed actions. Helpers now live with their component, the copied core union/export is removed, and failed typed construction remains retryable through the existing framework fence. Validation on the pushed source: 76 resource tests and 116 agent/HTTP/workload/core-session checks passed, plus full pre-commit. The new failed-construction regression reproduced the old behavior before the fix. Live E2E validation is still incomplete. At the latest job check, the full-history smoke reached model readiness but failed in the test launcher's directory creation before any rollout; the compaction learner was still queued. No new live rollout, optimizer-update or checkpoint/resume pass is claimed. The earlier November 10 rollout evidence does not validate these new changes. The optional migration to another harness remains outside this PR. I have left the review threads open for your verification. |
Signed-off-by: Ali Roshan Ghias <[email protected]>
yfw
left a comment
There was a problem hiding this comment.
All 18 review comments are fixed at 4cbf92d, and the threads are resolved. Before approval, please add one real rollout at the current head.
The fixes change what the agent does. A failed model call now ends the episode without a score. The model also gets only the row's instructions as its system prompt. The November 10 run covered only the compaction overlay, and it came before these changes.
Please run environments/gym_v/config.yaml without the overlay on the five rows in environments/gym_v/data/example.jsonl. In the Rollouts section, please give the model, the reward and task_success for each row, and what the agent and the verifier did. If the launcher's directory error stops the job again, please post the error here.
Generated by Claude Code
|
Tested the current head Model: Super step_120 (
All five episodes completed verification without infrastructure masking. All 80 model calls returned HTTP 200; 37 reached their output-token limit. For a concrete successful episode, GridComponent returned The initial serving configuration allowed only 21 images, which blocked longer histories. Raising the server-side allowance to 65 fixed that without changing agent behavior or shortening episodes. These are inference/verification results. The separate latest-commit RL test remains queued. Model serving used temperature 1/top_p 1 to match the NeMo-RL endpoint’s sampling profile; the example rows request temperature 0.7. Agent/resource defaults were preserved. |
|
/ok to test 4cbf92d |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45728891133 |
What does this PR do?
Add Gym-V resources and Responses API agent components for visual reset/action/step/verification episodes, with optional capture-backed context compaction. The default retains full history; the compaction overlay retains first-plus-latest-two reasoning/images while preserving actions and observation boundaries. It uses measured admission and the shared client/policy from #3368.
Context-management dependency #3368 is merged. This PR targets NVIDIA-NeMo/Gym main and incorporates upstream
da75c436c3a17ba942a5b59ba31c0757727f59f5. Review the adapter-only diff. Both game adapters remain independent siblings; their common admission helper, core export and test helper are identical. No separate issue is needed for this scoped adapter integration.The scope cleanup removes optional debug/transition plumbing and experiment-specific helpers while retaining the shared compaction client, capture identity, history boundaries, native reward and lifecycle protections. The November 20 refresh updates the four affected component locks to reflect upstream's optional Ray/E2B bounds. Resolved package versions, sources and simulator revisions are unchanged.
The adapter owns resource sessions, bounded cleanup and verification retries; infrastructure failures are masked, while legitimate model failures remain scored. Native accumulated reward remains the default; the qualification workload explicitly selects binary task success. Includes isolated component dependencies, deterministic smoke preparation, verifier fixtures, usage aggregation and rollout/capture identity propagation. Component-local pytest importlib mode and namespace-package discovery prevent provider/module shadowing during tests. No shared resources package marker or edits to existing Aviary components are needed.
Validation — November 20 refresh
Scope cleanup: the component-local discovery replacement passed 70 Gym-V resource tests plus 73 agent/workload tests, and 73 VisGym resource tests plus 89 agent/workload tests, with no skips. Both full pre-commit and resource lock checks passed. Aviary and the shared resources package layout match upstream main. Normal per-component CI discovers the local pytest configuration automatically; combined tests from the repository root should select
--import-mode=importlib -o consider_namespace_packages=true. The public API checks below preceded this test-discovery-only cleanup.uv lock --checkpass. Full repository pre-commit passes, including guardwords and layering. Both new commits are signed off. Root dependency files match upstream main.Rollouts
Representative real-model compaction smoke completed on November 10 (job 8838475, exit 0), using Super step_120, 8,192 output tokens, measured 51,200-token context and up to 20 calls. Measurement and generation both explicitly set
truncate_history_thinking=falseso the model template preserves selected reasoning.Compatibility and benchmark impact
Experimental status and
verified: falseremain. Existing environments are not reconfigured. The legacy-agent relay remains the dispatch boundary; the agent does not claim typed-turn telemetry. The optional overlay uses 20 calls and 8,192/51,200 output/context limits without changing model sampling. Additional task families need their own audited success predicates and assets.Gym-V is pinned to rohitrango/gym-v at
7ccf14ecb5241f37372dd530accf77f7e7ef5fc6, Apache-2.0. Provider dependencies/assets retain their own licenses; synthetic smoke inputs do not license them. Earlier full-history model smoke covered 25 scored records across five families; the compaction smoke above is narrower and does not establish a qualified 22-game benchmark.The adapter is extracted from existing NVIDIA-NeMo/Gym work at 22742c13589b610d6af81a87949916b7f682b62f, Apache-2.0, under
resources_servers/gym_vandresponses_api_agents/gymv_agent. It is not copied from the external simulator implementation; that implementation remains an isolated dependency. No NeMo-RL code is included.Checklist
For contributor CI, a qualified maintainer must authorize the current head with
/ok to test 3ce0e4853920dccbecdd083e6459078dc8a1ee50. No trust-gate comment is part of this refresh.