Repository navigation
Fix option-like --kit_args values failing argparse on all entry points - #6363
Conversation
The multi-GPU launcher forwards unrecognized arguments to the child train.py verbatim. Kit arguments always start with "--", so the space-separated form --kit_args "--foo=/bar" arrived as two tokens and the child's argparse rejected the option-like value token with "expected one argument", exiting with code 2 on every rank. Fuse ["--kit_args", <value>] pairs into a single --kit_args=<value> token when building the torchrun and skrl JAX commands, and document the "="-attached form in AppLauncher's --kit_args help since direct single-process invocations hit the same argparse behavior.
Cover fusing the space-separated form into --kit_args=<value> on both the torchrun and skrl JAX paths, pass-through of the "="-attached and multi-token forms, acceptance of the forwarded arguments by the training script's argparse spec, and --dry_run output parsing. The tests run without a GPU or Isaac Sim installation.
Greptile SummaryThis PR fixes a bug where passing a single Kit argument in space-separated form (e.g.
Confidence Score: 5/5Safe to merge — the change is a targeted, well-tested one-function addition with no impact on execution paths that do not involve --kit_args. The helper is narrow in scope, both affected command-building paths receive the same treatment, and six GPU-free regression tests cover all relevant variants including child argparse acceptance. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["User: train_multigpu.py\n--kit_args --ext-folder=/path"] --> B["_parse_args()\nparse_known_args"]
B --> C["train_args =\n['--kit_args', '--ext-folder=/path']"]
C --> D["_build_distributed_command()"]
D --> E{Is skrl JAX?}
E -- No --> F["_build_torchrun_command()"]
E -- Yes --> G["_build_skrl_jax_command()"]
F --> H["_with_fused_kit_args(train_args)\nBEFORE: ['--kit_args', '--ext-folder=/path']\nAFTER: ['--kit_args=--ext-folder=/path']"]
G --> H
H --> I["_with_distributed_arg()\nadds --distributed"]
I --> J["Child train.py command\n--kit_args=--ext-folder=/path --distributed"]
J --> K["AppLauncher argparse\nAccepts --kit_args=value"]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["User: train_multigpu.py\n--kit_args --ext-folder=/path"] --> B["_parse_args()\nparse_known_args"]
B --> C["train_args =\n['--kit_args', '--ext-folder=/path']"]
C --> D["_build_distributed_command()"]
D --> E{Is skrl JAX?}
E -- No --> F["_build_torchrun_command()"]
E -- Yes --> G["_build_skrl_jax_command()"]
F --> H["_with_fused_kit_args(train_args)\nBEFORE: ['--kit_args', '--ext-folder=/path']\nAFTER: ['--kit_args=--ext-folder=/path']"]
G --> H
H --> I["_with_distributed_arg()\nadds --distributed"]
I --> J["Child train.py command\n--kit_args=--ext-folder=/path --distributed"]
J --> K["AppLauncher argparse\nAccepts --kit_args=value"]
Reviews (1): Last reviewed commit: "Add changelog fragment for --kit_args fo..." | Re-trigger Greptile |
Move the --kit_args fix from the multi-GPU launcher into AppLauncher.add_app_launcher_args: fuse ["--kit_args", "<option-like value>"] pairs in sys.argv into single --kit_args=<value> tokens before any parsing. Argparse rejects a value token that looks like an option (dash-prefixed, no space), so the documented space-separated form failed for a single Kit argument on every entry point, not only the multi-GPU forwarding path. Normalizing at the argument's owner fixes direct and forwarded invocations alike; the launcher-side fuse is removed as redundant and the launcher now forwards tokens verbatim.
The unified train.py/play.py dispatcher hands each per-library script an explicit argv list copied from sys.argv before any AppLauncher code runs, and the per-library scripts parse that list rather than sys.argv. The sys.argv normalization in add_app_launcher_args therefore never reached the unified train command or the multi-GPU child ranks, which still failed with "argument --kit_args: expected one argument". Apply the same fusing to the dispatcher's argv list before forwarding. Covered by a stub-entrypoint regression test that fails without the fix and a guard test asserting already-working argv forms are forwarded unchanged.
Re-sync onto latest develop (adds isaac-sim#6431 rendering-test timeout bump, isaac-sim#5730, isaac-sim#6363, OVPhysX test enablement). Keep device_scope test_devices() migration in test_rigid_object.py over develop's cpu/cuda:0 list.
isaac-sim#6363) ## Problem ```bash --kit_args "--ext-folder=/path/to/ext" # exit 2: "argument --kit_args: expected one argument" --kit_args=--ext-folder=/path/to/ext # worked --kit_args "--ext-folder=/a --ext-folder=/b" # worked ``` argparse rejects a value token that looks like an option (`-`-prefixed, no space) — and Kit args always start with `--`. Affects every entry point. ## Fix Two normalization points, sharing one fusing helper that rewrites `["--kit_args", "--ext-folder=/path/to/ext"]` into `["--kit_args=--ext-folder=/path/to/ext"]`: 1. `AppLauncher.add_app_launcher_args` fuses the pair in `sys.argv` before any parsing. Covers every script that parses `sys.argv`: demos, tutorials, tools, benchmarks, and the per-library play scripts. 2. `dispatch_library_entrypoint` applies the same fusing to the explicit argv list it forwards to the per-library train/play scripts. Those scripts parse that list (not `sys.argv`), so the `sys.argv` normalization alone never reached the unified `train` command or the multi-GPU ranks (each child rank runs through the dispatcher). Already-working forms are unchanged: a guard test asserts the equals-attached, quoted multi-token, and plain-flag forms are forwarded byte-identical. Tests: 17 in `source/isaaclab/test/cli/test_train_multigpu_command_building.py`. 12 fail with the `AppLauncher` fusing reverted; the dispatcher regression test fails with the dispatcher fusing reverted. Verified end-to-end: cartpole training via `train --rl_library rsl_rl ... --kit_args "--ext-folder=..."` (previously exit 2) now trains to completion, and the same command without `--kit_args` behaves identically to before. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
Problem
argparse rejects a value token that looks like an option (
--prefixed, no space) — and Kit args always start with--. Affects every entry point.Fix
Two normalization points, sharing one fusing helper that rewrites
["--kit_args", "--ext-folder=/path/to/ext"]into["--kit_args=--ext-folder=/path/to/ext"]:AppLauncher.add_app_launcher_argsfuses the pair insys.argvbefore any parsing. Covers every script that parsessys.argv: demos, tutorials, tools, benchmarks, and the per-library play scripts.dispatch_library_entrypointapplies the same fusing to the explicit argv list it forwards to the per-library train/play scripts. Those scripts parse that list (notsys.argv), so thesys.argvnormalization alone never reached the unifiedtraincommand or the multi-GPU ranks (each child rank runs through the dispatcher).Already-working forms are unchanged: a guard test asserts the equals-attached, quoted multi-token, and plain-flag forms are forwarded byte-identical.
Tests: 17 in
source/isaaclab/test/cli/test_train_multigpu_command_building.py. 12 fail with theAppLauncherfusing reverted; the dispatcher regression test fails with the dispatcher fusing reverted. Verified end-to-end: cartpole training viatrain --rl_library rsl_rl ... --kit_args "--ext-folder=..."(previously exit 2) now trains to completion, and the same command without--kit_argsbehaves identically to before.Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there