Repository navigation
feat(swebench): seed typed resources sessions for environment server episodes - #4277
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. |
Add resources_servers/swebench/task_sandbox_sessions.py, a shared helper for SWE resources servers whose seed starts one task sandbox, and use it in swe_gym and r2e_gym. An Environment Server can now seed a typed session, hand the agent the task sandbox through sandbox_access, verify, and close. The legacy seed body and response are unchanged. Signed-off-by: Ananth Subramaniam <[email protected]>
…episodes Make SwebenchResourcesServer a SandboxSessionResourcesServer, so it serves environment server episodes the same way the SWE training servers do. A typed seed validates task_data as a SWE-bench instance, starts the task sandbox with the same anti-cheating setup as the legacy seed, and returns sandbox_access with the serialized sandbox and the image's working directory, resolved with pwd. That is the directory verify extracts the patch from. The first verify of a typed session consumes the task sandbox, and is claimed before the evaluation sandbox starts, so a rejected repeat leaks nothing. Close, fences, expiry, and shutdown cleanup come from the base class. The legacy seed body and response are unchanged. Signed-off-by: Ananth Subramaniam <[email protected]>
Add benchmarks/swebench/verified/hermes.yaml, which runs SWE-bench Verified rows through single_agent_turn_legacy with the swebench resources server preparing the task sandbox and Hermes working inside it through sandbox_access. The configuration's own resources server instance allows hermes_agent, so the shared swebench.yaml and its allowed_agents stay unchanged. Signed-off-by: Ananth Subramaniam <[email protected]>
6c15a2c to
5cf67b5
Compare
|
PR |
|
💬 Merge-queue validation failed in two OpenClaw cancellation/close tests at their termination deadline. Both tests passed on current main and the PR head, and the queue has identical relevant code, dependencies and test configuration. This supports a timing-flake diagnosis, so I’m requesting the first bounded CI rerun without changing the branch. |
|
CI restart for |
|
💬 No rerun started: this lane can’t restart the synthetic merge-queue commit. Could a maintainer requeue #4277 for validation against current main? The PR is still open with its ready-to-merge label, and I’ll keep watching it. |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41973936937 |
|
PR |
1 similar comment
|
PR |
|
💬 I can’t inspect the new merge-queue failure because brokered GitHub reads still return |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42092117431 |
|
PR |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42094509840 |
|
The PR is no longer an open ready-to-merge PR targeting main. |
|
The PR is no longer an open ready-to-merge PR targeting main. |
|
The PR is no longer an open ready-to-merge PR targeting main. |
#4277 gave the swebench server an agent-run seed path that still used the removed ResourcesSessionFence API (_task_session_fence.closed_episode) and the old "legacy seed" and "typed session" wording. It now tests membership in the shared base's _task_session_fences and refuses with "An agent-run seed cannot replace an episode session", as r2e_gym and swe_gym do. Its test names and docstrings say episode seed and agent-run seed, and the refusal test checks the message. A pi_agent test comment merged since says "terminal 422". Signed-off-by: Ananth Subramaniam <[email protected]>
…ease (NVIDIA-NeMo#5083) * refactor(sessions): one name per session lifecycle concept before release Give each resources session and agent session lifecycle concept one name across code, docstrings, error messages, tests, config descriptions and docs. - Split ResourcesSessionFence into ResourcesSessionLocks, which runs a session's seed and close one at a time, and ResourcesSessionFences, which replaces ClosedResourcesSessionRecords and refuses a seed after its close until the fence expires. - Call the fence's duration the close retry window everywhere, including close_retry_window_seconds in session routing. - Add AgentSessionConflictError for agent session 409 refusals. - Use episode session, episode seed, legacy run seed, saved reply, release, lost and terminal in place of typed, untyped, close receipt, tombstone, free and final. Nothing renamed has been released, so there are no aliases. Signed-off-by: Ananth Subramaniam <[email protected]> * fix(sessions): clarify seed names and unavailable-session errors Signed-off-by: yaoyu-33 <[email protected]> * test(sessions): match the unavailable-session message in OpenClaw and OpenCode tests The agent base now refuses a retried close or a seed after the fence expires with "Agent session is no longer available". Two sandbox tests still matched "expired". Signed-off-by: Ananth Subramaniam <[email protected]> * refactor(sessions): say owner for session routing and release for freeing state (NVIDIA-NeMo#5087) * refactor(sessions): say owner for session routing and release for freeing state Session routing called the worker that holds a session a claimant and its record a claim, while the checkpoint stack uses claim for a worker taking a restored record (unclaimed, settled in NVIDIA-NeMo#4997). Routing already said owner in x-ng-session-owner and routes_sessions_to_owner, so it now says owner everywhere: SessionClaims becomes SessionOwners, claim files become owner files in session-owners, and claimed_session_routing becomes owned_session_routing. The checkpoint stack said a retire frees a session, while the session code says release. It now says release too, and on_session_freed becomes on_session_released. A few session tests still called an episode seed typed; they now use the episode session names. Signed-off-by: Ananth Subramaniam <[email protected]> * docs(sessions): define ownership by the current session holder Signed-off-by: yaoyu-33 <[email protected]> --------- Signed-off-by: Ananth Subramaniam <[email protected]> Signed-off-by: yaoyu-33 <[email protected]> Co-authored-by: yaoyu-33 <[email protected]> * refactor(sessions): carry the session names to servers merged since Servers and routing code merged after this branch opened still used the earlier names: ResourcesSessionFence in browsecomp_advanced_harness and the shared SWE sandbox-session base, ClosedResourcesSessionRecords in agentic_if, officeenv, partner_if's SWE adapter and scale_swe, and claim, claimant and ROLLOUT_CLAIM_PREFIX in the rollout-stop routing. Move them onto ResourcesSessionLocks, ResourcesSessionFences and the owner names, and drop "typed", "Environment Server session", "retention window", "remembers the close" and "close receipt" from their prose, tests and docs. terminal_bench_4 keeps its own fence bookkeeping under fence names, and nemo_user_sim's closed-session map becomes fenced_resources_session_ids. Add a Sessions section to the key terminology page with each term and the names it replaces, and point AGENTS.md at it in one line. Export the new classes from nemo_gym.server_runtime and AgentSessionConflictError from nemo_gym.agents, and record the renamed names in the import-surface fixture in place of the removed ones. Signed-off-by: Ananth Subramaniam <[email protected]> * refactor(sessions): finish the name sweep and scope the glossary to the code Review follow-ups for the session names: - The glossary's Conflict row now names the shared session code that raises ResourcesSessionConflictError and AgentSessionConflictError, instead of promising that no session code raises a plain 409. Release also covers a worker releasing ownership of a session ID, Lost says how an agent refuses a cookie for a lost session, and the note on other features' senses lists token capture and launch fences, MCP token claims, the launch claim file, the checkpoint terminal step and SandboxSession.expire(). - The harness guide says saved reply, close retry window and fence instead of "retained close", "replayed" and "final", and points 409 refusals at AgentSessionConflictError. The nemo_user_sim README names session_ttl_seconds, the window its fences really last. - partner_if's SWE adapter keeps its fences in _adapter_fences, apart from the Scale-SWE _fences it inherits, as it did before the rename. - ResourcesSessionFences.get() tells callers whose record may be None to test membership, and the TODO about sessions that are never closed moves to close_resources_session. - Test names, locals, comments and READMEs drop the remaining "typed", "legacy seed", "close receipt", "frees" and "final 422" wording. - New tests pin AgentSessionConflictError as a 409 that is still a ValueError, a fence holding a None record refusing a late seed, and the Codex refusal of a sandbox cookie that names no agent session. The agent retry tests match the exact close and seed messages. Signed-off-by: Ananth Subramaniam <[email protected]> * refactor(sessions): carry the session names to swebench's agent-run seed NVIDIA-NeMo#4277 gave the swebench server an agent-run seed path that still used the removed ResourcesSessionFence API (_task_session_fence.closed_episode) and the old "legacy seed" and "typed session" wording. It now tests membership in the shared base's _task_session_fences and refuses with "An agent-run seed cannot replace an episode session", as r2e_gym and swe_gym do. Its test names and docstrings say episode seed and agent-run seed, and the refusal test checks the message. A pi_agent test comment merged since says "terminal 422". Signed-off-by: Ananth Subramaniam <[email protected]> --------- Signed-off-by: Ananth Subramaniam <[email protected]> Signed-off-by: yaoyu-33 <[email protected]> Co-authored-by: yaoyu-33 <[email protected]>
SWE-bench now uses the shared resources-owned sandbox session implementation from #4302. An Environment Server seeds the task, passes
sandbox_accessto the harness, verifies its saved patch, and closes the session. The Hermes recipe uses currentsingle_agent_turntaskset routing with the agent borrowing that sandbox.This update incorporates repaired parent
fb5525f87dbd56d6070e38b68c8405823cbbc8fbwithout rewriting the author's history. Failed startup/teardown retains cleanup ownership; identical typed verification retries reuse the captured patch or verdict. Missing/closed sessions return maskedSESSION_LOST, and expiry returnsSESSION_EXPIRED. Canonical caller TaskIds are accepted. Legacy flat seeds and seedless golden-patch verification remain supported. Main's seed-head handling, staged/committed patch extraction, binary filtering, patch hashes, masking and sandbox observations are preserved.No separate issue is needed: this is the SWE-bench consumer of the reviewed shared session change. Merge #4302 before this PR.
Validation at
94142e1768f12604063b7e19e3ca299f591572d9:pytest resources_servers/swe_gym/tests resources_servers/r2e_gym/tests resources_servers/swebench/tests tests/unit_tests/test_session_contract_repo.py tests/unit_tests/server_runtime/test_resources_sessions.py tests/unit_tests/data/test_task_materialization.py --import-mode=importlib -q: 299 passed on Python 3.13.14.pre-commit run --all-filespassed; the new commit has DCO sign-off.Real Linux/Docker smoke with
nvidia/nemotron-3.5-super-vl-120b-a12bondjango__django-11099:opencode_agent+single_agent_turnBoth used canonical outer TaskId
caller-row-0and left no task containers. Changed runtime/recipe files on the smoke host were hash-checked against the committed source. These are representative lifecycle/verification checks, not a full benchmark or solve-rate comparison.An additional Hermes run capped at 15 turns completed the same verification, but its token health check failed: the forced final-summary call's 12,318 input / 737 output tokens were absent from returned usage. Source tracing places that defect in the unchanged Hermes runtime/adapter; the failed health result is retained separately and is not counted as a clean smoke.