feat(swe_env): decoupled SWE environment library + verifier (#1249) [1/3] - #2
Closed
adil-a wants to merge 1 commit into
Closed
feat(swe_env): decoupled SWE environment library + verifier (#1249) [1/3]#2adil-a wants to merge 1 commit into
adil-a wants to merge 1 commit into
Conversation
…eMo#1249) Adds the provider-neutral swe_env library (sandbox lifecycle, docker/apptainer providers, per-benchmark task harnesses, test-output parsing, grading) and the required stateless verifier resources server that grades an agent's patch in a fresh sandbox and returns the reward. No agent is wired to it yet; it stands alone and is covered by its own unit tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: adil-a <adil.asif2000@hotmail.com>
Owner
Author
|
Superseded by the stacked PRs opened directly on NVIDIA-NeMo/Gym (NVIDIA-NeMo#1677, NVIDIA-NeMo#1678, NVIDIA-NeMo#1679). |
adil-a
pushed a commit
that referenced
this pull request
Jun 25, 2026
…ool error Addresses review feedback on MCPResourcesServer: - (#3) Replace the per-process token->session dict with a stateless signed token (itsdangerous URLSafeSerializer keyed by the deterministic session-middleware secret). Any worker can verify a token another worker minted, so this works with num_workers > 1 and there is nothing to evict. - (#1) Offload blocking sync @gym_tool methods to a threadpool so they don't stall the event loop (and every concurrent rollout in the worker). - (#2) Raise a plain MCPSessionError with a clean message instead of HTTPException(401). MCP runs over JSON-RPC (HTTP 200), so the status code never reaches the client; FastMCP surfaces this as a tool error (isError: true). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decoupled SWE environment library + verifier (NVIDIA-NeMo#1249)
Stacked PR 1 of 3 · base:
main· next:stack/2-swe-agents-openhandsPart of #1249 — decouple the SWE environment infrastructure from the agent harnesses — built on top of the Sandbox API from NVIDIA-NeMo#1377 (now on
main).What this PR adds
Today the entire SWE-bench stack (sandbox provisioning, the per-dataset eval recipes, patch parsing, and grading) is fused into the OpenHands agent in
responses_api_agents/swe_agents/app.py. No other agent can reuse any of it. This PR extracts that infrastructure into two reusable, agent-agnostic pieces. It adds the new pieces only — no existing agent is rewired yet (that is PR 2).1.
responses_api_agents/swe_env/— a shared SWE environment library. An installable distribution that any agent imports to provision and drive its own task sandbox on top of the NVIDIA-NeMo#1377 Sandbox API:environment.py—AsyncSweEnvironment, the provider-neutral execute/upload/download wrapper agents drive.harness.py/registry.py— theSweTaskHarnessABC and a name→harness registry; one source of truth for the dataset families (swebench, swe-rebench, nv-internal, swe-bench-ext, r2egym, flat-eval).grading.py— purecompute_resolved()/reward_from_report()helpers.parsing/— the SWE-bench-Ext test-log parser (relocated here as the single home; the duplicate underswe_agentsis removed in PR 2).providers/{apptainer,docker}_provider.py—SandboxProviderimplementations, including the Apptainer.sifpath the on-prem clusters use.lifecycle.py— a thinacquire_sandbox()context manager. (The heavier durable-registry/reaper/admission lifecycle layer is intentionally out of scope here and tracked as a follow-up to generalize it into the sandbox layer.)model_endpoint.py— provider-neutral resolution of a sandbox-reachable model-server endpoint for self-driving agents.2.
resources_servers/swe_env/— the verifier. ASimpleResourcesServerwhoseverify()is the single scoring entry point: it extracts the model's patch from the response, grades it in a fresh, stateless sandbox, and returns the eval-side fields.verify_task.pyholds the server-private grading orchestrator (reset → apply patch → run eval → parse → reward). Ships with a launchable config + offline example fixtures for the data gate.Tests
ruff check/ruff formatclean. Real-container grading paths are skip-guarded (apptainer/Docker); the orchestrator is exercised via a FakeSandbox that replays recorded eval transcripts.Review notes
requirements.txt), so the cross-tree import works underng_run/ng_test.🤖 Generated with Claude Code