Skip to content

fix(physx): handle collection deletion events safely - #7901

Open
Xalzeroph wants to merge 4 commits into
isaac-sim:developfrom
Xalzeroph:fix/rigid-collection-deletion-event
Open

Xalzeroph wants to merge 4 commits into
isaac-sim:developfrom
Xalzeroph:fix/rigid-collection-deletion-event

Conversation

@Xalzeroph

Copy link
Copy Markdown

Description

This fixes the rigid object collection deletion callback for PhysX deletion events.

PhysX delivers a deletion event whose path is stored in event.payload["prim_path"], but the collection override treated the event object itself as a string. Matching a member deletion could therefore fail before cleanup, leaving the collection initialized and retaining its root view.

The callback now:

  • normalizes event and dictionary payloads before path matching;
  • routes matching member/root deletions through the normal invalidation lifecycle;
  • always clears callbacks, including when invalidation raises.

Fixes #7799

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • Documentation update

Tests

  • Added regression tests for event/dict payloads, matching and non-matching paths, and callback cleanup failures.
  • git diff --check
  • python -m py_compile on the modified implementation and test files.
  • Full IsaacLab/PhysX tests (not available in this environment because pytest and the Isaac Sim runtime are not installed).

@Xalzeroph
Xalzeroph requested a review from a team September 19, 2026 11:17
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 19, 2026
@greptile-apps

greptile-apps Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the callback now follows the actual PhysX event contract and performs lifecycle cleanup in the required order.

Summary

This PR corrects PhysX rigid-object collection deletion handling by extracting the deleted prim path from event payloads and routing matching deletions through the normal invalidation lifecycle.

  • Accepts both event-wrapper and raw-dictionary payload forms used by the callback infrastructure.
  • Invalidates collection state and its root PhysX view for root, member, and ancestor deletions.
  • Guarantees callback cleanup even if invalidation raises.
  • Adds focused regression coverage for matching, non-matching, root, and exceptional cleanup paths.

Reviews (1) · Last reviewed commit: "fix(physx): handle collection deletion e..."

@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 deletion callback fix correctly normalizes PhysX event payloads, invalidates matching collections through the established lifecycle, and guarantees callback cleanup. Before merge, it should preserve the previously accepted string-path input and satisfy repository metadata requirements for the new test file and user-visible package change.

  • Design and architecture: Routing matching member and root deletions through _invalidate_initialize_callback is coherent and ensures the root view is invalidated. However, the override previously declared and handled a plain path string; the new normalization supports event and dictionary forms but silently ignores that existing form. Supporting all three forms would retain compatibility while fixing PhysX event handling.
  • API: Although _on_prim_deletion is private, its changed annotation and behavior remove the prior string-path contract without the bug fix requiring that removal. Normalize strings directly as paths in addition to extracting prim_path from event and dictionary payloads.
  • Implementation: The prefix matching and try/finally cleanup are internally consistent, and the regression tests cover matching, nonmatching, root, and cleanup-failure paths. Add string-input coverage, apply the repository SPDX header template to the new test module, and add the required changelog fragment for the user-visible isaaclab_physx fix.

Minor fixes needed. Posted 3 actionable findings inline.

Automated review; human maintainers own approval decisions.

This function is called when the prim is deleted.
This function is called when a prim is deleted.
"""
payload = getattr(event, "payload", event) if not isinstance(event, dict) else event

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 · Api — String prim path input no longer handled

The replaced implementation took prim_path: str and compared it directly, so a path string was a supported input form. With a str argument the new code sets payload to the string, prim_path to "", matches_collection to False, and returns without invalidating or clearing callbacks. Accept a str path alongside event and dict payloads so both caller forms keep working.

@@ -0,0 +1,56 @@
from types import SimpleNamespace

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 · Implementation — New source file missing SPDX header

Repository guidelines require the current SPDX/copyright header template on new source files. This new test module begins directly with imports. Add the same header block used by the other files under source/isaaclab_physx/test.


def _on_prim_deletion(self, prim_path: str) -> None:
"""Invalidates and deletes the callbacks when the prim is deleted.
def _on_prim_deletion(self, event) -> 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.

🔵 Suggestion · Implementation — Missing changelog fragment for isaaclab_physx

Repository guidelines require one changelog fragment per changed source package for user-visible changes (or a .skip fragment otherwise). This user-visible deletion-handling fix in isaaclab_physx ships with no fragment. Add one written in past tense describing the corrected collection deletion behavior.

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.

[Bug Report] RigidObjectCollection deletion callback treats an event as a path

1 participant