You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[envpool] Fix explicit episodic-life reset for Atari and Vizdoom (#344)
## Summary
- Problem: explicit `env.reset()` did not fully reset underlying state
for episodic-life envs, so repeated resets could continue the same
game/session instead of starting a fresh episode.
- Scope: preserve the existing `force_reset` signal through the core
async env path, make Atari and Vizdoom honor explicit resets under
`episodic_life`, add regression coverage for both Python-facing APIs,
and keep the branch green against current lint drift.
- Outcome: explicit user resets now route to a real underlying reset for
both env families instead of being treated like episodic-life
continuation.
Fixes#301 by restoring explicit reset semantics for episodic-life envs.
## Technical Details
- Approach: thread the existing `force_reset` bit from `AsyncEnvPool`
into `Env::PreProcess`, then consume it in env-specific reset logic.
- Code pointers:
- `envpool/core/env.h`: stores `force_reset_` on the env instance and
threads it through `EnvStep`/`PreProcess`.
- `envpool/core/async_envpool.h`: forwards `raw_action.force_reset`
instead of collapsing explicit resets into generic reset handling.
- `envpool/atari/atari_env.h`: treats explicit resets as a full
`reset_game()` even when `episodic_life=True`.
- `envpool/vizdoom/vizdoom_env.h`: treats explicit resets as a full
`newEpisode()` even when `episodic_life=True`.
- `envpool/atari/atari_env_test.cc`: adds a C++ regression test for
repeated explicit resets.
- `envpool/atari/atari_envpool_test.py`: adds a gymnasium regression
test matching the user-facing Atari repro.
- `envpool/vizdoom/vizdoom_test.py`: adds a Python regression test for
repeated explicit resets under Vizdoom episodic life.
- `envpool/core/xla_template.h`: fixes current `clang-tidy` / lint
complaints encountered while validating this branch.
- Notes: the Linux `make bazel-test` run on `dev` used `--distdir` with
a locally downloaded `pretrain.tar.gz` and an Atari ROM override to
avoid unrelated external download failures during validation.
## Test Plan
### Automated
- `make bazel-test BAZELOPT="--distdir=/tmp/bazel-distdir-test
--override_repository=atari_roms=/tmp/atari_roms_override_test"` on
`dev`: passed (`30 / 30 tests pass`) before the Vizdoom follow-up.
- issue #301 Atari repro script on `dev` against a patched wheel: passed
(`info["lives"]` stayed at 5 across repeated `reset()`).
- `ruff check envpool/vizdoom/vizdoom_test.py`: passed.
- `ruff format --check envpool/vizdoom/vizdoom_test.py`: passed.
- `clang-format --style=file -n --Werror envpool/vizdoom/vizdoom_env.h`
on `dev`: passed.
### Known Verification Gap
- Targeted `//envpool/vizdoom:vizdoom_test` execution on `dev` currently
crashes in existing test setup with `v_video.cpp:1346 Assertion
'CleanWidth >= 320' failed`, including the pre-existing `test_timelimit`
case. That prevented runtime confirmation of the new Vizdoom regression
test on this box, but the failure reproduces independently of this
patch.
0 commit comments