fix: respect --viz flag in lift_cube_sm.py#6017
Conversation
Fixes isaac-sim#5572 The AppLauncher was receiving only headless=args_cli.headless instead of the full args_cli, causing the --viz kit flag to be silently ignored. Signed-off-by: Ottohere-Mourn <3311436628@qq.com>
Greptile SummaryThis PR fixes
Confidence Score: 5/5Safe to merge — the single-line change is correct and consistent with the rest of the codebase. Every other script in the repository already calls AppLauncher(args_cli). This change brings lift_cube_sm.py in line with that pattern, and there are no other side-effects to consider in such a narrow fix. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI as CLI / User
participant Parser as argparse.ArgumentParser
participant AL as AppLauncher
participant App as simulation_app
CLI->>Parser: parse_args() → args_cli
Note over Parser: --headless, --viz, --device, etc.
alt Before fix (broken)
Parser->>AL: "AppLauncher(headless=args_cli.headless)"
Note over AL: --viz and other flags ignored
else After fix (correct)
Parser->>AL: AppLauncher(args_cli)
Note over AL: All flags honoured
end
AL->>App: app_launcher.app
Reviews (1): Last reviewed commit: "fix: pass args_cli to AppLauncher so --v..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review — PR #6017
Summary
Clean, minimal fix that addresses a real usability bug. The change correctly passes the full args_cli namespace to AppLauncher instead of only extracting headless, which was silently dropping all other CLI flags (--viz, --livestream, --device, --offscreen_render, etc.).
🔬 Design Assessment
Correct approach. The AppLauncher.__init__ signature is:
def __init__(self, launcher_args: argparse.Namespace | dict | None = None, **kwargs):Passing args_cli (an argparse.Namespace) directly is the canonical pattern used throughout the codebase (e.g., scripts/tutorials/, scripts/environments/zero_agent.py). The old headless=args_cli.headless pattern was an oversight that existed since the script was first written.
Cross-module impact: Self-contained — this is a standalone demo script with no downstream consumers.
Findings
🟡 Same bug exists in sibling scripts — scripts/environments/state_machine/
The following files have the identical anti-pattern (AppLauncher(headless=args_cli.headless)) and should be fixed in this PR or a follow-up:
scripts/environments/state_machine/open_cabinet_sm.pyscripts/environments/state_machine/lift_teddy_bear.pyscripts/tutorials/04_sensors/run_frame_transformer.py
Since these are all single-line changes with the same root cause, including them here would be low-risk and high-value. Alternatively, note them as a follow-up issue.
🔵 Improvement: Consider adding a note to CHANGELOG.rst
This fixes user-facing behavior (CLI flags being silently ignored). A brief entry under the relevant release section would help users who hit this issue and are searching the changelog for resolution.
🔍 Silent Failure Note
The original code was a textbook silent failure — users passing --viz kit would see no error, no warning, but the visualizer simply wouldn't open. The fix eliminates this by forwarding all parsed arguments to AppLauncher, which handles each flag appropriately.
🧪 Test Coverage
This is a demo script (not a library component), so the manual test plan in the PR description is appropriate:
--viz kitopens the visualizer ✓--headlesscontinues to work ✓
No automated regression test is needed here — the script isn't covered by unit tests, and adding one would require a full Isaac Sim runtime.
Verdict
Ship it (with minor suggestion to batch-fix sibling scripts). The change is correct, minimal, follows established patterns, and fixes a real user-facing bug. Well done! 🚀
|
Should this PR be targeting develop? I don't think main has a --viz arg? |
Summary
scripts/environments/state_machine/lift_cube_sm.pyto pass the fullargs_clitoAppLauncherinstead of onlyheadless=args_cli.headless--vizkit flag is properly respected when launching the state machine demoFixes #5572
Test Plan
./isaaclab.sh -p scripts/environments/state_machine/lift_cube_sm.py --viz kitnow correctly opens the Kit/Isaac Sim visualizer--headlessmode continues to work as before🤖 Generated with Claude Code