Repository navigation
feat(harbor): dataset identity, derived-only manifest and digest check (M33) - #4664
Conversation
|
/ok to test 31781c3 |
31781c3 to
28d48e7
Compare
|
/ok to test 28d48e7 |
28d48e7 to
c337d08
Compare
|
/ok to test c337d08 |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
I found three issues in dataset identity and manifest handling, plus one small documentation correction. Details and suggested fixes are inline.
c337d08 to
aac3bac
Compare
|
/ok to test aac3bac |
|
/ok to test 3b1d083 |
|
Thanks, this one was real. As of 3b1d083 the claim and every progress manifest are built from verified digests only. _build_manifest now passes names=list(digests) to Manifest.build so no folder is hashed on the way, and the checkpoint written after each download goes through a small _checkpoint_digests helper that carries the previous manifest's digest forward for a task the loop has not reached yet when its folder is still there, since that digest was verified when it was written and pins the same task version, and drops it when the folder is gone so the task is fetched again. With your reproduction the first rerun downloads alpha, writes a manifest that still holds beta's trusted digest, then refuses beta, and the second and third reruns refuse it the same way while prepare_target raises ManifestError on the folder, so nothing is materialized with harbor-package-store provenance. The regression test in test_harbor_package_store.py runs exactly that sequence, three fetches, a prepare, then the move-aside recovery, and asserts the edited hash never appears in manifest.toml, and I confirmed it fails on the previous code at the first checkpoint. I also ran the same scenario against the M9 commit, whose dict-based _manifest_text only emits a digest for tasks already in the verified mapping, and it keeps refusing the edit across repeated fetches with no edited hash recorded, so M9 did not need a change (its prepare path has no manifest check at all, that arrives with M33). |
|
/ok to test 66bcacd |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
The checkpoint-manifest finding is addressed. The reviewed change is unchanged by the rebase, and the required checks pass.
|
/ok to test 5fb6542 |
|
/ok to test 092a65f |
|
/ok to test 4d4bf21 |
|
/ok to test e8ee25d |
|
/ok to test 58dccd9 |
|
/ok to test e67e9b2 |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Rechecked against the previously approved revision and current direct parent. Earlier findings remain addressed; 1,027 focused tests and the manifest migration probes pass. Required CI checks pass. No new blockers found in the incremental review.
|
/ok to test 275d367 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — two RISK regressions remain in package-store cache migration and reuse.
Reviewed all 19 changed files and traced fetch, manifest reconciliation, preparation, server identity checks, and rollout provenance. The checkpoint fix now preserves previously verified hashes without hashing unchecked folders, and unsupported schemas are propagated rather than rewritten.
The inline findings include concrete failure cases, preservation requirements, and proposed acceptance checks. Review validation was static only; no tests were executed. Suggested code must be verified before adoption.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
/ok to test 7b6ddfb |
ffrujeri
left a comment
There was a problem hiding this comment.
Thanks for working through all the earlier rounds. The two codex RISKs (legacy sha256: digests and tasks owned by other orgs) look fixed, with regression tests matching the reported scenarios, and the focused manifest, package-store and rollout-collection tests pass locally. I left two small questions inline: targeting a single task folder skips the manifest check, and a license-only [gym] table shifts the per-task row digests. Neither looks large, but I'd like to settle them before approving.
Small doc point: the task_data.py module docstring, the materialize_task docstring and the README say the collector copies "the _ng_* keys", while the code copies only the two PROVENANCE_KEYS (which seems to be the intended safety property).
nemo_gym/tasks/harbor/task.py (around line 562): Could a dataset.toml that only adds [gym] license = "..." (or type) change every task's _ng_digest? It looks like task_digest still branches on is_empty, which now counts the identity fields, while apply_dataset_config uses shapes_tasks. Locally a license-only [gym] made digest != folder_digest for an unchanged task, so rows written before the edit would get a 409. Would it make sense to branch on not dataset.shapes_tasks here, so the license change shows up only through dataset_toml_digest?
|
/ok to test b3a4550 |
|
/ok to test 392689f |
parse_global_config_dict_from_cli monkeypatches hydra.main.get_args_parser to disable Hydra's help and left the patch in place, so a second parse in the same process wrapped the previous wrapper, one frame deeper each time; after 987 parses the parser recursed past the limit (RecursionError inside argparse/gettext). The unit-test session reaches the CLI from about that many tests, so the three multi-step tests this branch adds tipped the CI job over: test_harbor_validation and test_super35_batch_launcher failed with RecursionError, as every PR above this one did. The patch now lasts for the hydra call alone and is restored in a finally, the form the M38 second slice (#4872) already carried further up the stack; that slice's hunk becomes a no-op here. A test parses four times and checks hydra's own function is back. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
Every Compose service with a build: section is built at prepare, as Harbor's docker compose build does. One build entry per (context, service): main keeps hb__<hash>, a sidecar is hb__<hash>-<service>. built-images.json records a services map per context (the top-level image stays main's, legacy records still read). The loader substitutes the recorded image for every built service and drops build: and pull_policy from the document the sandbox receives. The docker path builds the project in one compose build with an images override file passed last; buildah and podman build one service at a time with the direct-path argv. The blanket sidecar refusal is gone; the security refusals stay for every service. Verified on this node with buildah: counselbench-100 main plus world, tb3-preview-v2 three services. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
Generalizes the harbor environment server and the loader beyond the two
Terminal Bench datasets, per the M27 row of the gym-harbor-tasks RFC.
Shipped:
- Operator `secrets` on the server config reach the test.sh process only:
they fill `${NAME}` templates in `[verifier].env` and are exported into
that process; sandbox creation and the agent turn never see them.
- ATIF v1.7 `trajectory.json` written to /logs/agent before every verify
(shared and separate mode), exported from the Gym transcript by the new
`nemo_gym.atif_export.transcript_to_atif`; a failed export masks the
turn (`harbor:trajectory_export_failed`); Terminus user turns become the
previous step's observation (exporter extension).
- In-server image pull retries (`image_pull_retries`, jittered backoff,
per-server gate) before a retryable seed failure.
- Recursive dataset discovery: task folders may sit in subfolders;
dataset.toml and recorded image configs are read from the dataset root;
the taskset mapping records nested tasks under `paths`, which the server
and the oracle agent resolve.
- `gym dataset validate` reports verify time (`verify_s`) and the network
the verifier ran under (`network`) per task; results carry
`verifier_network`.
- `SandboxAccess.user` filled from the task's `[agent].user`.
- A slow agent-session close that fails only by timeout no longer
discards the finished turn; it is verified with observations unset.
- Per-task episode deadline enforced by default (`enforce_task_timeouts`,
`harness_setup_allowance_s`); the sandbox lifetime follows the task
budget; overruns fail with `harbor:task_deadline`.
- `EpisodeFailure.step`, forwarded by the collector as `_ng_failure_step`.
- `[gym.tasks."<id>"]` gains `verifier` overrides and `artifacts`
additions, applied by the loader like the `environment` overrides.
- `separate_verifier_for_artifacts` forces separate mode for tasks that
declare artifacts.
- The task's `[agent].timeout_sec` travels in the agent-session seed as
`agent_timeout_sec` (the row metadata stays until harnesses read it).
Already on the branch and left as is: taskset mapping with per-task
digests, strict rejection of Windows and TPU tasks, tool grants as the
`tool_accesses` list, the reward.txt fallback, mask_sample on Gym-side
failures and the reward.json rule.
Review fixes (Devil's Advocate on this commit): the ATIF live profile
exports model-caused shapes as partial trajectories instead of masking
them (a reasoning item no answer follows becomes an agent step with an
empty message and extra.nemo_gym.incomplete = max_output_tokens; several
reasoning segments join with newlines; empty or encrypted reasoning and
non-object tool arguments export with a note under extra.nemo_gym), and
still raises for what ATIF cannot represent; test.sh receives only the
`[verifier].env` the task resolves, never the whole secrets block; the
per-task deadline starts when the sandbox is ready, so image pull
retries are not charged against it (`_post_seed_budget_s`; the sandbox
TTL keeps the full budget); Compose groups and separate verifier
sandboxes get the same in-server pull retries (`_start_with_pull_retries`);
prepare records compose-images.json at the dataset root for nested
tasks; and duplicate task IDs are rejected by the folder walk itself,
before base-image recording and Dockerfile builds; the pull-failure check
walks exception groups (a Compose group whose cleanup failed too) and
the separate verifier's retry path has committed tests.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
|
/ok to test 4c5a340 |
|
/ok to test 6cc8122 |
Harbor tasks write Compose service fields the sandbox group rejected at seed or ignored: `alibaba-aaig/alibaba-ctf` has `restart: always` and a custom `agent_network`, `grafana/o11y-bench` a custom `harbor-shared` network, and about 20 datasets use `deploy.resources`, `extra_hosts`, `pull_policy`, `platform`, `post_start` or container options. Prepare and the adapter now give each a defined meaning through one normalizer, `compose_config.check_compose_fields`, and fail naming the field otherwise: - `deploy.resources`: `limits`, then `reservations`, then the legacy `cpus`/`mem_limit`, size each service's sandbox; `reservations.devices` with the `gpu` capability becomes the service's GPU count. GPU sidecars route per service: the environment server runs a service that reserves GPUs on the `gpu_sandbox_provider` block, with its `default_metadata` and the task's `gpu_types[0]` under `request_gpu_type`, as M13 does for the main service; the adapter takes `service_providers`. - `restart` is accepted and recorded (`restart_policies`); the group restarts nothing. `pull_policy` maps to `always`/`missing`/`never`, applied per sandbox by providers implementing `SupportsSandboxPullPolicy` (OpenSandbox's pull-policy extension, Docker's `--pull`) and recorded otherwise. `platform` must match the deployment platform at prepare and at seed. - Custom `networks` map onto the pod network as name scopes: a service resolves the services sharing a network with it, by name and alias, and nothing else; `extra_hosts` add hostname entries. - `post_start` hooks run in order once the service's command has started; a failing hook fails the seed. - `tmpfs`, `ulimits`, `sysctls` and `security_opt` sit behind `SupportsSandboxServiceOptions`; prepare reads the provider name from the `sandbox:` block's keys (never its values) and fails with `<task>: environment/docker-compose.yaml: service '<n>' <field> is not supported by the <provider> sandbox provider`. Docker applies all four as run flags; OpenSandbox applies none. Tests cover the normalizer (fixtures modelled on the two examples), the adapter against real processes (network scoping, extra hosts, GPU sidecar on a second provider, hooks, options, pull policy, platform), both providers, prepare failing with the field name, the CLI pass-through and the server's routing. README documents the field table and the capability check. Review fixes. `normalize_deploy` is idempotent: it accepts its own `reservations.gpus` output (a positive integer, never beside `devices`), so the document the server normalizes once and writes passes the adapter's second pass; a server test now starts the GPU-sidecar group through the real `AsyncSandboxCompose`. A service on its own provider is forwarded (`forward_ports`), volume-initialized, seeded and mounted through that provider (one shared-storage helper per provider). `network_mode` chains resolve to the end of the chain in any declaration order, and a cycle is named before provisioning. Prepare and seed decide the same way: `extra_hosts` on a sidecar whose image runs as a non-root user (no host injection) fails prepare once the image configurations are recorded, with the reason the adapter gives; `platform` is read at prepare from the same `sandbox_provider_options.platform` the server reads (`compose_platform_from_overrides`); and the capability check runs per service, a GPU-reserving sidecar (or every service of a GPU-declaring task) against the `gpu_sandbox_provider` block's provider (`gpu_sandbox_provider_from_overrides`, read from that block's keys like the `sandbox:` block). Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
…ernal volumes (M22)
Harbor tasks mount files into their Compose services: `abhishek203/task-aw` bind-mounts `./seed.json`
from the task folder into a sidecar, kumo-style tasks share named volumes between services, and some
declare `external: true` volumes the deployment has to supply. Prepare and the environment server now
resolve `volumes` (short and long syntax) through one planner, `plan_compose_volumes`:
- a bind mount of a task file or folder becomes an `x-sandbox.uploads` entry; the Compose adapter
copies it into the service after its sandbox starts and before its command runs, creating the
receiving folders and making the tree readable by any user;
- a named volume declared at top level stays, in long syntax, for the provider's shared storage, which
the adapter already mounts into every service naming it;
- an external volume, or a bind of a host path outside the task, resolves through `volume_sources`, a
new reserved key of the `sandbox:` provider block (volume name or host path to a shared-storage path);
prepare fails naming the volume when it is missing;
- a bind of Harbor's `/logs` tree onto `main` is dropped (the server creates it at seed); anonymous
volumes, `tmpfs`, bind propagation, volume drivers and other unsupported options fail prepare
naming the field.
`gym eval run` and `gym dataset validate` read `volume_sources` from the `--sandbox` provider file and
the configuration the command names, resolving only that node so provider credentials are not needed
at prepare; `prepare_target(..., volume_sources=...)` takes it directly. The server passes the same
mapping to `AsyncSandboxCompose`, and `adapt_non_root_sidecars` keeps a sidecar's uploads.
Tests cover the parser, the planner (with a fixture modelled on task-aw), the adapter's uploads against
real processes, the reserved key, prepare failing with the volume name, the CLI pass-through and the
server's compose document. README documents the three cases and the new provider key.
Review fixes: a task-authored `x-sandbox` key is refused at prepare and on the server naming the field, and the
adapter only reads upload sources under the `upload_root` it is handed (the server passes its task copy; a
document with uploads and no root is refused); a bound folder that contains a link fails prepare and the
adapter, naming the link, instead of reading through it; null top-level volume declarations are normalised
to `{}` by the planner and accepted by the adapter; the post-upload chmod is non-recursive and covers only
the uploaded files and folders, targets must be absolute, below `/` and free of `..` in both syntaxes, and a
folder upload is documented as a merge; `~user` bind sources raise ComposeVolumeError naming the source;
prepare checks GPU-declaring tasks against the `gpu_sandbox_provider` block's `volume_sources`
(`needs_gpu` moved to nemo_gym.tasks.harbor.task, shared with the server). Verify round: the planner's
ImageConfigError exits `gym eval run` and `gym dataset validate` cleanly; a bind source reached through a link with
an absolute target is refused at prepare (the server plans on a copy, where seed would refuse it); the adapter
chmods every folder its `mkdir -p` created, intermediates included, never `/` or what already existed.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Adil Asif <[email protected]>
…k (M33) `manifest.toml` beside the task folders now holds derived facts only, in one shared writer (`nemo_gym/tasks/harbor/manifest.py`): the source, one dataset digest over the sorted per-task digests plus `dataset.toml` plus the `downstream/` set, the `dataset.toml` and `downstream/` digests on their own, and per task the folder digest with its upstream pin. No copy of the name or version, which live in `dataset.toml`. The output is deterministic: fixed key order, sorted tasks, no timestamps, so equal manifests mean identical inputs. The registry and package-store fetchers write it; a registry fetch that adds tasks first checks the kept folders against their recorded digests so a hand edit is never blessed, and a package-store `latest` folder whose manifest was written for another version is refused as stale with the recovery step. Prepare reconciles the manifest with the loaded tasks' digests: a fetched dataset whose folders changed is refused, naming the tasks and telling the user to delete the folder, or move it aside, and run again; a local folder gets a manifest and follows its own edits; when only `dataset.toml` moved the derived facts are rewritten without a fetch; a manifest written before digests existed is upgraded in place. The dataset digest is recorded in the run config (`tasksets.<name>.dataset_digest`, `dataset_toml_digest`), in every row as `task_data._ng_dataset_digest`, and, because rollout collection now copies a materialized row's `_ng_digest` and `_ng_dataset_digest` task data onto the record it writes, in every `rollouts.jsonl` row as `_ng_dataset_digest` beside `_ng_digest`. `[gym]` in `dataset.toml` gains `license` (Gym's dataset license values, named once as `DatasetLicense`) and `type` (train, validation, example, benchmark), with Gym's rule that train and validation need a license; the scaffold documents both. Wiring them into the generated `datasets:` entry stays with M37, and the automatic pull on a stale manifest with M38. Review fixes: fetchers record only the tasks they fetched (`Manifest.build` takes the names) and refuse a task folder that neither the source names nor a previous fetch recorded; prepare runs the manifest check before any base image is recorded or any Dockerfile is built or pushed; `check_manifest` fails closed on a source it does not know, a non-table `[dataset]` or a newer `schema_version`, instead of reading the folder as local; a folder git tracks (the repository's example dataset) gets its identity in memory and no `manifest.toml`, and a read-only folder keeps its identity with a warning; `_quote` writes characters above U+FFFF as TOML `\UXXXXXXXX` so such names round-trip; a deleted pinned folder is reported as `missing`, not `changed`; the per-task fetch checkpoints no longer rescan or rehash the dataset folder; the collector copies only the two digest keys (`PROVENANCE_KEYS`) from a row's dataset-controlled `task_data`, never other `_ng_*` keys it reads, and `schema_version` must be the int 1, so the float 1.0 is refused. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
/ok to test 1fbb92f |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Rechecked the latest changes against the current stack parent. Earlier findings remain addressed, including older-manifest migration, mixed-owner datasets, single-task validation, and checkpoint integrity. 1,070 focused tests and independent compatibility probes pass. Required CI checks pass; no new blockers found.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40372807935 |
manifest.tomlbeside the task folders now holds derived facts only, in oneshared writer (
nemo_gym/tasks/harbor/manifest.py): the source, one datasetdigest over the sorted per-task digests plus
dataset.toml, thedataset.tomldigest on its own, and per task the folder digest with its upstream pin. No copy of the name orversion, which live in
dataset.toml. The output is deterministic: fixed keyorder, sorted tasks, no timestamps, so equal manifests mean identical inputs.
The registry and package-store fetchers write it; a registry fetch that adds
tasks first checks the kept folders against their recorded digests so a hand
edit is never blessed, and a package-store
latestfolder whose manifest waswritten for another version is refused as stale with the recovery step.
Prepare reconciles the manifest with the loaded tasks' digests: a fetched
dataset whose folders changed is refused, naming the tasks and telling the
user to delete the folder, or move it aside, and run again; a local folder
gets a manifest and follows its own edits; when only
dataset.tomlmoved thederived facts are rewritten without a fetch; a manifest written before digests
existed is upgraded in place. The dataset digest is recorded in the run config
(
tasksets.<name>.dataset_digest,dataset_toml_digest), in every row astask_data._ng_dataset_digest, and, because rollout collection now copies amaterialized row's
_ng_digestand_ng_dataset_digesttask data onto therecord it writes, in every
rollouts.jsonlrow as_ng_dataset_digestbeside
_ng_digest.[gym]indataset.tomlgainslicense(Gym's dataset license values, namedonce as
DatasetLicense) andtype(train, validation, example, benchmark),with Gym's rule that train and validation need a license; the scaffold
documents both. Wiring them into the generated
datasets:entry stays withM37, and the automatic pull on a stale manifest with M38.
Review fixes: fetchers record only the tasks they fetched (
Manifest.buildtakes the names) and refuse a task folder that neither the source names nor a
previous fetch recorded; prepare runs the manifest check before any base image
is recorded or any Dockerfile is built or pushed;
check_manifestfailsclosed on a source it does not know, a non-table
[dataset]or a newerschema_version, instead of reading the folder as local; a folder git tracks(the repository's example dataset) gets its identity in memory and no
manifest.toml, and a read-only folder keeps its identity with a warning;_quotewrites characters above U+FFFF as TOML\UXXXXXXXXso such namesround-trip; a deleted pinned folder is reported as
missing, notchanged;the per-task fetch checkpoints no longer rescan or rehash the dataset folder;
the collector copies only the two digest keys (
PROVENANCE_KEYS) from arow's dataset-controlled
task_data, never other_ng_*keys it reads, andschema_versionmust be the int 1, so the float 1.0 is refused.🤖 Generated with Claude Code