Skip to content

Fixes merge bug - #4867

Merged
ooctipus merged 1 commit into
isaac-sim:developfrom
ooctipus:fix/develop/fix_merge_bug
Mar 7, 2026
Merged

ooctipus merged 1 commit into
isaac-sim:developfrom
ooctipus:fix/develop/fix_merge_bug

Conversation

@ooctipus

@ooctipus ooctipus commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes dependency issue introduced in merging rsl_Rl

Fixes # (issue)

Type of change

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

Screenshots

Please attach before and after screenshots of the change if applicable.

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 updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Mar 7, 2026
@ooctipus
ooctipus merged commit 258925d into isaac-sim:develop Mar 7, 2026
5 of 9 checks passed
@greptile-apps

greptile-apps Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a dependency regression introduced during the rsl_rl merge by applying two complementary strategies: (1) replacing eager submodule imports in isaaclab_rl/rsl_rl/__init__.py with a single lazy_export() call so that rsl_rl submodule symbols are only resolved when first accessed, and (2) moving the multi_agent_to_single_agent import in both play.py and train.py inside the conditional branch where it is actually consumed, so the import is skipped entirely for non-MARL environments.

Key changes:

  • __init__.py: all seven eager from .x import ... lines replaced by lazy_export(), which reads symbol declarations from the adjacent __init__.pyi stub via lazy_loader.attach_stub.
  • __init__.pyi: handle_deprecated_rsl_rl_cfg was missing from the stub — added to both __all__ and the explicit from .utils import line so lazy_loader can resolve it.
  • play.py / train.py: multi_agent_to_single_agent import deferred into the if isinstance(env.unwrapped.cfg, DirectMARLEnvCfg) block, eliminating the problematic top-level dependency.

Confidence Score: 5/5

  • This PR is safe to merge — all changes are targeted, non-breaking fixes with no new logic.
  • The patch is minimal and focused: deferred imports in two scripts and a lazy-export refactor in the package init backed by an existing, now-corrected .pyi stub. No new public API is introduced, existing behaviour is preserved for all callers, and the lazy-loader path is already used elsewhere in the codebase. No tests were added (noted in the checklist), but the change is a straightforward import reorganisation with very low risk of regression.
  • No files require special attention.

Important Files Changed

Filename Overview
source/isaaclab_rl/isaaclab_rl/rsl_rl/init.py Replaces seven eager import lines with a single lazy_export() call that defers submodule loading until symbols are actually accessed, resolving the circular/conditional dependency introduced during the rsl_rl merge.
source/isaaclab_rl/isaaclab_rl/rsl_rl/init.pyi Adds the missing handle_deprecated_rsl_rl_cfg to both __all__ and to the explicit from .utils import line, making it visible to lazy_loader's stub parser and enabling proper lazy export.
scripts/reinforcement_learning/rsl_rl/play.py Moves multi_agent_to_single_agent from a top-level import to a conditional, deferred import inside the DirectMARLEnvCfg branch, eliminating the eager dependency that caused the merge bug.
scripts/reinforcement_learning/rsl_rl/train.py Same deferred-import fix as play.py — multi_agent_to_single_agent is now imported only inside the DirectMARLEnvCfg branch where it is actually used.

Sequence Diagram

sequenceDiagram
    participant Script as play.py / train.py
    participant PkgInit as isaaclab_rl.rsl_rl.__init__
    participant LazyExport as lazy_export()
    participant Stub as __init__.pyi
    participant SubMod as rsl_rl submodules
    participant IsaacEnvs as isaaclab.envs

    Script->>PkgInit: import isaaclab_rl.rsl_rl
    PkgInit->>LazyExport: lazy_export()
    LazyExport->>Stub: lazy_loader.attach_stub(__init__.pyi)
    Stub-->>LazyExport: symbol map (RslRlVecEnvWrapper, handle_deprecated_rsl_rl_cfg, ...)
    LazyExport-->>PkgInit: sets __getattr__, __dir__, __all__ on module

    Note over PkgInit,SubMod: submodules NOT imported yet

    Script->>PkgInit: access RslRlVecEnvWrapper
    PkgInit->>SubMod: __getattr__ triggers import of vecenv_wrapper
    SubMod-->>Script: RslRlVecEnvWrapper

    alt env is DirectMARLEnvCfg
        Script->>IsaacEnvs: from isaaclab.envs import multi_agent_to_single_agent
        IsaacEnvs-->>Script: multi_agent_to_single_agent
        Script->>Script: env = multi_agent_to_single_agent(env)
    else env is not DirectMARLEnvCfg
        Note over Script,IsaacEnvs: multi_agent_to_single_agent never imported
    end
Loading

Last reviewed commit: 36bffd3

@ooctipus
ooctipus deleted the fix/develop/fix_merge_bug branch October 14, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants