Skip to content

Move task registration to explicit registry module - #7966

Closed
StafaH wants to merge 1 commit into
isaac-sim:developfrom
StafaH:mh/issue-668-explicit-task-registration
Closed

StafaH wants to merge 1 commit into
isaac-sim:developfrom
StafaH:mh/issue-668-explicit-task-registration

Conversation

@StafaH

@StafaH StafaH commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Move built-in Gymnasium task discovery from isaaclab_tasks.__init__ to the explicit isaaclab_tasks.registry module. This follows mjlab's separation of its top-level package from task discovery, while retaining Isaac Lab's existing per-task gym.register() calls, import walker, and Kit re-import guard.

Importing an individual task module now leaves unrelated task packages unloaded and unrelated Gym environments unregistered. Built-in CLI, RL, benchmark, script, and test entrypoints import the registry explicitly. The documentation and changelog explain the required migration for external callers.

No new dependencies.

Fixes #668

Type of change

  • Breaking change (code that relied on import isaaclab_tasks to register all tasks must import isaaclab_tasks.registry)
  • Documentation update

Release backport

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

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab -f
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (uv run --isolated --extra dev -- make -C docs current-docs)
  • I have added a regression test and verified that it fails before the fix and passes after it
  • I have added a changelog fragment for every touched source package
  • My name already exists in CONTRIBUTORS.md

Validation

  • uv run --frozen --extra test --extra mimic python -m pytest source/isaaclab_tasks/test/core/test_parse_cfg.py -q — 11 passed
  • uv run --frozen --extra test --extra mimic python -m pytest source/isaaclab_tasks/test/core/test_env_cfg_no_forbidden_imports.py source/isaaclab_rl/test/test_entrypoints_common.py -q — 80 passed
  • uv run --frozen --extra mimic python -c 'from isaaclab.cli.commands.list_envs import command_list_envs; command_list_envs(["--keyword", "Isaac-Cartpole-Direct"])' — listed Cartpole
  • uv run isaaclab -f — passed
  • Changelog gate against upstream/develop — passed
  • uv run --isolated --extra dev -- make -C docs current-docs — passed

Release backport

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

@StafaH
StafaH requested a review from a team September 23, 2026 03:46
@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-mimic Related to Isaac Mimic team infrastructure labels Sep 23, 2026
@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

The PR is not yet safe to merge because the lazy-export benchmark and two robomimic executables can no longer resolve built-in task IDs.

Findings

  1. P1 Robomimic entrypoints skip registration ▶

Summary

This PR separates lightweight isaaclab_tasks package import from explicit built-in Gym task discovery through isaaclab_tasks.registry, then migrates most first-party callers and documentation.

  • Adds the explicit registry module while retaining the global re-import guard and package walker.
  • Updates CLI, RL, benchmark, script, test, and mimic entrypoints to opt into built-in task registration.
  • Adds migration documentation, changelog coverage, and a regression test for isolated task-module imports.
  • Two robomimic entrypoints and the lazy-export benchmark still follow the former implicit-registration contract and fail after the separation.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Import isaaclab_tasks] --> B[Lightweight package metadata only]
  C[Import isaaclab_tasks.registry] --> D{Registration guard set?}
  D -- No --> E[Walk built-in task packages]
  E --> F[Task packages call gym.register]
  F --> G[Set global registration guard]
  D -- Yes --> H[Reuse existing Gym registrations]
  I[CLI / RL / scripts] --> C
  J[Missed robomimic callers] --> A
  J --> K[resolve_task_config]
  K --> L[gym.spec]
  L --> M[Missing environment error]
Loading

Reviews (1) · Last reviewed commit: "Move task registration to explicit regis..."

Comment on lines +8 to +10
Import this module before listing or creating a built-in environment by name.
Importing :mod:`isaaclab_tasks` or one of its task modules does not register
unrelated environments.

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.

P1 Robomimic entrypoints skip registration

scripts/imitation_learning/robomimic/play.py and robust_eval.py were not migrated to this new contract. Both import only isaaclab_tasks.utils and call resolve_task_config() before launching the application. That helper reaches gym.spec() without importing this registry, so running either script with a built-in task now fails before startup. Both entrypoints need to import isaaclab_tasks.registry first.

@greptile-apps

greptile-apps Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.

  • P1 Cold-start benchmark loses registrations scripts/benchmarks/benchmark_lazy_export.py:102 ▶

    After _purge_all() removes the built-in Gym registrations and resets the guard, this loop imports only isaaclab_tasks. That package no longer registers tasks, so load_cfg_from_registry() raises RegistrationError for the first Isaac-* task and the benchmark produces no results. The loop needs to import isaaclab_tasks.registry, as described by the updated docstring. The purge must also remove IsaacContrib-* IDs; otherwise those cases keep stale registrations and do not measure a cold start.

@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 explicit isaaclab_tasks.registry boundary is coherent, but the migration leaves the cold-start benchmark re-importing the now side-effect-free top-level package and removes the documented package-level registration behavior without the required deprecation window.

  • Design and architecture: Separating task-registration side effects from the top-level package improves import isolation. However, the previous documented registration contract should remain temporarily through a deprecated compatibility shim before registration is removed from isaaclab_tasks.__init__.
  • API: External callers using the documented import isaaclab_tasks registration pattern will immediately lose Gymnasium registrations. Repository policy requires a prior deprecation and migration path, so the top-level behavior should warn and delegate to the registry for a transition period.
  • Implementation: The new registry preserves the package walker, blacklist, and builtins-based Kit re-import guard, and most consumers now import it explicitly. benchmark_lazy_export.py still uses the top-level package in its timed purge-and-reimport loop, so after clearing registrations it does not repopulate Gymnasium and cannot perform the intended cold-start measurement.

Minor fixes needed. Posted 2 actionable findings inline.

Automated review; human maintainers own approval decisions.

with warnings.catch_warnings():
warnings.simplefilter("ignore", UserWarning)
import isaaclab_tasks # noqa: F401
import isaaclab_tasks.registry # noqa: F401

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.

🟡 Warning · Implementation — Cold-start reimport loop not migrated to registry

Only the module-level import, docstrings, and one print label changed here. _purge_all() still deletes every isaaclab_tasks module, resets _isaaclab_tasks_registered, and drops all Isaac- gym ids, while the timed per-iteration reimport inside benchmark() was left pointing at the top-level package, which no longer registers anything. After the first purge the registry stays empty and load_cfg_from_registry fails. Point that timed reimport at isaaclab_tasks.registry.

"""Register the built-in Isaac Lab tasks with Gymnasium on import.

Import this module before listing or creating a built-in environment by name.
Importing :mod:`isaaclab_tasks` or one of its task modules does not register

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.

🟡 Warning · Api — No deprecation window for implicit registration

The documented pattern import isaaclab_tasks followed by gym.make("Isaac-Cartpole") now raises a lookup error for external callers with no warning, and repository policy requires a prior deprecation and migration path before removing public behavior. Consider keeping the registration walk in isaaclab_tasks/__init__.py for one release behind a DeprecationWarning that points at isaaclab_tasks.registry, then removing it in the following breaking release.

@StafaH
StafaH marked this pull request as draft September 24, 2026 20:23
@StafaH StafaH closed this Oct 1, 2026
@StafaH
StafaH deleted the mh/issue-668-explicit-task-registration branch October 10, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation infrastructure isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Move lab_tasks gym registrations out of __init__.py

1 participant