Skip to content

Conversation

@KyleM73
Copy link
Contributor

@KyleM73 KyleM73 commented Dec 2, 2025

Description

Event manager needs to instantiate class-based terms or else func.reset(env_ids) will not work (requires positional argument self).

Type of change

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

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 Dec 2, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 2, 2025

Greptile Overview

Greptile Summary

Fixed a critical bug where class-based event terms were stored as uninstantiated classes, causing reset() method calls to fail with a missing self parameter error.

Key Changes:

  • Added instantiation of class-based event terms at event_manager.py:390 using term_cfg.func(cfg=term_cfg, env=self._env) before storing them
  • This mirrors the existing pattern for "prestartup" mode class terms (line 376)
  • Ensures all class-based terms are callable instances when their reset() methods are invoked

Impact:

  • Fixes runtime errors when using class-based event terms that implement the reset() method
  • Aligns behavior across all event modes (not just "prestartup")
  • No breaking changes - maintains the same API contract

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The fix is minimal, surgical, and directly addresses the root cause. It follows the existing pattern for class instantiation already used in the "prestartup" mode (line 376). The change is well-tested by the existing test suite which includes class-based event terms with reset methods. No side effects or breaking changes are introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
source/isaaclab/isaaclab/managers/event_manager.py 5/5 Fixed bug where class-based event terms were not instantiated, causing reset() calls to fail with missing self parameter. The fix instantiates the class with proper parameters before storing it.

Sequence Diagram

sequenceDiagram
    participant EM as EventManager
    participant Term as EventTermCfg
    participant ClassTerm as Class-based Term
    participant Instance as Term Instance

    Note over EM,Instance: Before Fix (Broken)
    EM->>Term: Detect inspect.isclass(term_cfg.func)
    EM->>EM: Store class (not instance) in _mode_class_term_cfgs
    EM->>ClassTerm: Later call reset(env_ids)
    ClassTerm-->>EM: Error: missing required 'self' argument

    Note over EM,Instance: After Fix (Working)
    EM->>Term: Detect inspect.isclass(term_cfg.func)
    EM->>ClassTerm: Instantiate: term_cfg.func(cfg=term_cfg, env=self._env)
    ClassTerm->>Instance: Create instance
    EM->>EM: Store instance in _mode_class_term_cfgs
    EM->>Instance: Later call reset(env_ids)
    Instance-->>EM: Success: bound method executes correctly
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

1 participant