Skip to content

Stop resetting the environment after the last episode - #2

Merged
tactino merged 1 commit into
mainfrom
fix/no-reset-after-last-episode
Sep 11, 2026
Merged

tactino merged 1 commit into
mainfrom
fix/no-reset-after-last-episode

Conversation

@tactino

@tactino tactino commented Sep 11, 2026

Copy link
Copy Markdown
Member

rollout() reset unconditionally whenever an episode finished, including
the one that satisfied num_episodes. The observation it produced was
never read - the loop exits immediately afterwards. For a simulator that is
a wasted rollout; for a real robot it is a pointless move back to the home
pose after the run is over.

The test that proves it is nothingbutbut's, from the unmerged
features/robocasa branch, where this was fixed in April. It is the only
end-to-end rollout() test in the package other than the two added
yesterday, so it belongs on main whatever happens to the rest of that
branch.

Two adaptations, both because main has moved since April: the fake agent
returned (steps, n_envs), valid only under the _get_action_spec
batch-axis guess that was removed yesterday, and now returns [H, n, *da];
and the recorder spy predates record_timing.

test_rollout_infer_feedback_and_partial_reset_semantics changed with it,
which is worth being explicit about. It asserted that a partial reset
happens, using num_episodes=1 as the shortest route to a done
environment. Under the new behaviour that run is over before the reset would
happen, so it now uses two episodes. Its subject - a partial reset targets
only the environments that finished - is unchanged and still asserted.

🤖 Generated with Claude Code

rollout() reset unconditionally whenever an episode finished, including the
one that satisfied num_episodes. The observation it produced was never read -
the loop exits immediately afterwards. For a simulator that is a wasted
rollout. For a real robot it is a pointless move back to the home pose after
the run is already over.

The test that proves it comes from nothingbutbut's features/robocasa branch,
where this was fixed and never merged. It is the only test in this package
that exercises rollout() end to end other than the two added yesterday, so
it is worth having on main whatever happens to the rest of that branch.

Two adaptations were needed, both because main has moved since April:

  * its fake agent returned an action of shape (steps, n_envs), which was
    only valid under the batch-axis guess that _get_action_spec made until
    yesterday. It now returns [H, n, *da] like the protocol specifies.
  * its recorder spy predates record_timing.

test_cli.py::test_rollout_infer_feedback_and_partial_reset_semantics had to
change with it, and this is worth being explicit about: it asserted that a
partial reset happens, using num_episodes=1 as the shortest route to a done
environment. Under the new behaviour that run is over before the reset would
happen, so the test now uses two episodes. Its subject - that a partial reset
targets only the environments that finished - is unchanged and still
asserted.

Co-Authored-By: nothingbutbut <2367347983@qq.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tactino
tactino merged commit a634f84 into main Sep 11, 2026
2 checks passed
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