Skip to content

Select pretrained checkpoints from resolved task configs - #7491

Closed
maxkra15 wants to merge 3 commits into
isaac-sim:developfrom
maxkra15:fix-missing-cartpole-checkpoints
Closed

maxkra15 wants to merge 3 commits into
isaac-sim:developfrom
maxkra15:fix-missing-cartpole-checkpoints

Conversation

@maxkra15

@maxkra15 maxkra15 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Select pretrained checkpoints from the final resolved environment configuration instead of retaining preset-selection history in Hydra. Physics and renderer backends remain shared dimensions, while a task-owned variant_resolver identifies only the policy-relevant contract (observations, actions, and shapes); presets are retained solely as reproducible training recipes.

Runtime playback, benchmark playback, and LEAPP export all consume the same checkpoint declaration as the training/publication matrix. Unsupported configurations fail closed before downloading a shape-incompatible checkpoint. For camera Cartpole this distinguishes raw RGB from depth and rejects RGB feature-extractor policies or changed image shapes rather than silently falling back to the raw-RGB model.

Camera Cartpole declares the existing RSL-RL RGB policy plus RL-Games RGB and depth policies. The default variant preserves existing unsuffixed artifact names; depth uses the stable _depth suffix. Backend discovery is reused during a fetch, so the resolved config's renderer tree is traversed only once.

This addresses the reported A pre-trained checkpoint is currently unavailable for this task failure for Isaac-Cartpole-Camera-Direct with presets=rgb and presets=depth.

Type of change

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

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Screenshots

Not applicable.

Validation

  • uv run --frozen --extra test python -m pytest scripts/tools/test/test_train_and_publish_checkpoints.py source/isaaclab/test/benchmark/test_api.py source/isaaclab_rl/test/test_pretrained_checkpoint.py source/isaaclab_rl/test/export/test_pretrained_checkpoint_lookup.py source/isaaclab_tasks/test/core/test_hydra.py source/isaaclab_tasks/test/core/test_preset_cli.py -q — 180 passed
  • Regression tests cover implicit/default RGB, explicit RGB, final scalar overrides to depth, ResNet18/Theia rejection, changed image-shape rejection, and a single backend traversal per fetch
  • SKIP=check-git-lfs-pointers uv run --frozen isaaclab -f — all applicable hooks passed; Git LFS pointer check skipped because this is a source-only change
  • uv run --frozen python tools/changelog/cli.py check develop — passed
  • Publication matrix listing produces the existing RGB artifact and distinct depth artifact with unchanged names
  • RGB and depth RL-Games one-iteration smoke training on Newton MJWarp/Newton renderer — passed at 32 environments
  • RGB and depth RL-Games full training — completed 500 epochs each at 512 environments
  • Deterministic --checkpoint pretrained playback — both variants selected their intended cached artifacts, loaded successfully, and ran at 32 environments; RGB used observation shape (6, 96, 96), depth used (2, 96, 96), and both used action shape (1,)
  • Fresh Nucleus downloads matched the local SHA-256 hashes exactly
  • uv run --isolated --extra test -- make -C docs current-docs — documentation rendered completely, then failed the warning-as-error gate on 14 pre-existing duplicate SchemaFragment API descriptions in untouched schemas_cfg.py files

Training results and staged artifacts

Both policies reached Episode/Metrics/success_rate = 1.0 at epoch 500 (survival to the 300-step task timeout).

Variant Last mean episode length Max mean reward Internal Nucleus artifact Size SHA-256
RGB 299.652 / 300 4.816965 omniverse://isaac-dev.ov.nvidia.com/Isaac/IsaacLab/PretrainedCheckpoints/rl_games/Isaac-Cartpole-Camera-Direct_newtonmjwarp_newton_rl_games.pth 26,190,312 bytes 8690461fed33b9110e3e3d09ba4b37674ef98585de01fc40b0f425be84f62b95
Depth 299.329 / 300 4.803334 omniverse://isaac-dev.ov.nvidia.com/Isaac/IsaacLab/PretrainedCheckpoints/rl_games/Isaac-Cartpole-Camera-Direct_depth_newtonmjwarp_newton_rl_games.pth 26,092,438 bytes b5273a34159824b65e9d0fe0edc3e18c52babcccea58ee2e442e82179ac530cc

The artifacts are staged on the internal Isaac Nucleus server for promotion to the public pretrained-checkpoint bucket. This PR remains a draft until review and promotion are complete.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the applicable pre-commit checks
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove the fix
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package
  • My name already exists in CONTRIBUTORS.md

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Sep 2, 2026
raise ValueError("smoke_num_envs must be positive")

@property
def preset_selections(self) -> tuple[tuple[str, ...], ...]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually we try to minimize the method and property in dataclasses, they are not object classes

"""
checkpoint = select_pretrained_checkpoint(workflow, task_name, env_cfg, agent)
if checkpoint is None:
presets = get_preset_selection(env_cfg)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isaaclab_rl should not depends on knowing preset, can we get the preset selection in scripts directly?

return PretrainedCheckpointCfg(workflow=workflow)

physics_backend, render_backend = get_pretrained_checkpoint_backend_names(env_cfg)
active_presets = set(get_preset_selection(env_cfg)) & set(checkpoint_set.policy_presets)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here as wll isaaclab_rl as package should not understand the preset, you can get the preset seleciton in scripts entrypoint

@maxkra15 maxkra15 changed the title Add preset-aware pretrained checkpoint selection Select pretrained checkpoints from resolved task configs Sep 3, 2026
kellyguo11 pushed a commit that referenced this pull request Sep 7, 2026
…7532)

# Description

Preset-based `--agent` auto-selection is dead code for `rsl_rl`,
`rl_games` and `sb3`. Two defects sit **in series** on the same code
path:

1. **The selection guard cannot see past the CLI default.**
`_auto_select_agent` in
`source/isaaclab_tasks/isaaclab_tasks/utils/preset_cli.py` was only
reached when `args.agent is None`. `add_common_train_args` registers
`--agent` with `default=agent_default`, and every backend except `skrl`
passes a non-`None` `agent_default` (`rsl_rl_cfg_entry_point`,
`rl_games_cfg_entry_point`, `sb3_cfg_entry_point`). The parsed value is
therefore never `None`, so the branch never runs.
2. **The benchmark entrypoints never asked for it.**
`benchmark_train_{rsl_rl,rl_games,sb3}.py` and
`benchmark_play_{rsl_rl,rl_games,sb3}.py` called
`setup_preset_cli(parser, argv)` without `agent_library`, so
auto-selection was not attempted at all (and the registered-agent help
listing was missing too). Only the `skrl` benchmark entrypoints wired
it.

## Provenance and symptom

Benchmark sweep dispatch `20260901-153531` (image built from
`release/3.0.0` at `f88dbc59c82`, `rsl_rl`) produced **60 failed rows**:
`resnet18` (30) and `theia_tiny` (30), failing 100% across all three
renderers and all physics backends. Every one died before the first
training step:

```
ValueError: Observation 'critic' in observation set 'critic' not found in the observations
from the environment. Available observations from the environment: ['policy']
```

Call chain: `OnPolicyRunner.__init__` → `ppo.py construct_algorithm` →
`rsl_rl/utils/utils.py:233 resolve_obs_groups`.

## Why this is an agent-entrypoint bug, not a missing observation group

`Isaac-Cartpole-Camera` already declares the correct pairing:

```python
"agent_preset_compatibility": {
    "rsl_rl_cfg_entry_point": _RAW_CAMERA_PRESETS,
    "rsl_rl_feature_cfg_entry_point": ("resnet18", "theia_tiny"),
    ...
}
```

and `CartpoleCameraFeaturePPORunnerCfg` sets `obs_groups` with `critic:
["policy"]`. The feature entry point exists, is registered, is correct —
it was simply unreachable, so `resnet18`/`theia_tiny` ran against the
raw-camera `CartpoleCameraPPORunnerCfg`, whose `obs_groups` asks for a
`critic` group the env does not expose. Nothing needs to be added to the
environment.

## Why both defects are in one PR

Neither half fixes the observed failure alone; this was measured, not
assumed. Reverting either half of the change and running the regression
test:

| state | result |
| --- | --- |
| defect 2 fixed only (`agent_library` wired, guard unchanged) | 4
failed — `--agent` still parses to the non-`None` default, so the guard
rejects |
| defect 1 fixed only (guard fixed, `agent_library` not wired) | 4
failed — `if agent_library and ...` is `False`, auto-selection never
attempted |
| both fixed | passes |

They are two links in one chain, so splitting them yields a PR that
fixes nothing observable and a PR that cannot be tested end-to-end.

## Scope: train **and** play, benchmark **and** non-benchmark

To pre-empt the obvious question — this is not a play-only or a
train-only fix.

| path | affected by | fixed by | proven by |
| --- | --- | --- | --- |
| `benchmark_train_{rsl_rl,rl_games,sb3}` | defects 1 + 2 |
`preset_cli.py` + `agent_library=` wiring |
`test_training_request_selects_preset_compatible_agent` — **this is the
observed 60-row failure** |
| `benchmark_play_{rsl_rl,rl_games,sb3}` | defects 1 + 2 |
`preset_cli.py` + `agent_library=` wiring |
`test_play_request_selects_preset_compatible_agent` |
| `isaaclab_rl` `train_*`/`play_*` (non-benchmark) | defect 1 only —
they already pass `agent_library` | `preset_cli.py` alone; **no file in
this PR touches them** |
`test_setup_preset_cli_auto_selects_agent_over_non_none_default` |

Each half of the benchmark wiring was reverted independently and
re-tested:

* revert the three **train** wirings → the 4 training selection cases
fail. Load-bearing for the reported failure.
* revert the three **play** wirings → the 2 playback selection cases
fail.

There is **no train/play asymmetry** that would justify wiring only one
of them: both register `--agent` with the same non-`None` default via
the same helper, both call `setup_preset_cli`, and both feed
`args.agent` into the same `resolve_task_config(...)` and then into the
same `OnPolicyRunner(...)` construction. The reason the sweep only
surfaced the training failure is ordering, not asymmetry — a row that
dies at `train_rc=1` never reaches playback. Measured on the playback
path before the wiring was added:

```
$ BenchmarkPlayRequest(backend="rsl_rl", task="Isaac-Cartpole-Camera", presets=("resnet18",))
args.agent : rsl_rl_cfg_entry_point          # raw-camera config, wrong
# with the wiring:
args.agent : rsl_rl_feature_cfg_entry_point  # correct
```

Playback would therefore have loaded a feature-trained checkpoint into
the raw-camera policy architecture.

## Fix chosen

Detect an explicitly typed `--agent` by re-parsing the same argv into a
namespace pre-seeded with a sentinel: argparse only applies a default
for a destination the namespace does not already carry, so the sentinel
survives unless the user actually typed the flag. Auto-selection runs
only when it does survive; an explicit `--agent` still wins. The six
benchmark entrypoints now pass `agent_library`.

The probe uses the same parser on the same argv as the real parse, so
its verdict *is* argparse's verdict. Verified across every spelling —
`--agent V`, `--agent=V`, the abbreviation `--age V`, repeated flags,
and `--agent` after a `--` separator (correctly not explicit: argparse
does not set it in the real parse either). A literal argv scan for
`--agent` would get the abbreviation wrong and silently override a
user's explicit choice, which is why the probe is preferred; the repo's
existing `ExplicitAction` idiom would work too but requires touching all
ten `--agent` registration sites across three packages, and a missed
site fails the same silent way.

### Rejected: make `--agent` default to `None` everywhere

This is the obvious fix and it is not safe. `skrl` can default to `None`
because `train_skrl.py` reconstructs the entry point from `--algorithm`
when it is `None`. The other three pass `args_cli.agent` straight into
`resolve_task_config(...)`, which has no such fallback — `hydra.py:619`
sets `agent_cfg = load_cfg_from_registry(...) if agent_entry else None`,
and the entrypoints then dereference `agent_cfg.max_iterations`. A
`None` default would break every plain `--task=X` run that relies on the
canonical entry point, i.e. the overwhelmingly common case. Fixing that
would mean adding a fallback to each of the six benchmark entrypoints
plus the four train/play entrypoints: a much wider blast radius than the
bug.

### Blast radius

Behavior changes only where auto-selection actually fires, and only when
the user did **not** type `--agent`:

* **Rule 1 (preset-based)** fires only for tasks that opted in with
`agent_preset_compatibility` — today `Isaac-Cartpole-Camera` and the two
cartpole-showcase tasks. That is the declared contract finally being
honored. Anyone who wants the previous (broken) pairing can still pass
`--agent rsl_rl_cfg_entry_point` explicitly; covered by a test.
* **Rule 2 (default-absent)** fires only when
`<library>_cfg_entry_point` is *not* registered and exactly one other
entry point is. That path previously resolved an unregistered entry
point and crashed, so this is strictly a repair.
* Everything else — no preset pairing declared, or the canonical default
is registered — keeps the exact default it had; covered by a test for
all three libraries.
* `skrl` is unaffected: it already passed `agent_default=None`, and the
explicit/implicit distinction collapses to the old `is None` check for
it.

`rl_games` and `sb3` share the defect and are fixed by the same change.
**`sb3` has no task declaring `agent_preset_compatibility`, so there is
no positive selection test for it** — its wiring is covered by the
shared code path and by a default-preservation test only.

## Type of change

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

## Screenshots

Not applicable.

## Validation

Regression tests were confirmed to fail on `develop` without the fix and
pass with it.

**Before the fix** (production changes reverted to `develop`, tests in
place):

```
$ uv run --frozen --extra test python -m pytest source/isaaclab_tasks/test/core/test_preset_cli.py \
    source/isaaclab/test/benchmark/test_api.py -q -p no:warnings \
    -k "preset_compatible_agent or keeps_backend_default_agent or auto_selects_agent_over_non_none or keeps_explicit_agent"

FAILED test_preset_cli.py::test_setup_preset_cli_auto_selects_agent_over_non_none_default
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[resnet18-rsl_rl]
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[resnet18-rl_games]
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[theia_tiny-rsl_rl]
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[theia_tiny-rl_games]
5 failed, 6 passed, 53 deselected

E  AssertionError: assert 'rl_games_cfg_entry_point' == 'rl_games_feature_cfg_entry_point'
```

**After the fix:**

```
$ uv run --frozen --extra test python -m pytest source/isaaclab_tasks/test/core/test_preset_cli.py \
    source/isaaclab_tasks/test/core/test_hydra.py source/isaaclab/test/benchmark \
    source/isaaclab_rl/test/test_entrypoints_common.py -q -p no:warnings
492 passed, 1 skipped in 30.89s

$ uv run --frozen --extra test --extra skrl --extra sb3 --extra rl-games --extra rsl-rl \
    python -m pytest source/isaaclab_rl/test/test_typed_preset_cli_train_play.py -q -p no:warnings
8 passed in 33.27s
```

(The last suite fails on a bare `--extra test` environment on `develop`
too — `ModuleNotFoundError: No module named 'skrl'` etc. — so it was
rerun with the RL extras.)

```
$ uv run --frozen python tools/changelog/cli.py check develop
✓ All modified packages have valid changelog fragments.

$ uv run --frozen isaaclab -f
all hooks passed
```

Tests added:

* `source/isaaclab_tasks/test/core/test_preset_cli.py` — auto-selection
over a non-`None` default; explicit `--agent` wins over the preset,
parametrized over the three spellings argparse accepts. The two
pre-existing auto-selection tests only covered `skrl` with
`agent_default=None`, which is exactly why this bug went unnoticed.
* `source/isaaclab/test/benchmark/test_api.py` — drives the real
benchmark entrypoints via
`BenchmarkTrainingRequest`/`BenchmarkPlayRequest` and `_parse_args`,
asserting the feature entry point is selected for
`resnet18`/`theia_tiny` × `rsl_rl`/`rl_games` on the train path
(mirroring the failing rows), the same on the play path, and that the
canonical default survives otherwise (`rsl_rl`, `rl_games`, `sb3`).

Both assert the *selected agent config*, not merely absence of an
exception.

Not run: a real training job on the failing rows (requires GPU sim). The
failure is a construction-time config selection, fully reproduced at CLI
level.

## Related PRs — checked, no overlap

* **#7491** (Select pretrained checkpoints from resolved task configs)
touches `isaaclab_rl/entrypoints/common.py`, the four `play_*`
entrypoints, the four `benchmark_play_*` entrypoints,
`cartpole/__init__.py` and `test_preset_cli.py` — adjacent, but changes
neither `agent_default` nor the selection guard. Textual conflicts are
possible in `test_preset_cli.py` and the `benchmark_play_*` files
(one-line `setup_preset_cli(...)` call); no semantic conflict.
* **#6440** (`fix(rsl_rl): default obs_groups for new runners`) adds an
`obs_groups` default in `isaaclab_rl/rsl_rl/utils.py`. It would mask
this symptom for runners that omit `obs_groups`, but
`CartpoleCameraPPORunnerCfg` sets `obs_groups` explicitly, so it does
not fix these 60 rows — and it would not make the correct feature config
get selected either. Complementary, not duplicate.
* `gh pr list --search "agent preset"` returned nothing touching this
code.

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

---------

Co-authored-by: hujc <[email protected]>
isaaclab-bot Bot pushed a commit that referenced this pull request Sep 7, 2026
…7532)

# Description

Preset-based `--agent` auto-selection is dead code for `rsl_rl`,
`rl_games` and `sb3`. Two defects sit **in series** on the same code
path:

1. **The selection guard cannot see past the CLI default.**
`_auto_select_agent` in
`source/isaaclab_tasks/isaaclab_tasks/utils/preset_cli.py` was only
reached when `args.agent is None`. `add_common_train_args` registers
`--agent` with `default=agent_default`, and every backend except `skrl`
passes a non-`None` `agent_default` (`rsl_rl_cfg_entry_point`,
`rl_games_cfg_entry_point`, `sb3_cfg_entry_point`). The parsed value is
therefore never `None`, so the branch never runs.
2. **The benchmark entrypoints never asked for it.**
`benchmark_train_{rsl_rl,rl_games,sb3}.py` and
`benchmark_play_{rsl_rl,rl_games,sb3}.py` called
`setup_preset_cli(parser, argv)` without `agent_library`, so
auto-selection was not attempted at all (and the registered-agent help
listing was missing too). Only the `skrl` benchmark entrypoints wired
it.

## Provenance and symptom

Benchmark sweep dispatch `20260901-153531` (image built from
`release/3.0.0` at `f88dbc59c82`, `rsl_rl`) produced **60 failed rows**:
`resnet18` (30) and `theia_tiny` (30), failing 100% across all three
renderers and all physics backends. Every one died before the first
training step:

```
ValueError: Observation 'critic' in observation set 'critic' not found in the observations
from the environment. Available observations from the environment: ['policy']
```

Call chain: `OnPolicyRunner.__init__` → `ppo.py construct_algorithm` →
`rsl_rl/utils/utils.py:233 resolve_obs_groups`.

## Why this is an agent-entrypoint bug, not a missing observation group

`Isaac-Cartpole-Camera` already declares the correct pairing:

```python
"agent_preset_compatibility": {
    "rsl_rl_cfg_entry_point": _RAW_CAMERA_PRESETS,
    "rsl_rl_feature_cfg_entry_point": ("resnet18", "theia_tiny"),
    ...
}
```

and `CartpoleCameraFeaturePPORunnerCfg` sets `obs_groups` with `critic:
["policy"]`. The feature entry point exists, is registered, is correct —
it was simply unreachable, so `resnet18`/`theia_tiny` ran against the
raw-camera `CartpoleCameraPPORunnerCfg`, whose `obs_groups` asks for a
`critic` group the env does not expose. Nothing needs to be added to the
environment.

## Why both defects are in one PR

Neither half fixes the observed failure alone; this was measured, not
assumed. Reverting either half of the change and running the regression
test:

| state | result |
| --- | --- |
| defect 2 fixed only (`agent_library` wired, guard unchanged) | 4
failed — `--agent` still parses to the non-`None` default, so the guard
rejects |
| defect 1 fixed only (guard fixed, `agent_library` not wired) | 4
failed — `if agent_library and ...` is `False`, auto-selection never
attempted |
| both fixed | passes |

They are two links in one chain, so splitting them yields a PR that
fixes nothing observable and a PR that cannot be tested end-to-end.

## Scope: train **and** play, benchmark **and** non-benchmark

To pre-empt the obvious question — this is not a play-only or a
train-only fix.

| path | affected by | fixed by | proven by |
| --- | --- | --- | --- |
| `benchmark_train_{rsl_rl,rl_games,sb3}` | defects 1 + 2 |
`preset_cli.py` + `agent_library=` wiring |
`test_training_request_selects_preset_compatible_agent` — **this is the
observed 60-row failure** |
| `benchmark_play_{rsl_rl,rl_games,sb3}` | defects 1 + 2 |
`preset_cli.py` + `agent_library=` wiring |
`test_play_request_selects_preset_compatible_agent` |
| `isaaclab_rl` `train_*`/`play_*` (non-benchmark) | defect 1 only —
they already pass `agent_library` | `preset_cli.py` alone; **no file in
this PR touches them** |
`test_setup_preset_cli_auto_selects_agent_over_non_none_default` |

Each half of the benchmark wiring was reverted independently and
re-tested:

* revert the three **train** wirings → the 4 training selection cases
fail. Load-bearing for the reported failure.
* revert the three **play** wirings → the 2 playback selection cases
fail.

There is **no train/play asymmetry** that would justify wiring only one
of them: both register `--agent` with the same non-`None` default via
the same helper, both call `setup_preset_cli`, and both feed
`args.agent` into the same `resolve_task_config(...)` and then into the
same `OnPolicyRunner(...)` construction. The reason the sweep only
surfaced the training failure is ordering, not asymmetry — a row that
dies at `train_rc=1` never reaches playback. Measured on the playback
path before the wiring was added:

```
$ BenchmarkPlayRequest(backend="rsl_rl", task="Isaac-Cartpole-Camera", presets=("resnet18",))
args.agent : rsl_rl_cfg_entry_point          # raw-camera config, wrong
# with the wiring:
args.agent : rsl_rl_feature_cfg_entry_point  # correct
```

Playback would therefore have loaded a feature-trained checkpoint into
the raw-camera policy architecture.

## Fix chosen

Detect an explicitly typed `--agent` by re-parsing the same argv into a
namespace pre-seeded with a sentinel: argparse only applies a default
for a destination the namespace does not already carry, so the sentinel
survives unless the user actually typed the flag. Auto-selection runs
only when it does survive; an explicit `--agent` still wins. The six
benchmark entrypoints now pass `agent_library`.

The probe uses the same parser on the same argv as the real parse, so
its verdict *is* argparse's verdict. Verified across every spelling —
`--agent V`, `--agent=V`, the abbreviation `--age V`, repeated flags,
and `--agent` after a `--` separator (correctly not explicit: argparse
does not set it in the real parse either). A literal argv scan for
`--agent` would get the abbreviation wrong and silently override a
user's explicit choice, which is why the probe is preferred; the repo's
existing `ExplicitAction` idiom would work too but requires touching all
ten `--agent` registration sites across three packages, and a missed
site fails the same silent way.

### Rejected: make `--agent` default to `None` everywhere

This is the obvious fix and it is not safe. `skrl` can default to `None`
because `train_skrl.py` reconstructs the entry point from `--algorithm`
when it is `None`. The other three pass `args_cli.agent` straight into
`resolve_task_config(...)`, which has no such fallback — `hydra.py:619`
sets `agent_cfg = load_cfg_from_registry(...) if agent_entry else None`,
and the entrypoints then dereference `agent_cfg.max_iterations`. A
`None` default would break every plain `--task=X` run that relies on the
canonical entry point, i.e. the overwhelmingly common case. Fixing that
would mean adding a fallback to each of the six benchmark entrypoints
plus the four train/play entrypoints: a much wider blast radius than the
bug.

### Blast radius

Behavior changes only where auto-selection actually fires, and only when
the user did **not** type `--agent`:

* **Rule 1 (preset-based)** fires only for tasks that opted in with
`agent_preset_compatibility` — today `Isaac-Cartpole-Camera` and the two
cartpole-showcase tasks. That is the declared contract finally being
honored. Anyone who wants the previous (broken) pairing can still pass
`--agent rsl_rl_cfg_entry_point` explicitly; covered by a test.
* **Rule 2 (default-absent)** fires only when
`<library>_cfg_entry_point` is *not* registered and exactly one other
entry point is. That path previously resolved an unregistered entry
point and crashed, so this is strictly a repair.
* Everything else — no preset pairing declared, or the canonical default
is registered — keeps the exact default it had; covered by a test for
all three libraries.
* `skrl` is unaffected: it already passed `agent_default=None`, and the
explicit/implicit distinction collapses to the old `is None` check for
it.

`rl_games` and `sb3` share the defect and are fixed by the same change.
**`sb3` has no task declaring `agent_preset_compatibility`, so there is
no positive selection test for it** — its wiring is covered by the
shared code path and by a default-preservation test only.

## Type of change

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

## Screenshots

Not applicable.

## Validation

Regression tests were confirmed to fail on `develop` without the fix and
pass with it.

**Before the fix** (production changes reverted to `develop`, tests in
place):

```
$ uv run --frozen --extra test python -m pytest source/isaaclab_tasks/test/core/test_preset_cli.py \
    source/isaaclab/test/benchmark/test_api.py -q -p no:warnings \
    -k "preset_compatible_agent or keeps_backend_default_agent or auto_selects_agent_over_non_none or keeps_explicit_agent"

FAILED test_preset_cli.py::test_setup_preset_cli_auto_selects_agent_over_non_none_default
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[resnet18-rsl_rl]
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[resnet18-rl_games]
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[theia_tiny-rsl_rl]
FAILED test_api.py::test_training_request_selects_preset_compatible_agent[theia_tiny-rl_games]
5 failed, 6 passed, 53 deselected

E  AssertionError: assert 'rl_games_cfg_entry_point' == 'rl_games_feature_cfg_entry_point'
```

**After the fix:**

```
$ uv run --frozen --extra test python -m pytest source/isaaclab_tasks/test/core/test_preset_cli.py \
    source/isaaclab_tasks/test/core/test_hydra.py source/isaaclab/test/benchmark \
    source/isaaclab_rl/test/test_entrypoints_common.py -q -p no:warnings
492 passed, 1 skipped in 30.89s

$ uv run --frozen --extra test --extra skrl --extra sb3 --extra rl-games --extra rsl-rl \
    python -m pytest source/isaaclab_rl/test/test_typed_preset_cli_train_play.py -q -p no:warnings
8 passed in 33.27s
```

(The last suite fails on a bare `--extra test` environment on `develop`
too — `ModuleNotFoundError: No module named 'skrl'` etc. — so it was
rerun with the RL extras.)

```
$ uv run --frozen python tools/changelog/cli.py check develop
✓ All modified packages have valid changelog fragments.

$ uv run --frozen isaaclab -f
all hooks passed
```

Tests added:

* `source/isaaclab_tasks/test/core/test_preset_cli.py` — auto-selection
over a non-`None` default; explicit `--agent` wins over the preset,
parametrized over the three spellings argparse accepts. The two
pre-existing auto-selection tests only covered `skrl` with
`agent_default=None`, which is exactly why this bug went unnoticed.
* `source/isaaclab/test/benchmark/test_api.py` — drives the real
benchmark entrypoints via
`BenchmarkTrainingRequest`/`BenchmarkPlayRequest` and `_parse_args`,
asserting the feature entry point is selected for
`resnet18`/`theia_tiny` × `rsl_rl`/`rl_games` on the train path
(mirroring the failing rows), the same on the play path, and that the
canonical default survives otherwise (`rsl_rl`, `rl_games`, `sb3`).

Both assert the *selected agent config*, not merely absence of an
exception.

Not run: a real training job on the failing rows (requires GPU sim). The
failure is a construction-time config selection, fully reproduced at CLI
level.

## Related PRs — checked, no overlap

* **#7491** (Select pretrained checkpoints from resolved task configs)
touches `isaaclab_rl/entrypoints/common.py`, the four `play_*`
entrypoints, the four `benchmark_play_*` entrypoints,
`cartpole/__init__.py` and `test_preset_cli.py` — adjacent, but changes
neither `agent_default` nor the selection guard. Textual conflicts are
possible in `test_preset_cli.py` and the `benchmark_play_*` files
(one-line `setup_preset_cli(...)` call); no semantic conflict.
* **#6440** (`fix(rsl_rl): default obs_groups for new runners`) adds an
`obs_groups` default in `isaaclab_rl/rsl_rl/utils.py`. It would mask
this symptom for runners that omit `obs_groups`, but
`CartpoleCameraPPORunnerCfg` sets `obs_groups` explicitly, so it does
not fix these 60 rows — and it would not make the correct feature config
get selected either. Complementary, not duplicate.
* `gh pr list --search "agent preset"` returned nothing touching this
code.

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

---------

Co-authored-by: hujc <[email protected]>

(cherry picked from commit 7c6b4d7)
@kellyguo11

Copy link
Copy Markdown
Contributor

closed as we merged #7594

@kellyguo11 kellyguo11 closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants