Skip to content

feat(harbor): separate verification in its own sandbox (M10) - #3744

Merged
adil-a merged 1 commit into
adasif/harbor-m9-package-storefrom
adasif/harbor-m10-separate-verifier
Oct 21, 2026
Merged

adil-a merged 1 commit into
adasif/harbor-m9-package-storefrom
adasif/harbor-m10-separate-verifier

Conversation

@adil-a

@adil-a adil-a commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

M10 of the Harbor tasks RFC: separate verification, the mode every Terminal Bench 4 task uses. Stacked on the M9 PR (#3743).

  • harbor resources server. When a task's verifier declares environment_mode = "separate" or a [verifier.environment], verification follows Harbor: the main-container [[verifier.collect]] hooks run in the agent's sandbox, /logs/artifacts and every artifacts entry are copied to the host, the agent's sandbox is stopped, a fresh sandbox starts from the verifier's prebuilt image with the verifier's resources, the artifacts and tests/ are restored into it, and test.sh runs there with [verifier.env] and [verifier].user. A task in separate mode without a [verifier.environment] image verifies in a fresh sandbox from the task image. The verifier sandbox is stopped afterwards. /close_session does not stop the agent sandbox twice. The response carries verifier_mode.
  • Not yet. Sidecar (Compose) hooks and artifacts are skipped with a warning. A verifier that must be built from tests/Dockerfile is refused at seed with a 422.
  • sandbox_io. download_path and upload_path move a single file or a directory between the host and a sandbox, creating parent folders. Running transfers as root moved to the M11 PR (feat(miniswe): episode sessions on the resources server sandbox (M11) #3745).

Review fixes (2026-10-04)

  • Dockerfile ENV now reaches the agent sandbox. The loader records ENV lines from a base-image-only Dockerfile on HarborTask.env, merged under [environment.env], but the server built the agent's SandboxSpec from [environment.env] alone. The agent sandbox now uses task.env. A separate verifier still uses its own [verifier.environment].env.

Validation

  • pytest resources_servers/harbor/tests responses_api_agents/harbor_oracle_agent/tests tests/unit_tests/test_harbor_tasks.py: pass. TestSeparateVerification (six tests) covers the main-container collect hook with the sidecar hook skipped, a directory and a file artifact pulled to the host, the agent sandbox stopped before test.sh, tests and artifacts restored into the verifier sandbox, the verifier exec's env, user and budget, no second stop at close, the spec built from [verifier.environment], the fallback to the task image, the 422 for a verifier that must be built, masking plus both sandboxes stopped when the verifier sandbox fails, and Dockerfile ENV in the agent's spec.
  • pre-commit run --files <changed files> clean.

Rollouts

Reference solutions of the 52 Terminal Bench 4 CPU tasks through gym dataset validate on OpenSandbox Cell-3, all in separate mode. Numbers in the M12 PR of this stack (#3746). Those runs predate the rebase below.

Rebased onto main

Rebased onto main 128eab4 (2026-10-04).

Compatibility and benchmark impact

Shared-mode tasks (hello-world, Terminal Bench 2.1) are unchanged apart from verifier_mode: shared in the response and Dockerfile ENV now applied to the agent sandbox.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@adil-a
adil-a added this pull request to stack #3733 September 29, 2026 01:01
@adil-a adil-a changed the title feat(harbor): separate verification in its own sandbox feat(harbor): separate verification in its own sandbox (M10) Sep 29, 2026
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from af92f5c to c7f7484 Compare September 29, 2026 01:10
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from c7f7484 to 115f904 Compare September 30, 2026 03:48
@adil-a
adil-a removed this pull request from stack #3733 September 30, 2026 03:50
@adil-a
adil-a added this pull request to stack #3806 September 30, 2026 03:51
@adil-a
adil-a removed this pull request from stack #3806 September 30, 2026 04:12
@adil-a
adil-a added this pull request to stack #3808 September 30, 2026 04:12
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from 115f904 to fc7ea8f Compare October 4, 2026 23:19
Comment thread environment_servers/harbor/app.py Resolved
Comment thread resources_servers/harbor/app.py Resolved
Comment thread nemo_gym/sandbox/transfer.py Resolved
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from fc7ea8f to ad84e8f Compare October 9, 2026 20:08
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from ad84e8f to 8e64e72 Compare October 9, 2026 20:20

@yuhezhang-ai yuhezhang-ai 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.

Please address the failure-handling, fallback-environment, and artifact-collection cases below, and reconcile the two differences from the current RFC. The lifecycle-test suggestion is non-blocking.

Comment thread environment_servers/harbor/app.py Resolved
Comment thread environment_servers/harbor/app.py Resolved
Comment thread environment_servers/harbor/app.py Resolved
Comment thread environment_servers/harbor/app.py Resolved
Comment thread environment_servers/harbor/app.py Resolved
@adil-a
adil-a removed this pull request from stack #3808 October 14, 2026 00:54
@adil-a
adil-a added this pull request to stack #4583 October 14, 2026 00:55
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from 8e64e72 to 5a2ef47 Compare October 14, 2026 01:06
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from 5a2ef47 to 92bb899 Compare October 14, 2026 01:33
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from 92bb899 to b8b559d Compare October 14, 2026 15:02
@adil-a
adil-a force-pushed the adasif/harbor-m10-separate-verifier branch from b8b559d to 6958650 Compare October 14, 2026 16:29
@adil-a
adil-a marked this pull request as ready for review October 14, 2026 16:49
@adil-a

adil-a commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a775952

@adil-a

adil-a commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f67300c

@adil-a

adil-a commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 634e758

@adil-a

adil-a commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 42c71a6

@adil-a

adil-a commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 85d5bd9

@adil-a

adil-a commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Status at the new head 85d5bd9. Every thread from both reviews is answered inline, the opt-in one you resolved on 14 Oct, so pointers only.

Artifact collection is best effort the way Harbor's is, with the three rechecked cases closed (device nodes and FIFOs refused in both link modes, an over-long name not collected, a collect hook timeout warned and skipped) while a lost sandbox or a full disk still masks. Shared mode runs collect hooks, restored directories replace what the verifier image shipped, probe failures propagate, exclusions reach tar unanchored exactly as Harbor passes them, a single file artifact keeps its mode bits and the verifier now receives the archive the sandbox packed rather than the host copy, each artifact stages under its own root, the transfer user prepares file artifacts, and the verifier lifetime is episode sized.

Three answers are placements rather than fixes here: the verifier working directory and variables come with the rewrite in #4566, /logs/artifacts is created at seed from #3754, and the operator setup premise went away with #3807, which removed sandbox_setup_commands. Two are kept by design with the rule written in the README: baked tests in an explicit verifier image are not overwritten, and the support table was rewritten alongside. The lifecycle assertion in the tests now checks the stop at verifier creation.

@yuhezhang-ai yuhezhang-ai 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.

Rechecked 85d5bd987 against its immediate stack parent and inspected the included changes through M20. The earlier fixes are accounted for, including those implemented later in the stack. The current Harbor and transfer suites pass: 145 tests. Two new findings below remain: a reproduced incorrect-score case that should be fixed before approval, and three regression methods that pytest never collects. The grading reproduction uses real shell/tar operations with isolated local sandbox stand-ins; it is not a live-provider/model rollout.

Comment thread environment_servers/harbor/verifier.py Resolved
@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ff55ac4

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 6e3ee5d

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 19ad5e3

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Both findings are fixed at head 19ad5e3. An artifact whose declared path is /tests, inside or over it, or at or inside /logs/verifier is collected on the host as a diagnostic but is never restored into the verifier sandbox, which closes the reproduced incorrect-score case, and the three regression methods are collected as methods of TestSeparateVerification in environment_servers/harbor/tests/test_app.py. Both threads carry the detail and are resolved.

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test fea0619

@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2c9f191

M10 of the Harbor tasks RFC. A task whose verifier declares `environment_mode = "separate"` or a
`[verifier.environment]` is verified the way Harbor does it: the main-container
`[[verifier.collect]]` hooks run, `/logs/artifacts` and every `artifacts` entry are copied out of
the agent's sandbox, that sandbox is stopped (and leaves the server's ownership table, so the
episode's final cleanup has nothing left to stop), a fresh sandbox starts from the verifier's
prebuilt image with the verifier's resources, the artifacts and `tests/` are restored into it,
and `test.sh` runs there with `[verifier.env]` and `[verifier].user`. The result says which
mode ran (`verifier_mode`). Sidecar (Compose) hooks and artifacts are skipped with a warning
until Compose groups land. A verifier that must be built from `tests/Dockerfile` is refused at
seed as a terminal failure until image builds land.

Dockerfile ENV recorded by the loader now reaches the agent's sandbox, merged under
`[environment.env]`; a separate verifier still uses its own `[verifier.environment].env`.

Squashed from the previous branch and re-applied onto the environment server.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
@adil-a

adil-a commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a794211

@ffrujeri ffrujeri 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.

Approving a7942110. The linked-parent restore is fixed: upload_archive now resolves the physical destination with a read-only probe (walking up to the nearest existing ancestor) before _prepare_restore_target runs, so a refusal touches nothing. test_keep_out_is_judged_before_the_target_is_prepared_so_a_refusal_touches_nothing covers a linked parent, trailing slashes, a file target and a missing subdirectory under the link. It also asserts that only the probe ran and that /tests stays byte-identical. The BusyBox-safe names collection (positional parameters after --, and an empty archive without tar when nothing is present) also looks right.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39682964871

This branch was previously deployed

1 inactive deployment
public — a7942110 Deployed Oct 21, 2026 by copy-pr-bot[bot] via release / finalize / notify #6387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer QA_verified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants