Skip to content

Fix dynamic replay of position-velocity expert actions - #699

Merged
yuecideng merged 1 commit into
mainfrom
codex/fix-replay-position-velocity
Sep 27, 2026
Merged

yuecideng merged 1 commit into
mainfrom
codex/fix-replay-position-velocity

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

Fix dynamic replay for expert trajectories recorded with joint_command_mode="position_velocity".

Position-velocity actions are persisted as a flat [qpos, qvel] vector. Dynamic replay now reconstructs them as a ControllerAction with separate controller fields before calling env.step(). Single-environment broadcast also preserves tensor-valued per-environment lengths.

No linked issue was provided.

Dependencies: None.

Type of change

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

Validation

  • black . passed with the installed Black 24.3.0 environment.
  • python docs/scripts/check_api_docs.py passed (2298/2298 exports documented).
  • Python compilation and git diff --check passed.
  • Provider-isolated replay wrapper tests passed: 6 passed.
  • Direct replay test collection is blocked in this environment by a pre-existing SciPy/scikit-learn ABI mismatch during DexSim import.

Checklist

  • I have run the black . command to format the code base.
  • I reviewed affected documentation and agent context; no context update was needed.
  • Public API documentation coverage is aligned; this change does not add a public export.
  • I added tests that prove the fix and cover replay modes.
  • Dependencies have not been changed.

Decode persisted position-velocity expert actions into controller commands during dynamic replay. Add provider-free coverage for replay modes and preserve broadcast lengths for tensor metadata.
@yuecideng yuecideng added bug Something isn't working gym robot learning env and its related features dataset labels Sep 27, 2026
@greptile-apps

greptile-apps Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Fixes action decoding in environment replay simulation.

The PR appears safe to merge, with a non-blocking gap in end-to-end position-velocity replay coverage.

Fix All in CodexFindings

  1. P2 Controller application remains untested ▶
Fix with agent prompt
### Issue 1
tests/gym/envs/test_replay_wrapper.py:191-194
The new position-velocity test checks only what `_FakeEnv.step()` receives; the fake environment stores the action but never applies it. Existing simulator-backed dynamic replay tests cover position-only and policy actions, so a mistake in applying either qpos or qvel during real position-velocity replay would go undetected. Please add a focused integration test when the simulator test environment is available.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR reconstructs stored position-velocity expert actions as controller commands during dynamic replay and corrects single-environment length broadcasting.

  • Adds provider-isolated tests for replay modes and action reconstruction.
  • The new test does not verify application through the real controller boundary.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Recorded flat action] --> B{Expert position-velocity?}
  B -- Yes --> C[Split qpos and qvel]
  C --> D[ControllerAction]
  B -- No --> E[Flat action]
  D --> F[env.step]
  E --> F
Loading

Reviews (1) · Last reviewed commit: "fix(gym): replay position-velocity exper..."

Comment on lines +191 to +194
action = env.received_actions[0]
assert isinstance(action, ControllerAction)
assert torch.equal(action.value["qpos"], torch.tensor([[0.0, 1.0]]))
assert torch.equal(action.value["qvel"], torch.tensor([[2.0, 3.0]]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Controller application remains untested The new position-velocity test checks only what _FakeEnv.step() receives; the fake environment stores the action but never applies it. Existing simulator-backed dynamic replay tests cover position-only and policy actions, so a mistake in applying either qpos or qvel during real position-velocity replay would go undetected. Please add a focused integration test when the simulator test environment is available.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/gym/envs/test_replay_wrapper.py
Line: 191-194

Comment:
**Controller application remains untested** The new position-velocity test checks only what `_FakeEnv.step()` receives; the fake environment stores the action but never applies it. Existing simulator-backed dynamic replay tests cover position-only and policy actions, so a mistake in applying either qpos or qvel during real position-velocity replay would go undetected. Please add a focused integration test when the simulator test environment is available.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code

@yuecideng
yuecideng merged commit 20d62b2 into main Sep 27, 2026
9 checks passed
@yuecideng
yuecideng deleted the codex/fix-replay-position-velocity branch September 27, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dataset gym robot learning env and its related features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant