Repository navigation
feat(harbor): TB2.1 minimum hardening for the harbor environment server (M6) - #3706
Conversation
574a040 to
d982104
Compare
d982104 to
998606b
Compare
998606b to
020b736
Compare
012c55a to
294bf41
Compare
294bf41 to
416294e
Compare
416294e to
996809b
Compare
996809b to
a62d40e
Compare
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Two additional issues to address: exit code 137 can incorrectly discard a valid reward, and oracle log-directory setup can prevent a reference solution from running in a non-root image. I also left three nonblocking suggestions for ownership handling, diagnostic coverage, and configuration wording.
a62d40e to
900fbe8
Compare
be92a19 to
b4446fa
Compare
|
/ok to test b4446fa |
|
/ok to test 23ec55b |
|
/ok to test 1fd051f |
|
Status at the new head 1fd051f, now based directly on #3675 since M5 was folded into #3674. Your four correctness threads each carry the fix and its tests inline:
The withdrawn ownership thread keeps its guard anyway: _prepare_workdir neither creates nor chowns a working directory of /. The other two nonblocking items are done, the oracle fake models stderr and the provider error type, and the grace comment describes extra provider waiting time. The verifier half of this code moved into environment_servers/harbor/verifier.py in the rebase. |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Thanks for addressing the review. Rechecked 1fd051f and verified the oracle log-directory fix in #3754 and OpenSandbox cancellation cleanup in #3807. With those included in the planned stack landing, I have no remaining blocking findings for this PR. The timeout-policy/documentation follow-up is nonblocking.
|
/ok to test 9dcbe69 |
|
/ok to test 3f00ba5 |
|
/ok to test 68cadce |
ffrujeri
left a comment
There was a problem hiding this comment.
Approving 68cadce7. I checked the verifier timeout path: the exit record is written after test.sh into a directory cleared before verification, elapsed >= budget cannot miss a fired timer with whole-second date, and a reward written before a late kill still counts. Harbor, Oracle, validation and sandbox suites pass locally (810 passed, 13 skipped); CI is green apart from the non-blocking harness conformance probes. The Oracle log-directory fix for non-root images lands in #3754, as Yu noted, so this should land with the stack. Title and body updated to the environment-server layout and the current 137 handling.
|
/ok to test 91d34c5 |
ffrujeri
left a comment
There was a problem hiding this comment.
Re-approving 91d34c5d after the restack: git range-diff against the approved 68cadce7 shows the same patch. Stack tests pass locally; CI was still running at approval time.
|
/ok to test f42f3f3 |
|
/ok to test abd09ba |
…bor tasks Adds `responses_api_agents/harbor_oracle_agent` (M3 of the Harbor tasks RFC). The oracle is an ordinary agent harness that runs a task's reference solution instead of a model: it borrows the sandbox the `harbor` environment server seeded, where that server placed the task's `solution/`, and runs `bash /solution/solve.sh` in the task's working directory as the task user. Verification then scores the result like any rollout. Tasks without `solution/solve.sh` return a response tagged `oracle=unvalidated` and are never failed. The oracle contract lives in the seed. The environment server recognises the oracle by the implementation name of the agent instance it serves: the one key under that instance's `responses_api_agents` block in the merged run config (`ORACLE_AGENT`, `harbor_oracle_agent`), read from the same block the token-capture lookup already uses. For that harness alone, after the sandbox seed and before the agent session opens, it uploads the task snapshot's `solution/` to `/solution` as root (where Harbor's oracle copies it) and resolves the task's `[solution].env` on its host; any other harness never sees the solution, and a task without `solution/` uploads nothing. `SandboxAccess` gains `user` (the task's `[agent].user`, `None` for the sandbox's default) and `env` (the owner's resolved environment for the harness's commands), and `AgentSeedSessionRequest` gains `agent_timeout_sec`, the task's `[agent].timeout_sec`, which the server now sends with every seed. The oracle reads nothing else: no `environment_server` reference, taskset mapping, task folder or digest check. Its solve budget is the seed's `agent_timeout_sec` under `max_solve_timeout_s`, it runs as the sandbox access's user with its env, and it probes `/solution/solve.sh` as that user first, reporting `unvalidated` when the script is absent and failing the episode as retryable when the probe itself hits a provider error. `gym dataset validate <folder | harbor:dataset> [--sandbox <provider>]` prepares the taskset, runs it with the oracle through the normal end-to-end collection (with a placeholder policy model block, since the oracle calls no model), and prints one line per task with its reward or why there is none. It exits non-zero when a validated task scores below 1.0, is masked, or fails. The generated run config sets `use_absolute_ip` for harnesses that call the model server from inside the sandbox. Squashed from the previous oracle branch, review fixes included: every selected task and repeat is accounted for, validation artifacts stay apart from model evaluation, resumed validation is rejected when task digests or the selection changed, solution environment templates resolve on the server's host at seed, the oracle serves sessions through the base agent hooks, `ray_enabled` is declared, custom provider execution compatibility is preserved, and validate reads rollouts in the collector's stored shape. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…er (M6) M6 of the Harbor tasks RFC, sized for the 89 Terminal Bench 2.1 tasks: - use the image's own WORKDIR when a task sets none; - run `test.sh` under an in-container `timeout` with a grace period on the exec, so hour-long verifiers survive a provider's per-request limit and a killed verifier is a measured zero; - keep verifier logs on timeout and report `verifier_seconds`; - optional `sandbox_resources_override`, `sandbox_env` and `derive_cpu_env`, so a benchmark can run at fixed resources for a like-for-like comparison; - operator `sandbox_setup_commands`, run as root in every new sandbox before the harness sees it (for repairs the operator owns rather than the task, such as pointing an end-of-life Debian at its signed final snapshot); a failing command is a retryable seed failure. They go through the root-first exec helper, so sandboxes that cannot switch identities still work; - `oracle_agent`: run `solve.sh` the same bounded way with its output captured to a file. Squashed from the resources-server branch and re-applied onto the environment server. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
/ok to test e28457c |
ffrujeri
left a comment
There was a problem hiding this comment.
Re-approving e28457c3 after the restack. git range-diff shows the patch is identical to the 91d34c5d I approved.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39658611232 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39659421754 |
What does this PR do?
M6 of the Harbor tasks RFC (GitLab MR 340, MR 354): the minimum hardening the
harborenvironment server (environment_servers/harbor) needs to run Terminal Bench 2.1 tasks. Stacked on #3675 (M5 was folded into #3674). Followed by M7 (Terminus 2 sessions) and M8 (the TB2.1 taskset and parity run).pwdin the fresh sandbox. The old/appdefault is gone.test.shruns as one plain exec bounded by the task budget plus a grace period, withtimeout --signal=KILLinside the container as the cap on the command itself. The provider keeps the exec alive for that long (OpenSandbox polls a background command, Docker streams), so hour-long verifiers need no detached launch. A run that leaves no reward scores 0 withharbor:verifier_timeoutwhen the provider timed out or the wrapper's exit record shows 137 after the whole budget elapsed. A reward written before a late kill still counts, and a 137 from a killed helper insidetest.shis not taken for the timer. An image withouttimeoutorbashis masked as a verifier error instead of scored. A first version in this branch launched the command undersetsidand polled for its exit code. On OpenSandbox Cell-3 a process left running after a command returns is reaped, so that never completed. Verified on Cell-3 with a 400 s command in both provider modes.sandbox_resources_override(replaces only the keys it names, so a GPU task keeps itsgpurequest under a CPU or memory override).sandbox_env(the task's own[environment.env]wins).derive_cpu_env(on by default: exportsOMP_NUM_THREADSand the other CPU-count variables matching the sandbox CPU limit, nothing when the task sets no CPU limit).sandbox_setup_commandswithsandbox_setup_timeout_s(root commands run in every new sandbox before the agent sees it, for repairs the operator owns such as pointing Debian 11 at its final security snapshot. A failing command stops the sandbox and fails the seed with a 503).verifier_grace_s(default 30 s).test-stdout.txt. The response carriesverifier_seconds.harbor_oracle_agent. Runssolve.shthe same bounded way (timeout --signal=KILLinside the container, 60 s grace on the exec). Output is captured to/logs/agent/oracle.txt(Harbor's name) and its tail goes into the oracle status. A missingtimeoutorbashreportsoracle_error_type=wrapper.Review fixes (2026-10-04)
sandbox_resources_overridemerges over the task's resources instead of replacing the whole dict. A GPU task routed to the GPU provider lost itsgpurequest under a CPU or memory override. Also drops an import left unused when the setsid runner was removed.Validation
pytest environment_servers/harbor/tests responses_api_agents/harbor_oracle_agent/tests tests/unit_tests/test_harbor_validation.py tests/unit_tests/test_harbor_tasks.py tests/unit_tests/test_sandbox.py tests/unit_tests/test_task_data.py: 810 passed, 13 skipped at 68cadce (reviewer rerun).ruff checkandruff format --checkclean on the changed files at the rebased head.pre-commit run --files <changed files>was clean before the rebase.Rollouts
Exercised by the TB2.1 parity run in the M8 PR of this stack: 89 tasks through
gym dataset validate(oracle) and through Terminus 2, both on x86 OpenSandbox. See that PR for the tables. Those runs predate the move to the environment server and the rebase onto #3675.Compatibility and benchmark impact
Tasks that declare a working directory keep it. Two defaults change behaviour for every task:
test.shnow runs under an in-containertimeoutwith a 30 s grace period, and a sandbox with a CPU limit gets the CPU-count env vars unlessderive_cpu_envis off. The other knobs are empty by default. The reward and failure-kind rules are unchanged.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code