Skip to content

fix(swe): keep verification logs out of the source checkout - #6230

Open
ananthsub wants to merge 11 commits into
ananthsub/runtime-write-pathsfrom
ananthsub/verification-log-dir
Open

ananthsub wants to merge 11 commits into
ananthsub/runtime-write-pathsfrom
ananthsub/verification-log-dir

Conversation

@ananthsub

@ananthsub ananthsub commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #6235, which adds nemo_gym/core/runtime_files.py with async_request_temp_dir and save_dir. Review and merge #6235 first; until it merges, this PR's diff is against its branch.

What changed and why

Six SWE-style resources servers wrote a verification log on every /verify call into a logs/ folder next to their own app.py. In training, that folder is inside the Gym checkout, which the job mounts from Lustre. Each verification therefore created a folder and wrote files into the shared checkout, and nothing ever removed them. Over a training run this adds thousands of files and metadata operations on the shared filesystem.

The servers and what each one wrote:

  • scale_swe, r2e_gym, swe_gym and denovo_swe wrote logs/<instance_id>/test_output.log.
  • swe_next wrote logs/<random id>/attempt-<n>/test_output.log, unless its verification_log_dir setting named another folder.
  • swebench_pro wrote six files under logs/run_evaluation/<session_id>/<instance_id>/, so it also added one folder per session.

Now each verification attempt writes its logs into a temporary folder on the node, from async_request_temp_dir, and the folder is removed when the attempt ends. A verify therefore writes nothing into the checkout or onto shared storage while it runs. Each server has a keep_verification_logs setting, off by default. With it on, the attempt's folder is copied once with save_dir into <results_dir>/<server name>/verification/<rollout>/<UTC time>-<instance id>-attempt<n>-<random>/ after the attempt, even when the attempt fails. The rollout comes from the request, so logs from different rollouts of the same task stay apart, and the random part keeps two copies from sharing a folder.

One function, run_keeping_logs in resources_servers/swebench/verification_logs.py, wraps a verifier call in that temporary folder and keeps the copy when asked. All thirteen servers below call it. swe_rebench, the swemer_* servers and swe_internal_v1 already had an opt-in setting called verification_log_dir, and each built its log path inline. swe_next had a setting with the same name that only moved its logs elsewhere. These servers now use keep_verification_logs and run_keeping_logs too. swebench_pro's run_verification used to require a log folder; it now also accepts None and then writes nothing. swebench_pro_v2 overrides only the verifier call, so it inherits the same temporary folder and the same setting.

The swebench resources server, which grades SWE-bench Multilingual, ran the SWE-bench harness with its default log folder. That default is relative to the working directory, which is the server's own source folder. So every verify built a logs/run_evaluation/<run_id> tree in the checkout, searched it for the test output and then deleted it, and a verify that was interrupted left its tree behind. run_instance now takes the log folder as an argument, and the server runs it through run_keeping_logs like the other servers.

opencode_sandboxed_agent has the same problem in a different form. When artifacts_dir was unset, it downloaded each session's OpenCode export and database snapshot into a results/ folder next to its app.py and never removed the export. The agent has to download the export to parse it, so it cannot skip the download. Instead, without artifacts_dir it now downloads into async_request_temp_dir, and the folder is removed once the export and snapshot are parsed. With artifacts_dir set, nothing changes.

The other open PRs on the same Lustre access problem don't touch these files: the run manifest (#6214), model-call claims (#6216), the node-local driver folder (#6217) and agentic_if episodes (#6218). #6236, a cancellation fix in the same run_instance, will need a small rebase after this one. No issue was filed, because the problem and the fix are both contained in this PR.

Compatibility

  • By default, the six servers no longer keep any logs. A workflow that read logs/ next to a server's app.py must now set keep_verification_logs: true and read the logs under the server's results folder.
  • swe_next, swe_rebench, the swemer_* servers and swe_internal_v1 replace verification_log_dir with keep_verification_logs, and their kept logs use the layout above. No release has included verification_log_dir, so the old setting is not kept. The verify responses of swe_rebench, the swemer_* servers and swe_internal_v1 still report the kept folder in a field named verification_log_dir.
  • swebench's clear_swebench_debug_logs no longer has an effect, because the harness logs are always removed. It is still accepted so existing configs load. When it is set to false without keep_verification_logs, the server logs a warning that says how to keep the logs. Golden-patch verification no longer keeps logs by default, and analyze_golden_patch_logs.py now takes the folder of kept verification logs as its argument and copies each failed sample's own kept folder.
  • The log_dir field in the swebench and swebench_pro verify responses names the kept copy, and is an empty string when logs are not kept.
  • Without artifacts_dir, opencode_sandboxed_agent now returns an empty opencode_results_fpath, because the export it named is gone by the time the response returns. No code in Gym reads that field.
  • Rewards and verification results do not change. Only where the logs go changes.

Validation

  • New tests check, for each of the six servers, that the verifier writes into a temporary folder outside the server's source folder, that the folder is gone after the verify, and that nothing reaches the results folder by default. With keep_verification_logs on, they check that one copy lands under <server>/verification/ with the instance id and attempt in its name. For swebench_pro, a test also checks the log_dir field in the verify response.
  • A swebench_pro test makes an attempt hang past its timeout and checks that its partial log is still kept. Before this change, the copy ran inside the expired timeout and kept nothing.
  • A swebench_pro test runs run_verification with no log folder and checks that it grades the run without writing any file.
  • swebench tests stand in for the harness and check the same temporary folder and kept copy, and that a verify where the harness fails still removes its temporary folder and, with keep_verification_logs on, keeps its copy. They also check that a config with clear_swebench_debug_logs still loads.
  • A swebench test runs the real run_instance with a separate log folder and an empty working directory. It checks that the test output and report land in the log folder and that nothing is written to the working directory.
  • The existing OpenCode observation test used to place the agent's module in a temporary folder and check that the export landed next to it. It now checks that nothing is written there and that the temporary folder is gone after the run.
  • The new tests fail against upstream/main and pass on this branch.
  • pytest passed for the tests of every touched resources server, resources_servers/swebench (with the swebench library installed), responses_api_agents/opencode_sandboxed_agent and feat(core): add temporary dir helpers, save_dir and temp_dir for runtime files #6235's runtime file tests.
  • pre-commit run passed on the changed files.

Rollout evidence

N/A. The patch capture, the scripts that run in the sandbox and the grading code do not change. The only change is where the server writes its copies of the logs on its own host, and whether it keeps them. The new tests drive /verify on each server and check the folders the verifier writes to and what is kept.

@ananthsub ananthsub added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers area:agent Agent harnesses and Responses API agent behavior labels Nov 16, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

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.

@ananthsub
ananthsub marked this pull request as ready for review November 16, 2026 17:11
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 16, 2026 17:12

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP

LGTM, no concerns found. I reviewed all 30 changed files and traced the affected verifier and export consumers. The changes keep grading logic unchanged, isolate configured verification attempts, and parse OpenCode artifacts before temporary-directory cleanup.

I did not execute tests or rollouts in this read-only review.

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.

wprazuch
wprazuch previously approved these changes Nov 16, 2026
@yaoyu-33
yaoyu-33 requested a review from weijiac0619 November 16, 2026 18:05
@ananthsub
ananthsub force-pushed the ananthsub/verification-log-dir branch from 32ccdff to 88c885e Compare November 16, 2026 21:10
@ananthsub
ananthsub changed the base branch from main to ananthsub/runtime-write-paths November 16, 2026 21:10
@ananthsub
ananthsub marked this pull request as draft November 16, 2026 21:11
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 16, 2026 21:11
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the bug Something isn't working label Nov 16, 2026
@ananthsub
ananthsub force-pushed the ananthsub/verification-log-dir branch 2 times, most recently from 91f8acf to a42e4e5 Compare November 16, 2026 21:50
@ananthsub
ananthsub marked this pull request as ready for review November 16, 2026 21:56
@ananthsub
ananthsub force-pushed the ananthsub/verification-log-dir branch 2 times, most recently from a1c43c6 to 1849780 Compare November 17, 2026 00:53
@ananthsub
ananthsub marked this pull request as ready for review November 17, 2026 14:41

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP

No eligible findings in this follow-up.

I checked the shared verification-log helper, its runtime contracts, and representative SWE callers. I also checked the affected tests and temporary-file lifetimes in SWE-bench and OpenCode. SWE-bench reads test output before cleanup, and OpenCode finishes file-dependent parsing before removing its temporary folder. SWE-bench Pro’s attempt timeout exits before log retention runs.

Review 5928704286 had no findings to recheck. Its reviewed tree is unavailable, so I could not establish the exact changes since that review. The supplied diff compares against the PR base, not the previously reviewed head. This approval is limited to the follow-up scope, not a fresh whole-PR review.

I did not execute tests or rollouts.

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.

@ananthsub
ananthsub force-pushed the ananthsub/verification-log-dir branch 3 times, most recently from 1790002 to 521ab36 Compare November 17, 2026 16:37
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 17, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 17, 2026
@ananthsub
ananthsub force-pushed the ananthsub/runtime-write-paths branch from 15fac36 to 7ac1b58 Compare November 18, 2026 17:02
@ananthsub
ananthsub force-pushed the ananthsub/verification-log-dir branch 2 times, most recently from b1f50bd to 80b92b6 Compare November 18, 2026 17:26
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 18, 2026
@ananthsub
ananthsub force-pushed the ananthsub/verification-log-dir branch 2 times, most recently from ca6870b to e1eafc6 Compare November 18, 2026 18:02
@ananthsub
ananthsub force-pushed the ananthsub/runtime-write-paths branch from 6107b0b to aaf9e4a Compare November 20, 2026 19:33
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]>
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]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants