Repository navigation
[Fix] Separate SimulationContext construction from lookup - #7722
Conversation
SimulationContext.__new__ returns the existing singleton and __init__ returns before storing the config, so a second construction discarded every field of the config it was handed. A caller that set SimulationCfg(device=...) on a second context got no exception, no warning and no log line, and the simulation stayed on the original device. The OvPhysxManager device lock never saw the request: it is only reached through the construction branch that a live instance skips, which is why the drop is backend-agnostic rather than specific to one physics manager. Ignoring a device request is harder to diagnose than failing it, and moving a running simulation to another device is not something the singleton can do. A repeat construction that would need a different device now raises; one that differs only in other fields warns and is still ignored. Reaching the existing instance through instance() or a no-argument construction is unchanged, as is the clear_instance() and rebuild lifecycle. The "cuda" alias resolution moves into a shared helper so the new comparison and the existing normalization cannot drift apart and disagree about whether "cuda" and "cuda:0" name the same device.
|
run-ci |
|
There was a problem hiding this comment.
Isaac Lab Review Bot
The reuse guard correctly distinguishes conflicting-device requests, but the updated public class docstring inaccurately says every repeat construction returns the existing instance and ignores its configuration.
- Design and architecture: Keeping reuse validation in
SimulationContext.__init__before the singleton early return is coherent, and sharing CUDA alias normalization avoids inconsistent device comparisons. The class-level description of that singleton behavior must reflect the guard’s exception path. - API: The documented contract contradicts the implementation: a repeat construction with a different device raises
RuntimeErrorrather than returning normally and ignoring the configuration. Qualify the class docstring to distinguish same-device ignored configurations from conflicting-device requests. - Implementation: The changed implementation checks reuse before mutating state and consistently normalizes bare
cudaaliases. The actionable issue is the inaccurate public documentation at the changed class docstring.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| * Rendering and visualization | ||
|
|
||
| The singleton instance can be accessed using the ``instance()`` class method. | ||
| The singleton instance can be accessed using the ``instance()`` class method. Constructing |
There was a problem hiding this comment.
🟡 Warning · Api — Class docstring omits new device-conflict RuntimeError
The added class-level text states that constructing the class again "returns that instance and ignores the configuration passed in", but _check_reuse_request now raises RuntimeError when the requested device differs from the running one. The primary public documentation therefore states the pre-change contract and contradicts the __init__ Raises: section and the changelog fragment. Qualify the sentence to distinguish same-device ignored configurations from conflicting-device requests.
|
run-ci |
…7722) Separate `SimulationContext` construction from lookup. A second construction previously returned the live singleton and silently discarded its configuration, including a requested device change (NVBug 6677911). - `SimulationContext(cfg)` constructs a context and raises if one already exists, including no-argument construction or re-passing the same cfg. - `SimulationContext.instance()` retrieves the live context. - `SimulationContext.clear_instance()` releases it before constructing a replacement. Removed the singleton-reusing `__new__`, configuration/device comparison helper, and warn-and-ignore path. Native-backend sharing remains the registry's responsibility; this change does not alter it or introduce concurrent simulation contexts. The follow-up removes 49 production lines compared with the previous PR revision. Thirteen existing test suites now release the contexts they construct instead of accidentally borrowing a previous test's context. No production caller migration was needed. **Breaking:** callers using repeated `SimulationContext(...)` as lookup must switch to `SimulationContext.instance()`. To apply a new configuration, tear down with `clear_instance()` before constructing again. The class documentation and major changelog fragment include this migration. - Verified the revised singleton regression test fails on the previous implementation and passes with the fix. - GPU 0 / CPU: `test_simulation_context.py`: **51 passed**; `test_build_simulation_context_headless.py`: **15 passed**, run in separate processes because each launches Kit. - Nine schema/fragment suites: **165 passed**. - Four manager suites: **38 passed**. Total: **269 passed**. - `uv run --no-sync isaaclab -f`: passed, including changelog validation against the PR merge base. - Bug fix - Breaking change with migration guidance - [ ] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` - [x] Read the contribution guidelines - [x] Ran formatting and lint checks - [x] Updated public API documentation and migration guidance - [x] Added no new runtime warnings - [x] Verified the regression test fails before the fix and passes afterward - [x] Added a changelog fragment for the changed package - [x] Contributor already listed in `CONTRIBUTORS.md` --------- Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit 4cf439d)
…ng docs (#7957) Backports the three changes from the September 20–23 `develop` audit that are missing from `release/3.0.0`, alongside the existing cloning-guide backport: - #7722 (`4cf439dfeb`): reject a second `SimulationContext` construction instead of silently discarding its configuration. Includes the original fixture cleanup and regression coverage. - #7893 (`22fcd71bc4`): validate DelayBuffer lag values before mutating its live configuration. - #7947 (`6e9ef17f59`): make `v3.0.0-EA` the default documentation version in deployment and local multi-version builds. - #7129 (`354168560f`): clarify that `replicate_physics=False` skips the active physics context while other declared replication contexts still run. **Compatibility:** repeated `SimulationContext(...)` calls now raise. Retrieve the live context with `SimulationContext.instance()`, or call `clear_instance()` before constructing a replacement. The original major changelog fragment includes this migration. The runtime and test files match current `develop`. The docs-default backport adapts the release branch's existing redirect template, validates the target page, and preserves explicit overrides. The cloning-guide backport preserves the current release APIs; its obsolete sections were already removed. ## Release audit Checked all **35 PRs** merged into `develop` from **2026-09-20 16:43:18 UTC** through `cff81e8473` (September 23), against release head `5d3e0b695e`. **32 are already covered; the remaining three are included here.** Git history, patch equivalence, GitHub's merged PR list, and remaining file differences were checked. Branch-specific version/changelog compilation and existing release-only changes are preserved. <details> <summary>Already covered PRs</summary> 26 have an equivalent patch in release: #7919, #7922, #7923, #7924, #7925, #6758, #7928, #7902, #7927, #7891, #7931, #7691, #7861, #7929, #7916, #7939, #4609, #7942, #7940, #7948, #7937, #7955, #7960, #7961, #7970, #7958. Six were squash-merged or adapted: #7530 and #7899 in #7926; #7637 in #7933; #7860 in #7936; #7954 and #7950 in #7964. Their implementation differences were checked against the current release tree. </details> ## Validation - **276 tests passed**: SimulationContext (51, including CPU/CUDA), headless context construction (15), nine schema/fragment suites (165), four manager suites (38), and DelayBuffer (7). - Both backported regressions reproduce with the original release implementations. - Docs redirect recipe: local/deployment EA defaults, explicit override, and missing-target rejection passed with a stubbed Sphinx builder. - All 22 changed files match the intended backport scope; `uv run isaaclab -f` and `git diff --check` passed. - Fresh Sphinx validation (`-b dummy -W --keep-going`): passed without warnings, excluding static assets as the HTML builder does. Full HTML documentation CI is running. Local runtime validation used PyTorch 2.12.0, CUDA 13.0, Isaac Sim 6.0.1.0, and an RTX 5090. Existing runtime/deprecation warnings occurred; the CI jobs validate the pinned environments. The previous [docs CI failure](https://github.com/isaac-sim/IsaacLab/actions/runs/35795116307/job/106972539281) was an external connection reset fetching the Omniverse intersphinx inventory, producing one warning under `-W`. That URL returned HTTP 200 when rechecked. This update starts a fresh docs build. --------- Co-authored-by: hujc <[email protected]> Co-authored-by: Zihan Xu <[email protected]>
Summary
Separate
SimulationContextconstruction from lookup. A second construction previously returned the live singleton and silently discarded its configuration, including a requested device change (NVBug 6677911).SimulationContext(cfg)constructs a context and raises if one already exists, including no-argument construction or re-passing the same cfg.SimulationContext.instance()retrieves the live context.SimulationContext.clear_instance()releases it before constructing a replacement.Removed the singleton-reusing
__new__, configuration/device comparison helper, and warn-and-ignore path. Native-backend sharing remains the registry's responsibility; this change does not alter it or introduce concurrent simulation contexts.The follow-up removes 49 production lines compared with the previous PR revision. Thirteen existing test suites now release the contexts they construct instead of accidentally borrowing a previous test's context. No production caller migration was needed.
Compatibility
Breaking: callers using repeated
SimulationContext(...)as lookup must switch toSimulationContext.instance(). To apply a new configuration, tear down withclear_instance()before constructing again. The class documentation and major changelog fragment include this migration.Validation
test_simulation_context.py: 51 passed;test_build_simulation_context_headless.py: 15 passed, run in separate processes because each launches Kit.uv run --no-sync isaaclab -f: passed, including changelog validation against the PR merge base.Type of change
Release backport
developChecklist
CONTRIBUTORS.md