Skip to content

fix(sc): give vLLM workers the nemo_gym extra by default instead of swapping the env at runtime - #4043

Merged
cspades merged 1 commit into
cye/rl_mllm_omni_mm_nocolgym_rebase_pr2957from
terryk/sc-vllm-gym-venv-default
Sep 7, 2026
Merged

fix(sc): give vLLM workers the nemo_gym extra by default instead of swapping the env at runtime#4043
cspades merged 1 commit into
cye/rl_mllm_omni_mm_nocolgym_rebase_pr2957from
terryk/sc-vllm-gym-venv-default

Conversation

@terrykong

Copy link
Copy Markdown
Collaborator

What does this PR do?

Targets the head branch of #4009. Fixes the L1_Functional_Tests_SingleController failure seen in https://github.com/NVIDIA-NeMo/RL/actions/runs/34093342031/job/101689581550:

ModuleNotFoundError: No module named 'nemo_gym'
RuntimeError: token_capture.enabled requires nemo_gym inside the vLLM worker venv, but the cached worker venv predates it.

Root cause

Token capture (#3837) swapped the VllmAsyncGenerationWorker registry entry to PY_EXECUTABLES.VLLM_GYM at setup time. But worker venvs are cached by actor class name only, and the venv builder returns early as soon as bin/python exists. The Dockerfile bakes that venv with plain --extra vllm, so the runtime swap never takes effect: the baked venv is reused as-is and the nemo_gym import fails.

That is why this fails on a freshly built container. Rebuilding the image reproduces the bug rather than fixing it. It was not caught before because no CI run of #3837, and no main run since it merged, ever got past L0 to run this job.

Fix

  • VLLM_EXECUTABLE now uses PY_EXECUTABLES.VLLM_GYM (vllm + nemo_gym extras), so the venv the Dockerfile prefetches already has nemo_gym.
  • Remove the runtime ACTOR_ENVIRONMENT_REGISTRY override in setup_single_controller. We should not change a worker's environment after the venv cache has been built.
  • Remove the try/except that rewrote the nemo_gym import error. It described the old behavior and is no longer reachable.

The venv fingerprint commit already on this branch (32fbaef) would also have hidden this symptom, because the digest includes the uv command string. It is left alone here, but it is not needed for this bug.

Testing

  • ruff check and ruff format --check pass on the edited files.
  • Needs CI:L1 to rebuild the container and re-run L1_Functional_Tests_SingleController, which is where the token-capture test lives.

…wapping the env at runtime

Token capture swapped the VllmAsyncGenerationWorker registry entry to
VLLM_GYM at setup time. Worker venvs are cached by actor class name, so a
venv prebuilt with plain --extra vllm (which is what the Dockerfile bakes)
was reused as-is and the nemo_gym import failed. This is why the
SingleController L1 job fails even on a freshly built container.

Make VLLM_EXECUTABLE use VLLM_GYM so the baked venv already has nemo_gym,
and drop the runtime registry override and the error wrapper that
described the old behavior.

Signed-off-by: Terry Kong <terryk@nvidia.com>
@terrykong
terrykong requested review from a team as code owners September 7, 2026 17:10
@copy-pr-bot

copy-pr-bot Bot commented Sep 7, 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.

@terrykong terrykong added the CI:L1 Run doctests, unit tests, and functional tests label Sep 7, 2026
@terrykong

Copy link
Copy Markdown
Collaborator Author

/ok to test 3e547fa

@cspades
cspades merged commit 3e547fa into cye/rl_mllm_omni_mm_nocolgym_rebase_pr2957 Sep 7, 2026
31 of 33 checks passed
@cspades
cspades deleted the terryk/sc-vllm-gym-venv-default branch September 7, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants