Repository navigation
fix(cli): serialize shared virtual environment setup - #3435
Conversation
|
🌿 Preview your docs: https://nvidia-preview-mbien-fix-venv-setup-race.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
Check environment readiness under a per-venv lock and mark setup complete only after dependency installation succeeds. Preserve existing reuse behavior and cover concurrent setup, interruption, and retry with focused regression tests. Signed-off-by: Michal Bien <[email protected]>
9d6b98a to
53b072c
Compare
|
/claude review |
|
/ok to test 53b072c |
@Glorf, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
SHIP — no reliability concerns. Reviewed the venv-setup concurrency and quoting rework end to end. Concurrency / locking ( TOCTOU fix — deferring the Quoting — Tests — exercise the interrupt/kill concurrency path with real subprocesses, signal handling, marker invalidation+retry, and the deferred-manifest branch. Real behavior, not pass-through. |
|
/ok to test 31d150e |
|
@bxyu-nvidia could you take a look? |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/35375138185 |
What does this PR do?
Prevent a server from starting while another server is still installing dependencies into their shared virtual environment. With
skip_venv_if_present=true, the presence ofbin/pythonandbin/activatecould previously trigger premature reuse and import failures such as missingaiohttp.Check readiness at execution time under a per-environment lock, and record completion only after installation succeeds. A surviving installer retains the lock if its wrapper is killed; failed or interrupted setup can be retried.
No separate issue: this focused bug fix includes a regression test for the observed startup race.
Validation
Run against the final squashed change (
53b072cb):.venv/bin/python -m pytest tests/unit_tests/test_cli_setup_command.py tests/unit_tests/test_cli.py -x --durations=5— 132 passed..venv/bin/pre-commit run --all-files— passed.New runtime coverage is limited to seven cases across four tests: concurrent setup/interruption, failure/retry, reuse without a manifest, and the generated setup/activation command. Existing dependency and version assertions are retained. The full unit suite and coverage were not rerun for this revision.
Rollouts
N/A: this changes component setup, with no changes to agent or verifier behavior. Startup is exercised with real subprocesses and a controlled dependency installer; no model rollout was run for this revision.
Compatibility and benchmark impact
The existing
skip_venv_if_presentoption and default are unchanged. Environments without a completion marker run dependency installation once before reuse, without being deleted. Setup/reuse requires a writable sibling lock file on a filesystem supporting process-shared locks. Benchmark definitions and scoring are unchanged.Checklist