Skip to content

chore(server): request the ray extra from servers that use Ray - #4301

Merged
ananthsub merged 1 commit into
mainfrom
ananthsub/ray-servers-request-extra
Oct 9, 2026
Merged

ananthsub merged 1 commit into
mainfrom
ananthsub/ray-servers-request-extra

Conversation

@ananthsub

@ananthsub ananthsub commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4314.

What changed

Every server implementation that declares ray_enabled = True now requests nemo-gym's ray extra (added in #4300) in its own manifest:

Manifest Change Servers
requirements.txt -e nemo-gym[dev,ray] @ ../../ code_gen, evalplus, legal_agent_bench, longmt_eval, spider2_lite, swerl_gen, wmt_translation, mini_swe_agent, osworld_agent, stirrup_agent, swe_agents
requirements.txt -e nemo-gym[dev,ray,sandbox] @ ../../ anyterminal_agent, harbor_agent, mini_swe_agent_2
pyproject.toml "nemo-gym[dev,ray]" code_fim, harbor_agent_general
setup.py "nemo-gym[dev,ray]" local_vllm_model, genrm_model

A new audit in tests/unit_tests/test_ray_opt_out.py fails when a server directory containing a class that declares ray_enabled = True doesn't request the extra in any of its manifests. The FAQ's "Installing Ray" section now describes the convention.

Why

This is the third step of making Ray optional (#3669). After #4300, a server venv gets Ray only when the server's own dependencies ask for it; the parent's version is applied as a constraint, not installed. Once Ray leaves nemo-gym's core dependencies, these servers need to request it themselves, and #4295 makes sure the extra survives PyPI installs.

Validation

  • pytest tests/unit_tests/test_ray_opt_out.py. With the manifests reverted, the new audit lists every Ray server.
  • Resolution: uv pip install --dry-run from each server's directory resolves with Ray included, for one server per manifest format: code_gen (requirements.txt), anyterminal_agent (requirements.txt with sandbox), code_fim (pyproject.toml), and local_vllm_model (setup.py).
  • pytest responses_api_agents/osworld_agent/tests/test_dependency_policy.py, which reads that server's dependency files.
  • fern check passes.
  • pre-commit run scoped to the changed files.

Rollout evidence

N/A. Ray is still a core dependency of nemo-gym, so these servers install the same packages as before. This doesn't change prompts, model requests, trajectories, verification or rewards.

Compatibility

No change for any install today. External servers that use Ray should request nemo-gym[ray] the same way before Ray becomes optional.

@copy-pr-bot

copy-pr-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ananthsub
ananthsub force-pushed the ananthsub/tolerate-missing-ray branch from 684d7ec to 86aac2a Compare October 9, 2026 17:06
@ananthsub
ananthsub force-pushed the ananthsub/ray-servers-request-extra branch from 107be62 to 13087fa Compare October 9, 2026 17:06
@ananthsub
ananthsub force-pushed the ananthsub/tolerate-missing-ray branch from 86aac2a to 8bba52b Compare October 9, 2026 17:17
@ananthsub
ananthsub force-pushed the ananthsub/ray-servers-request-extra branch from 13087fa to 5ae24f8 Compare October 9, 2026 17:17
hemildesai
hemildesai previously approved these changes Oct 9, 2026
@ananthsub
ananthsub marked this pull request as ready for review October 9, 2026 18:17
@ananthsub
ananthsub requested a review from a team as a code owner October 9, 2026 18:17
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 9, 2026 18:17
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Base automatically changed from ananthsub/tolerate-missing-ray to main October 9, 2026 18:51
@ananthsub
ananthsub dismissed hemildesai’s stale review October 9, 2026 18:51

The base branch was changed.

@ananthsub
ananthsub requested a review from hemildesai October 9, 2026 18:55
Every server implementation that declares ray_enabled = True now asks
for nemo-gym's `ray` extra in its own manifest:
- requirements.txt: `-e nemo-gym[dev,ray]` (or `[dev,ray,sandbox]`)
- pyproject.toml and setup.py: `nemo-gym[dev,ray]`

Ray is still a core dependency, so nothing installs differently yet.
Once Ray moves out of the core dependencies, these servers keep getting
Ray in their venvs, pinned to the parent's version by the existing
constraint.

Add an audit that fails when a server declaring ray_enabled = True
doesn't request the extra, and document the convention in the FAQ.

Part of #3669.

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
@yaoyu-33 yaoyu-33 added area:build Packaging, dependencies, containers, and releases complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge labels Oct 9, 2026
@ananthsub
ananthsub added this pull request to the merge queue Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37981983559

Merged via the queue into main with commit 82f9200 Oct 9, 2026
53 of 55 checks passed
@ananthsub
ananthsub deleted the ananthsub/ray-servers-request-extra branch October 9, 2026 19:58
github-merge-queue Bot pushed a commit that referenced this pull request Oct 14, 2026
Closes #4316.

## What changed

`ray[default]` and its `jinja2` pin move out of nemo-gym's core
dependencies and live only in the `ray` extra (also part of `all`). A
plain `pip install nemo-gym` no longer installs Ray.

- **Packaging:** `pyproject.toml` and `uv.lock`. The lockfile change is
metadata only; Ray and `jinja2` stay locked through the extra, and no
package versions move.
- **CI:**
- `scripts/ci/core_unit_tests.sh`, plus the unit-test and
full-test-suite syncs, add `--extra ray`, so Ray code paths stay tested
and stay in the coverage gate.
- The wheel smoke test still installs the plain wheel, which now also
covers the path without Ray.
- Server-test setup stays without the extra, because each Ray server's
own venv requests it.
- **Docker:** the image builds add `--extra ray`. The `ray_dist.jar`
removal for the CVE is unchanged.
- **Tests:** two tests skip when Ray isn't installed:
- `tests/unit_tests/test_ray_serve_gateway.py`, because the gateway
imports Ray Serve at module level;
- the Super 3.5 launcher's prebuilt-environment check, because its
generated dependency check imports Ray, which the evaluation image
provides.
- **Docs:** the installation and development-setup pages explain when to
add the `ray` extra, and the FAQ no longer says Ray is a core
dependency.

## Why

This is the last step of #3669. Earlier changes made Gym run without Ray
(#4300), had Ray servers request the extra (#4301), and made servers run
without Ray unless they declare `ray_enabled = True` (#4307). The only
remaining reason every install got Ray was nemo-gym's own core
dependency.

## Validation

- **Package metadata:** `uv build --wheel` gives `Requires-Dist:
ray[default]>=2.58.0; extra == "ray"` and `Requires-Dist: jinja2>=3.1;
extra == "ray"`, with no unconditional Ray requirement.
- **Without the extra:** `uv sync --locked --extra dev` gives an
environment where neither `ray` nor `jinja2` is importable, and `gym
--version` reports `"ray": "not installed"`.
- **Full `tests/unit_tests/` run, `-m "not sandbox"` as in the core CI
job.** I built the core CI job's environment (`dev`, `telemetry`,
`mlflow`, `wandb`) twice:
  - With `--extra ray`, everything passes.
- Without it, only the Ray-specific tests above skip. One
timing-sensitive OpenSandbox cleanup test failed once under parallel
load, and passed three times out of three on its own.
- `fern check` passes.
- `pre-commit run` scoped to the changed files.

## Rollout evidence

N/A. This changes which packages a default install includes. It doesn't
change prompts, model requests, trajectories, verification or rewards.
#4300 smoke-tested `gym env start` with Ray uninstalled.

## Compatibility

This is a breaking packaging change and needs a release note (#4317):
- **Ray-backed servers after a plain install:** anyone running a server
that declares `ray_enabled = True` (such as `local_vllm_model`,
`genrm_model` or the SWE agents) needs `pip install "nemo-gym[ray]"`, or
`uv sync --extra ray`, where `gym` runs. Without it, `gym env start`
stops before launching anything and says so.
- **Built-in Ray servers' own venvs:** they keep getting Ray through
their manifests, pinned to the version where `gym` runs.
- **NeMo RL:** brings its own Ray, so nothing changes there.
- **External servers that use Ray:** should request `nemo-gym[ray]` in
their manifests.

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
JeffPengCoder added a commit to JeffPengCoder/Gym that referenced this pull request Oct 20, 2026
Merge upstream main d96b337. Keep main's server startup environment, Ray auto-connect guard, reserved control-client pool, archived-audio splicing and requested Gym extras alongside this branch's runtime contracts.

- Setup: main now pins the parent's Ray version as a constraint (head_server_constraints) rather than a dependency. Keep its -c flag and also write the constraints into the per-venv parent-runtime overrides file, so a stale exact Ray pin in a server dependency is replaced instead of making the solve unsatisfiable; a server that does not require Ray still does not install it. Include the constraints in the environment identity.
- HTTP lifecycle: close the reserved control client together with the data client on the owner loop.
- vLLM proxy: keep the purpose marker where it was, before the new audio-splicing helper.

Validation: the core unit suite plus the vLLM, simple/compaction-agent and OSWorld server tests ran against this merge and against main d96b337 in the same environments (Python 3.13.14, aiohttp 3.14.4, yarl 1.25.1, FastAPI 0.135.2, real E2B SDK 2.46.0). On a Linux x86_64 CPU node, 10617 passed (main: 10563); every remaining failure also fails on main (optional mlflow/wandb absent, a symlinked work directory, and the OSWorld requirements assertion left by main NVIDIA-NeMo#4301), except one load-sensitive 10 s subprocess timeout in test_slurm_script that passes in isolation on both trees. On macOS ARM64, no test that passes on main fails here. The focused regression selection passed 3031 of 3034; its 3 failures are identical on main. pre-commit run --all-files, uv lock --check --offline and the main-relative git diff --check passed. No live GPU rollout or training run was launched.
Signed-off-by: Jeff Peng <jepeng@nvidia.com>

This branch was previously deployed

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

Labels

area:build Packaging, dependencies, containers, and releases complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request the ray extra from servers that use Ray

4 participants