Repository navigation
feat(oracle): add the oracle agent and gym dataset validate for Harbor tasks - #3675
Conversation
0ca054d to
1a7d02a
Compare
1a7d02a to
cc5fd6c
Compare
cc5fd6c to
c199385
Compare
c199385 to
4aade10
Compare
4aade10 to
ac39be0
Compare
ac39be0 to
8646d47
Compare
yuhezhang-ai
left a comment
There was a problem hiding this comment.
The Oracle reuses the normal grading path well. Before merging, please make validation account for missing selected tasks, use its own artifacts and effective output path, exclude tasks without solutions from execution, and reconcile successful retries with earlier failure records. Those cases currently allow incorrect pass/fail reports. The remaining inline suggestions are nonblocking.
Reviewed 8646d474 against its own base, e33e106f. Focused local tests and reproductions passed; no live sandbox or model rollout was run.
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Rechecked 1114c5f883614249eb40bd5fb6987e4aac7482a3 against its current stack parent f1e36c7617729580410f2d38b741f4c39131be79 (#3674). Confirmed the previous findings are addressed:
- A model reward alone no longer passes the validation report: success requires affirmative
oracle=solvedmetadata and a valid reward. - Validation rejects a foreign cache before server startup or dispatch and preserves the cached files. A legitimate Oracle cache resumes, and an explicit fresh run replaces the foreign cache.
- Both
--agent harbor_oracleand--agent harbor_oracle_agentroute toresults/harbor/validation/. A subsequent model resume dispatches model work into its separate evaluation directory. - The previously omitted native Codex, OpenCode, Pi and OpenClaw harnesses are now recognized through their sandbox-model-call declarations.
One new P2 remains in the added cache guard: an interrupted final JSONL write prevents resume from reaching the collector's existing recovery logic. Details and the verified reproduction are attached inline.
The cache checks exercised the real CLI and collector with server execution stubbed; they do not substitute for the pending live validation smoke on the current environment-server implementation.
yaoyu-33
left a comment
There was a problem hiding this comment.
Thanks for the work here. The reference-solution validation path is a useful addition, and reusing the collector with an oracle agent in place of a model is a clean design. I checked the head against the earlier review threads; the ones from ananthsub, ffrujeri and yuhezhang-ai hold in the code except the one noted below.
Inline comments cover the two items I'd like addressed before merge (resume crash on a truncated last line, which is still the open interrupted-write thread; and validate exiting 0 when nothing was validated), plus a hermetic-test fix, the old-provider env/user error, and the missing CLI reference entry.
A few things for the PR description:
- The Rollouts section is still the placeholder. Could you add a fresh
gym dataset validaterun on this head (positive and negative tasks) through theharborenvironment server? The earlier evidence predates this stack, and the CI evidence cited is for3709ae7a, not the current head. - The status comment doesn't mention the open interrupted-write thread, and it says
miniswe_sandboxedand a base-class default declarecalls_model_from_sandbox; neither is in this head (I understand they land later in the stack). - The
global_confighost-resolution change (explicitdefault_hostwins; loopback hostname withuse_absolute_ipis now aConfigError) is broader than validation. Could it be called out as its own item or split out, with a release note?
One low-likelihood caveat, not a request: if a dropped connection makes the HTTP client resend /responses, solve.sh would run a second time in the same sandbox.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/ok to test 85ddd8c |
This comment has been minimized.
This comment has been minimized.
yaoyu-33
left a comment
There was a problem hiding this comment.
Re-reviewed at 85ddd8cd. The oracle contract now in this PR looks right to me: the environment server places solution/ only for harbor_oracle_agent, resolves [solution].env at seed time (a missing variable now fails the seed instead of the turn), and the oracle reads no task folder or config. SandboxAccess.user/env and AgentSeedSessionRequest.agent_timeout_sec are generic, optional, and stay off the wire when unset.
I checked Felipe's six threads against this head and they all still hold:
- Truncated final JSONL record crashes the resume guard (
_validation_rowsis unchanged), for both the materialized inputs and the cached rollouts. Must-fix. gym dataset validateexits 0 when no task has a solution. Must-fix.test_eval_run_with_the_oracle_is_a_validation_rundoes a real hostname lookup; it fails here too (socket.gaierror), onegethostbynamemonkeypatch fixes it. Must-fix.- Older custom providers get a raw
TypeErroronceenv/useris forwarded withpreserve_background_services=True. Fine as a linked follow-up. cli-commands.mdxstill has no entry forgym dataset validateor--agent harbor_oracle. Fine as a linked follow-up.
One new inline note on how a failed oracle detection surfaces. Requesting changes for the three must-fixes above.
|
/ok to test 2569da8 |
|
/ok to test 200d029 |
|
Thanks for the re-review. The three must-fixes are at head 200d029: _validation_rows in nemo_gym/tasks/harbor/validation_report.py repairs a truncated or non UTF-8 final record for both the materialized inputs and the cached rollouts, gym dataset validate exits 1 and reports 0 tasks validated when no selected task ships a solution/, and the oracle validation-run test patches gethostbyname. Your inline note on a failed oracle detection is fixed at the same head and that thread carries the detail. On the two follow-ups, exec already forwards env and user only when they are set so a provider with the older signature keeps working, and cli-commands.mdx on this head documents gym dataset validate and --agent harbor_oracle. |
ffrujeri
left a comment
There was a problem hiding this comment.
Approving 200d029d. All five follow-ups from the 85ddd8cd threads are fixed:
- resume tolerates a truncated final record and reports damage elsewhere by file and line;
- an empty selection fails with "0 tasks validated";
- the hostname-dependent test is stubbed;
- older custom providers get a named
TypeError; - the CLI reference covers
gym dataset validateand--agent harbor_oracle.
The Harbor, Oracle, validation and sandbox suites pass locally (1030 passed, 14 skipped). CI is green apart from the non-blocking harness conformance probes, with the unit Test job still running at the time of approval.
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Rechecked 200d029d128985aab326cf7ee295c120df2824e7 against its immediate stack parent d0f4c2166ae7aa52467ef6f1733d69c4dab473c4 (#3674), with independent Codex and Claude reviews and follow-up verification.
Existing threads — confirmed addressed. I replied in the original threads for interrupted-write recovery, empty selection, the hostname fixture, legacy-provider diagnostics, the CLI reference, and ambiguous Oracle wiring. These are confirmations of the fixes, not new findings. The interrupted-write reply also covers the duplicate report. The earlier cache-separation and Oracle-result checks remain fixed. Materialized inputs have a distinct contract: truncated inputs are safely rejected and preserved, rather than repaired.
New threads — two P2 findings. The two inline comments attached to this review concern (1) the automatic network binding exposing the unauthenticated head/config endpoint, and (2) uploaded solution files retaining root-only permissions when a prebuilt image runs as a non-root user. These are newly reported findings in the current implementation; they do not reopen the six issues above. In particular, the permission issue is separate from the fixed Oracle-wiring diagnostic, and is not a claim that moving the upload to the environment server introduced it.
Validation: 703 focused tests passed and 14 skipped. Seven macOS tar failures reproduce on the exact stack parent. Separate CLI/collector cache controls, snapshot checks, and changed-file lint/format checks passed. The inline comments state the limits of the network and permissions reproductions; no live provider run was performed in this review.
The current CI run passed the core tests and all eight server shards. The explicitly nonblocking harness-conformance jobs remain red; I am not treating those as a new blocker or calling the whole workflow green. Fresh positive and negative Oracle validation through the current environment-server implementation is still pending in the PR description; please attach that evidence before merge. The older resources-server smoke does not cover this handoff.
Please address the two new P2 comments before approval.
|
/ok to test 28b1627 |
|
Rechecked
The suites pass locally (1026 passed, 13 skipped). Two things remain before merge, so I'm holding approval:
|
|
/ok to test f49526a |
|
/ok to test c6a8673 |
…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]>
|
/ok to test ff47d67 |
ffrujeri
left a comment
There was a problem hiding this comment.
Re-approving ff47d672 after the rebase onto main (#3674 merged). git range-diff against 28b16278 shows no change to this patch beyond context from main, such as claude_code_agent joining the same agent lists. The fixes for absolute_ip_server_types and the /solution readability are intact, and CI is green apart from the non-blocking conformance probes.
One thing is still owed: the Rollouts section is still the placeholder. Please attach the fresh gym dataset validate run through the harbor environment server, with at least one solved task and one failing task, before merge.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39658610632 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39659421569 |
|
The Rollouts section now carries a fresh run on this head through the harbor environment server and the oracle on OpenSandbox: six Terminal-Bench 2.1 task folders, two solved at 1.0 (openssl-selfsigned-cert and regex-log), a deliberate negative with a solution that writes a regex matching nothing, the two tasks broken upstream failing in their own test.sh, and fix-git failing because at this head a declared docker_image takes no WORKDIR from the image, so the oracle ran in /app instead of /app/personal-site, which the image-configuration reading later in the stack fixes and which [environment].workdir works around here. The command exited 1 as it should with solutions below 1, and the raw log, rollouts JSONL and verifier outputs are kept with the review notes. |
What does this PR do?
M3 of the Harbor tasks stack, stacked on #3674 (
cf44a4be). Adds an Oracle agent that runs a task's reference solution instead of a model, andgym dataset validate <folder | harbor:dataset>, which runs every task's solution through the normal verifier and reports whether each one scores 1. This is the next layer of the existing Harbor proposal, so no separate issue is needed.Oracle agent (
responses_api_agents/harbor_oracle_agent): an ordinary native-session harness driven by theharborenvironment server.SandboxAccess. On close it disconnects without stopping the sandbox, which stays owned by the environment server.harborenvironment server recognises the oracle by the implementation name of the agent instance it serves (harbor_oracle_agent, the key under itsresponses_api_agentsblock) and, after seeding the sandbox, uploads the task snapshot'ssolution/to/solutionas root, readable by the task user, before opening the oracle's session. No other harness receives the solution. On its turn the oracle runsbash /solution/solve.shin the task workdir as the task user from the seed'ssandbox_access. It never calls a model.solve.shruns with service-preserving execution, so background services it starts are still up when the verifier runs. The environment server resolves[solution].envhost templates and hands them over assandbox_access.env,DEBIAN_FRONTENDdefaults tononinteractive, and the timeout is the seed'sagent_timeout_sec(the task's[agent].timeout_sec), capped bymax_solve_timeout_swhen that is set. A task withoutsolution/solve.shhas nothing at/solution/solve.shand is reportedunvalidated.oracle=solved|failed|unvalidated, plus the return code and any error type. A task withoutsolution/solve.shreturnsunvalidatedand does nothing in the sandbox.gym dataset validate(nemo_gym/tasks/harbor/cli.py,validation_report.py):results/harbor/validation/<taskset>/, separate fromgym eval runoutput, and runs it with the Oracle through ordinary end-to-end rollout collection. No model server is injected or required.--limitand collection.solve.shcannot reuse an old success.Shared changes:
AsyncSandbox.exec(..., preserve_background_services=True)now forwards per-commandenvanduser, and passes them only when set, so custom providers implementing the older signature keep working. OpenSandbox applies them inside its native bash session.global_config.py: an explicitdefault_hostnow takes precedence over hostname lookup. Withuse_absolute_ip=trueand nodefault_host, a hostname that cannot be resolved, or that resolves to a loopback or unspecified address, is now aConfigErrorwith guidance, instead of silently advertising an address the sandbox cannot reach.gym eval runon a Harbor target defaultsuse_absolute_ip=truefor harnesses that call the model from inside the sandbox (Hermes, sandboxed mini-SWE, OpenCode and Pi, or any agent config declaringsandbox_model_base_url). The default output path also moves into the generated run config, so explicit config files and overrides take precedence.scripts/add_legacy_agent_environment_servers.pytreatsharbor_oracle_agentas a native-session harness.Validation
3709ae7a:pytest responses_api_agents/harbor_oracle_agent/tests tests/unit_tests/test_harbor_validation.py tests/unit_tests/test_harbor_validation_report.py tests/unit_tests/test_harbor_tasks.py tests/unit_tests/test_global_config.py tests/unit_tests/test_sandbox.py tests/unit_tests/test_opensandbox_provider.py tests/unit_tests/test_add_legacy_agent_environment_servers.py environment_servers/harbor/tests: 612 passed, 14 skipped. The skips include the live OpenSandbox tests.3709ae7a: Lint, Test, and server shards 0, 1, 3, 4, 6 and 7 pass. Shard 2 fails data validation forresources_servers/indirect_prompt_injection, whose data files are among those deleted in the feat(harbor): add the environment server for Harbor-format tasks #3674 base (raised on feat(harbor): add the environment server for Harbor-format tasks #3674). Shard 5 fails inminiswe_sandboxed_agent(APIConnectionErrorto its mock model, same as feat(harbor): add the environment server for Harbor-format tasks #3674) and in one PTY timing test interminus_2_sandboxed_agent; neither is touched here. The codex, opencode and pi harness conformance failures also occur onmain.Rollouts
Live
gym dataset validaterun on this head (ff47d6722) on 21 Oct 2026, through theharborenvironment server and theharbor_oracle_agent, with the OpenSandbox provider (amd64 pods, since the Terminal-Bench 2.1 images are the published amd64alexgshaw/<task>images) and no model server configured. The target was a folder of six Harbor task folders: five Terminal-Bench 2.1 tasks copied unmodified from the published dataset and one deliberate negative,regex-log-wrong-solution, a copy ofregex-logwhosesolution/solve.shwrites a regex that matches nothing. The command, run from an export of this commit with the OpenSandbox block of the localenv.yaml:The overlay only pins the sandbox platform to
linux/amd64, sets small pod resource requests and shortens the create timeouts. For every task the environment server created the sandbox, uploaded the task'ssolution/to/solutionand opened the oracle's session; the oracle ranbash /solution/solve.shin the task workdir; the verifier then rantests/test.shand readreward.txt. All six rollouts produced a result (no masked rows, no failures file entries). The command exited 1, as it must when a selected solution scores below 1. Report as printed:openssl-selfsigned-certsolve.shexited 0; verifier passed 6/6 tests.regex-logsolve.shexited 0; verifier passed 1/1 tests.regex-log-wrong-solutionsolve.shexited 0 but wrote a regex that matches nothing; verifier:Expected ['2025-01-09', ...], but got [].qemu-startupsolve.shexited 0 afterSystem is booted and ready; the published image'stests/test.shcannot installcurl/uv(bullseye-securitypackages 404), so the verifier writes reward 0.qemu-alpine-sshqemu-startup; the oracle's SSH setup inside the VM ran.fix-gitsolve.shexited 128 (not a git repository): the oracle ran in/app, the server's default workdir, while the image setsWORKDIR /app/personal-site. With a prebuiltdocker_imagethis head takes no settings from the image or Dockerfile, so such a task needs[environment].workdiruntil the image configuration is read later in the stack. Verifier failed 2/2 tests.A first attempt with the same command failed all six seeds before any sandbox existed, because the local
env.yamlcarried asandbox.opensandbox.setupblock that the provider at this head does not accept (OpenSandboxProvider.__init__() got an unexpected keyword argument 'setup'); the block was removed from that local file and the run repeated. Nothing in this PR changed between the two attempts. The raw log, the rollouts JSONL and the verifiertest-stdout.txtfiles are kept with the review notes.Compatibility and benchmark impact
New agent and CLI command. No benchmark scores or verification rules change. User-facing changes:
max_solve_timeout_sto capsolve.sh.+resume_from_cache=falseor a new output path); saved results are preserved.use_absolute_ip=trueand nodefault_hostnow fails at startup if the hostname resolves to loopback (for example Ubuntu's default127.0.1.1mapping). Set+default_host=<reachable address>. Previously such runs started but advertised an address remote callers could not reach.default_hostnow wins overuse_absolute_iplookup.gym eval runwith an in-sandbox harness now advertises the host IP by default.Checklist
pre-commit run --all-files).git commit -s).