diff --git a/envs/textarena_env/server/environment.py b/envs/textarena_env/server/environment.py index 5591f41ad1..5568bd0129 100644 --- a/envs/textarena_env/server/environment.py +++ b/envs/textarena_env/server/environment.py @@ -188,7 +188,7 @@ def reset( if hasattr(env, "full_observations"): env.full_observations = {} - self._ta_env.reset(num_players=self.num_players) + self._ta_env.reset(num_players=self.num_players, seed=seed) for provider in self._reward_providers: provider.reset() diff --git a/tests/envs/test_textarena_environment.py b/tests/envs/test_textarena_environment.py index 673a3d6673..3f714bce7a 100644 --- a/tests/envs/test_textarena_environment.py +++ b/tests/envs/test_textarena_environment.py @@ -65,3 +65,21 @@ def test_wordle_reset_clears_accumulated_state(): # Verify the prompts are actually the same content assert obs1.prompt == obs2.prompt assert obs2.prompt == obs3.prompt + + +def test_reset_seed_is_forwarded_to_textarena(): + """`reset(seed=...)` must reach the underlying TextArena env. + + Regression test: the seed was previously accepted but discarded, so two + resets with the same seed drew two different secret words. + """ + pytest.importorskip("textarena", reason="textarena not installed") + env = TextArenaEnvironment(env_id="Wordle-v0", num_players=1) + + env.reset(seed=1234) + first_word = env._ta_env.state.game_state["secret_word"] + + env.reset(seed=1234) + second_word = env._ta_env.state.game_state["secret_word"] + + assert first_word == second_word