Skip to content

Fixes false conflict error for aliased global presets in Hydra - #5130

Merged
ooctipus merged 2 commits into
isaac-sim:developfrom
ooctipus:fix/preset_collision
Mar 31, 2026
Merged

ooctipus merged 2 commits into
isaac-sim:developfrom
ooctipus:fix/preset_collision

Conversation

@ooctipus

Copy link
Copy Markdown
Collaborator

Description

Fixed :func:~isaaclab_tasks.utils.hydra.apply_overrides raising a false conflict error when two global presets resolve to the same value for a path (e.g. newton aliased to cube).

Type of change

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

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

…alse

  conflict error when two global presets resolve to the same value for a path
  (e.g. ``newton`` aliased to ``cube``).
@ooctipus
ooctipus marked this pull request as ready for review March 31, 2026 01:39
@ooctipus
ooctipus requested a review from Mayankm96 as a code owner March 31, 2026 01:39
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Mar 31, 2026
@ooctipus ooctipus changed the title Fixed :func:~isaaclab_tasks.utils.hydra.apply_overrides raising a f… Fixes false conflict error for aliased global presets in Hydra Mar 31, 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

Summary

Fixes a false-positive conflict error in apply_overrides() when two global presets resolve to the same value for a given config path. This is a real-world pattern in dexsuite where aliases like newton = cube produce separate but equal dataclass instances.

Design Assessment

Correct and minimal. The fix adds value-equality checking before raising the conflict error, using the idiomatic if prev_val is not cur_val and prev_val != cur_val pattern — identity check as a fast-path, then __eq__ fallback. This is the right approach: reject genuinely conflicting values, silently accept duplicates that agree.

The applied_by dict now only records the first preset that claims a path (via the else branch). When a later preset matches the same path with an equal value, it's allowed through but the original claimant is preserved. This is semantically sound — the first writer wins for tracking, and duplicates are harmless.

Architecture Impact

None. This is a narrowly-scoped behavioral fix in the preset resolution logic. No API changes, no new dependencies, no schema changes.

Implementation Verdict

✅ Approve — Clean, correct fix with proper test coverage.

Test Coverage

Good. New test test_apply_overrides_aliased_globals_no_conflict correctly:

  • Creates two separate but equal SharedCfg instances (asserts is not and ==)
  • Registers them under different preset names (cube, newton)
  • Verifies no exception is raised when both are applied as global presets
  • Asserts the final config value is correct

The existing test_apply_overrides_conflicting_globals_raises test ensures genuinely conflicting presets (different values) still raise ValueError.

CI Status

⏳ pre-commit: pending (CI just started)

Other checks: labeler ✅, Detect Changes ✅, Detect Doc Build Type ✅, remaining pending.

Findings

# Severity File Details
1 nit config/extension.toml Version jumps from 1.5.15 → 1.5.17, skipping 1.5.16. The CHANGELOG on develop already has a 1.5.16 entry, so 1.5.17 is correct — but note that extension.toml on develop still says 1.5.15 (appears another PR added the 1.5.16 changelog entry without bumping the toml). This will self-resolve on merge if the 1.5.16 PR merges first, but worth confirming merge order.
2 nit utils/hydra.py:405 Minor style thought: the else branch means applied_by[full_path] is only set on first encounter. If the first preset later appears again for the same path in a different sec, the tracking is correct since full_path includes sec. No bug, just noting the subtlety is handled.

Overall this is a clean, well-tested bug fix. Ship it. 🚀

[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "1.5.15"

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.

nit: Version jumps 1.5.15 → 1.5.17 (skipping 1.5.16). The develop branch CHANGELOG already has a 1.5.16 entry but extension.toml still says 1.5.15 there — looks like another PR added the changelog without bumping the toml. This is fine as long as that PR merges first, but worth confirming merge order to avoid version skew.

if full_path in applied_by:
raise ValueError(
f"Conflicting global presets: '{applied_by[full_path]}' and '{name}' "
f"both define preset for '{full_path}'"

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.

👍 Good use of the is not + != pattern — identity check as fast-path avoids potentially expensive __eq__ on large dataclass trees, with equality as the semantic fallback. Clean.

@greptile-apps

greptile-apps Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a false-positive conflict error in apply_overrides that was triggered when two global presets (e.g. newton and cube) were aliases — i.e. different Python objects that compare equal — for the same preset path. The fix adds an equality check before raising, so only genuinely differing values cause a ValueError.

  • hydra.py: The conflict guard now captures prev_val and cur_val from path_presets and only raises when prev_val is not cur_val and prev_val != cur_val, correctly tolerating distinct-but-equal config instances (the "alias" pattern produced by @configclass processing).
  • test_hydra.py: Adds test_apply_overrides_aliased_globals_no_conflict which directly mirrors the dexsuite scenario — two separate SharedCfg() instances that are is not each other but == each other — confirming no regression against the existing "real conflict" test.
  • extension.toml: Version bumped from 1.5.15 → 1.5.17, skipping 1.5.16 which already appeared in the CHANGELOG on the base branch; worth confirming the skip is intentional.
  • CHANGELOG.rst: Well-written entry accurately describes the fix.

Confidence Score: 5/5

Safe to merge — the logic change is minimal, well-tested, and correctly scoped.

No P0 or P1 issues found. The only finding is a P2 style note about the version number skipping 1.5.16 in extension.toml, which does not affect runtime behavior or correctness. The core fix is logically sound: the is not … and … != guard correctly identifies genuinely conflicting values while tolerating equal-valued aliases, and all edge cases (3+ presets, same preset twice, mixed equal/unequal) behave correctly.

source/isaaclab_tasks/config/extension.toml — version jumps from 1.5.15 to 1.5.17, skipping 1.5.16.

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/utils/hydra.py Core bug fix: global-preset conflict detection now tolerates two different preset names that resolve to equal values (the alias pattern), raising only when values genuinely differ.
source/isaaclab_tasks/test/test_hydra.py New regression test test_apply_overrides_aliased_globals_no_conflict correctly covers the fixed scenario with distinct-but-equal config instances; existing conflict test still passes.
source/isaaclab_tasks/config/extension.toml Version bumped from 1.5.15 to 1.5.17, skipping 1.5.16 which already appeared in the CHANGELOG on the base branch.
source/isaaclab_tasks/docs/CHANGELOG.rst Adds 1.5.17 changelog entry describing the false-conflict fix; accurate and well-written.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[apply_overrides called with global_presets list] --> B[Phase 1: Resolve preset selections from explicit preset_sel]
    B --> C[For each name in global_presets / sec / path]
    C --> D{name in path_presets?}
    D -- No --> C
    D -- Yes --> E{full_path already in applied_by?}
    E -- No --> F[Store applied_by = name]
    F --> G{full_path already in resolved?}
    E -- Yes --> H[Fetch prev_val and cur_val from path_presets]
    H --> I{prev_val is not cur_val AND prev_val != cur_val?}
    I -- Yes: Real conflict --> J[raise ValueError: Conflicting global presets]
    I -- No: Alias or same value --> G
    G -- No --> K[resolved = sec, path, name]
    G -- Yes --> C
    K --> C
    C --> L[Fill remaining paths with default preset]
    L --> M[Phase 2: Apply resolved presets in depth order]
    M --> N[Phase 3: Apply scalar overrides on top]
    N --> O[Return env_cfg, agent_cfg]
Loading

Reviews (1): Last reviewed commit: "Fixed :func:`~isaaclab_tasks.utils.hydra..." | Re-trigger Greptile

@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/

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 Version skip: 1.5.15 → 1.5.17

The extension.toml on the base branch was at 1.5.15, but the CHANGELOG in that same base already contained a 1.5.16 (2026-03-24) entry. This PR bumps straight to 1.5.17, meaning version 1.5.16 will never exist in the extension metadata. Downstream tooling or users checking the installed extension version against the changelog may find the gap confusing.

If 1.5.16 was supposed to be released as a separate increment, the correct sequence would be to first land a commit that brings extension.toml to 1.5.16, then bump again to 1.5.17 here. If this is intentional (e.g., the two versions are being merged into a single release), a brief note in the PR or changelog explaining the skip would be helpful.

@ooctipus
ooctipus merged commit 55e1da9 into isaac-sim:develop Mar 31, 2026
25 of 29 checks passed
es-rl pushed a commit to es-rl/IsaacLab-Newton that referenced this pull request Apr 4, 2026
…-sim#5130)

# Description

Fixed :func:`~isaaclab_tasks.utils.hydra.apply_overrides` raising a
false conflict error when two global presets resolve to the same value
for a path (e.g. ``newton`` aliased to ``cube``).


## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

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

## Screenshots

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

<!--
Example:

| Before | After |
| ------ | ----- |
| _gif/png before_ | _gif/png after_ |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->

## 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`
- [ ] 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 updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

Co-authored-by: HuiDong Chen <[email protected]>
nvsekkin added a commit that referenced this pull request May 19, 2026
Removed the stale file-level `@pytest.mark.xfail` decorator on
`test_environments_newton` (the cited Hydra deep nesting issue was
already resolved by PR #5029 and follow-ups #5130 / #5177).

## 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
- [ ] 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
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
@ooctipus
ooctipus deleted the fix/preset_collision branch October 14, 2026 14:28
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