Skip to content

Fix LeappDeploymentEnv missing extras attribute#5560

Open
klakhi wants to merge 1 commit intoisaac-sim:developfrom
klakhi:klakhi/fix-leapp-deployment-env-extras
Open

Fix LeappDeploymentEnv missing extras attribute#5560
klakhi wants to merge 1 commit intoisaac-sim:developfrom
klakhi:klakhi/fix-leapp-deployment-env-extras

Conversation

@klakhi
Copy link
Copy Markdown
Contributor

@klakhi klakhi commented May 9, 2026

CommandManager terms call self._env.extras during reset(). LeappDeploymentEnv bypasses the standard ManagerBasedRLEnv init path and never initializes this dict, causing an AttributeError on the first reset() call.

Add self.extras: dict = {} to init to fix the crash.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

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

CommandManager terms call self._env.extras during reset(). LeappDeploymentEnv
bypasses the standard ManagerBasedRLEnv init path and never initializes this
dict, causing an AttributeError on the first reset() call.

Add self.extras: dict = {} to __init__ to fix the crash.
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels May 9, 2026
@klakhi klakhi requested a review from frlai May 9, 2026 07:32
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 9, 2026

Greptile Summary

This PR fixes a crash in LeappDeploymentEnv where self.extras was never initialized because the class bypasses the standard ManagerBasedRLEnv.__init__ path. Command terms such as velocity_command, pose_command, and pose_2d_command call self._env.extras.setdefault(...) during their reset(), causing an AttributeError on the first reset when a CommandManager is present.

  • Adds self.extras: dict = {} in LeappDeploymentEnv.__init__, mirroring what manager_based_env.py and direct_rl_env.py do at their respective init sites.
  • Adds a changelog fragment describing the fix.

Confidence Score: 4/5

Safe to merge; the one-line addition prevents a reproducible crash with no side effects on existing code paths.

The change is a targeted initialization that mirrors what every other env class in this codebase does. The confirmed call sites in velocity_command.py, pose_command.py, and pose_2d_command.py all write to self._env.extras, so the crash is real and the fix is correct. The only minor gap is that LeappDeploymentEnv.reset() never clears extras between episodes, so metric entries written by command terms accumulate indefinitely, but since extras is not part of any return value in this class this is inconsequential in practice.

No files require special attention beyond the single changed line in leapp_deployment_env.py.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/envs/leapp_deployment_env.py Adds self.extras: dict = {} to __init__ to prevent AttributeError when command terms access self._env.extras during reset; fix is minimal and correct.
source/isaaclab/changelog.d/klakhi-fix-leapp-deployment-env-extras.rst New changelog fragment accurately describing the bug and fix.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant LeappDeploymentEnv
    participant CommandManager
    participant CommandTerm

    Caller->>LeappDeploymentEnv: reset()
    LeappDeploymentEnv->>CommandManager: reset(env_ids)
    CommandManager->>CommandTerm: _resample_command(env_ids)
    CommandTerm->>LeappDeploymentEnv: "self._env.extras.setdefault("log", {})"
    Note over LeappDeploymentEnv: Before fix: AttributeError<br/>After fix: returns {}
    CommandTerm-->>CommandManager: ok
    CommandManager-->>LeappDeploymentEnv: extras dict
    LeappDeploymentEnv-->>Caller: initial inputs
Loading

Reviews (1): Last reviewed commit: "Fix LeappDeploymentEnv missing extras at..." | Re-trigger Greptile

Copy link
Copy Markdown
Collaborator

@frlai frlai left a comment

Choose a reason for hiding this comment

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

looks good. Thanks for adding this.

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