MultiStepWrapper steps past truncation and erases the episode boundary

Author: dvasquezlopezCreated Sep 24, 2026Updated Sep 27, 2026

Specula found this at current main commit 51d4c89f72fda44cbf77285c6a8114b52676b8a1.

MultiStepWrapper.step() stops an action chunk only for accumulated terminated values. It receives Gymnasium's truncated flag but neither stores nor checks it, then returns the final inner step's flag. A truncation before the chunk ends can therefore be crossed and later overwritten with False.

Current sequence

T0: the wrapper starts a multi-action chunk
T1: the first inner step returns truncated=True
T2: the wrapper executes the remaining actions because terminated is false
T3: a later truncated=False overwrites the boundary and the wrapper returns both flags false

Proposed sequence

T0: the wrapper starts a multi-action chunk
T1: each inner step updates accumulated terminated and truncated flags independently
T2: the wrapper stops when either accumulated flag becomes true
T3: the wrapper returns the preserved episode boundary

The exact current wrapper ran around a minimal Gymnasium environment. The first step of a three-action chunk returned truncated=True; the wrapper made all three inner calls and returned both flags false with n_env_steps=3. The witness used Gymnasium 1.3.0 and NumPy 2.5.1 instead of the pinned 1.2.2 and 1.26.4. No full SimplerEnv, LIBERO, or RoboCasa runtime ran.

Track terminated and truncated independently, stop on either, and return their aggregates. The wrapper's own max_episode_steps condition should set truncated. Add a first-action truncation regression.

@youliangtan was detected as the most likely owner from current-source blame. Please feel free to assign this to someone else if another owner is closer to the code.