Skip to content

Fix runtime episode step limit off-by-one - #1033

Open
zjn20030811 wants to merge 1 commit into
Physical-Intelligence:mainfrom
zjn20030811:fix/runtime-episode-step-limit
Open

Fix runtime episode step limit off-by-one#1033
zjn20030811 wants to merge 1 commit into
Physical-Intelligence:mainfrom
zjn20030811:fix/runtime-episode-step-limit

Conversation

@zjn20030811

Copy link
Copy Markdown

Summary

  • count each completed runtime step before evaluating episode termination
  • make max_episode_steps=N apply exactly N actions instead of N+1
  • preserve environment-driven early completion
  • add CPU-only regressions for limits 1, 2, and 3 plus natural termination

The previous loop incremented _episode_steps only after _step returned, while _step checked the old value. That let every bounded episode issue one extra action, which is especially undesirable for real robot rollouts.

Testing

  • python -m pytest packages/openpi-client/src/openpi_client/runtime/runtime_test.py -q (4 passed)
  • ruff check with the repository configuration
  • ruff format --check with the repository configuration

@jimmyt857
jimmyt857 removed their request for review September 1, 2026 15:40
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.

1 participant