Skip to content

Fix backend factory fallback before simulator initialization - #7121

Merged
ooctipus merged 12 commits into
isaac-sim:developfrom
sylvesterkaczmarek:fix/backend-fallback-without-sim-context
Aug 23, 2026
Merged

Fix backend factory fallback before simulator initialization#7121
ooctipus merged 12 commits into
isaac-sim:developfrom
sylvesterkaczmarek:fix/backend-fallback-without-sim-context

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Aug 15, 2026

Copy link
Copy Markdown

Description

FactoryBase._get_backend() can be called before a SimulationContext has been created, but it previously dereferenced SimulationContext.instance().physics_manager unconditionally. SimulationContext.instance() returns None before initialization, so backend resolution could fail before any fallback was applied.

Following maintainer confirmation, the pre-context fallback is now newton. Initialized backend resolution remains unchanged for Newton, PhysX, and OV PhysX contexts.

A separate follow-up should update SimulationCfg(physics=None) to default to Newton as well; that broader configuration-default change is intentionally outside this PR.

Validation

Adds unit coverage for backend resolution with SimulationContext._instance unset and verifies the newton fallback.

Type of change

  • Bug fix

@sylvesterkaczmarek
sylvesterkaczmarek requested a review from a team August 15, 2026 23:33
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Aug 15, 2026
@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR fixes backend detection before simulator initialization by returning the documented PhysX compatibility fallback when no SimulationContext exists.

  • Preserves existing backend detection when a simulation context is active.
  • Adds focused unit coverage for the uninitialized singleton state.
  • Documents the fix in the changelog.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The null guard makes the implementation match its documented pre-initialization contract, and backend selection remains dynamically resolved after a simulation context exists.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/utils/backend_utils.py Adds the missing null-context guard while leaving initialized backend-name mapping unchanged.
source/isaaclab/test/utils/test_backend_fallback.py Adds focused unit coverage that safely restores the patched singleton state through pytest's monkeypatch fixture.
source/isaaclab/changelog.d/sylvesterkaczmarek-fix-backend-fallback.rst Accurately describes the corrected pre-initialization fallback behavior.

Reviews (1): Last reviewed commit: "docs: note backend fallback fix" | Re-trigger Greptile

@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 change adds the missing None guard so backend resolution returns the documented physx fallback before SimulationContext initialization. The focused regression test and changelog fragment align with that behavior.

  • Design and architecture: Backend selection remains contained within FactoryBase._get_backend(). Existing initialized-context routing for newton, ovphysx, and physx is unchanged, and the fallback continues through the established registry and module-resolution paths.
  • API: The method retains its str return contract and changes no public symbols or exports. Pre-initialization behavior now matches the existing docstring rather than raising while dereferencing a nonexistent context.
  • Implementation: The early return directly prevents access to physics_manager when SimulationContext.instance() is None. The regression test covers that boundary, though its setup uses the private SimulationContext._instance attribute as a small non-blocking maintenance tradeoff.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@sylvesterkaczmarek
sylvesterkaczmarek force-pushed the fix/backend-fallback-without-sim-context branch from 1de1346 to 63ece49 Compare August 16, 2026 10:08
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@sylvesterkaczmarek
sylvesterkaczmarek force-pushed the fix/backend-fallback-without-sim-context branch from 63ece49 to e39376f Compare August 16, 2026 10:29
Comment thread source/isaaclab/isaaclab/utils/backend_utils.py Outdated
@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Updated per the team confirmation: the pre-context backend fallback is now newton, with the regression test and changelog updated accordingly. I’ve kept the SimulationCfg(physics=None) default change separate as the requested follow-up.

@ooctipus

Copy link
Copy Markdown
Collaborator

Hi @sylvesterkaczmarek thanks for the pr, we have a test file called source/isaaclab/test/utils/test_backend_utils.py, can you put your test there

@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Hi @sylvesterkaczmarek thanks for the pr, we have a test file called source/isaaclab/test/utils/test_backend_utils.py, can you put your test there

Sure. Thanks for your guidance.

@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Done. The fallback test is now in test_backend_utils.py, and the standalone test file has been removed.

auto-merge was automatically disabled August 22, 2026 14:49

Head branch was pushed to by a user without write access

ooctipus added a commit that referenced this pull request Aug 22, 2026
…7299)

## Summary

Backports the following merged changes to `release/3.0.0` as separate
provenance-preserving cherry-picks:

- #7292 — scope Newton global imports with clone plans
- #7285 — stabilize the sensor/PhysX video recording test
- #7269 — streamline Newton contact and raycast sensor startup
- #7119 — normalize non-finite depth display values safely
- #7295 — avoid repeated Newton model and articulation startup work

Each source squash commit was cherry-picked with `-x` and applied
without conflicts.

## Validation

- Stable patch IDs match all five source squash commits exactly.
- File-by-file manifests match each source squash commit.
- `git diff --check upstream/release/3.0.0..HEAD`
- `uv run --frozen python tools/changelog/cli.py check
backport-7285-7292-base`
- `SKIP=check-changelog-fragments uv run --frozen isaaclab -f`
- Cloner/Newton focused tests: 98 passed
- Scene global-ownership tests: 2 passed
- Simulator clone-plan tests: 4 passed
- Video recording regression test: 1 passed
- Newton BVH lifecycle tests: 2 passed
- Newton contact-selector tests: 7 passed
- Newton raycast BVH test: 4 passed
- Non-finite depth display tests: 4 passed
- #7295 physics lifecycle, cloner, manager, and coupling tests: 248
passed
- #7295 Newton joint-wrench sensor tests: 11 passed
- #7295 PhysX joint-wrench sensor tests: 16 passed

PR #7121 remains open and is intentionally excluded; it will be
backported from its final merge commit after merging.

---------

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Co-authored-by: matthewtrepte <mtrepte@nvidia.com>
Co-authored-by: camevor <camevor@nvidia.com>
Co-authored-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Co-authored-by: Antoine RICHARD <antoiner@nvidia.com>
@ooctipus
ooctipus merged commit 9f65e3d into isaac-sim:develop Aug 23, 2026
47 of 48 checks passed
ooctipus added a commit to ooctipus/IsaacLab that referenced this pull request Aug 24, 2026
…im#7121)

# Description

`FactoryBase._get_backend()` can be called before a `SimulationContext`
has been created, but it previously dereferenced
`SimulationContext.instance().physics_manager` unconditionally.
`SimulationContext.instance()` returns `None` before initialization, so
backend resolution could fail before any fallback was applied.

Following maintainer confirmation, the pre-context fallback is now
`newton`. Initialized backend resolution remains unchanged for Newton,
PhysX, and OV PhysX contexts.

A separate follow-up should update `SimulationCfg(physics=None)` to
default to Newton as well; that broader configuration-default change is
intentionally outside this PR.

## Validation

Adds unit coverage for backend resolution with
`SimulationContext._instance` unset and verifies the `newton` fallback.

## Type of change

- Bug fix

---------

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Co-authored-by: ooctipus <zhengyuz@nvidia.com>
(cherry picked from commit 9f65e3d)
ooctipus added a commit that referenced this pull request Aug 24, 2026
…#7303 (#7313)

# Description

Backports six merged PRs to `release/3.0.0` as separate
provenance-preserving cherry-picks:

| Source PR | Source commit | Backport commit | Scope |
| --- | --- | --- | --- |
| #7272 | `0081477fea2` | `c9fc1997476` | Fix scene-wide gravity
distributions for PhysX and OvPhysX. |
| #7121 | `9f65e3d4fd2` | `cce8acd84e1` | Fix backend-factory fallback
before simulator initialization. |
| #7183 | `3fcc9c6b824` | `99d58d3d3c4` | Streamline the getting-started
documentation. |
| #7306 | `6aad90be0ae` | `9a786cc028a` | Optimize Newton test runtime.
|
| #7305 | `1c9ba908cf1` | `a2dc8ce948e` | Disable Warp autodiff in the
test suite. |
| #7303 | `393fc37d2b0` | `249a5cb97d8` | Remove post-Hydra preset
resolution. |

#7272 forwards the validated `uniform`, `log_uniform`, or `gaussian`
distribution through both scene-wide backend paths. Newton behavior is
unchanged.

#7121 makes factory resolution fall back to Newton when no
`SimulationContext` exists while retaining the visualizer contract of
reporting no active backend before context creation.

#7183 is documentation-only. #7306 and #7305 change test infrastructure
only; they do not change runtime behavior.

#7303 makes `resolve_task_config` and `parse_env_cfg` the
task-composition boundary. Runtime consumers now require concrete
physics, renderer, and camera configurations and no longer attempt late
preset fallback after Hydra composition.

The branch was synchronized with the current `release/3.0.0` tip
containing #7301 before #7303 was applied. All six source cherry-picks
applied without conflicts. A file-by-file existence, mode, and blob
audit confirmed that every #7303 path matches its merged source commit
exactly.

## Validation

### #7272

- Regression verification against the unpatched `release/3.0.0` tip —
both PhysX and OvPhysX cases failed as expected.
- `uv run --extra test --frozen python -m pytest -q
source/isaaclab/test/envs/test_gravity_randomization.py
source/isaaclab/test/envs/test_mdp_event_selectors.py` — 7 passed.
- `uv run --extra test --extra ovphysx --frozen python -m pytest -q
source/isaaclab_ov/test/physics/test_ovphysx_gravity.py` — 1 passed.

### #7121

- Regression verification before the #7121 cherry-pick reproduced the
original `NoneType.physics_manager` failure.
- `uv run --extra test --frozen python -m pytest -q
source/isaaclab/test/utils/test_backend_utils.py
source/isaaclab/test/visualizers/test_visualizer.py` — 18 passed.

### #7183

- `uv run --frozen --extra test python -m pytest --noconftest -q
tools/test/test_environ_docs.py` — 26 passed.

### #7306

- All 9 affected paths match the merged source PR exactly.
- The full simulator-backed Newton suite is left to backport CI because
this local worktree does not include the full Isaac Sim runtime.

### #7305

- Loaded the root `conftest.py` successfully with Warp unavailable.
- Loaded it with Warp installed and confirmed `wp.config.enable_backward
is False`.

### #7303

- Hydra and Shadow Hand camera suites — 129 passed.
- Benchmark capture and RL entrypoint suites — 31 passed.
- Experimental frontend and custom-coupling suites — 74 passed, 1
skipped.
- Ruff and Ruff-format passed for every changed Python path.
- Source/backport audit — 54 paths checked, 0 mismatches.
- The Isaac Sim-backed integration case is left to CI because this local
worktree is kitless.

### Repository gates

- `git diff --check upstream/release/3.0.0...HEAD` — passed.

---------

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Co-authored-by: Antoine RICHARD <antoiner@nvidia.com>
Co-authored-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Co-authored-by: Mustafa H <34825877+StafaH@users.noreply.github.com>
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.

3 participants