openenv/tbench2: adapter-driven TB2 fidelity (no OpenEnv fork/vendor)#1633
openenv/tbench2: adapter-driven TB2 fidelity (no OpenEnv fork/vendor)#1633Shi-Dong wants to merge 2 commits into
Conversation
Run agent commands and scoring in the task image's real /app workdir and score via the canonical tests/test.sh -> /logs/verifier/reward.txt harness, driven through plain exec steps. This keeps upstream OpenEnv unmodified (no fork, no vendoring): the env server is used purely as a docker-exec transport. Validated end-to-end (reward=1.0) against a pristine origin/main Tbench2DockerEnvironment on a real docker daemon.
There was a problem hiding this comment.
Code Review
This pull request introduces adapter-driven Terminal-Bench-2 fidelity support to the OpenEnv agent function. It configures the agent to run commands in the correct task working directory and executes the canonical test.sh harness via an exec step rather than using the built-in non-canonical evaluate action. Feedback was provided to address potential stale reward leakage, ensure correct workdir fallback behavior when OPENENV_TASK_WORKDIR is disabled, and avoid shared temporary directory conflicts on multi-user clusters by appending the user's UID to the log path.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Address the Gemini review on PR #1633's _CANONICAL_EVAL_CMD: - rm -f /logs/verifier/reward.txt before running test.sh so a stale reward can never be read back if test.sh fails to write a fresh one. - Only prefix `cd <workdir>` when _TASK_WORKDIR is non-empty, so setting OPENENV_TASK_WORKDIR="" actually disables the prefix (matches _apply_workdir), instead of silently forcing /app. The test.sh stdout log stays at /tmp/tb2_testsh.log: it is written inside the ephemeral per-episode task container, not on a shared host, so a host UID suffix would be misleading rather than protective.
Summary
/appworkdir, and scoring uses the task's canonicaltests/test.sh->/logs/verifier/reward.txtharness, driven through plainexecsteps.huggingface/OpenEnv) unmodified and unvendored — the env server is used purely as a docker-exec transport.Why
Upstream's
Tbench2DockerEnvironmentdocker mode is low-fidelity: it runs the container in/task(a copy of the task source), drops the agent there instead of/app(the task imageWORKDIR), and scores via barepytest tests/rather than TB2's canonicaltest.sh(which pins the pytest toolchain, copiestest.pyinto/app, runstest_outputs.py, and writesreward.txt). That mis-drives and mis-scores essentially all 89 TB2 tasks. Rather than fork or vendor OpenEnv to fix it, this moves the TB2-specific fidelity logic into the adapter, where the rest of the TB2 integration already lives.What changed (
openenv_agent_function.py)OPENENV_TASK_WORKDIR(default/app): every agent command is prefixed to run in the real task workdir.evaluateaction with anexecthat stages the task tests to/tests, runs the canonicaltest.shin/app, and parsesreward.txt.OPENENV_TB2_TESTS_SRC(default/task/tests): where the unmodified upstream env stages the task's tests inside the container.Validation
Prototyped end-to-end against a pristine
origin/mainTbench2DockerEnvironmenton a real docker daemon:reset-> apply reference solution in/app-> canonical eval -> reward = 1.0 (taskcancel-async-tasks).Caveat / deployment
This intentionally couples the adapter to unmodified upstream OpenEnv (which copies the task dir, tests included, into
/task). It is incompatible with the earlier docker-patched snapshot path. Deployment therefore hosts the unmodified upstream env-server on a real-docker host (e.g. agent-server) rather than the serverless Daytona snapshot.Test plan