Skip to content

harbor: add Oh My Pi - #1787

Merged
burtenshaw merged 8 commits into
openenv:mainfrom
younesbelkada:harbor/oh-my-pi
Dec 1, 2026
Merged

burtenshaw merged 8 commits into
openenv:mainfrom
younesbelkada:harbor/oh-my-pi

Conversation

@younesbelkada

@younesbelkada younesbelkada commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds Oh My Pi (omp, MIT), a fork of pi on Bun, as an oh-my-pi seam. Harbor has no adapter for it.

  • InterceptOhMyPi: subclasses Harbor's Pi and keeps pi's session log, so OpenEnv's pi session reader and Harbor's trajectory converter work unchanged.
  • Config files: writes a models.yml routed to the capture proxy, plus a settings overlay that turns off omp's own model calls (titles, compaction, advisor), so each rollout contains the agent's calls only.

Type of Change

  • New feature

Settings found necessary

Found in Terminal-Bench evals and GRPO training through the capture proxy (omp 19.3.0):

Setting Without it
compat.replayReasoningContent: true omp replays past turns' reasoning only for a base URL that looks local (loopback or a private address). Behind the proxy's public URL it dropped all of it, so each new prompt no longer extended the tokens the model had generated: fork_frac 0.1–0.6, against pi's 0.01. With it: 0 forks in a trace-dump eval, and fork_frac 0.008 / 0 / 0 over 3 training steps.
compat.supportsReasoningEffort: false and --thinking off omp sends reasoning_effort: "high" on every call, overriding the engine's default. For a model id its catalog doesn't know, it also first probes thinking support with up to 7 extra calls.
input: ["text"] on the model omp treats a custom model as image-capable. When its read tool opens a PNG, a text-only engine rejects the next call (At most 0 image(s) may be provided).
--no-tools --tools read,bash,edit,write,grep,glob and a settings overlay omp's default tools add eval, subagents, web search and LSP, and its settings add model calls that aren't agent turns.
Config dir and TMPDIR fallback when /tmp isn't writable some task images have /tmp at mode 755, where apt's _apt user can't write.

Install

Many sandboxes start at once in training. Installing from GitHub (Bun) and npm in each one downloads ≈200 MB per rollout, risks rate limits, and with no lockfile the dependency versions can change during a run.

  • Bundle first: on x64 glibc images, install() downloads a prebuilt bundle (Bun 1.4.4 baseline + omp 19.3.0 with its bun.lock, 213 MB) from harness-hub/agent-bundles, checks its SHA-256 and unpacks it.
  • Fallback: on any other platform, for any other version, or on any failure, it installs Bun from its GitHub release (no unzip needed) and runs bun install -g.
  • Preinstalled: an image that already has omp skips the install.

Changes

  • openenv/harbor/oh_my_pi.py: InterceptOhMyPi, build_models_yml, and intercept_kwargs, which reads the tool set from OPENENV_OMP_TOOLS and the per-call output limit from OPENENV_OMP_MAX_TOKENS (default 32768; the proxy still applies its own cap).
  • seams.py: oh-my-pi, status untested, model id intercept/{model} as for pi.
  • test_harbor_qualification.py compares against len(SEAMS), the same one-line change as the hermes and DeepSeek Harness PRs.

Test Plan

tests/envs/test_harbor_oh_my_pi.py (7 tests):

  • the seam's routing and the server's settings;
  • the models.yml compat flags;
  • a preinstalled omp isn't reinstalled;
  • the bundle install, and the npm fallback when the bundle fails;
  • setup refusing to run without a route.
PYTHONPATH=src:envs uv run pytest tests/envs/test_harbor_*.py tests/envs/test_capture_*.py

773 passed, 7 skipped. ruff format --check, ruff check and usort check are clean.

Tested locally against a stub server on a public-looking host name (so the local-URL default doesn't hide the reasoning replay), with an omp session run from the bundle. In production, the same class ran through a runtime-registered seam for Terminal-Bench evals and a 3-step GRPO smoke training run with HF Sandboxes and Harbor 0.25. The status stays untested until a rollout through this exact seam has been checked.

RFC Status

  • Not required (bug fix, docs, minor refactoring)

🤖 Generated with Claude Code


Note

Medium Risk
New sandbox install path and proxy-facing model compat settings affect rollout capture correctness; changes are isolated to a new optional harness with unit tests but no full e2e validation yet (untested status).

Overview
Adds Oh My Pi (oh-my-pi) as a new Harbor harness by wiring a seam in seams.py and implementing InterceptOhMyPi in oh_my_pi.py, which subclasses Harbor's Pi so rollout logs still land under agent/pi/sessions/ for existing trajectory capture.

The adapter routes omp through the capture proxy via a models.yml intercept provider, with compat flags for text-only models, disabled reasoning-effort probing, and reasoning replay behind public proxy URLs. It installs omp on Bun using a SHA-256-checked HF bundle on x64 glibc (npm/Bun fallback otherwise), writes overlays to silence non-rollout model calls, and limits tools via OPENENV_OMP_TOOLS / OPENENV_OMP_MAX_TOKENS. Docs update the known-agent counts (32 total, 17 still untested).

tests/envs/test_harbor_oh_my_pi.py covers seam resolution, install paths, setup/run command shape, and proxy config generation.

Reviewed by Cursor Bugbot for commit 8ae0e04. Bugbot is set up for automated code reviews on this repo. Configure here.

Oh My Pi (omp, @oh-my-pi/pi-coding-agent) is a fork of pi on Bun with no
Harbor adapter. InterceptOhMyPi subclasses Harbor's Pi and keeps its session
log, so OpenEnv's pi session reader and Harbor's trajectory converter work
unchanged. It writes a models.yml routed to the capture proxy and a settings
overlay that turns off omp's own model calls (titles, compaction, advisor).

Settings found necessary in evals and GRPO training:
- compat.replayReasoningContent: true. omp only replays past reasoning for a
  base URL that looks local; behind the proxy's public URL it dropped it, and
  the capture forked after every turn that thought (10-60% of turns).
- compat.supportsReasoningEffort: false and --thinking off, so the engine's
  effort applies and omp sends no thinking probes.
- input: ["text"], so a PNG read by a tool is not sent as an image.

It installs from a sha256-checked prebuilt bundle (Bun + omp) on the Hub,
falling back to Bun's release and bun install -g. The seam reads the tool set
and output limit from OPENENV_OMP_TOOLS and OPENENV_OMP_MAX_TOKENS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

The docs for this pull request are available at https://openenv.github.io/OpenEnv/pr-preview/pr-1787/ (commit 8ae0e04). The preview may take a minute to update and is removed when the pull request closes.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

'export BUN_INSTALL="$HOME/.bun"; export PATH="$BUN_INSTALL/bin:$PATH"; '
f'if [ -w /tmp ]; then D={AGENT_DIR.as_posix()}; else D="$HOME/.openenv-omp-agent"; '
'export TMPDIR="$D/tmp"; mkdir -p "$TMPDIR"; fi; '
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bun still installs into read-only home

Medium Severity

PATH_PREFIX always sets BUN_INSTALL to $HOME/.bun, so bundle extract and bun install -g write there. Config was moved to /tmp because the agent home can be read-only, but install still targets home. When omp is not already on PATH, setup fails in that case even though /tmp is writable.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 175ccf3. Configure here.

younesbelkada and others added 6 commits December 1, 2026 15:17
Harbor's Pi defines _SESSIONS_DIRECTORY only from 0.24, so on 0.22 and 0.23
(both in the harbor extra's range) every InterceptOhMyPi.run() raised
AttributeError. Set it on the subclass, and test the run command line.

Co-authored-by: Cursor <cursoragent@cursor.com>
Harbor's BaseInstalledAgent already maps unzip, the same PackageSpec, in every
version of the supported range.

Co-authored-by: Cursor <cursoragent@cursor.com>
A re-upload on the dataset's main would fail the sha256 check and send every install to the GitHub + bun fallback; the commit URL keeps serving the file the hash names.

Co-authored-by: Cursor <cursoragent@cursor.com>
The seam is untested, so it gets no row in the validated table; the totals below it move from 31 known and 16 untested to 32 and 17.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a5bd202. Configure here.

Comment thread src/openenv/harbor/oh_my_pi.py Resolved
omp 19.3.0's argument parser reads an argument starting with - as an unrecognized flag and one starting with @ as a file to attach; after -- it takes every argument as the prompt.

Co-authored-by: Cursor <cursoragent@cursor.com>
@burtenshaw
burtenshaw merged commit 82faba6 into openenv:main Dec 1, 2026
18 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.

2 participants