Skip to content

Add NeMo Gym V1 integration - #2212

Open
xeophon wants to merge 22 commits into
mainfrom
agent/nemo-gym-v1
Open

Add NeMo Gym V1 integration#2212
xeophon wants to merge 22 commits into
mainfrom
agent/nemo-gym-v1

Conversation

@xeophon

@xeophon xeophon commented Jul 31, 2026

Copy link
Copy Markdown
Member

Overview

Adds a NeMo Gym resources-server integration for Verifiers V1. Existing Verifiers harnesses drive the rollout while NeMo Gym remains responsible for resource-server state, native tools, and scoring.

Details

  • Loads NeMo Gym JSONL requests into typed V1 tasks and preserves the source row for session setup and verification.
  • Carries per-rollout cookies and signed MCP session headers through V1 state while exposing upstream tool schemas to MCP-capable harnesses.
  • Converts completed single-branch traces into NeMo Responses objects and records /verify rewards and numeric metrics.
  • Adds a Python 3.12+ nemo-gym optional dependency and reuses resource-server classes from the published package, with V1 owning startup and cleanup.
  • Uses uv dependency metadata to install only the resource-server import slice instead of the full NeMo agent, model, and evaluation stack.
  • Adds environments/nemo_gym_weather_v1 as a thin, self-starting example package; external resource-server URLs remain supported for custom deployments.

Fixes RES-1090


Note

Medium Risk
New subprocess server lifecycle, HTTP/MCP bridging, and trace-to-Responses scoring affect eval correctness; dependency-metadata changes pull Ray and related packages when the extra is enabled.

Overview
Adds NeMo Gym as a V1 taskset path so Verifiers harnesses drive rollouts while Gym resource servers own session state, tools, and /verify scoring—not Gym’s native agent stack.

Core integration (verifiers/v1/tasksets/nemo_gym/): JSONL rows with responses_create_params become tasks; each rollout POSTs the row to /seed_session, exposes Gym tools to MCP harnesses via _NeMoGymToolset (MCP-over-HTTP or direct HTTP), then converts a single-branch trace to a NeMo Responses object and scores via /verify. NeMoGymEnv can spawn a packaged resource server in a subprocess (port file + health poll) or you can set resources_url for an external server.

Supporting changes: mcp_session in launch.py for scoped MCP HTTP client sessions; optional nemo-gym==0.4.0 extra with uv dependency-metadata to trim NeMo’s full platform install; example environments/nemo_gym_weather_v1; docs and e2e eval wiring with editable env packages.

Reviewed by Cursor Bugbot for commit 185dbd2. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add NeMo Gym V1 taskset integration with managed resource server lifecycle

  • Adds NeMoGymTaskset and NeMoGymEnv in taskset.py to load tasks from a JSONL dataset, seed sessions on a NeMo Gym resource server, expose tools via MCP-over-HTTP or direct HTTP, and compute rewards via the server's /verify endpoint.
  • Adds NeMoGymEnv.start/stop to automatically launch a local resource server subprocess, poll for readiness via a port file, and inject the resolved URL into task config — no manual server management needed.
  • Adds an mcp_session async context manager in launch.py for HTTP-based MCP ClientSession connections with a 600s timeout.
  • Adds a concrete NeMoGymWeatherTaskset example environment in environments/nemo_gym_weather_v1 backed by a bundled example.jsonl dataset.
  • Pins nemo-gym==0.4.0 as an optional dependency (Python >=3.12) in pyproject.toml installable via verifiers[nemo-gym].

Macroscope summarized 185dbd2.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@xeophon
xeophon requested a review from anravich13-cloud July 31, 2026 19:26
@xeophon

xeophon commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Migrated review context

This PR carries the exact head commit from the prior fork-backed review. Outstanding point retained for follow-up:

  • Normalize Codex-qualified MCP tool names back to the original NeMo Gym tool name before sending the trace to /verify.

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
for _ in range(60):
try:
port = int((await runtime.read("nemo_gym.port")).decode())
config.resources_url = f"http://127.0.0.1:{port}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High nemo_gym/taskset.py:335

NeMoGymEnv.start always probes http://127.0.0.1:{port} and sets that as resources_url, but the child server binds to whatever address NEMO_GYM_HOST specifies in its environment. When that variable is set to a non-loopback interface, the server is healthy but not listening on 127.0.0.1, so the health check never succeeds, start times out, and managed tasks cannot run. The host used in the probe URL must match the host the child server actually binds to.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @verifiers/v1/tasksets/nemo_gym/taskset.py around line 335:

`NeMoGymEnv.start` always probes `http://127.0.0.1:{port}` and sets that as `resources_url`, but the child server binds to whatever address `NEMO_GYM_HOST` specifies in its environment. When that variable is set to a non-loopback interface, the server is healthy but not listening on `127.0.0.1`, so the health check never succeeds, `start` times out, and managed tasks cannot run. The host used in the probe URL must match the host the child server actually binds to.

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
Comment thread verifiers/v1/tasksets/nemo_gym/server.py
@macroscopeapp

macroscopeapp Bot commented Jul 31, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR adds a new NeMo Gym V1 integration with substantial new components including taskset classes, server lifecycle management, and MCP toolset bridging. New integrations of this scope warrant human review. Additionally, an unresolved comment flags a potential bug in the server health check logic.

You can customize Macroscope's approvability policy. Learn more.

@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from 4ee6a93 to 44df475 Compare July 31, 2026 20:02
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from 44df475 to 3cc18e5 Compare August 3, 2026 08:46
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a609293. Configure here.

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant