Skip to content

docs: clarify VecEnv observation buffer lifetime - #235

Merged
ClemensSchwarke merged 5 commits into
leggedrobotics:mainfrom
Mikasa0503:docs/observation-buffer-lifetime
Oct 9, 2026
Merged

ClemensSchwarke merged 5 commits into
leggedrobotics:mainfrom
Mikasa0503:docs/observation-buffer-lifetime

Conversation

@Mikasa0503

Copy link
Copy Markdown
Contributor

Summary

Document that a VecEnv must not mutate a previously returned observation TensorDict or its underlying tensors in place during step().

PPO.act() retains the observation reference, while process_env_step() copies it into rollout storage only after env.step() returns. Reusing and overwriting the same buffer can therefore replace the observation associated with an action with the next observation. This PR clarifies the environment contract and does not change runtime behavior.

Closes #222

Validation

  • uvx pre-commit run --all-files (passed)
  • Sphinx HTML build (succeeded; one unrelated ambiguous cross-reference warning in docs/api/env.rst)
  • No training or simulator run was needed for this documentation-only change.

Copilot AI lite review requested due to automatic review settings September 27, 2026 17:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Clarify coverage for DistillationRunner and observations returned by previous calls.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Documents the VecEnv observation-buffer lifetime contract without changing runtime behavior.

Changes:

  • Clarifies observation immutability requirements.
  • Adds Hugo to the contributor list.
File Summary
rsl_rl/​env/​vec_env.py Documents observation buffer lifetime and mutation constraints.
CONTRIBUTORS.md Adds a contributor entry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rsl_rl/env/vec_env.py Outdated
`rsl_rl/utils/utils.py`, which provides detailed information on the expected configuration.

Do not modify the TensorDict or tensors returned by the previous `get_observations()` call in place.
PPO retains that observation reference until `process_env_step()` copies it into rollout storage after
@ClemensSchwarke

Copy link
Copy Markdown
Collaborator

Hi @Mikasa0503,
thanks for the PR! Would it be possible to add your full name to the contributors list?

@ClemensSchwarke
ClemensSchwarke merged commit a11f679 into leggedrobotics:main Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential bug: observation reference sharing in PPO.act() method

3 participants