Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
ef7a1d8 to
e0bdc11
Compare
a317ebb to
1790002
Compare
df34339 to
80b2d6f
Compare
1790002 to
521ab36
Compare
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
One RISK: the changed runtime default lacks the representative real smoke-rollout evidence required by repository guidance. I found no code defect in the inspected config wiring, cleanup, or downstream response handling.
I inspected all three changed files and their directly affected paths. One parallel review report was unavailable, so I independently inspected its lifecycle-test scope. This was a static review; I did not execute tests or verify the reported test results.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
A server runs with its own source folder as the working directory, so a relative default or a path built from Path.cwd() writes into the Gym checkout, which is on a shared filesystem on clusters. Add nemo_gym/core/runtime_files.py with one helper per kind of runtime write. scratch_dir and async_scratch_dir create a folder for one request or session under TMPDIR, or under the new shared_scratch_dir when another node reads it, and remove it on exit. debug_artifact_dir returns a new folder per unit of work under the new debug_artifacts_dir (off by default) or a server's own setting, separated by kind, capture key and agent instance. Add the runtime-write-paths pre-commit hook, which fails on new Path.cwd() and os.getcwd() calls and relative *_dir and *_root defaults in server code, with an allowlist of existing sites that only shrinks. Document the rule in AGENTS.md and the configuration reference. Signed-off-by: Ananth Subramaniam <[email protected]>
Shipped server, benchmark and environment configs set folder keys that
override the Python defaults, for example the OpenCode benchmark
config's artifacts_dir of ${oc.env:OPENCODE_ARTIFACTS_DIR,results/opencode}.
The runtime-write-paths check now also flags *_dir and *_root keys in
those YAML configs whose value is relative, reading the fallback of
oc.env and oc.select interpolations and treating references to other
keys as absolute. Existing sites join the allowlist.
Signed-off-by: Ananth Subramaniam <[email protected]>
Rework the runtime file foundation after design review: - Replace debug_artifacts_dir and debug_artifact_dir() with debug_dir and debug_folder(), so "artifacts" keeps its RunArtifacts meaning. - Drop shared_scratch_dir: a request passes data to another process in the request, never a temporary path. scratch_dir becomes temp_folder() under a new temp_dir setting, resolved on each node when unset, and removes leftover folders of dead processes in the same PID namespace. - Add finish_run_files() to delete a run's capture folder when a checkpoint controller holds its durable copy. - Move the storage warning from config parsing to the writing process: temp_dir and capture folders are checked once per process on their own node, for shared and memory-backed filesystems. Signed-off-by: Ananth Subramaniam <[email protected]>
Address the adversarial review of the runtime file helpers: - Name temporary folders by host boot id as well as PID namespace and pid, and skip removing leftovers on filesystems other hosts share: every host's initial PID namespace has the same number, so a check on one host could delete another host's live folder. - Remove a folder that a worker thread creates after its async_temp_folder task was cancelled. - Let callers pass the parent folder, for code such as Ray tasks that runs without Gym's configuration. - Replace finish_run_files with create_owned_folder and delete_owned_folder: deletion requires a .nemo-gym-owned marker, so a folder a user chose is never removed, and the marker goes last so an interrupted deletion can be finished. - Percent-encode every debug folder segment, check debug roots for unsuitable storage, and recognize more shared filesystems. Signed-off-by: Ananth Subramaniam <[email protected]>
…llow The parser resolved both settings on the driver, following the driver's symlinks before the path reached every node. Make them absolute without resolving symlinks instead. Signed-off-by: Ananth Subramaniam <[email protected]>
- The default temp_dir: an existing folder that others can open is made private again, with a warning, so a launcher's 0777 folder cannot let another user rename or replace this user's folders. - Session folders now start with "session.", and remove_temp_dir removes only those, so a request folder or a folder a tool made beside them is refused. - async_remove_temp_dir removes a session folder on the temporary folder threads, off the event loop. - Process folder names end with a random part drawn once per process, so removing a dead process's folder never removes the folder of a new process that reused its pid. The same-name clearing before use goes. - save_dir: a copy already running when its task is cancelled stops and removes what it copied, since the request may remove the source next. copy_tree takes a stop event and raises CopyStopped. - A rollout id of "." or ".." gets a folder of its own instead of naming the folder above it. - The save_dir docstring and the reference say that an invalid name or server_name raises ValueError. Signed-off-by: Ananth Subramaniam <[email protected]>
…ed removal remove_temp_dir now runs on worker threads through async_remove_temp_dir, so it reads the process folders under the lock: another thread adding or dropping one mid-iteration would otherwise raise instead of logging. A new test cancels async_remove_temp_dir while its removal waits behind a busy thread and checks that the folder is still removed. Signed-off-by: Ananth Subramaniam <[email protected]>
b1f50bd to
80b92b6
Compare
- Process folders and process-wide folders are created with mode 700, like the request and session folders in them, so a configured temp_dir that others can open does not expose process-wide state. - copy_tree writes into <dest>.partial and renames it to dest once complete, so a process killed mid-copy never leaves a kept folder that looks whole. - Leftovers of dead processes are removed outside the first-use lock, so a large one never holds up session removals or another temp_dir's first use. It removes only folders of processes that are gone, so it races with nothing this process makes. - async_session_temp_dir creates a session folder on the temporary folder threads and removes one created after its caller was cancelled; it shares that code with async_request_temp_dir. - The rollout part of a kept folder's path is cut to 200 characters after percent-encoding, which can triple a rollout id's length past the filesystem's name limit. Signed-off-by: Ananth Subramaniam <[email protected]>
80b92b6 to
ca6870b
Compare
A rename onto an empty folder replaces it, so copy_tree's check for an existing destination is what keeps a copy from taking over a folder it did not create. The existing test used a folder that was not empty, which the rename alone refuses. Signed-off-by: Ananth Subramaniam <[email protected]>
Six SWE-style resources servers wrote a verification log on every /verify call into a logs/ folder next to their own app.py: scale_swe, swe_next, r2e_gym, swe_gym, denovo_swe and swebench_pro. In training, that folder is inside the Gym checkout mounted from a shared filesystem, so every verification created a folder and files there, and nothing removed them. swebench_pro also added one folder per session. Each of these servers now takes verification_log_dir, the setting that swe_rebench and the swemer servers already had. It defaults to null, so no logs are written. When it is set, logs go to <verification_log_dir>/instance-<id>/<random>/attempt-<n>. The path is built by one helper, resources_servers/swebench/verification_logs.py, which the servers that already had the setting now use too. opencode_sandboxed_agent wrote each session's OpenCode export into a results/ folder next to its app.py when artifacts_dir was unset. It now uses a temporary folder in that case and removes it once the export and database snapshot are parsed, and opencode_results_fpath is empty. Signed-off-by: Ananth Subramaniam <[email protected]>
A relative path resolves against the server's working directory, which is its own source folder, so it would bring back writes into the checkout. Signed-off-by: Ananth Subramaniam <[email protected]>
The swebench resources server, which grades SWE-bench Multilingual, ran the SWE-bench harness with its default log folder. That folder is relative to the working directory, which is the server's own source folder. So every verify created a logs/run_evaluation/<run_id> tree in the checkout, searched it and deleted it, and an interrupted verify left the tree behind. run_instance now takes the log folder as an argument. The server gives each verify a new temporary folder and removes it in a finally block. To keep a copy, set verification_log_dir, as for the other SWE servers. clear_swebench_debug_logs has no effect now. It is still accepted so existing configs load, and it logs a warning when it is set to false without verification_log_dir. analyze_golden_patch_logs.py takes the log folder as an argument instead of the old path. Signed-off-by: Ananth Subramaniam <[email protected]>
The failure-only grading tests run the real run_instance. They now pass log_root and keep the working directory empty, and a new test checks that the test output and report land under log_root and nothing is written to the working directory. Signed-off-by: Ananth Subramaniam <[email protected]>
The SWE resources servers now take a per-server debug_dir in place of verification_log_dir, and build each verification's log folder with debug_folder from nemo_gym.core.runtime_files. When the server's own debug_dir is unset, the global debug_dir applies under the server's name, so one setting turns verification logs on for every server. This renames the setting on the servers that already had it (swe_rebench, the swemer servers and swe_internal_v1). No release has included it, so the old name is not kept. resources_servers/swebench/ verification_logs.py is removed. The swebench server runs the harness in async_temp_folder and keeps the folder through keep_as when debug files are on. The opencode agent's fallback for an unset artifacts_dir is async_temp_folder, so its parent follows the global temp_dir. Signed-off-by: Ananth Subramaniam <[email protected]>
Under debug_folder a report sits several levels below the verification folder, so copying the first path segment copied the whole verification tree for each failed sample. Copy the report's own verification folder, and say which folder to pass. Signed-off-by: Ananth Subramaniam <[email protected]>
…_dir explicit save_dir call, and leaves keeping files to each server. Each SWE server now has keep_verification_logs, off by default. Every verification attempt writes its logs into a temporary folder on the node, which is removed when the attempt ends. With the setting on, the folder is copied once into <results_dir>/<server name>/verification/<rollout>/<time>-<instance id>-attempt<n>-<random>/ after the attempt, even when it fails. So a verify never writes into the checkout or onto shared storage while it runs. run_keeping_logs in resources_servers/swebench/verification_logs.py does this for all thirteen servers. The servers that report a log folder in their verify response report the kept copy, or nothing when logs are not kept. Signed-off-by: Ananth Subramaniam <[email protected]>
… nemo_gym.core swebench_pro kept its verification logs inside the attempt's timeout. When that timeout expired, the copy ran while the task was being cancelled, so save_dir kept nothing for the attempts whose logs matter most. The timeout now ends inside the log folder, before the copy. The runtime file helpers are imported from nemo_gym.core's public API. Signed-off-by: Ananth Subramaniam <[email protected]>
The harness-crash test now also runs with keep_verification_logs on and checks that the failed verify's logs are copied once under the server's results. Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: Ananth Subramaniam <[email protected]>
SWE-Next sessions now read the global config at startup and stop the verifier sandbox through the shared session base, so the log tests stub both. Signed-off-by: Ananth Subramaniam <[email protected]>
ca6870b to
e1eafc6
Compare
The OpenCode agent's benchmark config set artifacts_dir to results/opencode, a relative path that resolves into the server's own source folder. With artifacts_dir set, the agent keeps every rollout's export under <artifacts_dir>/<session_id>/, so a benchmark run left one folder per rollout behind and never removed it. The config now defaults artifacts_dir to null, and OPENCODE_ARTIFACTS_DIR still keeps exports when it is set. Without artifacts_dir the export goes to a temporary folder that is removed once it is parsed. A test runs a rollout that completes, one whose export is invalid and one cancelled while the export downloads. Without artifacts_dir each must leave nothing behind; with it each must keep the export as before. Signed-off-by: Ananth Subramaniam <[email protected]>
80b2d6f to
7d0239c
Compare
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
The prior RISK about missing real-rollout evidence is addressed by the author's new rollout evidence. The documented command selects the affected legacy preset, which inherits the changed storage default. The reported unset-variable run produced a usable answer with populated usage and an unmasked judge reward of 0.0. It also recorded an empty opencode_results_fpath and removal of the temporary export. The configured-variable run kept its export. The documented image overrides do not bypass the export-storage path being validated.
I checked the six lifecycle cases and the length-stop assertions against their implementation. They still cover temporary cleanup, opt-in retention, and preservation of partial output and grading behavior.
This follow-up covered the prior finding and its preservation requirements, not a fresh whole-PR review. The previously reviewed tree at 80b2d6f137b2f0cb8de183177a85a0a1d163b11d was unavailable, so I could not compare inter-review source changes. I did not execute tests or rollouts, or independently inspect the Slurm artifacts.
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 findings-only review. Request a full review with /review reset=true.
e1eafc6 to
4226d69
Compare
What changed and why
For every rollout,
opencode_sandboxed_agentrunsopencode exportin the sandbox and downloads the result to the agent host, whereresponses()parses it to build the response, the usage and the length and error flags. Onmain, the agent downloads it to<artifacts_dir>/<session_id>/export.jsonand never removes the export or its folder, so a training run leaves one folder per rollout behind. When that folder is on a shared filesystem such as Lustre, each folder and file also adds load on its metadata servers.#6230 fixes this when
artifacts_diris unset. In that case the agent downloads the export into a temporary folder fromasync_request_temp_dir(#6235), which is removed once the export is parsed, and also when the rollout ends early. Withartifacts_dirset, the agent keeps each export as before, which is the explicit way to keep exports for debugging.The agent's
configs/benchmark.yaml, however, always setartifacts_dir, to${oc.env:OPENCODE_ARTIFACTS_DIR,results/opencode}. That is a relative path, and it resolves against the server's own source folder, so every benchmark run kept all of its exports inside the checkout even after #6230. This PR changes that default tonull. Benchmark runs then keep no exports unlessOPENCODE_ARTIFACTS_DIRis set.It also adds a test of the export's lifecycle through the real
responses()path. The test runs a rollout that completes, one whose export is invalid, and one cancelled while the export downloads. Withoutartifacts_dir, each must download outside the source folder and leave nothing behind. Withartifacts_dir, each must keep the export where it was kept before.This follows the rule for runtime writes in #6235. The export is scratch while the same request parses it, and it becomes debug output only when the server's own folder setting,
artifacts_dir, asks to keep it. The merge order is #6235, then #6230, then this PR, which targets #6230's branch. No issue was filed, because the problem and the fix are both contained in this PR and #6230.Compatibility
configs/benchmark.yamlno longer keep OpenCode exports unlessOPENCODE_ARTIFACTS_DIRis set. Set it to an absolute path, because a relative path resolves against the server's source folder.artifacts_dir,opencode_results_fpathis an empty string, as in fix(swe): keep verification logs out of the source checkout #6230. No code in Gym reads that field.artifacts_dirset, nothing changes.OPENCODE_ARTIFACTS_DIR. It now describes the variable as an optional debugging setting whose folders are never removed.PI_ARTIFACTS_DIRis still required for Pi.Validation
main, the three lifecycle cases withoutartifacts_dirfail and the three with it pass, which shows that keeping is unchanged.pre-commit runon the changed files, and DCO sign-off.Rollout evidence
Two real rollouts of
hle/opencode_legacy_agentran on Slurm job 2048963, onoci-aga-slurm-1, nodecpu-0001, partitioncpu. They used Gym at7d0239c414, this PR's head on #6230's branch. The policy model and the HLE judge wereopenai/openai/eccn-gpt-6-lunabehind theopenai_modelserver, and OpenCode ran in OpenSandbox. Both runs answered the first task of the prepared HLE text-only split,668825f80a642802bdfeadfa, a multiple-choice question from the Humanities/Social Science category.The preset's offline science image is not published, so the runs used
OPENCODE_SANDBOX_IMAGE=python:3.13. That image needed three overrides:network_access=inheritlets that install download OpenCode./root, because the image has no/workspace.None of these affects how the agent host downloads, parses or removes the export.
With
OPENCODE_ARTIFACTS_DIRunset, which is the new default:opencode_results_fpathis an empty string./tmp/nemo_gym-<uid>/<process folder>/opencode-results-*from 11:24:23 to 11:24:27. It was gone by the next check, beforegym eval runreturned at 11:24:33, and noopencode-results-*folder was left on the node afterwards.With
OPENCODE_ARTIFACTS_DIRset to an absolute path in the run folder:<OPENCODE_ARTIFACTS_DIR>/<session id>/export.json(4,316 bytes), andopencode_results_fpathnames that file.The job's cleanup found no sandboxes left for the run.