[RFC 005] 1/4: split openenv.core.harness into a package - #1097
Open
splusq wants to merge 2 commits into
Open
Conversation
Moves the trainer-side rollout API out of the package __init__ and into `openenv.core.harness.rollout`, leaving __init__ as a re-export shim. No behavior change: every name previously importable from `openenv.core.harness` still is, and is the same object. The module was ~730 lines living directly in __init__ with a docstring noting it sat outside the stable surface "while RFC 005 is still under review". Splitting it now makes room for the RFC 005 turn-based agentic harness layer to land in sibling modules instead of growing the __init__ further. Also re-exports the private `_resolve_env_reward`, which tests/scripts/test_browsergym_harness_eval_examples.py imports from the package root, and points `collect.py` at `.rollout` directly rather than importing from its own package. Consumers left untouched and verified: `openenv collect`, pi_env, opencode_env, browsergym_env, reasoning_gym_env, openspiel_env. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
splusq
commented
Aug 28, 2026
| from openenv.core.harness import rollout | ||
|
|
||
| ROLLOUT_PUBLIC_NAMES = [ | ||
| "CLIHarnessAdapter", |
Author
There was a problem hiding this comment.
these can be rationalized in a separate PR - there are lots of conflated names here.
splusq
marked this pull request as ready for review
August 31, 2026 21:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack for RFC 005: Agentic Harness Integration — this is 1 of 4. Each PR is one commit; later PRs target
main(cross-fork PRs cannot chain bases), so review them in order and read the top commit of each.HarnessEnvironment+ subprocess + tool bridge/harnessroute + mode wiringWhat
Moves the trainer-side rollout API out of the package
__init__and intoopenenv.core.harness.rollout, leaving__init__as a re-export shim.No behavior change. Every name previously importable from
openenv.core.harnessstill is, and is the identical object.Why now
openenv/core/harness/__init__.pyis ~730 lines of implementation living directly in the package__init__, with a docstring saying it sits outside the stable surface "while RFC 005 is still under review". The rest of RFC 005 adds a second, differently-shaped layer to the same package. Splitting first means that layer lands in sibling modules instead of growing the__init__to ~2000 lines, and it keeps the refactor reviewable on its own instead of buried inside a feature diff.Two details worth a look
_resolve_env_rewardis re-exported too, with anoqaand a comment. It is private, buttests/scripts/test_browsergym_harness_eval_examples.pyimports it from the package root. I found this by running the consumer tests, not by reading — worth knowing it is load-bearing.collect.pynow imports from.rolloutrather thanfrom . import ..., removing a self-referential package import.Verification
tests/core/test_harness_rollout_backcompat.pyis added as the contract: every name in the old__all__resolves from the package root andisthe same object as onrollout.All in-repo consumers pass unchanged —
openenv collect,pi_env,opencode_env,browsergym_env,reasoning_gym_env,openspiel_env:(
test_harness_runtime,test_harness_collect,test_opencode_factory_lifecycle,test_openspiel_collect,test_browsergym_harness,test_browsergym_harness_eval_examples, plus the new back-compat file.) Lint clean.Question for reviewers
Longer term the naming is muddled:
HarnessAdapterhere drives rollouts, while RFC 005's adapter adapts an external process, and both want the plain name. A rationalization would beRolloutDriver/MCPRolloutDriver/BlackBoxRolloutDriver/RolloutResult/RolloutLimitsfor this layer, freeingHarnessAdapterfor the RFC 005 meaning. Not done here — it would break the "no behavior change" property of this PR — but this is the natural moment to decide, before the names calcify. Happy to do it as a follow-up with deprecation aliases.Note
Low Risk
Mechanical module move with explicit re-exports and back-compat tests; no rollout or reward logic changes.
Overview
Refactor-only split of
openenv.core.harness: the trainer-side rollout implementation (~730 lines) moves from the package__init__into a newrolloutmodule.__init__.pyis now a thin re-export shim sofrom openenv.core.harness import ...still resolves to the same objects as before.collect.pyimports rollout types from.rolloutinstead offrom . import ..., avoiding a circular package self-import. The private helper_resolve_env_rewardis deliberately re-exported from the package root for existing test/script consumers.Adds
tests/core/test_harness_rollout_backcompat.pyto lock the contract: public__all__names and_resolve_env_rewardidentity-match betweenopenenv.core.harnessandrollout.Reviewed by Cursor Bugbot for commit f39c662. Bugbot is set up for automated code reviews on this repo. Configure here.