Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion envs/textarena_env/server/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 18 additions & 0 deletions tests/envs/test_textarena_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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