Skip to content

Runtime backend compatibility check#5471

Draft
pbarejko wants to merge 1 commit intoisaac-sim:developfrom
pbarejko:pbarejko/error-on-invalid-backend-combinations
Draft

Runtime backend compatibility check#5471
pbarejko wants to merge 1 commit intoisaac-sim:developfrom
pbarejko:pbarejko/error-on-invalid-backend-combinations

Conversation

@pbarejko
Copy link
Copy Markdown
Collaborator

@pbarejko pbarejko commented May 1, 2026

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@pbarejko pbarejko requested a review from Mayankm96 as a code owner May 1, 2026 18:39
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label May 1, 2026
@pbarejko pbarejko marked this pull request as draft May 1, 2026 18:40
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

🤖 Isaac Lab Review Bot

Summary

This PR adds a validate_runtime_compatibility() function that detects invalid combinations of the OVRTX renderer with Kit-based physics (PhysxCfg) or the Kit visualizer, raising a clear error message with remediation steps. The implementation is clean, well-tested, and integrates into the existing launch_simulation() context manager.

Architecture Impact

Self-contained addition to isaaclab_tasks.utils.sim_launcher. The new validation is called at the top of launch_simulation() before any Kit initialization, ensuring invalid configs fail fast with a helpful message. No breaking changes to existing APIs. The new public function validate_runtime_compatibility is properly exported via __init__.pyi.

Implementation Verdict

Ship it — Minor documentation/style suggestions below, but nothing blocking.

Test Coverage

Thorough test coverage with 9 distinct test cases covering:

  • Invalid combinations (PhysX + OVRTX, Kit visualizer + OVRTX)
  • Valid combinations (Newton + OVRTX, PhysX + Isaac RTX, Newton + Isaac RTX)
  • Both argparse.Namespace and dict forms of launcher args

The tests are well-structured with clear docstrings explaining what each test validates. They don't require GPU/Kit, making them CI-friendly.

CI Status

No CI checks available yet — recommend waiting for CI results before merge.

Findings

🔵 Improvement: sim_launcher.py:193 — Consider early-return readability
The double-negative logic if not has_kit_physics and not has_kit_visualizer: return could be inverted for clarity:

if has_kit_physics or has_kit_visualizer:
    # build error message
    raise ValueError(...)

This minor refactor would make the "raise on invalid" path the primary flow, but the current code is correct.

🔵 Improvement: sim_launcher.py:76-80 — Helper functions could be consolidated
_is_kitless_physics and _is_kit_physics have overlapping logic. Consider a single helper returning an enum or named tuple to avoid checking isinstance(node, PhysicsCfg) twice when both predicates are used. Not a bug, just DRY.

🔵 Improvement: test_runtime_compatibility.py:27-33 — Test helper modifies global state
The _resolve_with_presets helper temporarily modifies sys.argv. While it restores it in finally, this could cause flaky behavior if tests run in parallel with pytest-xdist and other tests also read sys.argv. Consider using monkeypatch.setattr from pytest fixtures for thread-safety:

@pytest.fixture
def resolve_with_presets(monkeypatch):
    def _resolve(presets: str):
        monkeypatch.setattr(sys, "argv", [sys.argv[0], f"presets={presets}"])
        return resolve_task_config(_CAMERA_PRESETS_TASK, "rl_games_cfg_entry_point")[0]
    return _resolve

🔵 Improvement: sim_launcher.py:169-227 — Function is well-documented but missing type hint for env_cfg
The env_cfg parameter has no type annotation. While the codebase uses Any implicitly, adding a Protocol or Union type hint would improve IDE support and documentation:

def validate_runtime_compatibility(
    env_cfg: Any,  # or a Protocol defining expected attrs
    ...

🔵 Improvement: test_runtime_compatibility.py:21-22 — Unused import note
The import isaaclab_tasks # noqa: F401 is necessary for task registration side effects. A brief comment explaining why would help future readers understand this isn't dead code. (The noqa already hints at it, but explicit is better.)

🟢 Positive: sim_launcher.py:300 — Correct placement
The validate_runtime_compatibility() call is correctly placed at the very top of launch_simulation(), before any Kit initialization or device resolution. This ensures users get a clear error message before any expensive operations.

🟢 Positive: init.pyi:19 — Clean export
The new function is properly added to both __all__ and the import statement, maintaining the existing alphabetical ordering convention.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR adds a validate_runtime_compatibility function to sim_launcher.py that detects unsupported backend combinations at runtime — specifically, pairing the kitless OVRTX renderer with Kit-based runtimes (Isaac Sim PhysX or --visualizer kit) — and raises a clear ValueError with actionable fix instructions. The check is wired into launch_simulation as an early guard and the new symbol is re-exported via the __init__.pyi stub.

Confidence Score: 4/5

Safe to merge; only P2 style/robustness findings, no correctness regressions on the primary code path.

All findings are P2. The _scan_config list-traversal gap is pre-existing and doesn't affect any currently known config layouts; the error-message suggestion mismatch is a UX nit. Core logic, exports, and test coverage are correct.

source/isaaclab_tasks/isaaclab_tasks/utils/sim_launcher.py — review the _scan_config traversal limitation and the conditional error-message suggestion.

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/utils/sim_launcher.py Adds _is_kit_physics, _is_ovrtx_renderer helpers and validate_runtime_compatibility called at the top of launch_simulation; logic is correct for flat-attribute config trees but shares the pre-existing _scan_config blind-spot for list/dict-valued attributes.
source/isaaclab_tasks/isaaclab_tasks/utils/init.pyi Stub updated to export validate_runtime_compatibility from sim_launcher; alphabetic import order is now consistent.
source/isaaclab_tasks/test/test_runtime_compatibility.py New test file covering valid and invalid OVRTX/PhysX/Kit-visualizer combinations; sys.argv manipulation is guarded by try/finally and acceptable for sequential CI runs. Missing coverage for simultaneous has_kit_physics + has_kit_visualizer.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[launch_simulation called] --> B[validate_runtime_compatibility]
    B --> C{_scan_config:
has_ovrtx_renderer?}
    C -- No --> D[return — valid]
    C -- Yes --> E[_compute_visualizer_intent
_get_visualizer_types]
    E --> F{has_kit_physics
OR has_kit_visualizer?}
    F -- No --> D
    F -- Yes --> G[raise ValueError
with fix instructions]
    B --> I[compute_kit_requirements]
    I --> J[rest of launch_simulation]
Loading

Reviews (1): Last reviewed commit: "Runtime backend compatibility check" | Re-trigger Greptile

ValueError: If the OVRTX renderer is combined with Kit-based physics or the
Kit visualizer.
"""
has_kit_physics, has_ovrtx_renderer = _scan_config(env_cfg, [_is_kit_physics, _is_ovrtx_renderer])
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.

P2 _scan_config silently skips list-valued attributes

_scan_config calls vars(node) and recurses into each value, but for list or dict values, vars(that_container) raises TypeError and the visitor returns immediately — the items inside the container are never visited. If a RendererCfg (or a PhysicsCfg) is ever stored as an element of a list attribute in the config tree, has_ovrtx_renderer / has_kit_physics would stay False and the incompatible combination would silently pass validation. The same gap exists in compute_kit_requirements (pre-existing), but this new guard relies on the same traversal, so the same blind spot applies here.

Comment on lines +210 to +222
raise ValueError(
"Invalid backend combination: the OVRTX renderer (`OVRTXRendererCfg`,"
' `renderer_type="ovrtx"`) is a kitless renderer and cannot be used together'
f" with Isaac Sim / Kit ({sources_text}).\n"
"\n"
"To fix this, pick one of the following supported combinations:\n"
" * Keep Isaac Sim / Kit and switch the renderer:\n"
" presets=isaacsim_rtx_renderer\n"
" (uses `IsaacRtxRendererCfg`, the Kit-compatible renderer.)\n"
" * Keep the OVRTX renderer and switch to a kitless physics backend\n"
" (and avoid `--visualizer kit`):\n"
" presets=newton,ovrtx_renderer\n"
)
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.

P2 Fix suggestion mismatches when only the visualizer is at fault

When the invalid combination is ovrtx_renderer + --visualizer kit but the physics is already Newton (i.e. has_kit_physics is False), the error message still offers presets=newton,ovrtx_renderer as a "fix", even though Newton is already in use — the user only needs to drop --visualizer kit. This can confuse users who have already configured Newton. Consider conditionally omitting the physics-switch suggestion when only the visualizer triggered the error.

@pbarejko pbarejko force-pushed the pbarejko/error-on-invalid-backend-combinations branch from f55929e to fd38778 Compare May 2, 2026 00:01
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

🤖 Isaac Lab Review Bot

Follow-up Review

The new commits appear to be a rebase/merge with no substantive changes to the PR's implementation. The code for validate_runtime_compatibility(), the test file, and the __init__.pyi exports remain identical to the previously reviewed version.

Previous findings status: All previous suggestions (🔵 Improvements) were optional style/DRY recommendations, not blocking issues. None were addressed, but none were required changes.

CI Status

Most CI checks are still pending. Pre-commit passed ✅, which confirms formatting is clean.

Verdict

Ship it — No new issues. The implementation is correct and well-tested. Previous optional suggestions remain valid but non-blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant