Skip to content

Harden task entry point loading and the project generator - #8668

Merged
StafaH merged 6 commits into
isaac-sim:mainfrom
AntoineRichard:antoiner/fix/task-entry-point-robustness
Oct 20, 2026
Merged

StafaH merged 6 commits into
isaac-sim:mainfrom
AntoineRichard:antoiner/fix/task-entry-point-robustness

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Three robustness fixes on the external-project path (isaaclab --new → uv sync → isaaclab train):

  1. One broken task package no longer breaks every workflow. isaaclab train, play, list_envs, and the other task commands load every isaaclab.tasks entry point first. Today, one installed package whose entry point fails to import stops all of them, including runs that never use that package. load_external_tasks() now loads each entry point on its own and logs a failure with the distribution name and traceback. list_envs now calls load_external_tasks() instead of its own copy of the loop.
  2. The generator reports a failed git setup. _setup_git_repo ignored git's exit status. Without a configured identity, the project ended up in a repository with no commits and no message. It now logs the failing command, git's error, and the commands left to run.
  3. Generated projects accept patch releases. A project generated from an installed wheel required isaaclab==X.Y.Z, so it stopped resolving once a patch release was installed. It now requires isaaclab~=X.Y.Z, built from the public part of the installed version (a local label such as +build7.abc1234 is dropped). Projects generated from a source checkout are unchanged.

Design notes:

  • except Exception: entry points run third-party code that can raise anything, at the CLI boundary. The failure is logged at warning level with the full traceback, so a typo in your own project is still visible before the "task not found" error.
  • ~= rather than >=: ~=X.Y.Z accepts patch releases but not the next minor release, which can change task APIs. An rc install gives ~=3.0.0rc1, which accepts 3.0.0 GA.

Known follow-ups (not in this PR):

  • isaaclab train/play run task discovery twice, once in the top-level CLI and once in isaaclab_rl's run_cli. This predates the PR, but a broken package now warns twice there.
  • Preventing a package from replacing an existing task ID needs a design of its own. Generated packages import isaaclab_tasks.utils, which registers Isaac Lab's tasks inside the package's own load.

Tests (test-audit gate):

  • test_task_discovery_skips_broken_packages goes through the public load_external_tasks(). It fails on develop, where the broken entry point raises and the next one never loads.
  • test_generation_warns_when_initial_commit_fails runs the real generator and real git, with an isolated git config that has no identity. It fails on develop, where nothing is reported.
  • The existing layout and blank-project tests now assert ~= and use a local version label. No other test covers the wheel-mode requirement string.

Type of change

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

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 --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

One isaaclab.tasks entry point that failed to import stopped every
isaaclab train, play, and list_envs run. Load each entry point on its
own and log the skipped package's error with its traceback. Restore a
task id that a package re-registers over an existing one, and route
list_envs through load_external_tasks so discovery has one owner.
isaaclab --new ignored the exit status of git, so without a configured
identity the project was left in a repository with no commits and no
message. Report the failing git command with its error and print the
commands left to run.
Projects generated from an installed wheel pinned isaaclab==X.Y.Z, so
they stopped resolving as soon as a patch release was installed. Require
isaaclab~=X.Y.Z instead, using the public part of the installed version.
Projects generated from a source checkout are unchanged.
@AntoineRichard
AntoineRichard requested a review from a team October 16, 2026 09:15
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team infrastructure labels Oct 16, 2026
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] Hardens task loading and project generation against failures.

Fix task discovery before merging so failed packages cannot retain task IDs and external packages cannot replace core tasks imported during discovery.

Findings

  1. P1 Failed packages keep their tasks ▶
  2. P1 Core tasks can still change ▶
  3. P2 Windows recovery command fails ▶

Summary

This PR makes task discovery tolerate failed imports and tries to preserve existing task IDs.
It also reports failed git setup and lets wheel-generated projects accept compatible patch releases.

  • Task discovery skips broken packages and protects registered task IDs.
  • Project generation explains Git setup failures and how to finish.
  • Wheel-generated projects accept patch releases of Isaac Lab.

Acknowledged follow-up: AntoineRichard identifies repeated discovery warnings as pre-existing and deferred in the PR description.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Snapshot registered tasks] --> B[Load external package]
    B --> C[Package imports core tasks]
    C --> D[Package replaces a core task]
    D --> E[Restore IDs from snapshot]
    E --> F[Newly imported core IDs are not restored]
Loading

Reviews (1) · Last reviewed commit: "Require a compatible Isaac Lab release i..." · Reviewed by Greptile

Comment on lines +57 to +62
except Exception:
logger.warning(
f"Skipped the '{entry_point.name}' task entry point of {entry_point.dist.name}, which failed to load.",
exc_info=True,
)
for task_id, spec in registered.items():

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 Failed packages keep their tasks

If a package registers a new task and then raises, load_external_tasks() leaves that task registered. The restore loop only visits IDs present before the import. A later, working package that registers the same ID then has its registration replaced with the failed package's leftover spec.

Roll back new registrations after a failed load, and test a package that registers a task before raising.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 3efbfbf by removing the override restore. A later package's registration is no longer replaced by a failed package's leftover spec. Tasks that a failed package registered before raising stay registered, as with any partially executed import. The warning now says the entry point failed to load instead of saying it was skipped.

Comment on lines +54 to +56
registered = dict(gym.registry)
try:
entry_point.load()

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 Core tasks can still change

In train and play, discovery runs before core tasks are imported. Generated task packages import isaaclab_tasks.utils, which first registers the core tasks. If the external package then registers a core task ID, that ID was absent from the snapshot, so its original spec is not restored.

Later imports cannot repair it: isaaclab_tasks is cached and guards registration with _isaaclab_tasks_registered. Training or playback can therefore run the external task under a core task ID. Load core tasks before taking the snapshot, and test this import order.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Confirmed: isaaclab_tasks.utils registers Isaac Lab's tasks inside the package's own load, after the snapshot. Protecting them would require isaaclab.cli to import isaaclab_tasks, which reverses the package dependency. So 3efbfbf drops the override protection, and this PR now only reports packages that fail to load. Override protection is listed as a follow-up in the description.

Comment thread tools/template/generator.py Outdated
for line in result.stderr.splitlines():
print(f" | {line}")
print(f" | Fix the error above, then run in {project_dir}:")
print(f" | {' && '.join(shlex.join(pending) for pending in commands[index:])}")

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 Windows recovery command fails

After a failed commit, the generator prints git commit -q -m 'Initial commit'. Windows Command Prompt does not treat single quotes as quoting, so copying this command fails instead of completing the commit.

Print a command suited to the platform, or label the output as Bash-only and provide a Windows alternative.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 3f8ac0a. The commands left to run are now printed one per line with double quotes (git commit -q -m "Initial commit"), which works in cmd, PowerShell, and POSIX shells.

@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

Needs attention: Implementation (1), Style consistency (2). Other reviewed categories look good.

  • PR description: The body matches all three changes and test scope; remove the unverifiable, process-only claim that each fix is a separate commit and the PR can be split.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Failed entry points retain IDs registered before raising, exposing tasks from packages reported as skipped; remove all IDs absent from the pre-load snapshot.
  • Style consistency: The generator prints a prefixed warning, bypassing configured logging and violating CLI guidance; emit logger.warning without a level prefix and capture it with caplog.
  • Test quality: Test quality looks good.

Minor fixes needed. Posted 3 inline findings.

Automated review; human maintainers own approval decisions.

f"Skipped the '{entry_point.name}' task entry point of {entry_point.dist.name}, which failed to load.",
exc_info=True,
)
for task_id, spec in registered.items():

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 — Skipped package keeps its own registrations

The snapshot restores only pre-existing IDs, so an entry point that registers tasks and then raises leaves those IDs in gym.registry despite being logged as skipped. Also drop IDs absent from the snapshot.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 3efbfbf (see the reply above). The restore loop is gone, so a failed package's leftover registrations no longer shadow later packages. The warning no longer claims that the package was skipped.

if gym.registry.get(task_id) is not spec:
logger.warning(
f"Ignored {entry_point.dist.name}'s registration of task '{task_id}',"
f" which {spec.entry_point} already registers."

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 · Style Consistency — Warning misnames the existing registrant

spec.entry_point is the environment class path, not the package that registered the ID, so the message reads "which core.env:Env already registers". Reword to say the ID is already registered with that entry point.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This message was removed together with the override protection in 3efbfbf.

Comment thread tools/template/generator.py Outdated
for line in result.stdout.splitlines():
print(f" | {line}")
if result.returncode != 0:
print(f" | WARNING: '{' '.join(command[:2])}' failed with exit code {result.returncode}:")

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 · Style Consistency — Warning printed with WARNING prefix

The contribution guide forbids print for warnings and level prefixes in command-line tools, since printed messages bypass log handlers. Emit this through a module-level logger.warning without the prefix and assert it with caplog.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 3f8ac0a. The failure is now emitted through a module-level logger.warning with no prefix, and the test asserts it with caplog.

@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 16, 2026
The registry snapshot could not protect Isaac Lab's task ids in train
and play: generated packages import isaaclab_tasks.utils, which registers
the core tasks inside the package's own load, after the snapshot. A
complete fix would make isaaclab.cli import isaaclab_tasks, so keep this
change to reporting packages that fail to load.
Report the failed git command through a module logger, as the
contribution guide asks for warnings in command-line tools, and print
the commands left to run one per line with double quotes so they also
work in the Windows command prompt.
@maxkra15 maxkra15 self-assigned this Oct 16, 2026
@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 18, 2026
…entry-point-robustness

# Conflicts:
#	docs/source/developer-tools/template_generator.rst
@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 18, 2026

@maxkra15 maxkra15 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.

lgtm

@StafaH
StafaH merged commit 9e66361 into isaac-sim:main Oct 20, 2026
59 checks passed
StafaH added a commit that referenced this pull request Oct 26, 2026
…e cuRobo cache (#8818)

## Summary

This is a follow-up to #8802. Across the last 40 PR runs of `Docker +
Tests`, the median wall time is 23 min, but the p75 is 43 min. The two
groups don't overlap: every run that took 40–65 min rebuilt a Docker
image, and every run that didn't finished in 14–28 min. This PR targets
the rebuilds, plus one serial test job.

### Where the slow runs go

| | Runs | Wall time |
|---|---|---|
| Both deps caches hit | ~24/40 | 14–28 min |
| Deps cache missed (base, cuRobo, or both) | ~16/40 | 30–65 min |

What happens on a cache miss:
- **cuRobo image:** 23–47 min, all of it on the critical path. One
30-min build broke down as: 4 min pulling cache layers, 2 min `uv sync`,
7.5 min recompiling cuRobo (its layer sits after the lockfile `COPY`), 3
min exporting layers, **10 min `--load` tarball** into the daemon, and 1
min cache export.
- **Base image:** about 20 min. That splits into 3.4 min cache pull, 2.3
min `uv sync`, 4.6 min exporting layers, **6 min `--load` tarball**, and
1.5 min cache export.

Why the cache misses so often:
1. **The nightly version bump.** The `[CI][Auto Version Bump]` commit
rewrites `version = "..."` in each bumped package's `pyproject.toml` and
its editable `uv.lock` entry. Both files feed the deps hash, so every
day's first PR rebuilt the images even though no dependency changed.
Replaying main over Oct 15–25: **18 distinct deps hashes before this PR,
9 after.** The remaining 9 are real changes to `docker/`, the
`isaaclab.cli` sources, or dependencies.
2. **Only the base image was built post-merge.** `build-curobo` skipped
`push` events, so the cuRobo deps cache was never warmed. Several runs
hit the base image cache (0.3 min) and still spent 25–30 min building
cuRobo.

## Changes

1. **Ignore first-party version bumps in the deps hash**
(`_lib/compute-deps-hash`).
- Manifests are now hashed by content, with two kinds of line dropped:
`version =` in a `[project]`/`[package]` table, and `version =` in
`uv.lock` entries whose `source` is `editable` or `virtual`.
- Third-party lock versions and all dependency specifiers are still
hashed.
- Covered by a new test in `test_registry_credential_fallback.py`. It
fails against the old hash code.
- Trade-off: an image served from the deps cache can report a stale
`importlib.metadata.version()` for first-party packages. The source is
bind-mounted, so the code under test is current. No CI test in the
Docker jobs checks these versions (`test_wheel.py` runs in install-ci).
2. **Build the cuRobo image on pushes to protected branches**, with no
test consumer. This matches what the base image already does. A cache
hit costs about 0.3 min of a GPU runner.
3. **`test-curobo`: `test-jobs: "3"`.** The job ran its three files one
at a time, about 9.7 min in total (`test_pink_ik.py` ~410 s, planner
franka ~100 s, cube stack ~73 s). Run concurrently, the job should be
bounded by `test_pink_ik.py` at about 7 min. Since #8802 moved contrib
off the cuRobo image, `test-curobo` is the last job to finish in the
newest runs.

4. **Standalone demos (Kit): 4 → 3 concurrent launches.** In 2 of the
last 8 runs (here and on an unrelated PR, both on the same main commit),
`microduck_warehouse` hung at startup right after the Newton viewer fell
back to headless EGL, and was killed at the 300 s launch timeout. In
passing runs it takes about 110 s, and the slowest Kit launch about 148
s. The non-Kit job has passed every run and stays at 4.
5. **De-flake `test_sphere_contact_time[cuda-mesh]`** (PhysX contact
sensor). The sphere's contact pose put its center at z = 0, half buried.
On the cobblestone triangle mesh, GPU PhysX sometimes resolves that
overlap below the mesh, which then reports no contact. It failed 5/5
retries in one run here, and locally 21/80 with four concurrent
processes; it passes on an idle GPU. With a 5 cm penetration (z = 0.2),
80/80 pass under the same load.

This PR touches `docker-build/action.yml`'s deps-hash inputs, so its own
CI run does a full rebuild of both images. Expect a slow first run.

## Follow-ups (not in this PR)

- **Skip `--load` on ECR builds (6–10 min per rebuilt image).** The
docker-container builder exports the whole image as a tarball into the
daemon, only so that the "Layer CI test dependencies" step and the base
invariants check can run locally. Possible fix:
- fold the pytest layer into the build (a temp Dockerfile that appends
it, or a `FROM` stage);
  - push straight from buildx (`push=true`, both tags);
- run `test_image_invariants.py` against a staging tag, then alias the
commit and deps tags with `imagetools create`.
- **Compile cuRobo in a stage that doesn't depend on the lockfile.** It
is rebuilt (7.5 min) on any `uv.lock` or pyproject change because it
comes after the `uv sync` layers. Keying it on the torch/CUDA version
would let it hit the layer cache.
- **`test_pink_ik.py`:** building the `FixedBaseUpperBodyIK-G1` env
takes about 2 min, versus about 7 s for the other three envs. Splitting
the file with xdist would need `--dist loadgroup`; the default `load`
mode would build every env on every worker.
- **Infra:** runners take about 3 min to pick up jobs after the image
build, and each job pulls a 2–4 min image. The ideas from #8802 still
apply: AMI-baked base layers or SOCI, and a warm runner pool.

## Test plan
- [x] `pytest
.github/actions/_lib/test_registry_credential_fallback.py`: the new test
passes, and fails against the old hash code.
- [x] Replayed the new hash over main's history: bump commits keep the
hash; real dependency commits (#8721, #8668) change it.
- [x] pre-commit on the changed files.
- [ ] CI: both images rebuild, and `test-curobo` passes with 3 slots.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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 infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants