Skip to content

fix(textarena): forward seed to underlying TextArena env on reset - #1148

Closed
caiotheodoro wants to merge 1 commit into
openenv:mainfrom
caiotheodoro:fix/textarena-reset-seed
Closed

caiotheodoro wants to merge 1 commit into
openenv:mainfrom
caiotheodoro:fix/textarena-reset-seed

Conversation

@caiotheodoro

@caiotheodoro caiotheodoro commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

TextArenaEnvironment.reset() takes a seed parameter (required by the
Environment base class interface) but never forwards it to the wrapped
TextArena env's own reset(). TextArena's reset(num_players, seed=None)
does accept a seed - it was just being dropped on the way through.

Result: reset(seed=1234) called repeatedly draws a different secret word
every time, even though the signature advertises reproducibility.

Fix

Pass seed through in TextArenaEnvironment.reset():

self._ta_env.reset(num_players=self.num_players, seed=seed)

(Left the constructor's initial reset() call alone - there's no seed in
scope there.)

Test plan

  • Added test_reset_seed_is_forwarded_to_textarena, which resets twice with
    the same seed and asserts the secret word matches. Confirmed it fails on
    main (different word each time) and passes with the fix.
  • PYTHONPATH=src:envs uv run pytest tests/ -v - full suite passes
    (1653 passed, 133 skipped, no failures).
  • uv run ruff format --check / ruff check on the touched files - clean.
  • Manually reproduced the bug and the fix outside pytest with real
    textarena installed (Wordle-v0, seed 1234 vs varying).

Fixes #1102


Note

Low Risk
Single-parameter pass-through on reset with a targeted regression test; no auth, data, or infrastructure changes.

Overview
TextArenaEnvironment.reset() now passes seed through to the wrapped TextArena env (self._ta_env.reset(..., seed=seed)). Previously the OpenEnv reset(seed=...) argument was ignored, so repeated resets with the same seed still randomized game setup (e.g. different Wordle secret words).

A regression test resets Wordle-v0 twice with seed=1234 and asserts the secret word matches.

Reviewed by Cursor Bugbot for commit 66c0bf5. Bugbot is set up for automated code reviews on this repo. Configure here.

TextArenaEnvironment.reset() accepted a seed parameter but never passed
it to the wrapped TextArena env's reset(), so repeated resets with the
same seed drew a different secret word every time. TextArena's own
reset() already accepts seed, it was just being dropped.

Fixes #1102
@caiotheodoro

Copy link
Copy Markdown
Contributor Author

Closing — #1127 already fixes this exact issue (same root cause, same one-line forward of seed into reset(), plus more thorough tests) and is mergeable. No need for a second PR against the same bug.

@caiotheodoro
caiotheodoro deleted the fix/textarena-reset-seed branch September 10, 2026 14:22
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.

textarena_env: reset() accepts a seed and discards it, so runs are not reproducible

1 participant