Skip to content

fix(issue-167): align play_interactive.py with current env contract - #180

Merged
TATP-233 merged 2 commits into
mainfrom
fix/issue-167-align-play-interactive-contract
Apr 9, 2026
Merged

TATP-233 merged 2 commits into
mainfrom
fix/issue-167-align-play-interactive-contract

Conversation

@TATP-233

@TATP-233 TATP-233 commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #167 by aligning play_interactive.py with the current env contract and sharing wrapper implementation with training scripts.

Changes

  • New shared module: src/unilab/utils/rsl_rl_vec_env_wrapper.py

    • Unified RslRlVecEnvWrapper class supporting both training and play use cases
    • Supports policy_obs_mode parameter (flat or actor) for checkpoint compatibility
    • Aligns with current env contract: reset() returns (obs_dict, info_dict)
    • Removes old (_, obs, _) contract compatibility branch
  • Updated play_interactive.py:

    • Import shared wrapper instead of maintaining duplicate
    • ~75 lines removed (old wrapper implementation)
  • Updated train_rsl_rl.py:

    • Import shared wrapper from new module
    • ~80 lines removed (old wrapper implementation)
  • Added tests in tests/scripts/test_train_scripts.py:

    • test_play_wrapper_imports_shared_implementation: Verify shared import
    • test_play_wrapper_uses_current_reset_contract: Verify (obs, info) contract
    • test_play_wrapper_policy_obs_mode_actor: Verify policy_obs_mode support

Verification

  • ✅ All 473 tests pass
  • ✅ 3 new tests for wrapper contract behavior
  • ✅ Play script resolves checkpoint correctly
  • ✅ Training script wrapper behavior unchanged

Definition of Done

  • play_interactive.py no longer maintains independent wrapper
  • Old (_, obs, _) contract compatibility code removed
  • Script tests cover play_interactive.py core contract behavior
  • CI green (all tests pass)

Closes #167

- Extract RslRlVecEnvWrapper to shared module (unilab/utils/rsl_rl_vec_env_wrapper.py)
- Update play_interactive.py to use shared wrapper, removing duplicate implementation
- Update train_rsl_rl.py to use shared wrapper
- Remove old (_, obs, _) contract compatibility branch from reset()
- Add policy_obs_mode parameter support to shared wrapper
- Add tests for play_interactive.py wrapper contract behavior

Closes #167
@TATP-233
TATP-233 merged commit 2bcab2f into main Apr 9, 2026
5 checks passed
@TATP-233
TATP-233 deleted the fix/issue-167-align-play-interactive-contract branch April 9, 2026 16:26
TATP-233 added a commit that referenced this pull request May 4, 2026
…active-contract

fix(issue-167): align play_interactive.py with current env contract
TATP-233 added a commit that referenced this pull request May 30, 2026
…active-contract

fix(issue-167): align play_interactive.py with current env contract
TATP-233 added a commit that referenced this pull request Sep 4, 2026
…active-contract

fix(issue-167): align play_interactive.py with current env contract
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.

Work: 让 play_interactive.py 对齐当前 env contract

1 participant