Skip to content

Conversation

@ffrujeri
Copy link
Contributor

@ffrujeri ffrujeri commented Nov 16, 2025

Add VS Code Debugging Support for Server Subprocesses

Summary

Adds support for debugging NeMo Gym server subprocesses in VS Code without modifying application code. This enables developers to set breakpoints and debug server logic during development.

Motivation

Previously, debugging server code was difficult because:

  • Servers are spawned as subprocesses by the CLI (ng_run)
  • VS Code debugger couldn't attach to child processes
  • Required adding temporary debug code to server_utils.py
  • No standardized debugging workflow

This PR provides a clean, reproducible debugging setup that works out of the box.

Changes

1. Added debugpy to Dev Dependencies

File: pyproject.toml

  • Added debugpy>=1.8.0 to [project.optional-dependencies].dev
  • Included proper license and version documentation

2. CLI Support for Subprocess Debugging

File: nemo_gym/cli.py

  • Added DEBUG_MODE_KEY_NAME environment variable support
  • When enabled, spawns servers with python -m debugpy --listen
  • Each server gets a sequential debug port (5678, 5679, 5680, etc.)
  • Debug mode is opt-in and doesn't affect production usage

3. Documentation

  • Complete debugging workflow guide
  • VS Code launch.json configurations
  • Step-by-step instructions
  • Troubleshooting section
  • Quick reference for environment variables

Checklist

  • Added debugpy to dev dependencies
  • Updated CLI to support subprocess debugging
  • Added comprehensive documentation
  • Tested debugging workflow
  • No breaking changes

Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri ffrujeri requested a review from a team as a code owner November 16, 2025 06:05
@copy-pr-bot
Copy link

copy-pr-bot bot commented Nov 16, 2025

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.

Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri ffrujeri changed the title feat: Add debugging instructions for gym servers. docs: Add debugging instructions for gym servers. Nov 18, 2025
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri ffrujeri requested a review from bxyu-nvidia November 20, 2025 18:13
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.

3 participants