Skip to content

Fix: script-default visualizers not cleared in headless mode (--headless and HEADLESS=1) - #7444

Open
ChaitanyaParate wants to merge 1 commit into
isaac-sim:developfrom
ChaitanyaParate:chaitanya/fix-headless-visualizer-resolution
Open

Fix: script-default visualizers not cleared in headless mode (--headless and HEADLESS=1)#7444
ChaitanyaParate wants to merge 1 commit into
isaac-sim:developfrom
ChaitanyaParate:chaitanya/fix-headless-visualizer-resolution

Conversation

@ChaitanyaParate

Copy link
Copy Markdown

Summary

Fixes a runtime crash in AppLauncher when a task script registers a default visualizer via parser.set_defaults(visualizer=["kit"]) and the process is launched in headless mode.

Fixes #7403

Root cause

_resolve_visualizer_settings incorrectly promoted set_defaults() values to explicit user intent (_cli_visualizer_explicit = True), even though the user never typed --viz on the command line.

Fix

  • Instead of unconditionally clearing visualizers (which conflicts with develop's newly supported HEADLESS=1 + Kit visualizer livestreaming lifecycle), this PR fixes the root cause directly by tracking whether the arguments came from set_defaults.
  • Added parser.set_defaults(visualizer_explicit=False) in add_app_launcher_args.
  • Updated _resolve_visualizer_settings to correctly respect visualizer_explicit=False while preserving the presence-based fallback for programmatic kwargs (e.g., AppLauncher(visualizer=["kit"])).

Testing

  • Added test_visualizer_argparse_set_defaults_is_not_explicit and test_visualizer_direct_kwargs_is_explicit to verify intent resolution logic.
  • Updated test_matrix_headless_with_viz_names_takes_precedence to align with the new develop lifecycle (expecting visualizers not to be unconditionally cleared under headless modes).

Checklist

  • Pre-commit hooks run and passed (./isaaclab.sh -f)
  • Tests added / updated
  • CHANGELOG.rst updated (via changelog fragment)

@ChaitanyaParate
ChaitanyaParate requested a review from a team August 31, 2026 05:00
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Aug 31, 2026
@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR distinguishes script-defined argparse visualizer defaults from explicit --visualizer input so headless launches do not incorrectly enforce CLI visualizer behavior.

  • Adds a non-explicit default marker when registering launcher arguments.
  • Preserves presence-based intent detection for direct programmatic launcher kwargs.
  • Adds coverage for argparse defaults, direct kwargs, aliases, and headless visualizer resolution.
  • Documents the corrected headless-launch behavior.

Confidence Score: 5/5

The 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

Filename Overview
source/isaaclab/isaaclab/app/app_launcher.py Introduces an argparse intent marker and updates visualizer resolution to distinguish parser defaults from explicit CLI or direct-kwargs selections.
source/isaaclab/test/app/test_kwarg_launch.py Updates alias expectations and adds focused tests for visualizer intent and headless behavior.
source/isaaclab/changelog.d/chaitanya-fix-headless-visualizer-resolution.rst Accurately documents the corrected handling of script-defined visualizer defaults.

Reviews (1): Last reviewed commit: "Fix headless visualizer bug related to p..." | Re-trigger Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 --viz and AppLauncher(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 supplies visualizer_intent.
  • Implementation: Because visualizer_explicit=False bypasses the presence fallback, _resolve_headless_settings reaches its non-explicit branch and consults only _cfg_has_any_visualizers and _cfg_has_kit_visualizer. With no visualizer_intent, both are false, forcing headless even though _cli_visualizer_types contains kit. 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

non-explicit argparse visualizer defaults are now properly mapped into _cfg_has_any_visualizers and _cfg_has_kit_visualizer

@ChaitanyaParate
ChaitanyaParate force-pushed the chaitanya/fix-headless-visualizer-resolution branch from 998fdca to 5aaa51b Compare August 31, 2026 05:23
@ChaitanyaParate
ChaitanyaParate force-pushed the chaitanya/fix-headless-visualizer-resolution branch from 5aaa51b to b82fd8a Compare August 31, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant