Repository navigation
[Cartpole] Consolidate Cartpole task IDs via preset CLI - #5605
Conversation
There was a problem hiding this comment.
Code Review Summary
This is a well-structured refactoring PR that consolidates 35 per-variant Cartpole task IDs into 4 canonical tasks using the new typed preset CLI system. The implementation follows good patterns for deprecation handling and maintains backward compatibility.
✅ Architecture & Design
Strengths:
- The consolidation approach is sound — using presets to select variants at runtime is cleaner than proliferating task IDs
- The
deprecateddict convention ongym.registerprovides a declarative, extensible deprecation pattern - Historical per-variant cfg subclasses are preserved for bit-for-bit backward compatibility during the deprecation period
- The
PresetCfgwrappers cleanly expose existing per-variant subclasses as preset variants
Design Decision: Using concrete cfg instances as preset variants (one preset = one bundled cfg) is appropriate for showcase tasks where observation/action shapes cannot be composed from independent axes. The dict shape ({"alias": "..."}``) is open for future fields (reason, removed_in`, ...).
✅ Implementation Quality
Deprecation Contract (4 files):
- Clean declarative
deprecated={"alias": "..."}kwarg ingym.register()calls parse_cfg.load_cfg_from_registry()readskwargs["deprecated"]["alias"]and emitsFutureWarning- Warning is visible under default Python filter (unlike
DeprecationWarning) - Historical
env_cfg_entry_pointunchanged — retired IDs stay bit-for-bit identical to develop
Consolidated PresetCfg Classes:
CartpoleCameraPresetsEnvCfg(direct camera) — reuses existing develop structureCartpoleCameraPresetsEnvCfg(manager-based) — wraps RGB/Depth/ResNet18/TheiaTiny variantsCartpoleShowcasePresetsEnvCfg— wraps 15 proprioceptive obs×action shape combinationsCartpoleCameraShowcasePresetsEnvCfg— wraps 9 camera obs×action shape combinations
Migration Table Clarity:
- PR description includes comprehensive migration tables for all 35 retired IDs
- Each
deprecated["alias"]string includes--task=,--agent=(when needed), andpresets=tokens
✅ Update (4ca5200): Deprecation Visibility Fix
Problem: DeprecationWarning + stacklevel=2 silently suppressed warnings when the immediate caller of load_cfg_from_registry was a library module (e.g., parse_env_cfg, hydra.register_task, third-party wrappers). Python's default filter only shows DeprecationWarning attributed to __main__.
Solution:
- Package-scoped
_user_stacklevel()— Generalized from file-scoped (__file__) to package-scoped (__name__.startswith(__package__)), walking past all frames inisaaclab_tasks.utils.*to attribute warnings to user code FutureWarningcategory — Matches the existing convention for end-user-facing IsaacLab deprecations (cfg field warnings, preset-name aliases) and is shown by Python's default filter regardless of attribution- Import sharing —
_user_stacklevelimported fromhydraintoparse_cfgso all utils submodules share the same "skip our own internals" behavior
Verification: Tested under default Python filter for:
- Path 1: Direct call from
__main__ - Path 2:
parse_env_cfgfrom__main__ - Path 3: Third-party wrapper outside the utils package
All paths now correctly display the warning. This is a well-reasoned fix. ✅
✅ Test Coverage
- CI Status: 27+ jobs pending (fresh push), pre-commit and initial checks passing
- Changelog fragments: Thorough documentation covering Added/Deprecated sections
- Migration verification:
test_preset_kit_decision.py(5 tests) covers the retired catch-all ID flow
⚠️ Minor Observations
-
Documentation: The
PresetCfgdocstring update adding the underscore-prefix convention for class-local helpers is helpful for future maintainers. -
Follow-up opportunity: The PR description mentions a potential cfg simplification follow-up (22.6 ms → 1.25 ms instantiation, 1,419 → 215 nodes) — this is correctly scoped out and deferred.
📋 Checklist Verification
- ✅ Deprecation warnings include the old task ID and new invocation
- ✅
FutureWarningcategory ensures visibility under default Python filter - ✅ Package-scoped
_user_stacklevel()attributes warnings to user code - ✅ Consolidated tasks register all matching agent yamls as parallel entry points
- ✅ No behavior change for existing deprecated task ID callers
- ✅ Pre-commit clean
- ⏳ CI pending (fresh push)
Verdict: This is a clean, declarative refactoring that improves the developer experience while maintaining full backward compatibility. The latest commit correctly fixes deprecation warning visibility for all call paths. Approve once CI passes.
d3f7594 to
9a558ed
Compare
Collapse 35 per-variant Cartpole gym task IDs into 4 consolidated tasks that select the variant via the typed preset CLI from isaac-sim#5587: - Isaac-Cartpole-Camera-Direct-v0 (subsumes 7 Direct-backend perception IDs) - Isaac-Cartpole-Camera-v0 (subsumes 4 manager-based perception IDs) - Isaac-Cartpole-Showcase-Direct-v0 (subsumes 15 proprioceptive showcase IDs) - Isaac-Cartpole-Camera-Showcase-Direct-v0 (subsumes 9 camera showcase IDs) Variant selection moves from the gym ID to ``presets=<name>`` (plus ``physics=`` / ``renderer=`` on the Direct-backend camera task, and ``--agent=`` where the per-shape skrl / rl_games yaml differs from the default). Each retired ID stays registered for one release with an env_cfg_entry_point that emits a DeprecationWarning naming the new task and the equivalent CLI tokens, then returns the corresponding cfg. The shim machinery is factored into a new helper: isaaclab_tasks.utils.deprecated_task_alias( old_task_id, new_command, consolidated_cfg_path, cfg_factory=None ) which wraps the warning emission plus lazy cfg resolution behind the ``"module:Name"`` entry-point string convention gym uses elsewhere. The consolidated PresetCfg classes live alongside their per-variant siblings in the existing *_env_cfg.py files; no new wrapper modules. PresetCfg's docstring now documents the underscore-prefix convention for class-local helpers (the resolver already skips them). Full per-ID migration table is in the PR description.
e1eb51a to
84fdf54
Compare
…presets # Conflicts: # source/isaaclab_tasks/isaaclab_tasks/direct/cartpole/__init__.py # source/isaaclab_tasks/isaaclab_tasks/direct/cartpole/cartpole_camera_presets_env_cfg.py
…ing IDs The pre-existing develop consolidated ``MultiDataTypeCartpoleTiledCameraCfg`` uses a uniform identity-rotation camera for all data-type variants. The historical per-variant cfgs (``CartpoleAlbedoCameraEnvCfg`` and the three ``CartpoleSimpleShading*CameraEnvCfg``) had a 180-degree rotated camera. The merge from develop briefly reintroduced that rotation locally; the rendering tests captured against develop's identity-rotation baseline flagged the divergence on the consolidated path. Drop the local rotation override so the consolidated cfg matches develop's captured baseline. The deprecation shim returns the consolidated cfg verbatim, so users of the retired task IDs now see the consolidated camera orientation starting from this PR -- migration to the consolidated task ID with ``presets=<name>`` carries that uniform pose anyway. Test expectations updated accordingly.
Revert local extraction of `_CAMERA_CFG_PATH` / `_SHOWCASE_CFG_PATH` constants and the small `_CAMERA_KWARGS` dict in the four cartpole `__init__.py` files. Each `gym.register` block is again fully self-contained (cfg-path string + skrl/rl_games entry points spelled out in place), matching the per-block style on develop so the PR diff shows only what is genuinely new (the alias call itself). Pass `old_task_id=`, `new_command=`, and `consolidated_cfg_path=` as keyword arguments at every call site -- a 3-arg positional invocation is hard to read at the gym registration call sites. No behavior change: the 73 cartpole deprecation tests still pass.
Change deprecated_task_alias(new_command=...) from a free-form string to a list[str], where each list entry is one whitespace-separated CLI token. The factory joins the list with single spaces when forming the DeprecationWarning body, so the user-facing warning text is unchanged in shape (still quoted, one command). The list form makes per-token diffs easier to scan at the gym.register call sites: each --task / --agent / presets= entry is on its own line instead of being lost inside a multi-line implicit string concat. Call-site convention: --task=... first, --agent=... next when present, presets=NAME selector at the end -- the warning body reads in that order too. Test fixtures reordered to match the new --task / --agent / presets= sequence in the warning body. All 73 cartpole deprecation tests pass.
Greptile SummaryThis PR consolidates 35 Cartpole per-variant gym task IDs into 4 canonical tasks (
Confidence Score: 5/5Safe to merge — the change is purely additive (new canonical tasks + deprecation shims); retired IDs are bit-for-bit identical to develop and the FutureWarning machinery is straightforward. All 35 deprecated task IDs keep their original No files require special attention; Important Files Changed
Reviews (3): Last reviewed commit: "Fix deprecation visibility: use FutureWa..." | Re-trigger Greptile |
| def call(): | ||
| from .cartpole_camera_presets_env_cfg import CartpoleCameraPresetsEnvCfg | ||
|
|
||
| cfg = CartpoleCameraPresetsEnvCfg() | ||
| result = getattr(cfg, preset_name) | ||
| result.tiled_camera = getattr(result.tiled_camera, preset_name) | ||
| return result | ||
|
|
||
| return call |
There was a problem hiding this comment.
Shared class attribute mutated in-place on first factory call
getattr(cfg, preset_name) retrieves the class-level attribute on CartpoleCameraPresetsEnvCfg (e.g. CartpoleCameraPresetsEnvCfg.depth), not an instance copy. The next line result.tiled_camera = getattr(result.tiled_camera, preset_name) writes an instance attribute onto that shared object, permanently changing it. A second call to the same factory — e.g. a second gym.make("Isaac-Cartpole-Depth-Camera-Direct-v0") in the same process — will find tiled_camera already resolved to a concrete CartpoleTiledCameraCfg, and getattr(result.tiled_camera, preset_name) will raise AttributeError because CartpoleTiledCameraCfg does not have a depth/albedo/etc. attribute. The fix is to deep-copy result before mutating it (import copy; result = copy.deepcopy(result)).
| def _user_stacklevel() -> int: | ||
| """Compute a ``warnings.warn`` stacklevel that lands on the first frame | ||
| outside this module, so the deprecation warning cites user code rather | ||
| than the gym/parse_cfg loader that invoked the entry-point factory. | ||
|
|
||
| Walks a bounded number of frames; falls back to ``stacklevel=2`` if no | ||
| non-local frame is found within the bound. | ||
| """ | ||
| max_walk = 16 | ||
| level = 1 | ||
| frame = sys._getframe(1) | ||
| while frame is not None and frame.f_globals.get("__file__") == __file__: | ||
| level += 1 | ||
| frame = frame.f_back | ||
| if level > max_walk: | ||
| return 2 | ||
| return level |
There was a problem hiding this comment.
_user_stacklevel duplicated from hydra.py
hydra.py already defines an identical _user_stacklevel() at lines 45–63. Both copies share the same logic and walk the same bound (16 frames), so any future fix to the frame-walk heuristic needs to be applied in both files. The function should be extracted into a shared private utility (e.g. _warnings.py or an underscore-prefixed helper in a common module imported by both callers).
Replace the custom flat-getattr + nested-setattr default resolution inside deprecated_task_alias with a single call to isaaclab_tasks.utils.hydra.resolve_presets(cls(), selected). The resolver already walks every nested PresetCfg in the cfg tree and picks the variant matching one of the selected names (falling back to each preset's default field), which is exactly what the canonical task's Hydra path does. The shim now returns bit-for-bit what the canonical task plus presets=<name> would have produced. Side effects: * Drop the cfg_factory parameter from deprecated_task_alias -- the generic resolver handles the 2-axis (nested) case that previously required a custom callable. * Delete the local _resolve_camera_variant helper from direct/cartpole/__init__.py and the cfg_factory= argument from its 5 deprecated-shim call sites. * selected is now the union of every presets=NAME[,...] token's names, so a future caller passing presets=a,b correctly resolves both rather than truncating to the first. No measurable startup-time delta: instantiation of the consolidated PresetCfg (~22 ms, dominated by configclass deepcopy of a ~1400-node tree) is the shared cost; the tree walk on top is sub-millisecond. 73 cartpole deprecation tests still pass.
…a cfgs This is a two-part change driven by CI failures on the prior shim design: 1. ``test_preset_kit_decision`` (5 cases) failed because the shim's call to ``resolve_presets(cls(), selected)`` resolved every PresetCfg in the tree -- including ``sim.physics`` and ``tiled_camera.renderer_cfg`` -- to their defaults when the shim's preset names did not match. Hydra's downstream validation then reported the user's ``physics=`` / ``renderer=`` CLI selectors as "Unknown preset(s)" because no PresetCfg remained to resolve them against. 2. ``test_rendering_registered_tasks`` (4 cases: Albedo + 3 SimpleShading) failed because the consolidated cfg's matching variant does not carry the 180-degree camera rotation that the historical per-variant subclasses use (a long-standing latent divergence on develop between Style A subclasses and Style B consolidated cfg -- the consolidation PR never reconciled it). Routing retired IDs through Style B silently dropped the rotation, so rendering baselines captured against Style A no longer matched. Both regressions come from the same root cause: the shim was re-resolving the consolidated cfg instead of returning the retired ID's historical cfg verbatim. The fix: * ``deprecated_task_alias`` now takes a required ``cfg_factory`` callable and drops ``consolidated_cfg_path`` + the in-shim ``resolve_presets`` call. Each retired task's shim returns whatever the factory builds. * Every retired task call site passes ``cfg_factory=lambda: OldClass()`` pointing at the historical per-variant subclass, so the retired ID stays bit-for-bit identical to develop. The deprecation warning is layered on top; no behavior change. * The 4 manager-camera per-variant subclasses (deleted in an earlier attempt that consolidated them away) are restored alongside the new consolidated ``CartpoleCameraPresetsEnvCfg``. Both styles co-exist for one release, mirroring how the direct-camera files already work on develop. The consolidated cfg powers the canonical ``Isaac-Cartpole-Camera-v0`` task; the per-variant subclasses back the retired task IDs. * The direct-camera ``CartpoleCameraPresetsEnvCfg`` keeps its earlier restructure (flat env cfg + nested PresetCfg fields for ``observation_space`` and ``tiled_camera.data_types``). The canonical ``Isaac-Cartpole-Camera-Direct-v0`` uses it; field-by-field equivalent to develop's consolidated cfg. * ``hydra.py`` is unchanged from develop -- the earlier ``strict=`` parameter is removed since the shim no longer calls ``resolve_presets``. Each OLD per-variant subclass gets a docstring note pointing at the canonical task + the migration command, marking it for removal alongside the retired gym task ID after one release. Tests: * ``test_cartpole_preset_deprecations``: 73 pass (rotation expectations updated to reflect the historical 180-degree flip on Albedo / SimpleShading subclasses). * ``test_preset_kit_decision``: 5 pass. * ``test_manager_based_rl_env_obs_spaces``: imports ``CartpoleRGBCameraEnvCfg`` / ``CartpoleDepthCameraEnvCfg`` -- both remain present so the test is unaffected.
The consolidated ``CartpoleCameraPresetsEnvCfg`` was restructured from a top-level ``PresetCfg`` (Style B on develop) into a flat ``DirectRLEnvCfg`` with nested ``PresetCfg`` fields. The visualizer integration test extracted the rgb variant via ``getattr(env_cfg_root, "default", None)`` -- that path no longer exists on the new shape and raises ``RuntimeError`` before any actual rendering. Replace the ``default`` lookup with ``resolve_presets(env_cfg)`` so the nested ``PresetCfg`` fields (observation_space, tiled_camera.data_types, sim.physics, renderer_cfg) are resolved to their defaults in place, matching how the canonical gym task ID resolves them at ``gym.make()`` time. The downstream test logic (overriding ``scene.num_envs``, ``viewer``, ``tiled_camera.width/height``, ``observation_space[2]``, ``sim.physics``, ``sim.visualizer_cfgs``) is unchanged.
…-state leak
Importing the historical per-variant cfg classes at the top of each
cartpole task ``__init__.py`` (so ``cfg_factory=lambda: SomeClass()``
could close over them) pulled ``isaaclab.envs``, ``isaaclab.scene``, and
their downstream modules into ``sys.modules`` *during*
``isaaclab_tasks.direct.cartpole``'s package import. That happens before
``AppLauncher._create_app`` runs, and AppLauncher's mod-cache cycle
``del sys.modules[key]`` + ``sys.modules[key] = value`` only restores
the ``sys.modules`` entries -- it never re-binds the submodules as
attributes on the parent ``isaaclab`` package. After the cycle,
``isaaclab.scene`` lives in ``sys.modules`` but ``isaaclab.scene``
``getattr`` on the ``isaaclab`` module raises ``AttributeError``, which
breaks any unrelated test that walks a dotted string path like
``monkeypatch.setattr("isaaclab.scene.interactive_scene.cloner.X", Y)``.
Concretely on this PR, both ``test_clone_environments_executes_*`` cases
in ``source/isaaclab/test/scene/test_interactive_scene.py`` started
failing once the eager imports landed. The same tests pass on develop
because there the cfg classes are only referenced via lazy
``"module:Class"`` strings in the gym entry points, so nothing imports
them before ``AppLauncher`` runs.
Fix: introduce a tiny ``_lazy_cfg(class_name, module=...)`` helper in
each of the four cartpole ``__init__.py`` files. The helper returns a
zero-arg callable that imports the cfg class via ``importlib`` only
when invoked. ``deprecated_task_alias`` still calls ``cfg_factory()``
exactly once per ``gym.make()``, so the deferred import path runs at
the same moment the eager-import path would have triggered (the
shim's factory body), just without the side effect of pre-loading the
cfg module before ``AppLauncher``.
Local verification:
* ``test_clone_environments_executes_env_root_plan_with_positions``: PASS
* ``test_clone_environments_executes_asset_level_plan_without_usd_positions``: PASS
* 73 cartpole-deprecation tests + 5 preset-kit-decision tests: all pass.
Limit this PR's scope to deprecating the per-variant cartpole task IDs in favor of the four consolidated tasks; revert the cfg-class simplification work that was an additional optimization. - Revert direct/cartpole/cartpole_camera_presets_env_cfg.py to develop. - Restructure manager-based and showcase consolidated cfgs as minimal PresetCfg wrappers that expose existing per-variant subclasses as preset variants. Drop the flat-cfg / nested-PresetCfg-field rewrite. - Replace the cfg_factory + lazy_cfg machinery with a data-driven deprecated_alias_for kwarg on gym.register. parse_cfg.load_cfg_from_registry checks the kwarg and emits the DeprecationWarning when the retired ID's env_cfg_entry_point is loaded. env_cfg_entry_point stays a plain "module:Class" string, matching develop's pattern. - Delete the now-unused task_deprecation.py utility and the test_cartpole_preset_deprecations.py test.
Replace flat ``deprecated_alias_for`` string kwarg on retired-task ``gym.register`` calls with a structured ``deprecated`` dict whose ``alias`` field holds the migration command. Keeps the kwarg shape open for future fields (``reason``, ``removed_in``, ...) without renaming the top-level key. ``parse_cfg.load_cfg_from_registry`` reads ``kwargs["deprecated"]["alias"]``; warning text and behavior unchanged.
|
@greptileai review |
| if new_command: | ||
| warnings.warn( | ||
| f"Task '{spec.id}' is deprecated and will be removed in a future release. Use '{new_command}'.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
There was a problem hiding this comment.
stacklevel=2 silently suppresses the deprecation warning in the common training path
Python's default warning filter only shows DeprecationWarning when the attributed source frame is in __main__. With stacklevel=2, the warning is attributed to whichever function called load_cfg_from_registry — parse_env_cfg (in parse_cfg.py) or register_task (in hydra.py) — both of which are library modules, not __main__. Any user running a typical training script via the hydra_task_config decorator or parse_env_cfg will have the warning silently dropped by the default filter and never see the migration guidance, defeating the purpose of the deprecation mechanism.
The _user_stacklevel() helper already exists in hydra.py (lines 45–63) for exactly this purpose. Extracting it into a shared helper and using it here would correctly point warnings at the user's calling frame in __main__.
DeprecationWarning + stacklevel=2 silently suppressed the warning in any call path where the immediate caller of load_cfg_from_registry is a library module (parse_env_cfg, hydra.register_task, isaaclab_contrib/isaaclab_mimic wrappers). Python's default DeprecationWarning filter only displays warnings attributed to __main__. - Generalize hydra._user_stacklevel from file-scoped to package-scoped (walks past anything under isaaclab_tasks.utils.*) so a single helper serves callers in any utils submodule. - Import _user_stacklevel from hydra into parse_cfg.load_cfg_from_registry and use it for the deprecation-alias warning. - Switch the warning category from DeprecationWarning to FutureWarning so the warning is shown by Python's default filter regardless of attribution (the existing convention for end-user-facing deprecations in hydra.py preset aliases and manager_based_env / direct_rl_env cfg-field warnings). Verified under default Python filter: paths 1 (direct call), 2 (parse_env_cfg from __main__), and 3 (third-party wrapper outside the utils package) all display the warning.
|
@greptileai review |
StafaH
left a comment
There was a problem hiding this comment.
LGTM! If we're planning to ship this as part of 3.0, do we need deprecation? 3.0 is a major release and we can just note the breaking change, we don't need a deprecation cycle. Either that or we cherry pick this into beta2 so that we can remove it by 3.0.
I am fine either way, but cherry-picking to beta branch seems needing more QA testing given release is close. I can remove the tasks if deprecation cycle is not needed. |
|
Ok let's remove the deprecation, we have many other breaking changes and task renaming going to happen. Just make sure the new names are reflected correctly in the docs. |
|
ya I think removing deprecation is fine. we don't need to cherry-pick this to the release branch. |
|
I think it will touch a lot more files, so creating a followup PR. |
|
could you also update all the relevant docs that reference the cartpole tasks? we should use the new names with the proper presets and list all the supported presets in the environments page |
#7611) # Description The symptoms addressed by #7045 and the now-merged #7532 are real, but the selection mechanism grew into a parallel configuration system: task registrations described preset-to-agent relationships, the preset CLI rediscovered those relationships and rewrote `args.agent`, every backend had to opt into that mutation, and the documentation browser copied the same mapping again. Because #7532 has since merged, this branch also fully removes its live sentinel, second parse, mutation guard, benchmark wiring, and associated compatibility tests. Historical compiled changelog entries remain as release history. This PR makes the existing preset resolver the only owner of environment-coupled selection: ```text presets=resnet18 | v resolve_task_config(task, <library>_cfg_entry_point) | +-- environment PresetCfg root -> ResNet18 observations | `-- agent PresetCfg root -> feature-policy configuration ``` The Gym registry now selects a library or a genuinely independent training recipe. A library's canonical entry point owns any agent variants coupled to environment presets, so the same `presets=` broadcast selects both roots in one resolution pass. The final diff is **687 additions / 787 deletions: net -100 lines**. ## Before and after ### 1. Environment-coupled agent variants #### Before: repeat the pairing, then teach the CLI to translate it The camera task registered separate raw and feature agent keys, then repeated their relationship to environment presets in another dictionary: ```python _RAW_CAMERA_PRESETS = ("albedo", "depth", "rgb", ...) gym.register( ..., kwargs={ "env_cfg_entry_point": "...:CartpoleCameraEnvCfg", "rsl_rl_cfg_entry_point": "...:CartpoleCameraPPORunnerCfg", "rsl_rl_feature_cfg_entry_point": "...:CartpoleCameraFeaturePPORunnerCfg", "agent_preset_compatibility": { "rsl_rl_cfg_entry_point": _RAW_CAMERA_PRESETS, "rsl_rl_feature_cfg_entry_point": ("resnet18", "theia_tiny"), # The same pairings were repeated for RL Games. }, }, ) ``` The showcase tasks amplified this into one registry key per observation/action-space combination—24 noncanonical SKRL keys across the two tasks—plus another compatibility map: ```python "skrl_cfg_entry_point": "...:skrl_box_box_ppo_cfg.yaml", "skrl_box_box_cfg_entry_point": "...:skrl_box_box_ppo_cfg.yaml", "skrl_box_discrete_cfg_entry_point": "...:skrl_box_discrete_ppo_cfg.yaml", "skrl_box_multidiscrete_cfg_entry_point": "...:skrl_box_multidiscrete_ppo_cfg.yaml", # ... one key for every remaining space combination ... "agent_preset_compatibility": { "skrl_cfg_entry_point": ("box_box",), "skrl_box_discrete_cfg_entry_point": ("box_discrete",), # ... repeat every pairing again ... }, ``` #### After: the canonical agent entry point is a preset root The agent package owns the variants directly: ```python @configclass class CartpoleCameraPPORunnerPresetsCfg(PresetCfg): default = CartpoleCameraPPORunnerCfg() resnet18 = CartpoleCameraFeaturePPORunnerCfg() theia_tiny = CartpoleCameraFeaturePPORunnerCfg() gym.register( ..., kwargs={ "env_cfg_entry_point": "...:CartpoleCameraEnvCfg", "rsl_rl_cfg_entry_point": "...:CartpoleCameraPPORunnerPresetsCfg", }, ) ``` RL Games uses the same canonical-root shape with `preset(default=..., resnet18=..., theia_tiny=...)`. The showcase YAML family is likewise exposed behind its sole canonical key: ```python def skrl_cfg(): configs = { path.stem.removeprefix("skrl_").removesuffix("_ppo_cfg"): load_yaml(path) for path in Path(__file__).parent.glob("skrl_*_ppo_cfg.yaml") } return preset(default=configs.pop("box_box"), **configs) # Gym registration "skrl_cfg_entry_point": f"{agents.__name__}:skrl_cfg" ``` The configurations remain, but the 26 preset-specific agent keys, three compatibility maps, and duplicate preset-name lists do not. ### 2. Preset CLI ownership #### Before: parse, rediscover task metadata, and mutate another subsystem's argument ```python def setup_preset_cli(parser, argv=None, *, agent_library=None): ... args, remaining = parser.parse_known_args(args_to_parse) if agent_library and task_name: _auto_select_agent(args, task_name, agent_library, args_to_parse) return args, remaining # Every caller had to opt into the second selector. args, remaining = setup_preset_cli(parser, agent_library="rsl_rl") ``` `_auto_select_agent` scanned raw `presets=` tokens, intersected them with the compatibility maps, selected a different registry key, and rewrote `args.agent`. #7532 later added a sentinel and a second argparse pass just to decide whether that mutation was allowed to override a parser default. #### After: parse preset syntax and return it unchanged ```python def setup_preset_cli(parser, argv=None): ... return parser.parse_known_args(args_to_parse) args, remaining = setup_preset_cli(parser) ``` The preset CLI is again bounded to preset help and parsing. Agent configuration selection happens once, inside config resolution. ### 3. Humanoid AMP and SKRL algorithm identity #### Before: infer both the config and algorithm from CLI/key spelling ```python # Humanoid AMP registered no canonical SKRL key. "skrl_amp_cfg_entry_point": "...:skrl_walk_amp_cfg.yaml" # SKRL defaulted to PPO and reconstructed meaning from registry-key text. parser.add_argument("--algorithm", default="PPO", ...) agent_cfg_entry_point = ( "skrl_cfg_entry_point" if args_cli.algorithm.lower() == "ppo" else f"skrl_{args_cli.algorithm.lower()}_cfg_entry_point" ) algorithm = agent_cfg_entry_point.split("_cfg")[0].split("skrl_")[-1].lower() ``` A plain Humanoid AMP command therefore looked for the missing `skrl_cfg_entry_point`. #7045 compensated with a second CLI rule: if the canonical key was absent and exactly one other key existed, mutate `args.agent` to that key. The same key-parsing pattern also mislabeled showcase keys such as `skrl_box_discrete_cfg_entry_point` as algorithms. #### After: the task owns its default; the resolved config owns its algorithm ```python # Humanoid AMP registration "default_agent": "skrl", "skrl_cfg_entry_point": "...:skrl_walk_amp_cfg.yaml", "skrl_amp_cfg_entry_point": "...:skrl_walk_amp_cfg.yaml", # explicit --algorithm AMP agent_cfg_entry_point = resolve_skrl_agent_cfg_entry_point(args_cli.agent, args_cli.algorithm) env_cfg, agent_cfg = resolve_task_config(args_cli.task, agent_cfg_entry_point) algorithm = resolve_skrl_algorithm(agent_cfg, args_cli.algorithm) # reads agent.class ``` Omitting `--algorithm` now means “use the task's canonical SKRL config,” not “assume PPO.” An explicit `--algorithm` still selects an independent algorithm recipe and is checked against the resolved `agent.class`. Train, play, benchmarks, and LEAPP all use the same rule. ### 4. Downstream consumers | Surface | Before | After | | --- | --- | --- | | CLI help | `_AgentDescriptionBuilder` and `_enumerate_agents` loaded Gym metadata and rendered compatibility pairings. | Preset help describes selectable presets; agent selection is not duplicated in the preset CLI. | | Environment browser | Every generated row carried `agentPresetCompatibility`; JavaScript searched it and injected `--agent` into commands. | The row field and JavaScript rewrite are gone; generated commands pass `presets=` directly. | | Environment catalog | Treated arbitrary agent-key suffixes as algorithms, displaying recipe names such as `FEATURE` or `BOX_DISCRETE`. | Recognizes only explicit algorithm aliases, ignores preset/recipe suffixes, and deduplicates canonical aliases of the same config. | | Ray Cartpole vision jobs | Set both `--agent=rl_games_feature_cfg_entry_point` and `presets=resnet18/theia_tiny`. | Set only the preset. | | Missing-config diagnostics | Split every `*_cfg_entry_point` suffix into guessed library and algorithm labels. | Lists the exact registered configuration keys. | | LEAPP export | The shared parser accepted `agent_library` so the preset CLI could mutate `args.agent`; SKRL then reconstructed the algorithm from that key. | Uses the plain preset parser and derives SKRL identity from the resolved `agent.class`. | | Generated project defaults | Emitted the canonical `<library>_cfg_entry_point` only for PPO, so non-PPO and all multi-agent projects depended on CLI fallback. | Filters selected algorithms per workflow and marks PPO, MAPPO, or the sole selected non-PPO recipe canonical; the documented command resolves directly. | | Regression tests | Preserved compatibility dictionaries and asserted an intermediate rewritten `args.agent` value. | Assert the resolved environment and agent configs, exact canonical registrations/minimal variants, and absence of the rejected maps/helpers. | ### 5. Commands Before, users either had to provide both coupled selectors explicitly or rely on the preset CLI to synthesize the `--agent` half: ```bash # Before: two names for one camera-feature choice uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera \ --agent rsl_rl_feature_cfg_entry_point presets=resnet18 # After: one preset is composed into both roots uv run isaaclab train --rl_library rsl_rl \ --task Isaac-Cartpole-Camera presets=resnet18 ``` The same simplification applies to RL Games and the showcase space matrix: ```bash # Before uv run isaaclab train --rl_library skrl \ --task IsaacContrib-Cartpole-Showcase-Direct \ --agent skrl_box_discrete_cfg_entry_point presets=box_discrete # After uv run isaaclab train --rl_library skrl \ --task IsaacContrib-Cartpole-Showcase-Direct presets=box_discrete ``` Humanoid AMP no longer depends on an algorithm flag or the sole-entry fallback: ```bash # Before, without relying on CLI auto-selection uv run isaaclab train --rl_library skrl \ --task IsaacContrib-Humanoid-AMP-Walk-Direct --algorithm AMP # After: the canonical task config is AMP uv run isaaclab train --rl_library skrl \ --task IsaacContrib-Humanoid-AMP-Walk-Direct ``` `--algorithm AMP` remains valid when an explicit algorithm selection is desired. Generated multi-agent projects likewise use MAPPO as their canonical SKRL config, so their documented command needs no fallback: ```bash uv run isaaclab train --rl_library skrl --task <GENERATED-MARL-TASK> ``` ## Exact lineage of the removed mechanism The structure removed or superseded here accumulated across several PRs: | Change | Mechanism introduced | Disposition in this PR | | --- | --- | --- | | #2713 | Made missing-config errors split every agent entry-point key into inferred library and algorithm labels. | Errors now report the exact registered keys instead of inventing semantics for their suffixes. | | #5605 | Added the 24 space-specific showcase SKRL keys and the RL-Games camera feature key while consolidating preset-driven Cartpole tasks. | Keeps those configurations under canonical agent preset roots and removes their preset-specific registry keys. | | #5879 | Made the generated environment catalog infer algorithm labels from arbitrary entry-point suffixes and, for RL-Games vision, from the config path. | Catalog generation recognizes only the known algorithm aliases and ignores preset/recipe suffixes. | | #5904 | Added Ray camera-feature jobs that specified both `--agent=rl_games_feature_cfg_entry_point` and `presets=resnet18/theia_tiny`. | Ray selects each feature pipeline with the preset alone. | | #5930 | Added the separate `rsl_rl_feature_cfg_entry_point` for pretrained camera features. | The canonical RSL-RL root owns its raw and feature-policy variants. | | #6553 and #6564 | Made SKRL train/play and benchmark entry points default `--algorithm` to PPO, select a registry key from that default, and reconstruct algorithm identity from explicit key suffixes. | An omitted algorithm resolves the task's canonical config first; the resolved `agent.class` is authoritative everywhere. | | #6677 | Added three `agent_preset_compatibility` maps, duplicate `_SPACE_PRESETS` / `_RAW_CAMERA_PRESETS` lists, `setup_preset_cli(..., agent_library=...)`, `_AgentDescriptionBuilder`, `_enumerate_agents`, and `agent_library=` plumbing in all eight unified RL train/play entry points. It also added help, docs, and tests around those pairings. | Deletes the maps, duplicate lists, agent-aware preset CLI API/helpers, call-site plumbing, and preservation tests. | | #6779 | Extended `agent_library` into the shared LEAPP export parser and added another SKRL helper that inferred the algorithm from the agent key. | Removes that parser parameter/helper and resolves algorithm identity from the loaded config. | | #7045 | Promoted the compatibility metadata from help text into runtime control with `_auto_select_agent`, raw `presets=` scanning, declared-domain filtering, preset-to-key matching, post-parse `args.agent` mutation, and a sole-noncanonical-agent fallback for Humanoid AMP. It also wired the two SKRL benchmark entry points. | Deletes both selection rules and their benchmark wiring. Presets compose the environment and agent roots directly; AMP is registered canonically. | | #7160 | Copied `agent_preset_compatibility` into the generated environment-browser row schema and used it in JavaScript to inject a preset-specific `--agent` into generated commands. | Removes the compatibility column and browser-side command rewrite. | | #7532 (merged) | Added `_AGENT_UNSET`, a second argparse pass in `_agent_passed_explicitly`, a looser mutation guard, six RSL-RL/RL-Games/SB3 benchmark train/play wirings, and tests for rewritten `args.agent` values and explicit-flag spellings. | Fully reverts its live implementation: there is no agent-key mutation to guard, no backend-specific preset-CLI wiring to propagate, and no preservation test for that removed behavior. | This is therefore more than an alternative fix for two symptoms: it removes the parallel preset-to-agent selection system end to end. ## Intentional compatibility removal No warning-only or no-op compatibility shim is retained for: - `agent_preset_compatibility` - preset-specific agent keys such as `rsl_rl_feature_cfg_entry_point` and the showcase space-specific SKRL keys - `setup_preset_cli(..., agent_library=...)` The separately named `pretrained_checkpoint_preset_compatibility` metadata from #7630 is intentionally retained: it declares which preset-specific checkpoint artifacts exist and never selects an agent entry point. Keeping those aliases would preserve the duplicate ownership this refactor removes. Commands using a preset-specific key should remove `--agent=<preset-specific-key>` and use the canonical library selection plus `presets=<name>`, as shown above. Older SKRL runs may have encoded a configuration-key suffix such as `box_discrete` as the algorithm in a run directory or manifest. The corrected identity is the resolved `agent.class` (`PPO` in that example), so automatic `latest` / `best` discovery cannot safely match those historical runs. Pass their checkpoint path explicitly. ## Type of change - Bug fix - Architecture refactor - Intentional removal of recently introduced compatibility APIs - Documentation update ## Validation The four-case composition regression was also run against an untouched `develop` worktree. All four cases failed there because the environment preset changed while the canonical agent stayed at its default; all four pass on this branch. - Preset composition, CLI, RL entrypoint, generator, and benchmark adapter/API tests: **148 passed** - Pretrained-checkpoint metadata tests: **12 passed** - Environment documentation tests: **35 passed** - LEAPP selector/checkpoint tests: **11 passed, 1 skipped** - Environment browser generation: up to date for **137** training environments - JavaScript syntax, pre-commit hooks for all PR files, changelog validation against current `upstream/develop`, centralized structure audit, and `git diff --check`: passed No GPU simulation or full training job was run; the regression is exercised at configuration composition and entrypoint boundaries before environment construction. The generated environment-browser refresh also incorporates the current physics selectors for the two DrLegs rows. ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Screenshots Not applicable. ## Checklist - [x] I have read and understood the contribution guidelines - [x] I have run the pre-commit checks with `uv run --frozen isaaclab -f` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove the fix is effective - [x] I have added changelog fragments for every touched package - [x] My name already exists in `CONTRIBUTORS.md`
1. Summary
presets=NAMEfrom [PresetCLI] Add typed preset selection with task-aware help #5587.env_cfg_entry_pointstill points at the historical per-variant cfg; only aFutureWarningis layered on top via a newdeprecatedkwarg (a dict with analiasfield holding the migration command) ongym.register.PresetCfgvariants; no field-level cfg restructuring. Simplification opportunities listed in §7 for follow-up.Isaac-Cartpole-Camera-Direct-v0presets=<data_type>Isaac-Cartpole-Camera-v0presets=<pipeline>,--agent rl_games_{,feature_}cfg_entry_point,physics=(inherited)Isaac-Cartpole-Showcase-Direct-v0presets=<obs>_<action>,--agent skrl_<obs>_<action>_cfg_entry_point,physics=(inherited)Isaac-Cartpole-Camera-Showcase-Direct-v0presets=<obs>_<action>,--agent skrl_<obs>_<action>_cfg_entry_point,physics=(inherited)Basic physics-only tasks (
Isaac-Cartpole-v0,Isaac-Cartpole-Direct-v0) stay unchanged.2. Migration map (each retired ID → new invocation)
2.1 Direct-backend perception (
Isaac-Cartpole-Camera-Direct-v0)Isaac-Cartpole-Camera-Presets-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0Isaac-Cartpole-RGB-Camera-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0 presets=rgbIsaac-Cartpole-Depth-Camera-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0 presets=depthIsaac-Cartpole-Albedo-Camera-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0 presets=albedoIsaac-Cartpole-SimpleShading-Constant-Camera-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0 presets=simple_shading_constant_diffuseIsaac-Cartpole-SimpleShading-Diffuse-Camera-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0 presets=simple_shading_diffuse_mdlIsaac-Cartpole-SimpleShading-Full-Camera-Direct-v0--task=Isaac-Cartpole-Camera-Direct-v0 presets=simple_shading_full_mdlRenderer selectable via
renderer=NAME. Physics backend selectable viaphysics=NAMEon the canonical task.2.2 Manager-based perception (
Isaac-Cartpole-Camera-v0)Isaac-Cartpole-RGB-v0--task=Isaac-Cartpole-Camera-v0 presets=rgbIsaac-Cartpole-Depth-v0--task=Isaac-Cartpole-Camera-v0 presets=depthIsaac-Cartpole-RGB-ResNet18-v0--task=Isaac-Cartpole-Camera-v0 --agent=rl_games_feature_cfg_entry_point presets=resnet18Isaac-Cartpole-RGB-TheiaTiny-v0--task=Isaac-Cartpole-Camera-v0 --agent=rl_games_feature_cfg_entry_point presets=theia_tinyphysics=is exposed via the inheritedCartpoleEnvCfg.sim.physicsPresetCfg.2.3 Proprioceptive showcase (
Isaac-Cartpole-Showcase-Direct-v0)Old:
Isaac-Cartpole-Showcase-<Obs>-<Action>-Direct-v0→New:
--task=Isaac-Cartpole-Showcase-Direct-v0 --agent=skrl_<obs>_<action>_cfg_entry_point presets=<obs>_<action>All 15 combinations:
<Obs>∈{Box, Discrete, MultiDiscrete, Dict, Tuple},<Action>∈{Box, Discrete, MultiDiscrete}.box_boxmatches the default skrl yaml so no--agent=is needed for it; every other variant needs an explicit--agent=.2.4 Camera showcase (
Isaac-Cartpole-Camera-Showcase-Direct-v0)Same pattern as proprioceptive showcase, but only 3 observation containers (
Box,Dict,Tuple) × 3 actions = 9 combinations.3. Deprecation contract
Each retired task ID stays registered with its historical
env_cfg_entry_pointplus a newdeprecatedkwarg holding the migration metadata:isaaclab_tasks.utils.parse_cfg.load_cfg_from_registryreadsspec.kwargs["deprecated"]["alias"]when loading anenv_cfg_entry_pointand emits aFutureWarningnaming the new command. The dict shape is open for future fields (reason,removed_in, …).4. Design notes
presets=selection picks the whole shape. Matches the existing behavior ofIsaac-Cartpole-Camera-Presets-Direct-v0.--agent=<name>.5. Dependencies
Depends on #5587 (the typed
physics=/renderer=/presets=CLI). Merged intodevelop; this branch is rebased.6. Test plan
test_preset_kit_decision.py(5 tests) passes locally — exercises the retired catch-allIsaac-Cartpole-Camera-Presets-Direct-v0via the new flowdeprecated={"alias": ...}and the warning text matches the contract7. Follow-up: cfg simplification
Consolidated cfgs currently wrap one full env-cfg instance per variant (the simple PresetCfg pattern). A follow-up PR can flatten them: share env fields at the top level and nest a
PresetCfgonly on the varying axes (e.g.observation_space,tiled_camera.data_types). Same pattern applies to all four consolidated cfgs; collapses duplicated__post_init__and near-duplicate scene cfgs along the way.Measured on
Isaac-Cartpole-Camera-Direct-v0(direct/cartpole/cartpole_camera_presets_env_cfg.py) from an earlier iteration of this PR:gym.make()cfg instantiation: 22.6 ms → 1.25 ms (18× faster).