Skip to content

Fix kitless OVPhysX scene cloning - #6072

Merged
AntoineRichard merged 1 commit into
isaac-sim:developfrom
AntoineRichard:antoiner/fix-kitless-fabric-notices
Jun 9, 2026
Merged

AntoineRichard merged 1 commit into
isaac-sim:developfrom
AntoineRichard:antoiner/fix-kitless-fabric-notices

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator

Description

OVPhysX can run kitless in a state where Carbonite exposes the Fabric USD notice interface but the Python usdrt module is not importable. In that state, disabled_fabric_change_notifies() should fall back to its intended no-op behavior instead of failing during scene cloning.

This PR keeps Fabric notice suspension active when usdrt is available, but treats only a missing top-level usdrt module as unavailable Fabric notice suspension. It also removes redundant queue_usd_replication(...) calls from the OVPhysX RigidObject, Articulation, and RigidObjectCollection constructors. OVPhysX assets continue to enqueue queue_ovphysx_replication(...) for backend runtime cloning.

Fixes #

Type of change

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

Screenshots

Not applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh -f
  • I have made corresponding changes to the documentation, or no documentation update is required
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Testing

  • ./isaaclab.sh -p -m pytest -q source/isaaclab/test/sim/test_cloner.py::test_disabled_fabric_change_notifies_noops_when_usdrt_unavailable (1 passed)
  • ./isaaclab.sh -p -m pytest -q source/isaaclab_physx/test/sim/test_cloner.py::test_disabled_fabric_change_notifies_toggles_ifabricusd_flag (2 passed)
  • ./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sim/test_views_xform_prim_ovphysx.py::test_world_pose_equals_parent_plus_offset -k cpu (1 passed, 1 deselected)
  • ./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sim/test_views_xform_prim_ovphysx.py::test_world_pose_equals_parent_plus_offset -k cuda (1 passed, 1 deselected)
  • PATH=/tmp/git-lfs-v3.7.1:$PATH ./isaaclab.sh -f

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Jun 9, 2026

@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 — PR #6072

Verdict: ✅ Looks Good

Summary

Well-scoped fix that removes redundant USD replication queuing from OVPhysX asset constructors. Since OVPhysX runs kitless (cannot coexist with Kit/OVRTX), these assets only need OvPhysxReplicateContext — the UsdReplicateContext calls were dead weight that could trigger unnecessary Fabric notice paths.

Analysis

Perspective Assessment
Architecture/Design ✅ Correct approach. OVPhysX assets inherit from base classes that handle USD concerns; the OVPhysX layer should only enqueue its own backend-specific replication.
Consistency ✅ All three asset types (Articulation, RigidObject, RigidObjectCollection) are updated uniformly — import removal + call removal.
Test Coverage ✅ New test_replication_queue.py comprehensively verifies that each OVPhysX asset type enqueues only OvPhysxReplicateContext and not UsdReplicateContext. Tests use pytest.importorskip to gracefully skip when ovphysx wheel is unavailable.
Changelog ✅ Fragment added under isaaclab_ovphysx/changelog.d/ with clear description.

Code Review

Changes are minimal and surgical:

  • 3 asset files: removed queue_usd_replication import + call
  • 1 test file: 77 lines of new tests with proper fixtures

🔵 Minor observation — test_replication_queue.py line 44: The helper _assert_only_ovphysx_replication_queued asserts both that the queue contains exactly [(cfg, OvPhysxReplicateContext)] AND that no UsdReplicateContext is present. The second assertion is redundant given the first, but harmless — defensive coding.

🔵 Suggestion — The test file monkeypatches AssetBase.__del__ to a no-op (line 37). A brief comment explaining why (e.g., "prevent finalizer from modifying queue during test teardown") would help future readers.

Overall: Clean removal of unnecessary code path, good test coverage, proper changelog. Ready to merge. 🚀


Update (e773554): New commits add graceful handling for missing usdrt in disabled_fabric_change_notifies(). Changes look good:

  • ✅ _fabric_notices.py: import usdrt now wrapped in try/except ModuleNotFoundError — context manager yields cleanly when usdrt is unavailable in kitless runtimes. Name check (exc.name != "usdrt") ensures unrelated import errors still propagate.
  • ✅ New test test_disabled_fabric_change_notifies_noops_when_usdrt_unavailable: properly monkeypatches builtins.__import__ to simulate missing usdrt and verifies the context manager no-ops without error.
  • ✅ Changelog fragment fix-kitless-fabric-notices.rst added.

🔵 Previous inline suggestion (adding logger.debug when usdrt is unavailable) not adopted — acceptable, the function is already a silent no-op by design.

No new concerns. Still ✅ ready to merge.

if exc.name != "usdrt":
raise
yield
return

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.

🔵 Suggestion: Consider adding a logger.debug("usdrt unavailable — Fabric notice suspension skipped") here for observability in verbose/debug runs. Matches the logger.info(...) pattern used in initialize() above when libcarb.so is missing.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes disabled_fabric_change_notifies to no-op gracefully in kitless runtimes by wrapping import usdrt in a targeted try/except ModuleNotFoundError, checking exc.name == \"usdrt\" to distinguish a wholly-absent module from a broken dependency that should still propagate.

  • _fabric_notices.py: The exc.name guard is correct — usdrt absent → yield/return; any other ModuleNotFoundError (missing native extension inside an installed usdrt) → re-raised.
  • test_cloner.py: Adds a regression test via builtins.__import__ monkeypatching and a fake get_bindings that asserts no fabric-id lookup occurs; the sys.modules cache is not cleared before the patch, which could cause the guard to be bypassed when usdrt is already loaded in a Kit session.
  • changelog.d/: RST fragment added as expected.

Confidence Score: 4/5

Safe to merge; the production fix is correct and the test gap is in the test harness only.

The core logic in _fabric_notices.py is sound — the exc.name check cleanly separates 'usdrt not installed' from 'usdrt installed but broken', and the no-op yield/return paths are exercised correctly. The only gap is in the regression test: it patches builtins.__import__ without also evicting usdrt from sys.modules, so in a Kit environment where usdrt is already cached the monkeypatch is silently bypassed. The production code path is unaffected.

source/isaaclab/test/sim/test_cloner.py — the new test would benefit from a sys.modules cleanup to be robust in Kit environments.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/cloner/_fabric_notices.py Wraps import usdrt in a try/except; silently no-ops when usdrt itself is absent, re-raises when a dependency of an installed usdrt fails — logic and guard condition are correct.
source/isaaclab/test/sim/test_cloner.py Adds regression test for the kitless no-op path; monkeypatches builtins.import but omits sys.modules cleanup, which can cause the patch to be bypassed in a Kit environment where usdrt is already loaded.
source/isaaclab/changelog.d/fix-kitless-fabric-notices.rst Changelog fragment correctly describes the fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["disabled_fabric_change_notifies(stage)"] --> B{"get_bindings()\nreturns None?"}
    B -- "Yes (no libcarb.so)" --> Z[yield / no-op]
    B -- "No" --> C{"import usdrt"}
    C -- "ModuleNotFoundError\nexc.name == 'usdrt'" --> Z
    C -- "ModuleNotFoundError\nexc.name != 'usdrt'\n(broken dependency)" --> E[re-raise exception]
    C -- "Success" --> F["Attach stage → get fabric_id"]
    F --> G{"bindings.validate_with\n(fabric_id)?"}
    G -- "Fails round-trip" --> Z
    G -- "OK" --> H["Disable Fabric notices\nyield\nRestore on exit"]
Loading

Comments Outside Diff (1)

  1. source/isaaclab/test/sim/test_cloner.py, line 143-154 (link)

    P2 sys.modules cache bypasses the __import__ monkeypatch

    The test patches builtins.__import__ to block usdrt, but Python resolves import usdrt from sys.modules before ever calling __import__. Because this test file launches a Kit app at module-load time (AppLauncher(headless=True).app), usdrt may already be cached in sys.modules by the time the monkeypatch fires.

    When that happens the import usdrt inside disabled_fabric_change_notifies succeeds silently, usdrt.Usd.Stage.Attach(...) runs with the real module, and _FakeBindings.validate_with raises AssertionError("missing usdrt should prevent fabric-id lookup") — a confusing failure unrelated to the actual regression being guarded. Adding monkeypatch.delitem(sys.modules, "usdrt", raising=False) before the builtins.__import__ patch makes the guard unconditional.

Reviews (1): Last reviewed commit: "Fix kitless Fabric notice guard" | Re-trigger Greptile

Comment thread source/isaaclab/test/sim/test_cloner.py Outdated
raise ModuleNotFoundError("No module named 'usdrt'", name="usdrt")
return real_import(name, *args, **kwargs)

monkeypatch.setattr(builtins, "__import__", _import_without_usdrt)

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 Adding monkeypatch.delitem(sys.modules, "usdrt", raising=False) ensures the __import__ patch is always effective, even in Kit environments where usdrt may already be cached in sys.modules.

Suggested change
monkeypatch.setattr(builtins, "__import__", _import_without_usdrt)
monkeypatch.delitem(sys.modules, "usdrt", raising=False)
monkeypatch.setattr(builtins, "__import__", _import_without_usdrt)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@AntoineRichard
AntoineRichard force-pushed the antoiner/fix-kitless-fabric-notices branch from 458acee to 31d12c0 Compare June 9, 2026 14:29
@AntoineRichard AntoineRichard changed the title Fix kitless Fabric notice guard Skip USD replication for OVPhysX assets Jun 9, 2026
Handle the kitless state where Fabric notice bindings are available but the Python usdrt module is not importable, so disabled_fabric_change_notifies falls back to a no-op instead of failing.

Also stop OVPhysX assets from enqueueing redundant USD replication; they still enqueue OvPhysxReplicateContext for backend runtime cloning.
@AntoineRichard
AntoineRichard force-pushed the antoiner/fix-kitless-fabric-notices branch from 31d12c0 to e773554 Compare June 9, 2026 14:59
@AntoineRichard AntoineRichard changed the title Skip USD replication for OVPhysX assets Fix kitless OVPhysX scene cloning Jun 9, 2026
@AntoineRichard
AntoineRichard merged commit 166f314 into isaac-sim:develop Jun 9, 2026
37 of 38 checks passed
@AntoineRichard AntoineRichard mentioned this pull request Jun 9, 2026
7 tasks done
AntoineRichard added a commit that referenced this pull request Jun 17, 2026
# Description

Implements `Pva` and `PvaData` for the OVPhysX backend, satisfying the
`BasePva` / `BasePvaData` contracts. The sensor reports world-frame
pose, body-frame linear and angular velocities, body-frame coordinate
linear and angular accelerations (zero at rest, `-g` in freefall - not
the IMU's proper acceleration), and projected gravity as a unit
direction vector.

- The kernel is byte-for-byte aligned with `isaaclab_physx`'s PVA
kernel.
- The sensor class mirrors the OVPhysX IMU's structure verbatim wherever
  applicable (binding setup, buffer naming, error wording, `__str__`),
  diverging only for PVA-specific outputs and gravity-direction vs
  gravity-bias semantics.
- `PvaData` uses the same `ProxyArray` pattern as the IMU / Newton data
  classes; `pose_w` is rebuilt on read via the shared
  `concat_pos_and_quat_to_pose_1d_kernel` (matches PhysX's lazy access).
- `OvPhysxManager.get_gravity()` is added so backend-agnostic sensor
code
  can read scene gravity through one classmethod; identical to the same
  addition in #5421, so the two PRs merge cleanly in either order.
- The branch is merged on top of latest `develop` after #6072 and #6085.
  The kitless `usdrt` guard, OVPhysX USD-clone removal, and OVPhysX
  `isaacsim_ci` cleanup are now in the base branch, so this PR carries
  only the PVA sensor changes.

Validated end-to-end against the real OVPhysX backend on both CPU and
CUDA. The procedural and Nucleus-backed cases are run in separate pytest
processes because mixing them in one process can hit the known
process-global `omni.client` symbol issue.

Validation run:

```bash
./isaaclab.sh -p -m pytest --collect-only -q -m device_split source/isaaclab_ovphysx/test/sensors/test_pva.py
# 28 tests collected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cpu and not offset and not env_ids'
# 11 passed, 17 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cpu and (offset or env_ids)'
# 2 passed, 26 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cuda and not offset and not env_ids'
# 11 passed, 17 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cuda and (offset or env_ids)'
# 2 passed, 26 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'single_dof_pendulum or indirect_attachment'
# 1 passed, 3 skipped, 24 deselected

PATH=/tmp/git-lfs-v3.7.1:$PATH ./isaaclab.sh -f
# Passed

rg -n "isaacsim_ci" source/isaaclab_ovphysx/test
# no matches
```

The skipped pendulum cases are pending a USD-converted pendulum asset;
the PhysX equivalents use the Kit URDF importer, which is not loaded
under the kitless launcher.

Fixes #5319

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` - CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Implements `Pva` and `PvaData` for the OVPhysX backend, satisfying the
`BasePva` / `BasePvaData` contracts. The sensor reports world-frame
pose, body-frame linear and angular velocities, body-frame coordinate
linear and angular accelerations (zero at rest, `-g` in freefall - not
the IMU's proper acceleration), and projected gravity as a unit
direction vector.

- The kernel is byte-for-byte aligned with `isaaclab_physx`'s PVA
kernel.
- The sensor class mirrors the OVPhysX IMU's structure verbatim wherever
  applicable (binding setup, buffer naming, error wording, `__str__`),
  diverging only for PVA-specific outputs and gravity-direction vs
  gravity-bias semantics.
- `PvaData` uses the same `ProxyArray` pattern as the IMU / Newton data
  classes; `pose_w` is rebuilt on read via the shared
  `concat_pos_and_quat_to_pose_1d_kernel` (matches PhysX's lazy access).
- `OvPhysxManager.get_gravity()` is added so backend-agnostic sensor
code
  can read scene gravity through one classmethod; identical to the same
  addition in isaac-sim#5421, so the two PRs merge cleanly in either order.
- The branch is merged on top of latest `develop` after isaac-sim#6072 and isaac-sim#6085.
  The kitless `usdrt` guard, OVPhysX USD-clone removal, and OVPhysX
  `isaacsim_ci` cleanup are now in the base branch, so this PR carries
  only the PVA sensor changes.

Validated end-to-end against the real OVPhysX backend on both CPU and
CUDA. The procedural and Nucleus-backed cases are run in separate pytest
processes because mixing them in one process can hit the known
process-global `omni.client` symbol issue.

Validation run:

```bash
./isaaclab.sh -p -m pytest --collect-only -q -m device_split source/isaaclab_ovphysx/test/sensors/test_pva.py
# 28 tests collected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cpu and not offset and not env_ids'
# 11 passed, 17 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cpu and (offset or env_ids)'
# 2 passed, 26 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cuda and not offset and not env_ids'
# 11 passed, 17 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'cuda and (offset or env_ids)'
# 2 passed, 26 deselected

./isaaclab.sh -p -m pytest -q source/isaaclab_ovphysx/test/sensors/test_pva.py -k 'single_dof_pendulum or indirect_attachment'
# 1 passed, 3 skipped, 24 deselected

PATH=/tmp/git-lfs-v3.7.1:$PATH ./isaaclab.sh -f
# Passed

rg -n "isaacsim_ci" source/isaaclab_ovphysx/test
# no matches
```

The skipped pendulum cases are pending a USD-converted pendulum asset;
the PhysX equivalents use the Kit URDF importer, which is not loaded
under the kitless launcher.

Fixes isaac-sim#5319

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` - CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
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.

2 participants