Skip to content

feat: add SWE Pro resources sessions - #3718

Merged
ananthsub merged 2 commits into
mainfrom
ananthsub/episode-orchestration-07-swe-pro-sessions
Sep 29, 2026
Merged

ananthsub merged 2 commits into
mainfrom
ananthsub/episode-orchestration-07-swe-pro-sessions

Conversation

@ananthsub

@ananthsub ananthsub commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds typed session support to SWE-bench Pro while preserving its legacy request shapes, and makes the single-agent-turn Environment Server verify through each Resources Server's own verify body.

SWE-bench Pro sessions:

  • The Resources Server owns task sandbox setup, verification, and cleanup.
  • The typed sessions build on the SWE-bench Pro lifecycle from feat: add sandboxed Hermes for SWE-bench Pro #3542. /close_session closes a typed session when given a ResourcesCloseSessionRequest, and closes the cookie session when given an empty body, as hermes_sandboxed_agent sends.
  • A repeated verify of a typed session fails once its task sandbox has been consumed, instead of grading an empty patch and returning a normal-looking reward.

Verification contract:

  • single_agent_turn now sends /verify the flat body an Agent's /run sends: the task's task_data fields, responses_create_params, and the agent's response. The request carries the Resources session cookie from seeding, which identifies the episode.
  • SingleAgentTurnVerificationInput and SingleAgentTurnResourcesVerifyRequest are removed, so no Resources Server depends on an Environment Server's protocol. This changes single_agent_turn code merged in feat: add single-agent-turn environment server #3717.
  • SWE-bench Pro accepts one verify model, SWEBenchProVerifyRequest, and finds its sandbox through the session.
  • ResourcesVerifyRequest[T] stays for Resources Servers paired with their own Environment Server, whose payload type they define.
  • Records from single_agent_turn now carry the same echoed task fields as records from an Agent's /run, and reverification sends the body live grading sends.

Single-agent-turn interaction flow

This diagram describes SWE-bench Pro under the built-in single-agent-turn Environment Server. Other Environment Servers may use different lifecycle and result contracts.

sequenceDiagram
    participant E as EnvironmentServer
    participant R as SWEProResources
    participant S as TaskSandbox

    E->>R: Seed with task data and caller ID
    R->>S: Start and prepare sandbox
    R-->>E: SandboxAccess and session cookie
    E->>R: Verify with task fields and the Agent response, under the session cookie
    R->>S: Extract patch and run evaluator
    R-->>E: Verification result
    E->>R: Close session
Loading

Stack position

Part 1 of 4, based on main. Next: #3720.

No issue is linked because this is one layer of the Environment Server stack.

Validation

  • uv run pytest resources_servers/swebench_pro/tests -q — 84 passed
  • uv run pytest environment_servers/single_agent_turn/tests/test_app.py -q — 12 passed, including a check that /verify receives the flat body under the Resources session cookie
  • uv run pytest tests/unit_tests -q — passes except two tests that also fail on main in the local environment (missing sandbox extras and a pip notice)
  • pre-commit run on the changed files

Rollouts

A real Hermes + SWE-bench Pro rollout through single_agent_turn_legacy resolved its task (reward 1.0, 300 of 300 tests) with the flat verify body under a typed session, with an empty failure sidecar and no leftover sandboxes. Its record carries the task fields, as a /run record does.

Compatibility and benchmark impact

Legacy SWE-bench Pro request bodies remain supported. Existing Resources Servers verify single-agent-turn episodes without changes. SingleAgentTurnVerificationInput and SingleAgentTurnResourcesVerifyRequest are removed from nemo_gym.single_agent_turn_types; they landed in #3717 and had no users outside this stack.

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team September 28, 2026 15:38
@ananthsub
ananthsub added this pull request to stack #3723 September 28, 2026 15:38
@ananthsub
ananthsub force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from 02b85d2 to 9d80a03 Compare September 28, 2026 15:41
@ananthsub
ananthsub removed this pull request from stack #3723 September 28, 2026 15:41
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team September 28, 2026 15:41
@ananthsub
ananthsub changed the base branch from ananthsub/episode-orchestration-06-single-agent-processor to ananthsub/episode-orchestration-09-legacy-adapter September 28, 2026 15:42
@ananthsub
ananthsub added this pull request to stack #3725 September 28, 2026 15:43
@yaoyu-33 yaoyu-33 added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Sep 28, 2026
@ananthsub
ananthsub force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from 9d80a03 to c9d8ea4 Compare September 28, 2026 15:48
@ananthsub
ananthsub force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from c9d8ea4 to 79232b6 Compare September 28, 2026 16:03
@ananthsub
ananthsub force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from 04a682a to 28e1f71 Compare September 29, 2026 00:16
@marta-sd
marta-sd force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from 28e1f71 to 50462e7 Compare September 29, 2026 06:22
@marta-sd
marta-sd force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from 50462e7 to e33a0d5 Compare September 29, 2026 08:57
Base automatically changed from ananthsub/episode-orchestration-09-legacy-adapter to main September 29, 2026 09:31
@marta-sd
marta-sd force-pushed the ananthsub/episode-orchestration-07-swe-pro-sessions branch from e33a0d5 to 849d147 Compare September 29, 2026 09:31
Signed-off-by: Ananth Subramaniam <[email protected]>
The single-agent-turn Environment Server now sends /verify the body an Agent's /run sends: the task's fields,
responses_create_params, and the agent's response, under the Resources session cookie that identifies the
episode. Existing Resources Servers verify these episodes without a second request type, and records and
reverification use the same body as live grading.

SingleAgentTurnVerificationInput and SingleAgentTurnResourcesVerifyRequest are removed, so no Resources Server
depends on an Environment Server's protocol. SWE-bench Pro accepts one verify model, finds its sandbox through the
session, and still rejects a repeated verify of a typed session whose sandbox is consumed.

Signed-off-by: Ananth Subramaniam <[email protected]>

@yaoyu-33 yaoyu-33 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. Reviewed f3cd130; all 96 targeted SWE-bench Pro and single-agent-turn tests passed.

@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/36595837317

This branch was previously deployed

1 inactive deployment
public — f3cd130d Deployed Sep 29, 2026 by copy-pr-bot[bot] via release / finalize / notify #3925
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 complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants