Skip to content

Restore remote asset URLs in stage dumps - #7083

Merged
mataylor-nvidia merged 4 commits into
isaac-sim:developfrom
mataylor-nvidia:mataylor/unmirror-cached-asset-paths
Aug 14, 2026
Merged

Restore remote asset URLs in stage dumps#7083
mataylor-nvidia merged 4 commits into
isaac-sim:developfrom
mataylor-nvidia:mataylor/unmirror-cached-asset-paths

Conversation

@mataylor-nvidia

Copy link
Copy Markdown

Description

When ISAAC_LAB_SAVE_STAGES is used, assets aren't resolved properly: remote assets are handed to callers as a local cache copy, so a stage built from one records an absolute path that resolves only on the machine holding the cache. Flattening for the dump therefore writes texture and material paths that are meaningless anywhere else.

This records the source URL of each cached copy as the copy is located, and adds unmirror_file_path to look it up, so a dump can name the asset it was built from.

Recording the pair is exact where recovering it from the path is not. A directory named after a URL scheme is an ordinary local layout — Omniverse is where Omniverse puts user projects by default — and inferring from the path rewrites it to a URL that was never fetched:

local path recovered from path this PR
C:/Users/user/Omniverse/MyProject/scene.usd omniverse://MyProject/scene.usd "" (left alone)
/data/omniverse/assets/robot.usd omniverse://assets/robot.usd "" (left alone)
/home/user/projects/https/site/logo.png https://site/logo.png "" (left alone)

The map is populated even when nothing is downloaded, because retrieval walks the whole dependency tree before consulting the cache — so a warm cache still names its sources. Verified against the real DexCube asset on a fully warm cache in a fresh process: the texture is recovered as its S3 URL despite zero downloads and only the root USD being requested.

This supersedes the string-parsing approach in #7080. It is one line shorter in assets.py (+31/-1 vs +32/-0), adds no module-level constants, and drops the scheme allowlist, the ':''_' port round-trip, and the coupling to the _mirror_path layout.

Commits

  1. Restore remote asset URLs in stage dumps — the map, unmirror_file_path, and the rendering-test consumer.
  2. Cover Windows path handling in cached asset URL lookup — a drive letter parses as a URL scheme, so C:/... must not be recorded as a cached copy; also covers USD reporting cached copies with forward slashes on Windows.
  3. Treat a Windows drive letter as a local git asset path — pre-existing bug found while running the suite on Windows. _is_git_remote_path used bool(urlparse(git_path).scheme), and urlparse("C:\assets").scheme == 'c', so retrieve_git_asset_path took a local checkout for a remote repository and tried to clone it into the cache. Independent of the rest; drop this commit if you'd rather it went separately.

Type of change

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

Testing

source/isaaclab/test/utils/test_assets.py: 45 passed, run per-commit in a clean worktree.

Commits 1 and 2 each carry one failure — the pre-existing Windows retrieve_git_asset_path bug, confirmed failing identically on pristine develop — which commit 3 fixes.

The drive-letter regression test was verified to fail without its guard and pass with it.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Remote assets are handed to callers as a local cache copy, so a stage
built from one records an absolute path that resolves only on the machine
holding the cache. Flattening such a stage for a dump under
ISAAC_LAB_SAVE_STAGES therefore writes texture and material paths that are
meaningless anywhere else.

Record the source URL of each cached copy as the copy is located, and add
unmirror_file_path to look it up, so a dump can name the asset it was
built from. Recording the pair is exact where recovering it from the path
is not: a directory named after a URL scheme -- Omniverse is where
Omniverse puts user projects by default -- would otherwise read as a cache
layout and be rewritten to a URL that was never fetched.

The map is populated even when nothing is downloaded, because retrieval
walks the whole dependency tree before consulting the cache, so a warm
cache still names its sources.
urlparse reports the drive letter of a path such as C:\assets as a URL
scheme, so retrieve_git_asset_path took a local checkout on Windows for a
remote repository and tried to clone it into the asset cache, failing with
a missing-asset error. Require a scheme longer than one character, since no
URL scheme is a single letter.
@mataylor-nvidia
mataylor-nvidia requested a review from a team August 13, 2026 21:25
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Aug 13, 2026
@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR records the source URL associated with each locally mirrored asset and restores those URLs when writing flattened rendering-test stage dumps.

  • Adds unmirror_file_path and process-local cache-source bookkeeping.
  • Restores portable remote references in saved stage dumps.
  • Correctly distinguishes Windows drive-letter paths from git remotes and cached remote URLs.
  • Adds regression coverage and changelog fragments for both packages.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The new source mapping is populated during existing cache-path resolution, unmatched paths remain unchanged, and the Windows-specific guards cover the intended drive-letter ambiguity.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/utils/assets.py Adds exact cached-path-to-source-URL bookkeeping and fixes Windows drive-letter classification without an identified actionable defect.
source/isaaclab_tasks/test/rendering_test_utils.py Rewrites known cached paths to their remote sources after flattening and preserves all unmatched local paths.
source/isaaclab/test/utils/test_assets.py Covers URL restoration, warm caches, local-path preservation, separator normalization, and Windows git paths.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    URL["Remote asset URL"] --> Mirror["_mirror_path"]
    Mirror --> Cache["Local cached copy"]
    Mirror --> Map["_MIRRORED_URLS"]
    Cache --> Stage["Flattened stage"]
    Stage --> Restore["_restore_remote_asset_paths"]
    Map --> Restore
    Restore --> Dump["Portable stage dump with source URLs"]
Loading

Reviews (1): Last reviewed commit: "Treat a Windows drive letter as a local ..." | Re-trigger Greptile

@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 cache-path-to-source-URL mapping and stage-dump rewrite are coherently integrated, but the changelog omits the user-visible Windows behavior fix in retrieve_git_asset_path.

  • Design and architecture: Recording source URLs when mirror paths are derived avoids unreliable reconstruction from cache layout, and the rendering-test consumer preserves the existing dependency direction with lazy USD imports. No architectural issue was identified.
  • API: unmirror_file_path is an additive, documented API with a clear empty-string miss contract. However, _is_git_remote_path also changes observable behavior of public retrieve_git_asset_path for Windows local checkout paths, and that fix is absent from the package release note.
  • Implementation: The stage-dump callback preserves unrecognized asset paths and rewrites recognized cached copies to their recorded URLs. The Windows drive-letter guard is directly covered by tests, but its user-visible effect should be added as a Fixed changelog entry before merge.

Minor fixes needed. Posted 1 actionable finding inline.

Automated review; human maintainers own approval decisions.

Added
^^^^^

* Added :func:`~isaaclab.utils.assets.unmirror_file_path`, which maps a locally cached asset copy

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.

🔵 Suggestion · Api — Changelog omits git remote-path behavior change

The fragment documents only the new unmirror_file_path, but the _is_git_remote_path change also alters user-visible behavior of the public retrieve_git_asset_path: a Windows local checkout such as C:\assets was previously treated as a remote repository and cloned into the cache, and is now used in place. Repository rules require changed behavior to appear in the release note; add a Fixed entry covering it.

Keeps both parametrized lists identical to the ones under review in isaac-sim#7080
so the two implementations diff directly, and moves the cases that
distinguish them -- an ordinary local directory named after a URL scheme --
into a test named for what it covers.
"""
from pxr import UsdUtils # noqa: PLC0415

from isaaclab.utils.assets import unmirror_file_path # noqa: PLC0415

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

should this be moved to the top?

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.

We already have imports at the top of isaaclab.utils, I would assume yes? i wonder why would we want to delay this import?

@mataylor-nvidia
mataylor-nvidia merged commit d8a0260 into isaac-sim:develop Aug 14, 2026
77 of 79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants