Deprecate opencode_env and pi_env in favour of harbor_env (removal in 0.8.0) - #1276
Conversation
OpenCode and Pi are validated Harbor harnesses (`harness="opencode"`, `harness="pi"`), with the same token-level capture for training, so the per-harness envs are now a second path to the same agents. Both are removed in OpenEnv 0.8.0. - Importing either package emits a FutureWarning with the removal version and the HarborSessionFactory call to use instead. - The env READMEs (and their generated doc pages) open with the same notice and a migration snippet; both tutorials and the sidebar and catalog mark them deprecated. - The OpenCode tutorial's TRL links are pinned to v1.14.1, the last release with that recipe, so they keep working once TRL drops the example. - The Pi tutorial linked a TRL script that was never merged; it now says so and points to Harbor.
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Alignment Review Report
Automated Checks
- Lint: PASS —
uv run usort check,ruff format --check, andruff checkare all clean for the two touched Python files (envs/opencode_env/__init__.py,envs/pi_env/__init__.py). The repo-wideusort checkstill flagstests/envs/test_grid_world.pyandtests/envs/test_julia_env.py, but those are pre-existing and untouched by this PR (perAGENTS.md). - Debug code: CLEAN —
check-debug.sh's repo-wideprint/TODO hits are all pre-existing and outside the files this PR touches; nothing new was introduced. - Docs sync: PASS —
python scripts/sync_env_docs.py --checkreports the generateddocs/source/environments/{opencode,pi}.mdstubs are in sync with the updated READMEs. - Tests:
tests/envs/test_opencode_env.pyandtests/envs/test_pi_runtime.py(26 passed, 1 skipped) still pass; they now surface the newFutureWarnings but nothing turns warnings into errors in this repo's pytest config, so no breakage.
Open RFCs Context
- RFC 005 (Agentic Harness Integration, In Review) — defines the harness-wrapping pattern (
HarborSessionFactory(harness=...)) that this PR's deprecation notices point users toward. Directly relevant, and this change is consistent with it. - RFC 012 (Harbor capture purpose/provider fidelity, In Review) — documents
run_rollout(..., harness="opencode", ...)as an existing, validated capture path, confirmingharness="opencode"/"pi"are real, supported seams and not just examples. - No other Draft/In Review RFCs (008, 010, 011) touch coding-harness environments or deprecation policy.
Tier 1: Fixes Required
None identified.
Tier 2: Alignment Discussion
Principle Conflicts
None identified. The deprecation is purely additive (a FutureWarning on import plus doc notices); it doesn't change any Gym-like API signatures, doesn't touch client/server boundaries, and doesn't move reward logic. The two-minor-version runway (current 0.6.1.dev0 → removal in 0.8.0) is more conservative than the "pre-1.0 breaking changes acceptable" policy in PRINCIPLES.md requires.
RFC Conflicts
None identified. The change directly implements the migration path RFC 005 and RFC 012 already describe (per-harness envs → harbor_env with harness="opencode"/"pi"), rather than conflicting with either.
Minor Observations (non-blocking)
pi_env/__init__.pyimportsfrom opencode_env.sandbox import ..., so importingpi_envnow also triggersopencode_env'sFutureWarningas a side effect (confirmed in the test run above). Since both packages are being removed together in 0.8.0, this is harmless and arguably informative, but callers who only ever touchpi_envwill see a warning mentioning an unrelated package name — worth a one-line note in the warning message if it's ever revisited, but not worth blocking on.
Summary
- 0 mechanical issues to fix
- 0 alignment points for human review
- 0 RFC conflicts to discuss
Sent by Cursor Automation: Pre-review
…ssionFactory `HarborSessionFactory` (where huggingface#1276 points opencode_env users) can't pass `purpose`, `provider` or `eval_sampling`, although `HarborEnv.run_rollout` and the server's `run_rollout` tool accept all three. So a TRL loop-owning run can't ask for `purpose="train"`, which the provider qualification guide recommends. That matters most for training: a vLLM started without `--return-tokens-as-token-ids` still runs every rollout, as eval, and `fetch_proxy_trace()` hands the trainer an empty list per rollout with only a warning. With `purpose="train"` the server refuses the rollout before creating a sandbox. The factory now takes the three kwargs and passes them through. It validates them at construction, like `sampling`, so a bad value fails once rather than on every rollout. Defaults are unchanged. Tests: new cases in `tests/envs/test_harbor_session_factory.py` fail on main (TypeError on the new kwargs) and pass with this change; the harbor and capture suites pass (606 passed, 3 skipped). ruff and usort clean on the touched files. Prepared with AI assistance (Claude Code); I reviewed the change and ran the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Summary
OpenCode and Pi are validated Harbor harnesses (
harness="opencode",harness="pi"), with the same token-level capture for training (both arestablewithoptimizer_passin the Harbor provider qualification table), soopencode_envandpi_envare now a second path to the same agents. This deprecates both, with removal in OpenEnv 0.8.0, and points users toharbor_env. Nothing is removed yet.This is the first time an environment is deprecated in OpenEnv, and there was no written convention (the only precedent is the
openenv_coreimport shim). So the approach follows how TRL does it, which it has applied since well before its 1.0: the warning names the removal version and a concrete replacement, it is aFutureWarningso users actually see it, the docs say the same, and the removal lands in the announced release. That convention is now written down in.claude/docs/INVARIANTS.md(#1277), and this PR follows it. For the two-minor-release runway, this should land before the 0.6.1 cut so the warning ships in 0.6.1; if it lands later, the removal version moves to 0.9.0.What changes
opencode_envorpi_envemits aFutureWarning:sync_env_docs.py) open with the same notice and a migration snippet (openenv harbor serve+HarborSessionFactory(..., harness=...)). Tasks become Harbor task directories instead ofOpenCodeTask/PiTask.examples/scripts/openenv/pi.pyin TRL, which was never merged (Add Pi coding-agent loop-owning GRPO examples trl#6600 was closed) and 404s. It now says so and points to Harbor.Notes
pi_envimportsopencode_env's sandbox layer, so importingpi_envshows both warnings. Both envs go away together, so I kept it simple rather than filtering one.openenv_coreshim predates this and usesDeprecationWarningwith no removal version; it can be aligned separately.docker-build.yml, their docs and tutorials,examples/opencode_env_simple.pyandexamples/pi_env_simple.py.cc @jayzuccarelli, since you have a few
opencode_envfixes open (#1262, #1263, #1264, #1074): heads up that the env is on its way out, and the same agent through Harbor is where fixes would land from now on.Type of Change
Alignment Checklist
Before submitting, verify:
.claude/docs/PRINCIPLES.mdand this PR aligns with our principles.claude/docs/INVARIANTS.mdand no invariants are violated/pre-submit-pr(orbash .claude/hooks/lint.shand tests) and addressed all issuesRFC Status
Test Plan
PYTHONPATH=src:envs pytest tests/envs/test_opencode_env.py tests/envs/test_opencode_factory_lifecycle.py tests/envs/test_opencode_hf_sandbox.py tests/envs/test_opencode_sandbox_home.py tests/envs/test_pi_factory_lifecycle.py tests/envs/test_pi_runtime.py: 60 passed, 1 skipped, and theFutureWarningis reported at the importing line.python -c "import pi_env"prints the warnings with default filters (no-Wneeded).ruff check/ruff format --checkclean on the changed files.bash .claude/hooks/lint.shreports the same 56 pre-existing format diffs onmainwith the local ruff (0.16.9), none in files touched here.python scripts/sync_env_docs.py --checkpasses.Claude Code Review
N/A
🤖 Generated with Claude Code
Note
Low Risk
Documentation and import-time warnings only; no runtime behavior change beyond visible deprecation notices for existing
opencode_env/pi_envusers.Overview
Deprecates
opencode_envandpi_envin favor ofharbor_env(planned removal in OpenEnv 0.8.0). Packages still work; imports now emitFutureWarningwith Harbor migration instructions (openenv harbor serve+HarborSessionFactory(..., harness="opencode"|"pi")).Docs and navigation label OpenCode/Pi environments and GRPO tutorials as (deprecated) and add top-of-page warnings with the same Harbor path. The OpenCode tutorial’s TRL links are pinned to v1.14.1; the Pi tutorial drops a broken TRL script link and directs readers to Harbor instead.
Reviewed by Cursor Bugbot for commit 030fd9a. Bugbot is set up for automated code reviews on this repo. Configure here.