Skip to content

feat(swe): support SWE-Next episode sessions - #5112

Merged
init-nikhil merged 3 commits into
mainfrom
init-nikhil/shared-opencode-training
Nov 17, 2026
Merged

init-nikhil merged 3 commits into
mainfrom
init-nikhil/shared-opencode-training

Conversation

@init-nikhil

@init-nikhil init-nikhil commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What changes

SWE-Next supports environment-server episode sessions and the existing agent /run path. Both paths capture the agent's patch before stopping its task sandbox and grade that patch in a fresh sandbox. Typed episode verification returns the saved result on an identical retry. Failed sandbox stops retain ownership for cleanup retry.

/run compatibility

Flat seed requests still return the sandbox handle, descriptor and workdir used by the existing agent-run integration. Cookie-scoped close releases that task's sandbox and retries failed cleanup; it cannot bypass a typed episode's identity checks. Both paths distinguish a completed Git failure, which receives empty-patch grading, from unavailable provider execution, which excludes the sample. Verification without an owned seeded session returns a masked lost-session result; re-seeding retains the old sandbox if stopping it fails.

Malformed requests claiming a typed session identity now return HTTP 422 before sandbox creation. Ordinary flat rows, including their scalar task IDs and extra dataset fields, remain accepted.

Scoring

  • A grading-command timeout receives reward 0, evaluation_completed=true, and no sample mask or verification retry. A bad patch that hangs the tests is penalized.
  • Provider execution failures remain inconclusive and receive bounded retries on fresh verifier sandboxes. Unavailable patch capture or an exhausted inconclusive verification receives mask_sample=true with a failure reason.
  • Completed incorrect patches and completed Git failures remain in the score denominator. Infrastructure exclusions change aggregate denominators.

Validation

  • 131 focused tests passed at 07274d43f5ea60b520beca742bba4858a4a25f52: the complete SWE-Next suite plus shared SWE-bench session and patch-capture tests. Local Python 3.13.14 used an isolated OpenAI 2.45.0 / SWE-bench 4.1.0 dependency overlay; imports were verified against the rebased worktree.
  • Server-level HTTP tests exercise the real capture and verification functions for both session and flat agent-run routes. Cases cover correct/incorrect patches, grading timeout, provider failure and retries, capture provider errors even with exit 0, genuine Git failure, captured patch delivery, saved-result replay, and cleanup.
  • Malformed typed seeds return 422 before allocation; valid typed seeds replay their descriptor, and flat rows with scalar task IDs succeed.
  • pre-commit run --all-files passed, including formatting and import-layer checks; the private guardword catalog was unavailable for that run. The staged commit guardword check also passed. All three commits include DCO sign-off; git diff --check passed.
  • Rebase validation preserves main's agent-network policy and verifies typed/flat session behavior. Test fixtures now return an actual sandbox execution result, accept the for_agent argument and isolate global configuration.
  • New model rollout: N/A for this rebase and test-fixture update. The affected production files are byte-identical to the preceding PR head 24eb8bfb0d04805696e406e12afd0b4ec8297d01.
  • CI authorized for the exact updated head with /ok to test 07274d43f5ea60b520beca742bba4858a4a25f52.

Base and scope

Rebased onto public main 5d6429f5b1362af47954d8cf72f03cbe443ff941. The scanner baseline matches main and is no longer changed by this PR. No separate issue is needed: this completes the SWE-Next episode-session integration proposed here.

@init-nikhil init-nikhil added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers area:agent Agent harnesses and Responses API agent behavior area:training Training framework integrations and training-data interfaces area:sandbox Sandbox providers, isolation, and sandbox runtime contracts labels Oct 27, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 27, 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.

@copy-pr-bot

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

@init-nikhil init-nikhil changed the title feat(swe): run OpenCode through shared environment sessions feat(swe): integrate trained sampling and typed verification Nov 7, 2026
@init-nikhil
init-nikhil force-pushed the init-nikhil/shared-opencode-training branch from fa46f4b to 1c13335 Compare November 11, 2026 04:35
@init-nikhil init-nikhil changed the title feat(swe): integrate trained sampling and typed verification feat(swe): support SWE-Next episode sessions Nov 11, 2026
@init-nikhil
init-nikhil removed this pull request from stack #5241 November 11, 2026 04:38
@init-nikhil
init-nikhil added this pull request to stack #5993 November 11, 2026 04:38
@init-nikhil
init-nikhil removed this pull request from stack #5993 November 11, 2026 05:05
@init-nikhil
init-nikhil added this pull request to stack #5994 November 11, 2026 05:06
@init-nikhil

Copy link
Copy Markdown
Member Author

DESCRIPTION FOR AGENTS

Codex-generated description; not a completed review or human approval.

Starting head: 1c13335e745cccdd4f8c10a59e11a4294255dc04
Starting base: main at 5db2b445e218357b88800d1501975aa83981404a

SWE-Next adopts the shared SandboxSessionResourcesServer. Both seed routes capture patches before stopping task sandboxes. Episode verification uses the shared lock and saved reply; failed stops retain ownership for retry.

Preserve the distinction between infrastructure failures and agent-caused repository damage: unavailable execution is incomplete and masked, while a genuine Git failure can retain empty-patch grading. Shared helpers also reject provider errors during capture and support cookie-scoped agent-run close without bypassing episode identity.

Tests cover both routes, capture-before-cleanup, masking, saved replies, close retries, and identity protection. The reported 107 passing tests and pre-commit result came from a combined stack tree; verify commands and provenance. Older runtime comments do not establish current-head validation.

After stack synchronization, review the updated diff and obtain representative model smoke evidence, including verification behavior and sandbox cleanup. Record results against the actual PR head. This is the parent of #5240.

@init-nikhil
init-nikhil force-pushed the init-nikhil/shared-opencode-training branch from 1c13335 to ce00ffe Compare November 12, 2026 10:42
@init-nikhil
init-nikhil marked this pull request as ready for review November 12, 2026 17:39

@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 — one request-validation defect and one required validation gap.

RISK — Provide representative smoke evidence for this change

The supplied model and training reports identify 8ff1ea96e983c911127951ad4cf8f92d101ef35d, not the reviewed head. They don't establish that the new SWE-Next episode-session integration works with a real model and provider. The supplied description also attributes the unit-test result to a combined stack tree. The repository quality bar requires representative model rollouts and inspection of both agent and verifier behavior for this behavior-changing environment work.

Could you record representative smoke results against ce00ffe5f94f51bba7a2085019426d3fbcbc378e, including the effective configuration and dependency revisions? Exercise an episode seed, real model-driven repository work, verification, and resource close. Confirm that the captured patch reaches grading, an identical verification retry returns the saved result, and a post-run provider audit finds no run-owned sandboxes. Retain the existing agent-run route as a preservation check. Separately demonstrate that unavailable execution produces evaluation_completed=false and mask_sample=true, while a genuine Git failure retains unmasked empty-patch grading. No reward-distribution benchmark or historical training-parity claim is needed for this training-environment smoke check.

I inspected all eight changed files and traced the affected seed, capture, grading, close, and provider contracts. This was a static review; I didn't execute tests or rollouts. The inline finding includes proposed regression checks, not executed results.

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

Comment thread resources_servers/swe_next/app.py Resolved
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 12, 2026 22:03
@init-nikhil
init-nikhil requested a review from a team as a code owner November 12, 2026 22:04
@init-nikhil

Copy link
Copy Markdown
Member Author

/ok to test f6ddb6a

@init-nikhil
init-nikhil requested a review from yaoyu-33 November 12, 2026 22:05
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 12, 2026 22:05

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

Pls also mention the changes related to the /run path in the PR description.

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 13, 2026
zyzhou5
zyzhou5 previously approved these changes Nov 13, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the ready-to-merge PR is approved, current, and waiting for final CI or merge label Nov 16, 2026
svcnvidia-nemo-ci pushed a commit that referenced this pull request Nov 16, 2026
Keep session lifecycle tracking alongside the agent-only network policy when creating SWE-Next task sandboxes. Keep all automatically merged changes.

Signed-off-by: svcnemo-autobot <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters label Nov 16, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 24eb8bf

@init-nikhil
init-nikhil force-pushed the init-nikhil/shared-opencode-training branch from 24eb8bf to 07274d4 Compare November 17, 2026 03:12
@init-nikhil

Copy link
Copy Markdown
Member Author

/ok to test 07274d4

@init-nikhil
init-nikhil added this pull request to the merge queue Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit 4d4da95 Nov 17, 2026
90 of 93 checks passed
@init-nikhil
init-nikhil deleted the init-nikhil/shared-opencode-training branch November 17, 2026 18:05
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 area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters area:sandbox Sandbox providers, isolation, and sandbox runtime contracts area:training Training framework integrations and training-data interfaces feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge 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