Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lerobot/envs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ def get_attr(self, name):
self._ensure()
return self._env.get_attr(name)

def __getattr__(self, name: str):
self._ensure()
return getattr(self._env, name)
Comment on lines +190 to +192
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Consider adding a small regression test for this proxying behavior (e.g., that accessing unwrapped/metadata on _LazyAsyncVectorEnv materializes the underlying env and forwards the attribute). A lightweight approach is to monkeypatch gym.vector.AsyncVectorEnv with a dummy object so the test doesn’t need to spawn subprocesses.

Copilot uses AI. Check for mistakes.
Comment on lines +190 to +192
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

For type-safety and clearer failure modes, it’d be good to narrow the optional type after _ensure() (e.g., assert the underlying _env is not None) and consider annotating __getattr__ to return Any to reflect that it forwards arbitrary attributes.

Copilot uses AI. Check for mistakes.

def close(self) -> None:
if self._env is not None:
self._env.close()
Expand Down
Loading