Repository navigation
feat(harbor): overlay image mode, Dockerfiles with FROM plus RUN run at seed without a build (M16) - #4256
Conversation
7733f07 to
64f864f
Compare
64f864f to
4e9672d
Compare
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Reviewed M16 at 4e9672df against its M15 stack base (#3807, bf7c74f2). The overlay approach is useful, but I’m requesting changes for six correctness issues around runtime-image metadata, WORKDIR creation, legacy records, shell behavior, and user/group identity. The inline comments include concrete triggers and suggested corrections; four smaller comments are nonblocking suggestions.
The focused tests pass, but targeted fixtures and shell reproductions expose the cases described below. No live provider/model rollout was run, so integration validation remains outstanding. Inherited final-USER and separate-verifier working-directory limitations are not counted as new M16 findings, and this review does not assume the ongoing M1–M3 fixes are present.
4e9672d to
7917f36
Compare
7917f36 to
e1ee143
Compare
235fe44 to
5ebea82
Compare
5ebea82 to
157022e
Compare
157022e to
3dd2f3f
Compare
|
/ok to test 3dd2f3f |
9ddb5a0 to
1fa41c6
Compare
|
/ok to test 1fa41c6 |
1fa41c6 to
ebab4b8
Compare
|
/ok to test ebab4b8 |
|
/ok to test 4befbfe |
|
/ok to test b7ede71 |
|
Status at the new head b7ede71. The six threads from your 19 Oct list and the three added that day are all answered inline: sandbox defaults come from the image that runs (a declared image takes the Dockerfile's final USER), WORKDIR instructions are created in order with the user in effect and the sandbox is created without the final workdir, pull and overlay tasks start the pinned reference the record was resolved at (the multi-arch index for a tag), the recorded Shell runs shell-form lines and exec form bypasses it, uid 0 with a group keeps the group on its workdir and runs as plain root since only Docker's --user takes user:group, and the README names harbor:overlay_failed against provider_unavailable. Legacy records re-resolve at their pinned digest (RECORD_VERSION), the prebuilt fallback is consistent across resolution errors, and shared image metadata is read once per discovery. Of the three later ones, FROM flags and an escape directive now need a build, the literal Dockerfile ENV reaches the sandbox spec, and the [agent].user carry is in #4566 with the seed change in #4663, as the replies say. |
|
Thanks, I verified the three additional findings across the stack, including the fixes in #4566 and #4663. Those are addressed. Four earlier concerns still reproduce: declared-image workdir defaults, default-shell selection, the explicit group during overlay RUN, and verifier directory ownership when These four threads still need follow-up. The verified fixes in later PRs don’t need backports just to close the earlier findings. |
|
/ok to test dcd0045 |
|
/ok to test b5dea2f |
|
/ok to test 07ff952 |
|
The four threads are addressed at head 07ff952 and each one carries the detail. A declared image takes its default user from the Dockerfile's final USER, with the FROM record supplying the user only when the Dockerfile has no USER line, overlay RUN lines run under the shell the image records and exec form lines run with no shell, a RUN line under a USER that names a group runs as that pair as written with the root exec path kept only for plain root, and the verifier directory ownership follows Harbor 0.22.0's verifier exactly as the transfer.py thread on #3754 explains, with no chown of the uploaded tree. |
|
Thanks for the updates. Of the four findings we reopened, one is now fixed and three need further work. I verified the explicit-group fix in #4566 and left that thread resolved. I replied in and reopened the three remaining threads: working-directory defaults, default-shell selection, and forced-separate-verifier directory ownership. The replies include the specific cases that still reproduce on the combined stack. Counting the later-stack fixes, that leaves 10 of our 13 findings addressed, with 3 remaining. |
|
/ok to test 6afdf58 |
ffrujeri
left a comment
There was a problem hiding this comment.
Checked this PR's own head 6afdf58a. All three of Yu's open threads still apply here, not only on the #4664 tip:
nemo_gym/tasks/harbor/task.py:264still hasworkdir = workdir or resolved.workdir, so the FROM image's/wins over the declared image's WORKDIR.environment_servers/harbor/overlay.pyoverlay_shell_commandstill leaves default-shell lines for the provider's shell (Bash on Docker), not/bin/sh -c._create_verifier_sandboxstill precreates the final workdir before the overlay replays.
Holding approval until those land. The rest of M16 can wait for that pass.
|
/ok to test 97efdc1 |
|
/ok to test 513a3c8 |
…at seed without a build (M16) The loader recognises a Dockerfile made of a pullable `FROM` plus `RUN`, `WORKDIR`, `ENV`, `USER`, `LABEL` and an empty `ENTRYPOINT`/`CMD`. `ENV`, `WORKDIR` and `USER` resolve at prepare the way `docker build` resolves them: the base image's OCI config (recorded into `compose-images.json` by `record_base_images` before the tasks load) is the starting state, `$NAME` expands against the accumulated environment, a relative `WORKDIR` joins the previous one, and each `RUN` line snapshots the state in effect at its point. Nothing reaches the sandbox with a live `$`. A base image the registry cannot resolve stops the preparation naming the image and the tasks. The environment server runs the recorded lines right after the sandbox starts, before the workdir, the healthcheck and the harness: as root unless a Dockerfile `USER` precedes the line (root images keep the plain exec path; a numeric user is mapped to its name in the image), with `ENV` exported and `WORKDIR` created and entered, all within `[environment].build_timeout_sec`. A failing line stops the sandbox and fails the seed as a terminal failure carrying the command and the tail of its output; a provider that cannot run a line is retryable. A separate verifier that runs in the task's own image gets the same overlay, and an overlay failure there masks the sample with `harbor:overlay_failed` instead of discarding the rollout. Agent user overrides (`[agent].user`, Dockerfile `USER`) are no longer rejected. Test hygiene: the prepare tests run under a fake registry (recording base images otherwise fetches from Docker Hub), and the validation CLI fixture clears and restores the root logging handlers. 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]>
|
/ok to test e9cf170 |
ffrujeri
left a comment
There was a problem hiding this comment.
Approving e9cf1703. All three of Yu's findings are addressed at this head:
- Default-shell overlay lines now run through
exec /bin/sh -c, so a line written for dash behaves as it did in the build. The dash test checks this. - A separate verifier for an overlay task starts without the workdir, so the overlay's WORKDIR step creates it for the user in effect (end-to-end test with
USER node). - The FROM record's workdir stands in only when the task has no declared
docker_imageor the Dockerfile sets a WORKDIR.
@yuhezhang-ai, could you re-review to clear your change request?
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Rechecked the three remaining findings at e9cf1703, including the M24 changes and their inclusion in the combined stack at 4d4bf21e. All are addressed: the declared image keeps its own working directory, the overlay verifier defers directory creation, and default-shell RUN steps explicitly invoke /bin/sh -c.
The 65 focused tests pass, and the previous failure reproductions now behave correctly. Validation used local provider fixtures and host-shell checks, not live containers. No remaining blocker from my review. Thanks for the fixes.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/39686628690 |
What does this PR do?
RFC M16, overlay image mode. A Harbor task whose
environment/Dockerfileis a pullableFROMplusRUN,WORKDIR,ENV,USERand an emptyENTRYPOINTruns without a build and without a registry: the server pulls the base image and runs theRUNlines inside the sandbox at seed, before the healthcheck and the agent. This is the slice of Dockerfile support that SWE-bench Verified and SWE-bench Pro need;COPY,ADD, multi-stage and heredoc Dockerfiles are still rejected with the instruction named and wait for M20.nemo_gym/tasks/harbor/dockerfile.py:parse_dockerfileandresolve_dockerfile.ENV,WORKDIRandUSERare resolved at prepare exactly asdocker buildresolves them, starting from the base image's recorded OCI config (Env,WorkingDir,User). Every pair of anENVline expands against the environment before the line; double-quoted and unquoted values expand, single-quoted stay literal,\$is a literal dollar,${X:-${Y}}nests. The task's env, workdir and user are literal before any sandbox exists.nemo_gym/tasks/harbor/image_configs.py: recordsEnvand the base image of every Dockerfile task at prepare, only for the tasks the run selects and whose effectivedocker_image(after the dataset.toml override) is unset. A base image whose config cannot be fetched fails prepare naming the image; no default PATH is guessed.resources_servers/harbor/app.py:_apply_overlayruns eachRUNwith its resolved env (exported withshlex.quote), workdir (created as root once per directory and chowned to the step's user) and user (numericUSERresolved withgetent). Root steps use the base image'sUseras the sandbox default (HarborTask.sandbox_user). ARUNthat exits non-zero or exhaustsbuild_timeout_secis a terminal 422 with the command and output tail; a provider failure is a 503; an overlay failure while preparing a separate verifier masks the sample instead of discarding the rollout. Sandbox TTLs includebuild_timeout_sec.Known gap, for M20:
SandboxSpechas no user field, so a Dockerfile's finalUSERapplies to the overlayRUNlines but not to later execs that pass no user.Testing
261 tests pass across
tests/unit_tests/test_harbor_tasks.py,tests/unit_tests/test_harbor_image_configs.pyandresources_servers/harbor/tests/test_app.py: classifier and resolver cases (SWE-bench Verified and TB2.1 Debian shapes, chainedPATH, quoting, modifiers, 17 rejections each naming the instruction), loader cases, and server cases with a container-like fake sandbox that applies the spec env and per-exec user (Docker-order env per step,WORKDIRafterUSER, numericUSER, root steps on a jovyan image, 422 versus 503, masked verifier overlay, TTLs, output tail). Two review rounds with refutation and reproduction, 49 findings, all fixed. No model rollout yet; the first real run is the SWE-bench Pro reference run (M23).🤖 Generated with Claude Code