Skip to content

Apply pending seeds when Gymnasium vector environments reset - #408

Merged
Denys88 merged 2 commits into
Denys88:masterfrom
Afloat16:afloat16/gymnasium-reset-seeds-20261116
Nov 19, 2026
Merged

Denys88 merged 2 commits into
Denys88:masterfrom
Afloat16:afloat16/gymnasium-reset-seeds-20261116

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

GymnasiumVecEnv.seed(seed) records a value that reset never consumes. Reseeding therefore fails to reproduce initial observations in both synchronous and asynchronous native vector environments and in custom manual environments. The manual path also ignores the constructor's seed.

Change

Keep a pending reset seed, pass it to the next reset, and consume it once. Manual environments receive distinct seed + index values. Subsequent unseeded resets continue each environment's random stream.

The regression suite uses real CartPole environments with one and three actors, seeds 0 and 42, native sync and async execution, and manual vectorization. A recording environment verifies that explicit seeds are applied exactly once and forwarded with the per-environment offset.

Validation

  • Unchanged-source baseline: 14 failed, 413 passed, 16 skipped in the Python 3.11 and 3.14 jobs.
  • Fixed workflow: all six jobs passed, including Python 3.11–3.14, lint and lock validation. Python 3.11 and 3.14 each report 427 passed, 16 skipped.

Validated head: 72f09f5ac8efac282730884398b7eb8d137df205.

#332 fixes Runner seed parsing; this addresses the vector environment's public reset-seeding path.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@9c0b3a0). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #408   +/-   ##
=========================================
  Coverage          ?   58.26%           
=========================================
  Files             ?       70           
  Lines             ?     8872           
  Branches          ?        0           
=========================================
  Hits              ?     5169           
  Misses            ?     3703           
  Partials          ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Denys88 Denys88 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending seed consumed once on the next reset, with per-env offsets on the manual path. Note: #426 touches the same manual-path seeding in the constructor; if both land, one of them needs to drop that part (their tests fail when combined).

@Denys88
Denys88 merged commit ba0a9a4 into Denys88:master Nov 19, 2026
6 checks passed
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.

3 participants