Skip to content

feat(swe): checkpoint the episode sessions of five more repository-task servers - #6763

Merged
zyzhou5 merged 6 commits into
NVIDIA-NeMo:mainfrom
zyzhou5:zezhou/ckpt-five-swe-servers
Dec 1, 2026
Merged

zyzhou5 merged 6 commits into
NVIDIA-NeMo:mainfrom
zyzhou5:zezhou/ckpt-five-swe-servers

Conversation

@zyzhou5

@zyzhou5 zyzhou5 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

Partial-rollout checkpointing for sandboxed SWE episodes (stack #5264–#5413) covers SWE-bench and the four repository-task servers of #5331. The Nemotron-4 post-training runs on Slurm need it for more of the SWE training mix. This PR brings five more servers onto it, with the same per-server change #5331 made:

swemer_oml, r2e_gym, swe_internal_v1, swe_gym, swemer_ultra

  • Base class: each server moves from SandboxSessionResourcesServer to RepoTaskSessionResourcesServer, adds RepoTaskSessionFields to its config and sets task_model.
  • Task sandbox: started with new_task_sandbox, so it runs on the provider the sessions share and is registered for checkpoints. swe_internal_v1 keeps its start_with_setup setup.
  • Diff base: the server's own pristine-untracked and base-commit maps are dropped for the base's, which a checkpoint exports and a restore puts back, so a patch captured in a fork is taken against the same base.
  • Capture: saved with saved_capture / loaded_capture, so a verify after a restore grades the saved patch. Golden-patch grading runs restart_only.
  • Setup reads retried, as in feat(swe): checkpoint the episode sessions of the repository-task servers #5331's servers: HEAD, the repository check, and r2e_gym's removal of the held-out tests. A seed whose untracked-file listing fails now fails instead of continuing with an empty list (the wrong-patch case feat(swe): checkpoint the episode sessions of the repository-task servers #5331 fixed).
  • Eval output: swemer_ultra joins the eval command's stderr to its stdout, so tests that report on stderr are graded on a provider that returns the two apart (E2B). swemer_oml and swe_internal_v1 already route it into the graded region; r2e_gym and swe_gym run pytest, which reports on stdout.
  • r2e_gym's diff base: the seed records the commit the agent starts from and the patch is taken against it, so a fix the agent committed is captured. Before, the patch was taken against HEAD at verify and came out empty.
  • fix(swe): mask verifications without a verdict and block agent egress in more SWE servers #6670, merged in: r2e_gym and swe_gym keep its capture rule (a capture the sandbox could not run is masked; a git exit stays a measured 0), now saved with the capture so a verify after a restore replies the same. r2e_gym, swe_gym and swemer_ultra keep its AgentNetworkConfig on the sandbox new_task_sandbox starts.

Shared code: resources_servers/swebench/repo_task_sessions.py changes only its module docstring, which now describes the repository-task servers without listing them.

Issue

No GitHub issue. Requested for the Nemotron-4 post-training environments marked for rollout checkpointing.

Validation

  • Server suites in an existing Gym venv, with pytest started without command-line arguments (as gym env test does, since get_global_config_dict() parses sys.argv): the five servers, swebench/tests/test_repo_task_sessions.py, swebench/tests/test_sandbox_session_checkpoints.py, and the suites of swemer_v1, swemer_v2, swe_rebench, swe_next (they share the base): 937 passed, 0 failed.
  • New tests: tests/helpers/swe_repo_task_checkpoints.py and a test_checkpoints.py per server (40 tests): the checkpoint conformance kit with verify_body, the saved diff base, a replayed verify after a restore, a capture the sandbox could not run, still masked after a restore, a fork capturing against the saved base commit, the agent's own /run with a flat row, golden-patch restart_only, and the egress rule after a restore (all five servers).
  • pre-commit run --files on the changed files: passed.

Rollout evidence

Real model on OpenSandbox, AGA (Slurm job 2480319). Nemotron-3-Nano-30B-A3B on vLLM, OpenCode through single_agent_turn, this PR at fbf3f3803dd (before the #6670 merge, which changes grading and egress rules but not the checkpoint path). Per server, up to 5 example rows: the first episode still running after at least 3 model calls and a change to the checkout was checkpointed, Gym was killed and restored, and the episode finished and was verified.

Server Checkpointed After the restore
r2e_gym after 12 calls continued in the fork, same checkout; verify completed, not masked
swemer_oml after 30 calls continued in the fork; verify completed, not masked
swe_gym after 19 calls continued in the fork; verify completed, not masked
swemer_ultra after 20 calls continued in the fork; verify completed, not masked
swe_internal_v1 during verify, after 62 calls the saved capture was graded; verify completed, not masked

Local, on Docker (stdout and stderr apart), no model, each row's golden patch standing in for the agent:

  • Golden-patch grading and the episode path (seed → patch in the agent sandbox → verify → close) give the same rewards and the same captured patch on main and this PR for every example row: 5/5 per server, and swe_gym 4/5 on both (one image name has capitals that Docker refuses).
  • A docker commit snapshot stand-in also ran checkpoint → crash → restore for swemer_oml and r2e_gym: verify completed, same patch.

Compatibility

  • Without checkpoints, seed, patch capture, grading and close behave as before, except that a failed untracked-file listing now fails the seed. On a provider that returns stdout and stderr apart (E2B), the stderr fix in swemer_ultra can change verdicts.
  • The task sandbox now runs on the provider client the server's sessions share.
  • r2e_gym now captures a fix the agent committed; before, such a rollout scored 0.
  • With checkpointing on and a sandbox provider that can snapshot, the server needs checkpoint.state_dir and refuses to start without it; before, it ran restart_only.

🤖 Generated with Claude Code

…sk servers

swemer_oml, r2e_gym, swe_internal_v1, swe_gym and swemer_ultra move onto RepoTaskSessionResourcesServer, as NVIDIA-NeMo#5331
did for swe_rebench, swemer_v1, swemer_v2 and swe_next: a commit snapshots the agent's task sandbox with the files the
checkout held untracked before the agent started (and the base commit where the server records one), a restore
continues the episode in a fork, and a verify after the restore grades the saved patch. Golden-patch grading runs
restart_only.

- Each server starts its task sandbox with new_task_sandbox, drops its own pristine-untracked and base-commit maps for
  the base's, and saves its capture with saved_capture / loaded_capture.
- Setup reads of a new sandbox (HEAD, the repository check, r2e_gym's removal of the held-out tests) are retried, as
  in NVIDIA-NeMo#5331's servers. A seed whose untracked-file listing fails now fails instead of continuing with none.
- r2e_gym, swe_gym and swemer_ultra join the eval command's stderr to its stdout, so tests that report on stderr are
  graded on a provider that returns the two apart.
- repo_task_sessions: a restore re-applies the agent egress rule only for a config that has one; r2e_gym, swe_gym and
  swemer_ultra have no AgentNetworkConfig.
- Tests: a shared helper (tests/helpers/swe_repo_task_checkpoints.py) and a test_checkpoints.py per server, including
  the checkpoint conformance kit with verify_body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 25, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:high Autobot PR risk: high feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 25, 2026
…them

The module now serves nine servers, and three of them have no agent egress rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
@zyzhou5
zyzhou5 marked this pull request as ready for review November 25, 2026 23:23
@zyzhou5

zyzhou5 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 0917b60

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 25, 2026 23:24
@github-actions

Copy link
Copy Markdown
Contributor

@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 WITH CARE

I reviewed all 21 changed files with four topic reviewers, including the five server migrations, shared restore logic, checkpoint test helper, callers and target-base compatibility. I found one validation-evidence RISK and no confirmed code defect.

RISK: add representative real rollout evidence

Could you add the representative real model smoke rollouts required by AGENTS.md? The PR’s rollout section still says “Not yet”. This changes task-sandbox ownership and checkpoint restoration across five training environments, including R2E-Gym, and changes stderr-based grading in three verifiers.

The new checkpoint helper uses fake snapshots and mocked grading. It checks bookkeeping, but cannot show that a real provider restores the repository and reconnects the agent successfully. This is a validation gap, not a reproduced provider failure.

The smallest correction is to attach representative model-rollout results for the migrated servers, including the planned OpenSandbox checkpoint → crash → restore continuation. Record the head, task IDs, agent/model/provider configuration, captured patch, verifier outcome and cleanup. Acceptance should show that resumed edits use the original diff base, verification grades the intended patch, and task/verifier sandboxes close. Preserve flat-row compatibility, saved-capture replay and provider-error masking. These are training environments, so I am not asking for a full reward profile; golden-patch checks alone do not replace the required model smoke.

Validation

  • I relied on this head’s successful Lint check, Unit tests / Test, Unit tests / Server suite, all four core shards, all eight server shards, sandbox tests and combined core coverage. I checked the workflow’s aggregation rules and job results. Build Gym container, changed-server tests and session-routing end-to-end were skipped, not passed. I did not rerun passing CI suites locally.
  • CPU probes ran in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:cd1b05dcdf72d6101a3a2b8292608422f0f93eb7, the default-branch CI image because this head’s build was skipped. The completed probes passed: r2e-swe-gym-1/probe.py covered mid-grading checkpoints, saved fallback replay and stderr parsing; internal-oml-1/probe.py covered 11 failure, cleanup and golden-verification scenarios; the two ultra-checkpoint-kit-1/probe_*.py probes covered full generated-script stderr grading and capture-failure attribution.
  • My network_restore_probe.py comparison confirmed that head fixes restore without AgentNetworkConfig while preserving enabled-policy replacement. base-drift-compat-1/probe.py exercised the five changed servers against the target base’s checkpoint implementation and passed snapshot/export, fork, saved-capture replay and cleanup with fake providers. This was not a materialized merge test.

Initial probe setup/import errors were corrected before the reported successful runs. No real provider/model rollout or GPU work ran during this review. All admitted checkouts still matched their assigned SHAs and were clean.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

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

Review covers patch-capture failure handling, test-output parsing, setup diagnostics, the pre-existing R2E diff-base bug, and the outstanding real-provider rollout evidence. The diff-base issue is pre-existing; the rollout-evidence requirement was also raised in the existing review.

Comment thread resources_servers/r2e_gym/app.py Outdated
except Exception as exc:
return PatchCapture.static("", mode, "none"), f"Failed to extract model patch: {exc}"
error = f"Failed to extract model patch: {exc}"
return saved_capture(PatchCapture.static("", mode, "none"), error, False)

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.

If the sandbox cannot capture the patch, we save an empty patch and grade it normally. Checkpoint restore then reuses that failed capture. This also applies to swe_gym. Please follow swemer_oml: distinguish provider failures from git failures, return an incomplete response, and mask the sample. Preserve and check the saved incomplete flag rather than discarding it. Add a test covering capture failure followed by checkpoint and restore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#6670 adds this rule to r2e_gym and swe_gym so i will leave it out for this PR.

return f"""#!/bin/bash
# Test runners report on stderr as often as on stdout. One ordered stream keeps the graded region between the
# markers whole on every provider: E2B returns a command's stdout and stderr apart.
exec 2>&1

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.

Merging stderr into stdout can corrupt the test IDs used for grading. I reproduced this locally with 1,000 passing pytest tests, capture disabled (-s), and a background thread writing diagnostics to stderr: both the R2E-Gym and SWE-Gym parsers produced incorrect test IDs in all three repeats, while separate streams preserved the expected IDs. For example, a diagnostic became attached directly to the end of a PASSED test ID. PYTHONUNBUFFERED=1 also failed in all three repeats. Please preserve reliable test boundaries or use structured test results, and add a regression test. This reproduction covers r2e_gym and swe_gym; it does not establish the same failure for swemer_ultra.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed for r2e_gym and swe_gym in b3d6cd9. It followed the design in #5331: the join is there for test runners that report on stderr, which applies to swemer_ultra but not to r2e_gym and swe_gym, whose pytest reports on stdout. I created an issue #6969 to track the risk.

Comment thread resources_servers/r2e_gym/app.py Outdated
result = await exec_idempotent(
sandbox, hide_from_agent_command(), what="r2e_gym: hiding the held-out tests", timeout_s=120
)
if result.return_code != 0:

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 check error_type as well as return_code, and include it in the exception, as _pristine_untracked_files does. When exec_idempotent exhausts its total deadline, it can return return_code=-1, error_type='timeout', and stderr=None. The current message then reports rc=-1: None, hiding why setup failed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

async def test_checkpoints(monkeypatch, tmp_path, scenario):
# The patch is taken against the checkout's HEAD, which the seed does not record.
await _helpers["check_repo_task_checkpoints"](
monkeypatch, tmp_path, "r2e_gym", "R2EGym", scenario, records_base_commit=False, base_commit="HEAD"

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.

Pre-existing correctness issue: this test preserves capture against the current HEAD, which loses changes the agent already committed. I reproduced a committed fix producing an empty patch against HEAD and a nonempty patch against the starting SHA. Please record the starting commit during setup, preserve it in checkpoints, and capture against that SHA. Add a test where the agent commits its fix before verification. This can be tracked as a separate fix if it is outside this PR's scope.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

completed=True, resolved=True, patch_applied=True, test_results={}, test_output="ok", error=None
)
grade = AsyncMock(return_value=passing)
monkeypatch.setattr(app, "run_verification", grade)

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.

Before merging, please attach the planned golden-patch comparisons and an OpenSandbox checkpoint -> crash -> restore smoke test, including a representative model rollout as required by AGENTS.md. These fake-provider tests with mocked grading cannot establish that a real provider restores the repository and reconnects the agent. Confirm that edits survive, verification grades the intended patch, and task and grading sandboxes are cleaned up. The PR's rollout-evidence section still says these checks are pending. This requirement was also raised in the existing review.

@yaoyu-33
yaoyu-33 requested a review from pthombre November 26, 2026 01:09
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 27, 2026
…m and swe_gym

r2e_gym and swe_gym run pytest, which prints its results on stdout next to the markers, so a
provider that returns the streams apart already grades them. Joining stderr into stdout let a
stderr write land inside a test result line and corrupt its test ID, and checkpointing does not
need it. swemer_ultra keeps the join: some of its test runners report on stderr.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 30, 2026
zyzhou5 and others added 2 commits November 30, 2026 21:01
A command the provider ended without an exit status, such as one that ran out of time, has no
stderr either, so the error read "rc=-1: None". Fail on its error_type too and name it, as the
untracked-file listing does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
The patch was taken against HEAD at verify, so a fix the agent committed moved HEAD and the
patch came out empty. The seed now records the starting commit, as the other repository-task
servers do, and a checkpoint keeps it with the session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
@zyzhou5

zyzhou5 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test fbf3f38

Comment thread resources_servers/r2e_gym/app.py Outdated
# The fallback is saved with the session too, so a retry after the task sandbox stopped grades it again.
capture, extraction_error = await self.capture_task_sandbox_patch(session_id, capture_or_fallback)
# Saved as a JSON value, so a checkpoint can export it.
capture, extraction_error, _ = loaded_capture(

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 preserve #6670's capture-failure handling when rebasing this and swe_gym. Main now distinguishes a failed Git command from an incomplete capture, but this version saves incomplete=False for every failure and discards the loaded flag. Keep main's classification, pass the resulting flag to saved_capture, unpack it as capture_incomplete, and return the incomplete/masked response after cleanup when it is set. Otherwise resolving the conflict with this version would undo the merged fix and checkpoint replay would keep grading the empty patch. Please add a capture-failure -> checkpoint -> restore test that checks the reward and masking stay consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

A server whose config has no ``AgentNetworkConfig`` puts no rule on its agent's sandbox.
"""
if self.config.enforce_agent_no_network:
if getattr(self.config, "enforce_agent_no_network", False):

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.

#6670 has merged and adds AgentNetworkConfig to r2e_gym, swe_gym and swemer_ultra, so all five migrated servers now support agent network enforcement. When rebasing, please preserve those config bases, startup checks, and sandbox_provider_options(provider_config, for_agent=session_id is not None) on the SandboxSpec while keeping new_task_sandbox. Extend restore_applies_the_restoring_job_s_egress_rule to these three servers as well; the scenario already checks the initial policy and the restoring job's model host, so it would catch accidentally dropping either behavior during the merge. The getattr fallback here can also return to direct config access, and the explanation about those configs lacking AgentNetworkConfig should be updated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Resolve the overlap with NVIDIA-NeMo#6670, keeping both changes:
- r2e_gym and swe_gym keep NVIDIA-NeMo#6670's capture classification: a capture the sandbox could not run is
  masked, a git failure stays a measured 0. The flag is now saved with the capture, so a verify
  after a restore replies the same; a shared scenario checks that for all five servers.
- r2e_gym, swe_gym and swemer_ultra keep NVIDIA-NeMo#6670's AgentNetworkConfig with new_task_sandbox. Their
  network tests make the task sandbox through new_task_sandbox, and their checkpoint tests check
  that a restore forks with the restoring job's egress rule.
- Every repository-task server now has AgentNetworkConfig, so the restore reads
  enforce_agent_no_network directly again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
@zyzhou5

zyzhou5 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7147143

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

LGTM. Verified the capture-failure replay and network-enforcement integration fixes; 245 focused tests passed locally and CI is green. The documented recovery rollout and comparison results address the outstanding validation request.

@zyzhou5
zyzhou5 added this pull request to the merge queue Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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

Merged via the queue into NVIDIA-NeMo:main with commit 505bd33 Dec 1, 2026
68 checks passed
@zyzhou5
zyzhou5 deleted the zezhou/ckpt-five-swe-servers branch December 1, 2026 23:28
zyzhou5 added a commit to zyzhou5/Gym that referenced this pull request Dec 2, 2026
Brings in NVIDIA-NeMo#6763, whose shared checkpoint test helper the next commit uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
zyzhou5 added a commit to zyzhou5/Gym that referenced this pull request Dec 2, 2026
Scale-SWE's checkpoint tests repeated the scenarios NVIDIA-NeMo#6763's helper runs for every repository-task
server (conformance, the seed's saved diff base, a restored verify, a capture the sandbox could not
run, a fork capturing against the saved base, the agent's own /run, golden-patch restart_only and
the restoring job's egress rule). Run the helper instead, and keep the Scale-SWE tests: grading in a
fresh sandbox, the stored failure kind, a commit during grading or during the stop after capture,
and the /run seed refusal.

The helper's seed HEAD is now a full object name and its passing run prints the server's start
marker, as Scale-SWE requires; the other servers accept both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>
katherineh123 pushed a commit to katherineh123/Gym that referenced this pull request Dec 2, 2026
…h checkpoints (NVIDIA-NeMo#6765)

* feat(scale_swe): run episode sessions on the shared session base, with checkpoints

scale_swe was the one SWE server with its own episode-session code on SimpleResourcesServer. It now runs on
RepoTaskSessionResourcesServer and takes part in partial-rollout checkpoints like the other repository-task servers.
Grading, the patch-capture failure semantics and the failure kinds are unchanged.

- The base supplies the session record, lock, close fences, expiry and checkpoint export/restore. Overrides keep
  scale_swe's own behaviour where the base differs: a close claims the session before waiting for its lock, bounded
  stop waits that never cut a stop short, verifier sandboxes kept until their stop succeeds, a 503 for a retry after
  an attempt without a verdict, bounded shutdown, and the lenient untracked-file listing.
- New for scale_swe: an episode session never closed expires after the sandbox's ttl_s; shutdown retries task
  sandboxes whose stop failed; an agent-run seed naming an episode session gets a 409.
- The patch capture, failure kind included, is saved as a JSON value so a verify after a restore grades the same patch.
- partner_if (a ScaleSWEResourcesServer subclass with its own sessions) declares restart_only and checkpoint_verify
  wait, keeping its behaviour.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* refactor(scale_swe): verify and close episode sessions with the shared base

Scale-SWE kept its own verify and close on the session base. Use the base's, as the other
repository-task servers do:

- an identical retry gets the first verification back, masked or not; a verification that
  ended before it replied runs again on the patch it captured instead of answering 503;
- a task sandbox that does not stop after the capture fails that verify, and the retry grades
  the captured patch;
- a close waits for a seed or verify in progress instead of claiming the session first;
- a verify after a close is masked as session_lost instead of refused with 409;
- a /run verify that finds no task sandbox, such as a retry, is masked as session_lost instead
  of grading an empty patch.

Grading, patch capture and the bounded sandbox stops are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* fix(scale_swe): fail the seed when the untracked-file listing fails

Use the repository-task base's listing, as the other repository-task servers do: it retries a
listing the provider refused and fails the seed when it still cannot run, instead of going on
with an empty list that would count the image's own untracked files as the agent's patch. The
grader's apply drops those files' sections, so rewards do not change. The episode, the /run
seed and partner_if's seed are retried instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* docs(scale_swe): say a late verify after expiry is masked as session_lost

Once the close retry window has passed, the expired session is forgotten and a verify is masked
as session_lost, not session_expired.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* docs(scale_swe): leave checkpoint behavior out of the README

The other repository-task servers document checkpoint behavior in code only. The README keeps
the session behavior it documented before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* docs(partner_if): give the real reason its verify is not replayable

A restart_only server never holds up a checkpoint. It declares wait because its judge-graded
verify is not safe to run again, so it must not inherit Scale-SWE's replay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* test(scale_swe): cover the stop under the export lock and the /run seed refusal

A commit that arrives while the task sandbox's stop after capture is running waits for it and
snapshots nothing, and an agent's own /run seed cannot replace an episode session. Each test
fails when its protection is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* refactor(scale_swe): stop sandboxes and shut down as the shared session base does

Scale-SWE waited a bounded time for each sandbox stop and left the stop running after the wait,
and bounded its shutdown wait for a busy session. On the session base that stop collided with the
base's own: a close that gave up let an identical seed replay a sandbox being deleted, shutdown
started a second stop and closed the provider under the first, a checkpoint could snapshot a
sandbox mid-deletion, and a slow verifier stop was waited for twice. Use the base's stop and
shutdown, as the other repository-task servers do: each stop waits for the provider's own stop,
and shutdown stops every sandbox the server holds, the cookie path's included.

sandbox_stop_timeout_seconds still loads, with a warning, and is ignored. Each grading attempt's
verifier sandbox still stays with the session until its stop succeeds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* fix(partner_if): honor anti_cheat_required in the SWE seed

SWEIFConfig inherits anti_cheat_required from Scale-SWE's config, but the seed called the scrub
without it, so the setting did nothing. Pass it, so a required scrub that did not complete fails
the seed and stops its sandbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* test(scale_swe): run the shared repository-task checkpoint scenarios

Scale-SWE's checkpoint tests repeated the scenarios NVIDIA-NeMo#6763's helper runs for every repository-task
server (conformance, the seed's saved diff base, a restored verify, a capture the sandbox could not
run, a fork capturing against the saved base, the agent's own /run, golden-patch restart_only and
the restoring job's egress rule). Run the helper instead, and keep the Scale-SWE tests: grading in a
fresh sandbox, the stored failure kind, a commit during grading or during the stop after capture,
and the /run seed refusal.

The helper's seed HEAD is now a full object name and its passing run prints the server's start
marker, as Scale-SWE requires; the other servers accept both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* fix(scale_swe): seed an agent's /run under the session lock

The /run seed took no session lock, so another seed for the same ID, such as a retry or an episode
seed, could replace its sandbox during setup; a setup that then failed cleaned up the replacement's
sandbox and saved state. Seed under the lock, as the other repository-task servers and every
episode seed do: an overlapping seed waits until this one is done. A /run re-seed now also waits for
a verification in progress on the same session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

* fix(scale_swe): stop the last grading sandbox once, when verify ends

Scale-SWE stopped every grading attempt's sandbox, the last one included, and the shared verify
wrapper stopped a sandbox whose stop had failed again before replying: a provider that hung on both
delayed the reply by two stop timeouts. Stop an attempt's sandbox only when another attempt follows
and leave the last one to the wrapper's single stop, as the other repository-task servers do. A
sandbox whose stop fails stays with the session for close and shutdown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zeyu Zhou <[email protected]>

---------

Signed-off-by: Zeyu Zhou <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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 feature New capabilities, enhancements, or enablement work 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