Fix: script-default visualizers not cleared in headless mode (--headless and HEADLESS=1) - #7444
Conversation
Greptile SummaryThis PR distinguishes script-defined argparse visualizer defaults from explicit
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified. The new intent marker correctly separates parser defaults from explicit CLI input while retaining direct-kwargs detection, and downstream handling prevents non-explicit defaults from reaching the explicit-visualizer error path. Important Files Changed
Reviews (1): Last reviewed commit: "Fix headless visualizer bug related to p..." | Re-trigger Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
The explicitness sentinel correctly distinguishes argparse defaults from explicit --viz input and direct kwargs, but it introduces a regression: a script-defined default such as visualizer=["kit"] no longer contributes to headless intent, so an ordinary launch is forced headless when visualizer_intent is absent.
- Design and architecture: The tri-state explicitness handling is appropriate, but script-defined visualizer defaults are demoted without being transferred to the existing configuration-intent path. Their selected backend remains recorded while headless resolution behaves as though no visualizer was selected.
- API: Explicit
--vizandAppLauncher(visualizer=[...])retain their existing explicit-selection behavior. However, the argparse integration surface changes materially:parser.set_defaults(visualizer=["kit"])now causes a normal launch to resolve as headless unless the script separately suppliesvisualizer_intent. - Implementation: Because
visualizer_explicit=Falsebypasses the presence fallback,_resolve_headless_settingsreaches its non-explicit branch and consults only_cfg_has_any_visualizersand_cfg_has_kit_visualizer. With novisualizer_intent, both are false, forcing headless even though_cli_visualizer_typescontainskit. Non-explicit argparse defaults should feed the configuration-intent state or otherwise preserve their normal-launch semantics.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| visualizer_explicit = bool(launcher_args.pop("visualizer_explicit", False)) | ||
| if not visualizer_explicit and "visualizer" in launcher_args: | ||
| visualizer_explicit = raw_visualizers is not None | ||
| visualizer_explicit = launcher_args.pop("visualizer_explicit", None) |
There was a problem hiding this comment.
🟡 Warning · Design Architecture — Script default visualizers now silently force headless
With visualizer_explicit=False always present in the parsed namespace, a script using parser.set_defaults(visualizer=["kit"]) takes the else branch of _resolve_headless_settings (lines 938-954). That branch consults only visualizer_intent, which such scripts do not set, so _headless becomes True even on a plain non-headless run, while _cli_visualizer_types still holds kit. Map non-explicit argparse visualizer defaults into _cfg_has_any_visualizers/_cfg_has_kit_visualizer instead of discarding them.
There was a problem hiding this comment.
non-explicit argparse visualizer defaults are now properly mapped into _cfg_has_any_visualizers and _cfg_has_kit_visualizer
998fdca to
5aaa51b
Compare
5aaa51b to
b82fd8a
Compare
|
Thanks for digging into this. I tried to reproduce it before reviewing the code, and I don't think the bug is where the issue says it is. The first repro command uses The second one works fine for me on current develop: That exits 0, and the log shows the Kit visualizer being created and running headless. Tracing where the RuntimeError can actually come from: it's raised in On the patch itself, it would cause a regression. Flipping I applied just the One thing in here is worth keeping, though. @matthewtrepte for viz. |
AntoineRichard
left a comment
There was a problem hiding this comment.
Will not merge unless more information is provided.
|
I am closing this PR because the root diagnosis was incorrect. As confirmed by a clean-install reproduction, the RuntimeError regarding explicit visualizer intent was not a logic bug in AppLauncher. It was caused by an environment misconfiguration where the isaaclab_visualizers extension failed to load, which masqueraded as a config failure. The proposed fix in this PR would cause a regression by disabling kit visualizer initialization for all non-headless runs that rely on script defaults. For the full explanation of the root cause, please see the update in #7403. I have extracted the valid test fixes (the newton_gl alias fallout) into a separate branch and will submit them as a new, standalone PR. |
… CLI test (#7533) This PR isolates and fixes the failing tests in `test_kwarg_launch.py` that surfaced during the investigation of #7403 (and the closed PR #7444). When run on a clean `upstream/develop`, `test_kwarg_launch.py` fails on exactly four tests. This PR addresses them: 1. **Newton Alias Fallout:** Fixed three tests (`test_parse_visualizer_csv_accepts_comma_delimited_values`, `test_visualizer_csv_does_not_swallow_hydra_overrides`, and `test_matrix_cli_kit_newton_with_custom_kit_cfg_intent_non_headless`) which were failing because they asserted against the deprecated `newton` alias instead of `newton_gl`. The third test was explicitly renamed to `test_matrix_cli_kit_newton_gl_with_custom_kit_cfg_intent_non_headless` to reflect the updated assertion. 2. **Removed Dead CLI Path:** Deleted `test_matrix_headless_with_viz_names_takes_precedence`. This test was failing because it passed `headless=True` directly through `_resolve_visualizer_settings`, simulating the `--headless` CLI flag which was removed in 3.0 and is no longer supported upstream. 3. **Hygiene Updates (Not Failing):** - Replaced `"kit, newton"` with `"kit, newton_gl"` in `test_parse_visualizer_csv_rejects_spaces_between_entries`. This test successfully raises an `ArgumentTypeError` before checking aliases so it wasn't failing, but it was updated to prevent stale strings from persisting. - Renamed `test_matrix_no_cli_with_cfg_kit_newton_non_headless` to `test_matrix_no_cli_with_cfg_kit_newton_gl_non_headless` for naming consistency. This test also passed previously but carried the stale alias in its name. _See the attached `pytest_before_fix.txt` (showing the 4 failures on develop) and `pytest_after_fix.txt` (showing 47 clean passes) for the exact run logs._ [pytest_after_fix.txt](https://github.com/user-attachments/files/31785416/pytest_after_fix.txt) [pytest_before_fix.txt](https://github.com/user-attachments/files/31785426/pytest_before_fix.txt) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com>
… CLI test (#7533) This PR isolates and fixes the failing tests in `test_kwarg_launch.py` that surfaced during the investigation of #7403 (and the closed PR #7444). When run on a clean `upstream/develop`, `test_kwarg_launch.py` fails on exactly four tests. This PR addresses them: 1. **Newton Alias Fallout:** Fixed three tests (`test_parse_visualizer_csv_accepts_comma_delimited_values`, `test_visualizer_csv_does_not_swallow_hydra_overrides`, and `test_matrix_cli_kit_newton_with_custom_kit_cfg_intent_non_headless`) which were failing because they asserted against the deprecated `newton` alias instead of `newton_gl`. The third test was explicitly renamed to `test_matrix_cli_kit_newton_gl_with_custom_kit_cfg_intent_non_headless` to reflect the updated assertion. 2. **Removed Dead CLI Path:** Deleted `test_matrix_headless_with_viz_names_takes_precedence`. This test was failing because it passed `headless=True` directly through `_resolve_visualizer_settings`, simulating the `--headless` CLI flag which was removed in 3.0 and is no longer supported upstream. 3. **Hygiene Updates (Not Failing):** - Replaced `"kit, newton"` with `"kit, newton_gl"` in `test_parse_visualizer_csv_rejects_spaces_between_entries`. This test successfully raises an `ArgumentTypeError` before checking aliases so it wasn't failing, but it was updated to prevent stale strings from persisting. - Renamed `test_matrix_no_cli_with_cfg_kit_newton_non_headless` to `test_matrix_no_cli_with_cfg_kit_newton_gl_non_headless` for naming consistency. This test also passed previously but carried the stale alias in its name. _See the attached `pytest_before_fix.txt` (showing the 4 failures on develop) and `pytest_after_fix.txt` (showing 47 clean passes) for the exact run logs._ [pytest_after_fix.txt](https://github.com/user-attachments/files/31785416/pytest_after_fix.txt) [pytest_before_fix.txt](https://github.com/user-attachments/files/31785426/pytest_before_fix.txt) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com> (cherry picked from commit cb43dd0)
Summary
Fixes a runtime crash in
AppLauncherwhen a task script registers a default visualizer viaparser.set_defaults(visualizer=["kit"])and the process is launched in headless mode.Fixes #7403
Root cause
_resolve_visualizer_settingsincorrectly promotedset_defaults()values to explicit user intent (_cli_visualizer_explicit = True), even though the user never typed--vizon the command line.Fix
develop's newly supportedHEADLESS=1+ Kit visualizer livestreaming lifecycle), this PR fixes the root cause directly by tracking whether the arguments came fromset_defaults.parser.set_defaults(visualizer_explicit=False)inadd_app_launcher_args._resolve_visualizer_settingsto correctly respectvisualizer_explicit=Falsewhile preserving the presence-based fallback for programmatic kwargs (e.g.,AppLauncher(visualizer=["kit"])).Testing
test_visualizer_argparse_set_defaults_is_not_explicitandtest_visualizer_direct_kwargs_is_explicitto verify intent resolution logic.test_matrix_headless_with_viz_names_takes_precedenceto align with the newdeveloplifecycle (expecting visualizers not to be unconditionally cleared under headless modes).Checklist
./isaaclab.sh -f)CHANGELOG.rstupdated (via changelog fragment)