Skip to content

[envpool] Fix native seed randomization and extend deterministic checks - #434

Merged
Trinkle23897 merged 7 commits into
mainfrom
jiayi/seed-randomization-checks
Aug 28, 2026
Merged

[envpool] Fix native seed randomization and extend deterministic checks#434
Trinkle23897 merged 7 commits into
mainfrom
jiayi/seed-randomization-checks

Conversation

@Trinkle23897

@Trinkle23897 Trinkle23897 commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Description

A reset that ignores its seed still passes a same-seed equality test. Several native environments had that behavior, and existing deterministic tests did not check the default reset/rollout paths across their whole families. This PR extends the existing family tests to require meaningful state variation where the official task is stochastic, and fixes the implementations those checks exposed.

  • MyoSuite: sample poses, goals, object properties, terrain, and challenge parameters from the pinned MyoSuite 2.12.2 task definitions. Restore model baselines before repeated randomization. Correct the terrain grid's floating half-cell offset and add the two reported random Finger tasks to the existing bitwise rollout checks.
  • Highway: restore seeded traffic, routes, speeds, and LaneKeeping noise, including Intersection traffic updates and route-aware MOBIL lane changes. Preserve the oracle's floating-point operation order and signed reverse-speed collision precheck. Correct multi-agent v1/v2 termination, and preserve both terminated and truncated when a natural ending coincides with the time limit.
  • Jumanji: restore 11 default random generators and PacMan's seeded ghost movement. Update native transitions that assumed the old fixed toy states so generated jobs, routes, warehouse layouts, targets, blocks, and pieces participate in simulation. Generate PacMan's maze from the pinned Jumanji 1.1.2 source at build time.
  • ViZDoom: start Cig/MultiDuel in their required deathmatch mode, handle failed initialization without crashing Python, and accept another Doom process creating the shared runtime directory during parallel startup. Restore the scenarios' render coverage and shard the expanded existing test target without increasing its per-shard timeout.

The tests stay in their existing environment families: there is no root seed-test suite or separate MyoSuite seed target. Shared behavioral assertions live in envpool/python/seed_test_utils.py; that helper is also included in the wheel because the installed-wheel tests use it. Environment simulation remains native C++, with official Python packages used only by test/oracle and build-time metadata tooling.

The assertions compare physical state or real multi-step trajectories, excluding seed/RNG metadata and counters. They check equal-seed reproducibility, different seeds, successive resets, and vector slots where appropriate. Deliberately fixed tasks remain fixed. No new skips, xfails, recorded-output fixtures, or relaxed alignment tolerances were introduced to pass these checks.

Motivation and Context

Closes #432. Both reported tasks reproduced on main 46b1e2f769320b2e1d579709f5979d32dc48e9ca. The old MyoSuite same-seed test passed all 398 configurations; adding state-variation assertions to that same deterministic method exposed 116 failures. The test changes before the native fixes are preserved in the commit history.

The original audit covered 1,119 distinct configurations across 19 families and found 147 seed/reset failures plus two ViZDoom initialization crashes. Highway previously checked seed sensitivity for only two configurations. Jumanji lacked a family-wide default-path check, and some existing oracle tests inject future recorded outputs. Reset-time oracle synchronization can also overwrite the randomized state being checked. The new seed assertions use neither synchronization nor recorded outputs.

The corrected registry has the same 1,704 IDs and 1,120 distinct configurations: fixing the multi-agent termination settings makes a previously identical Highway configuration distinct.

  • I have raised an issue to propose this change (required for new features and bug fixes)

This addresses the existing report in #432; no additional issue was opened.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • New environment (non-breaking change which adds 3rd-party environment)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Implemented Tasks

  • Extend existing family deterministic tests instead of adding separate seed-test entrypoints.
  • Repair the native MyoSuite, Highway, Jumanji, and ViZDoom behaviors exposed by those tests.
  • Fix the terminal-boundary, concurrent-startup, terrain-grid, and packaging failures found during full validation.
  • Complete final four-platform tests and all 12 installed-wheel release checks.

Validation

Final source commit: 094e53ca2feeefd055625ef93a5c2a3d4b985949. Native platform validation follows the same toolchains and release procedure as the dependency-upgrade validation. Linux full lint, including clang-tidy and the aggregate make lint target, passed.

Platform Full Bazel tests Python 3.12 release Python 3.13 release Python 3.14 release
Linux x86_64 102/102, uncached Pass Pass Pass
Linux aarch64, native VM 102/102, uncached Pass Pass Pass
macOS arm64 102/102, uncached Pass Pass Pass
Windows x86_64 102/102, uncached Pass Pass Pass

Each full test invocation selects //..., disables test-result caching, and checks that every configured test target completed successfully. This includes the existing oracle/render targets and all MyoSuite task shards. The affected families cover 398 MyoSuite, 31 Highway, 26 Jumanji, and 21 ViZDoom distinct configurations. ViZDoom's existing 29 test cases run in four shards.

The full-suite commands, omitting machine-specific cache and toolchain paths, are:

make lint
make BAZEL_TEST_TARGETS=//... BAZELOPT='--nocache_test_results --keep_going --instrumentation_filter=^//envpool[/:],^//scripts[/:]' bazel-coverage  # Linux x86_64
make BAZEL_TEST_TARGETS=//... BAZELOPT='--nocache_test_results --keep_going' bazel-test  # Other three platforms

Each release check builds the wheel with the corresponding Python version, installs it, runs pip check, and executes make release-test. The installed-wheel smoke check rejects source-tree imports. Linux wheels retain the manylinux_2_28 baseline and pass auditwheel show. Linux and Windows runtime checks run without the Qt SDK search paths; Linux also hides the SDK directory. macOS keeps its existing system Qt requirement.

Existing Jumanji oracle/render tests pass, but some legacy oracle cases replay recorded future outputs; they are not independent proof of native step semantics. The new seed checks and affected rule tests exercise real native paths. MyoSuite oracle/render coverage is the existing coverage plus the two reported Finger rollout cases, not a claim of complete upstream alignment for all 398 tasks.

Hosted workflow runs on the previously published revision were blocked by GitHub's billing/spending limit before job steps executed. The results above come from native runners; they do not claim hosted workflow passes.

Checklist

  • I have read the CONTRIBUTION guide (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have reformatted the code using make format (required)
  • I have checked the code using make lint (required)
  • I have ensured make bazel-test pass. (required)

New Environment Checklist

Not applicable: this PR adds no environment family or upstream task family.

  • Runtime logic is native C++ and does not bridge to the official Python environment.
  • All intended upstream task IDs/scenarios are registered, documented, and covered by tests.
  • The upstream oracle/version is pinned, and tests check EnvPool registration/configs against it.
  • Determinism tests cover reset plus multi-step rollouts for every registered ID, including render frames when rendering is supported.
  • Oracle alignment tests compare step-level observations, rewards, done/truncation, info, and renders after at most one reset-time state sync.
  • Render tests cover reset, multi-step, batched render/env-id selection, and docs include EnvPool-vs-official images when the official renderer exists.
  • envpool/make_test.py, release packaging, docs, and README support lists are updated.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-28T04:17:56.182243Z 0b9326d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b9326d704

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread envpool/BUILD Outdated
)

py_test(
name = "seed_test",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep known-failing checks out of the default test graph

The checked Linux workflow runs BAZEL_TEST_TARGETS="//...", and Windows uses the Makefile's identical default, so this target and //envpool/mujoco:myosuite_seed_test run in every normal CI build. The commit's validation reports 147 assertion failures and two VizDoom segfaults, while neither target is tagged out or uses passing expectations; consequently this change makes full-platform CI unconditionally red. Fix the reported implementations before enabling these targets in the default graph, or keep the diagnostic probes outside it until they pass.

AGENTS.md reference: AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

@Trinkle23897 Trinkle23897 changed the title [envpool] Add seed sensitivity checks across all environment families [envpool] Fix native seed randomization and extend deterministic checks Aug 28, 2026
@Trinkle23897
Trinkle23897 merged commit 0ae745a into main Aug 28, 2026
2 of 12 checks passed
@Trinkle23897
Trinkle23897 deleted the jiayi/seed-randomization-checks branch August 28, 2026 13:29
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.

MyoSuite envs: resets are fully deterministic — no state/target randomization (all *Random tasks degenerate to fixed-goal)

1 participant