opencode-lean
OpenCode Lean 4 theorem proving environment via ComposableEnv.
Overview
- Environment ID:
opencode-lean - Tags: lean, theorem-proving, multi-turn, sandbox
Quickstart
uv run vf-eval opencode-lean -n1 -r1 -d -v
Architecture
Uses ComposableEnv with LeanTaskSet + opencode_harness:
- Agent gets
bashandedittools - Proof file at
/tmp/proof.leanwithsorryplaceholder - System prompt instructs compile-iterate workflow
- Scoring by
LeanRubric(checksstate["lean_compiled"])
Dataset Presets
Each preset resolves a version-matched Mathlib sandbox image (mirroring lean-code's preset map), since each dataset's statements were formalized against a specific Lean/Mathlib version. Pass sandbox_docker_image to override. A preset without a mapped image raises unless sandbox_docker_image is passed explicitly — no silent fallback to a possibly version-mismatched default.
| Preset | Dataset | Image |
|---|---|---|
deepseek-prover-v1 | DeepSeek-Prover-V1 | lean-tactic:mathlib-v4.7.0-rc2-v1 |
goedel-pset | Goedel PSet | lean-tactic:mathlib-v4.9.0-v1 |
deepseek-proverbench | DeepSeek-ProverBench | lean-tactic:mathlib-v4.9.0-v1 |
numina-lean | NuminaMath-LEAN | lean-tactic:mathlib-v4.15.0-v1 |
minif2f | MiniF2F | lean-tactic:mathlib-v4.24.0-v1 |
kimina | Kimina-Prover-Promptset | lean-tactic:mathlib-v4.26.0-v1 |
Changelog
v0.3.16
- Bump
verifiersto>=0.1.15.dev178, lifting the<0.1.15.dev150cap: the cap excluded the newopencode_harnessAPI, which this version adapts to. The[packages]extra (added in v0.3.15) is dropped: it is unresolvable on dev178 (requiresharnesses>=0.1.2/tasksets>=0.1.5, neither published on PyPI yet) and unused here — this env runs on the composable stack in verifiers core, notverifiers.v1. Drop theopencode_release_repo/opencode_release_version/opencode_release_sha256args fromload_environment:opencode_harnessno longer accepts them — the release (PrimeIntellect-ai/opencodev1.1.63-rl2, matching our previous pin) is now a module-level default in verifiers. dev178 also carries the last-matchEXIT_CODE:Nparsing in upstreamLeanTaskSet(PR #1480), closing the reward-bypass trade-off documented in v0.3.14. - Move the proof file inside the agent workdir (new
proof_file_patharg, default/workspace/mathlib4/proof.lean). The upstreamLeanTaskSetdefault/tmp/proof.leanis outside the OpenCode workdir, so the agent's very firstcat /tmp/proof.leantriggered anexternal_directorypermission request that OpenCode auto-rejects in non-interactive runs — every rollout died after one turn with reward 0 (visible inagent_logs:! permission requested: external_directory (/tmp/*); auto-rejecting). The hardcoded path inLEAN_SYSTEM_PROMPTis rewritten to match. - Drop the broken
opencode-lean:rl2default image: it has no mathlib4 project at/workspace/mathlib4and nolakeon PATH, so even surviving rollouts could never compile a proof (lake: command not found,unknown module prefix 'Mathlib').sandbox_docker_imagenow defaults toNoneand resolves a version-matchedteam-clyvldofb0000gg1kx39rgzjq/lean-tacticimage per preset (mirroringlean-code's preset map — see the Dataset Presets table); a preset without a mapped image raises rather than silently falling back to a version-mismatched default. Trade-off: the lean-tactic images don't bake the opencode binary, so cold sandboxes download it via the harness install script at setup (~few seconds; verified working). With these fixes a deepseek-v4-flash rollout solvesthm_0end-to-end (reward 1.0).
v0.3.15
- Bound
verifiersto>=0.1.15.dev17,<0.1.15.dev150.
v0.3.14
- Pin
verifiers>=0.1.14(stable) and drop the[tool.uv.sources]git rev override. The previous>=0.1.15.dev11pin was a pre-release marker; the hub installer (prime env install) doesn't enable pre-releases by default, so any consumer pinning to a.devNverifiers couldn't resolve dependencies. Stable v0.1.14 has the composable env stack (ComposableEnv,LeanTaskSet, opencode harness) we need. Trade-off: opencode-lean now uses upstreamLeanTaskSet's reward path, which still has the first-matchEXIT_CODE:Nbypass (fix landed on verifiers main in PR #1480 but isn't in any stable release yet).
v0.3.11
- Align signature with the other
opencode-*envs (sandbox_cpu_cores,sandbox_memory_gb,sandbox_disk_size_gb,sandbox_labels; newsandbox_client_max_workers; drop**kwargscatch-all; gatesystem_promptinjection so a caller can passNoneto fall back to opencode's default).
v0.3.10
- Bump
verifiersto>=0.1.15.dev2for the OpenCode harness config that disables title-generation calls while preserving thesmall_modelpin.
v0.3.9
- Harden sandbox image bootstrap against transient Ubuntu archive mirror sync flakes by adding apt acquire retries.
v0.3.8
- Fix
sandbox_docker_imageprefix. Thecme8364tg000o1139v84cu0cv/...prefix carried over from v0.3.7 is a user-scoped ID that the cluster cannot pull from, causingImagePullBackOffon every sandbox creation. Swap to the team-scopedteam-clyvldofb0000gg1kx39rgzjq/opencode-lean:rl2.
v0.3.7
- Pin
sandbox_docker_imagedefault toteam-clyvldofb0000gg1kx39rgzjq/opencode-lean:rl2. The new image bakes the opencode v1.1.63-rl2 binary into the sandbox so cold sandboxes no longer need to install it at rollout time. README updated to document the change.
v0.3.5
- Add
sandbox_docker_imageargument (defaultteam-clyvldofb0000gg1kx39rgzjq/opencode-lean:rl2), threaded through toLeanTaskSet(#305). Companion to #303 which handled math/cp/science.
v0.3.4
- Bump opencode fork release from
1.1.63-rl1to1.1.63-rl2(PrimeIntellect-ai/opencode#3), explicitly pinned via theopencode_release_versionoverride. Fork release surfaces session-level retry exhaustion as a non-zero exit with a structured stderr dump, so hosted RL rollouts that previously returned silent empty trajectories now produce realAgentErrorentries. Companion default bump in verifiers: PrimeIntellect-ai/verifiers#1184.
v0.3.3
- Bump verifiers to stable
>=0.1.12.
v0.3.2
- Unpin
prime-sandboxesgit source override; use PyPI release>=0.2.19. - Bump verifiers to
>=0.1.13.dev1.
v0.2.1
- Migrate OpenCode fork from
rasdani/opencodetoPrimeIntellect-ai/opencode. Bump release from1.1.63-swe8to1.1.63-rl1via sharedopencode_harnessdefaults (trimmed system prompt for RL training efficiency).
v0.2.0
- Rewrite to composable architecture. Uses
ComposableEnv+LeanTaskSet+opencode_harness. Replaceslean_codeenvironment.
v0.1.0
- Initial release