Skip to content

Add NeMo Gym V1 integration - #2032

Closed
xeophon wants to merge 17 commits into
PrimeIntellect-ai:mainfrom
xeophon:agent/nemo-gym-v1
Closed

Add NeMo Gym V1 integration#2032
xeophon wants to merge 17 commits into
PrimeIntellect-ai:mainfrom
xeophon:agent/nemo-gym-v1

Conversation

@xeophon

@xeophon xeophon commented Jul 15, 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 eval/scoring path depends on external HTTP/MCP servers and subprocess lifecycle; trace→response conversion must match Gym’s verifier contract, but changes are isolated behind the new taskset and optional extra.

Overview
Adds NeMo Gym V1 integration so verifiers harnesses can run Gym JSONL tasks against resources servers while Gym keeps session state, tools, and /verify scoring.

NeMoGymTaskset / NeMoGymTask load JSONL rows with responses_create_params, call POST /seed_session per rollout (cookies + optional MCP metadata), expose Gym tools through _NeMoGymToolset (MCP HTTP or direct HTTP), and score by converting a single-branch trace to a NeMo Responses object and posting to /verify.

NeMoGymEnv optionally spawns a packaged resource server via verifiers.v1.tasksets.nemo_gym.server when no resources_url is set; subclasses set resource_server to an import path.

Adds mcp_session in verifiers/v1/mcp/launch.py for short-lived MCP HTTP client sessions. Adds optional verifiers[nemo-gym] (nemo-gym==0.4.0, Python ≥3.12) with uv dependency-metadata to trim the install graph, plus environments/nemo_gym_weather_v1 and docs/v1/nemo_gym.md.

Reviewed by Cursor Bugbot for commit 4ee6a93. 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 verifiers/v1/tasksets/nemo_gym/taskset.py that load tasks from a JSONL dataset, seed per-rollout server sessions, and score completions by calling a NeMo Gym resources server verifier.
  • NeMoGymEnv manages a subprocess-based resources server: on start it spawns the server, discovers its port via nemo_gym.port, and tears it down on stop. External server URLs are also supported.
  • Tool bridging in _NeMoGymToolset supports both MCP HTTP and direct HTTP endpoints, exposing gym tools to agents with consistent MCP-style results.
  • Adds verifiers/v1/mcp/launch.py mcp_session async context manager for streamable MCP HTTP client sessions with configurable timeout.
  • Includes a nemo-gym-weather-v1 example environment and documentation in docs/v1/nemo_gym.md.
  • Risk: nemo-gym==0.4.0 is pinned as an optional dependency (nemo-gym extra) and requires Python >=3.12; the managed server subprocess writes a port file and times out if the server fails to start.

Macroscope summarized 4ee6a93.

@xeophon
xeophon marked this pull request as draft July 15, 2026 16:51
Comment thread verifiers/v1/tasksets/nemo_gym/server.py Outdated
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch 2 times, most recently from de9f35a to 9cea5a6 Compare July 16, 2026 15:57
@xeophon
xeophon marked this pull request as ready for review July 22, 2026 13:52
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e42f163ddc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d9bc2c714

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from 9d9bc2c to af98d46 Compare July 23, 2026 12:25

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af98d46f17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from af98d46 to f18134d Compare July 24, 2026 06:25

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f18134dd1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/tasksets/nemo_gym/server.py
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
@xeophon
xeophon requested a review from anravich13-cloud July 26, 2026 16:54
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from 9656d11 to 6cb4d40 Compare July 27, 2026 13:26

@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 6cb4d40. Configure here.

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from cc45698 to 4ee6a93 Compare July 30, 2026 09:23

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ee6a934da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +203 to +207
for item in output:
name = str(item.get("name", ""))
bare_name = name.removeprefix("_")
if item.get("type") == "function_call" and bare_name in known_names:
item["name"] = bare_name

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Normalize Codex MCP tool names before verification

When this taskset is used with the Codex harness, its empty MCP server ID (TOOL_PREFIX = None) is exposed to the model under the mcp___ namespace by verifiers/v1/harnesses/codex/harness.py, so recorded function calls retain an mcp__...-qualified name. Removing only one leading underscore leaves that qualification intact, and /verify receives a name that is not among the original Gym tool names even though the tool executed successfully, causing tool-dependent Codex rollouts to be rejected or mis-scored. Normalize the Codex-qualified form back to an entry in known_names.

Useful? React with 👍 / 👎.

@xeophon

xeophon commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Superseded by #2212 after migrating the exact head commit to an upstream-owned branch. Outstanding review context and reviewer requests were carried forward.

@xeophon xeophon closed this Jul 31, 2026
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