Skip to content

[envpool] clean up dev Python dependencies and stabilize state buffers - #340

Merged
Trinkle23897 merged 14 commits into
mainfrom
jiayi/envpool-phase4-python-cleanup
Mar 22, 2026
Merged

[envpool] clean up dev Python dependencies and stabilize state buffers#340
Trinkle23897 merged 14 commits into
mainfrom
jiayi/envpool-phase4-python-cleanup

Conversation

@Trinkle23897

Copy link
Copy Markdown
Collaborator

Summary

  • Problem: the dev dependency set still carried legacy pins and packages such as protobuf<=4.20.0, box2d-py, and mujoco_py, while the phase-4 cleanup surfaced a StateBufferQueue::Wait() path that could block forever when the background stock-buffer queue was temporarily empty.
  • Scope: refresh the dev and benchmark Python requirements for the current Linux/JAX/Gymnasium stack, update the Box2D correctness baseline and Bazel deps, refresh the bazel_rules_qt pin, and harden the state-buffer fallback path. This does not change the release requirements or take on a broader bazel_clang_tidy migration.
  • Outcome: Linux dev requirements resolve without the legacy Box2D/MuJoCo Python packages, Box2D correctness tests run against current Gymnasium baselines, and full make bazel-test is stable again on dev.

This diff modernizes the phase-4 dev dependency surface and closes the queue-preallocation flaky that showed up during the full Linux test sweep.

Technical Details

  • Approach: remove obsolete Python packages from the dev-only requirements, refresh the Linux lockfile from a real dev resolution, keep the minimal runtime extras still required by Bazel tests, and make the state-buffer preallocation path fall back to synchronous allocation instead of blocking on an empty stock queue.
  • Code pointers:
    • third_party/pip_requirements/requirements-dev.txt: removes the protobuf cap, drops box2d-py / mujoco_py, updates opencv-python-headless, and keeps imageio for the MuJoCo Gym test runtime.
    • third_party/pip_requirements/requirements-dev-lock.txt: refreshed from a Linux dev environment to match the new dependency surface.
    • envpool/box2d/box2d_correctness_test.py: switches the baseline side of the Box2D space checks to Gymnasium's current v3 env IDs.
    • envpool/box2d/BUILD: depends on box2d and gymnasium directly so Bazel sandboxes still see the right runtime packages.
    • envpool/core/circular_buffer.h: adds a non-blocking TryGet() helper.
    • envpool/core/state_buffer_queue.h: uses TryGet() and falls back to a synchronous StateBuffer allocation when the background stock queue is temporarily empty.
    • envpool/workspace0.bzl: refreshes the bazel_rules_qt pin.
    • BUILD: exposes .clang-tidy via srcs for the current aspect consumer.
  • Notes: threadpool and gym3_libenv were checked and already match upstream head, so there is no diff for them. I also probed a newer bazel_clang_tidy, but that turned into a much larger lint/toolchain migration and is intentionally not included here.

Test Plan

Automated

  • brix ssh dev -C -- 'cd /root/code/envpool && USE_BAZEL_VERSION=8.6.0 bazelisk test //envpool/core:state_buffer_queue_test --config=test --test_output=errors --nocache_test_results --runs_per_test=10': passed (10/10).
  • brix ssh dev -C -- 'cd /root/code/envpool && make bazel-test': passed (30/30).

Suggested Manual

  • python -m venv /tmp/envpool-phase4 && source /tmp/envpool-phase4/bin/activate && pip install -r third_party/pip_requirements/requirements-dev.txt: verify the dev dependency set resolves cleanly on Linux.
  • USE_BAZEL_VERSION=8.6.0 bazelisk test //envpool/box2d:box2d_correctness_test --config=test --test_output=errors: verify the Gymnasium Box2D baseline continues to line up with EnvPool.

@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: 3b5a6d7162

ℹ️ 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/box2d/box2d_correctness_test.py
Comment thread envpool/core/state_buffer_queue.h Outdated
@Trinkle23897
Trinkle23897 merged commit 66658f9 into main Mar 22, 2026
2 of 4 checks passed
@Trinkle23897
Trinkle23897 deleted the jiayi/envpool-phase4-python-cleanup branch March 22, 2026 19: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.

1 participant