Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions embodichain/agents/rl/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def train_from_config(config_path: str):
gym_config_data, manager_modules=DEFAULT_MANAGER_MODULES
)

if num_envs is not None:
gym_env_cfg.num_envs = num_envs
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

num_envs is taken from JSON as-is and assigned directly to gym_env_cfg.num_envs. Since EnvCfg.num_envs is an int, this should be validated/cast (e.g., int(num_envs)) and rejected if it’s <= 0 to avoid creating an invalid environment count (or accidentally accepting a string).

Suggested change
gym_env_cfg.num_envs = num_envs
try:
parsed_num_envs = int(num_envs)
except (TypeError, ValueError) as exc:
raise ValueError(f"Invalid num_envs value in config: {num_envs!r}") from exc
if parsed_num_envs <= 0:
raise ValueError(f"num_envs must be a positive integer, got {parsed_num_envs}")
gym_env_cfg.num_envs = parsed_num_envs

Copilot uses AI. Check for mistakes.
Comment on lines +140 to +141
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

This change adds new behavior (trainer config overriding gym config for num_envs), but there’s no assertion-level test coverage verifying the override actually takes effect (e.g., gym_config has one value while trainer has another, and the env is constructed with the trainer value). Consider extending the existing RL training test to confirm the override is honored (can be done by monkeypatching build_env to capture the passed base_env_cfg.num_envs).

Copilot uses AI. Check for mistakes.

# Ensure sim configuration mirrors runtime overrides
if gym_env_cfg.sim_cfg is None:
gym_env_cfg.sim_cfg = SimulationManagerCfg()
Expand Down
Loading