Skip to content

Fixes ActionTerm.set_debug_vis crash in kitless mode#5399

Open
kellyguo11 wants to merge 2 commits intoisaac-sim:developfrom
kellyguo11:fix/action-manager-kitless-debug-vis
Open

Fixes ActionTerm.set_debug_vis crash in kitless mode#5399
kellyguo11 wants to merge 2 commits intoisaac-sim:developfrom
kellyguo11:fix/action-manager-kitless-debug-vis

Conversation

@kellyguo11
Copy link
Copy Markdown
Contributor

@kellyguo11 kellyguo11 commented Apr 25, 2026

Description

ActionTerm.set_debug_vis crashes with NameError: name 'omni' is not defined when running in Kit-based headless mode. This affects any environment with debug_vis=True on an action term (e.g. Isaac-Navigation-Flat-Anymal-C via PreTrainedPolicyAction).

Root cause: Two issues compound:

  1. The top-level import omni.kit.app is guarded by if has_kit():, but has_kit() returns False at module import time (before Kit is initialized in sys.modules), so the import is skipped.
  2. Later at runtime, set_debug_vis calls omni.kit.app.get_app_interface() unconditionally — omni is not in scope because the import was skipped.
NameError: name 'omni' is not defined
  File "action_manager.py", line 138, in set_debug_vis
    app_interface = omni.kit.app.get_app_interface()

Fix

Two changes to ActionTerm.set_debug_vis:

  1. Add has_kit() guard to the debug_vis check, matching the existing pattern in CommandTerm.set_debug_vis (command_manager.py:112).
  2. Add a local import omni.kit.app inside the guarded block, so the import resolves correctly even when the top-level conditional import was skipped at module load time.
# Before
if debug_vis:
    if self._debug_vis_handle is None:
        app_interface = omni.kit.app.get_app_interface()

# After
if debug_vis and has_kit():
    if self._debug_vis_handle is None:
        import omni.kit.app

        app_interface = omni.kit.app.get_app_interface()

Tested: Isaac-Navigation-Flat-Anymal-C-v0 now trains successfully in headless mode (1500 iterations, previously crashed immediately).

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Apr 25, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 25, 2026

Greptile Summary

This PR fixes a NameError crash in ActionTerm.set_debug_vis when running without Kit (kitless/headless mode) by guarding the omni.kit.app call with has_kit(). The one-line fix exactly mirrors the already-existing pattern in CommandTerm.set_debug_vis in command_manager.py, and has_kit is already imported and used at the top of action_manager.py for the conditional omni.kit.app import.

Confidence Score: 5/5

Safe to merge — minimal, targeted bug fix with no side effects.

Single-line fix that adds a has_kit() guard consistent with the already-established pattern in the codebase. has_kit is already imported and used in the same file, and the fix exactly mirrors CommandTerm.set_debug_vis. No new logic introduced, no regressions expected.

No files require special attention.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/managers/action_manager.py Single-line fix: adds has_kit() guard to prevent omni.kit.app access in kitless mode, matching the existing pattern in command_manager.py.

Sequence Diagram

sequenceDiagram
    participant Env as Environment
    participant AM as ActionTerm.set_debug_vis
    participant Kit as omni.kit.app

    Env->>AM: set_debug_vis(debug_vis=True)
    AM->>AM: has_debug_vis_implementation?
    AM->>AM: _set_debug_vis_impl(debug_vis)
    alt has_kit() == False (kitless mode)
        AM->>AM: skip omni.kit.app block (else: cleanup handle)
        AM-->>Env: return True
    else has_kit() == True
        AM->>Kit: get_app_interface()
        Kit-->>AM: app_interface
        AM->>AM: create post-update subscription
        AM-->>Env: return True
    end
Loading

Reviews (1): Last reviewed commit: "Fixes ActionTerm.set_debug_vis crash in ..." | Re-trigger Greptile

@kellyguo11 kellyguo11 force-pushed the fix/action-manager-kitless-debug-vis branch from 73f830d to 31a7399 Compare April 26, 2026 06:33
ActionTerm.set_debug_vis unconditionally referenced omni.kit.app without
checking has_kit(), causing a NameError when running without Kit (e.g.
Newton backend). This matches the existing guard in CommandTerm.set_debug_vis
which already checks 'if debug_vis and has_kit()'.

The bug caused any environment with debug_vis=True on an action term
(e.g. Isaac-Navigation-Flat-Anymal-C) to crash immediately on creation
in kitless/headless configurations.
@kellyguo11 kellyguo11 force-pushed the fix/action-manager-kitless-debug-vis branch from 31a7399 to 24c3572 Compare April 26, 2026 06:47
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