Skip to content

feat(swebench): run multimodal through environment server sessions - #5659

Open
yaoyu-33 wants to merge 15 commits into
mainfrom
codex/swebench-multimodal-env-server
Open

yaoyu-33 wants to merge 15 commits into
mainfrom
codex/swebench-multimodal-env-server

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

SWE-bench Multimodal now runs through single_agent_turn and opencode_agent, using the benchmark added in #5611 and the shared Resources-owned sandbox sessions from #4302/#4277. This removes the recipe's dependency on opencode_sandboxed_agent.

The Resources Server prepares the task sandbox, lends its access to OpenCode, verifies the captured patch in a fresh sandbox after agent close, and owns teardown. This PR reuses that implementation without adding another lifecycle helper.

Changes:

  • Route swebench:multimodal through a typed taskset; move the dataset declaration to Resources and update the recipe, manifest, pairing allowlist and binding test together.
  • Add generic OpenCode session support for inline PNG/JPEG/GIF/WebP images. Preserve bytes and image order, stage attachments outside the task repository, keep vision enabled across continuation, and use the existing activation/cleanup lifecycle.
  • Preserve feat(swebench): add the SWE-bench Multimodal benchmark #5611's preparation, reference-fixture isolation and failure-only grading repairs. Dataset, prompts, verifier and three repeats per task are unchanged.
  • Document prepare/run commands, budgets and compatibility. The agent instance is now swebench_multimodal_opencode_agent; use --split benchmark with the taskset recipe. Training token-ID capture is opt-in. Rebaseline results when changing harnesses.

The pinned runtime remains OpenCode 1.17.11. Remote image URLs and file IDs are rejected. The CLI groups image attachments ahead of its text prompt and does not forward the Responses detail hint; these limitations are documented. This does not add a harness or change its version.

This carries forward the generic image and recipe work from trintamaki#1; its duplicate Resources implementation is omitted. No separate issue is needed for this follow-up to #5611.

Dependency

#4302 and #5611 are merged. #4277 remains open; its four-file prerequisite is included in this branch. The migration itself is ten files on top of that implementation. Merge #4277 first, then update this branch from main to remove the prerequisite from the diff.

Validation

Runtime/tests: 6dce4252e00ac47b82de934a76255ad5e747caaf. Final head 33892118754ee177b62eed1ed38c674bfa140ee7 differs only in the two README files; runtime and recipe are identical.

  • SWE-bench preparation, binding, SWE resources suites, session contract/materialization and environment wiring checks: 549 passed.
  • Complete OpenCode adapter suite plus shared sandbox-session and routing tests: 756 passed, 61 skipped on macOS. Skips require Linux process supervision/installers or the pinned executable.
  • Benchmark catalog/manifest checks: 249 passed on macOS; the remaining global listing test failed because the Mac hostname could not resolve for ten existing use_absolute_ip recipes, then passed unchanged on Linux.
  • Image-focused subset: 42 passed. Reverting the adapter behavior in a separate process makes the new HTTP image test fail with 422 instead of 200.
  • pre-commit run --all-files: passed on the final head, including new files. SWE-bench, SWE-Gym and R2E-Gym example-data validation passed. New commits have DCO sign-off.
  • Two independent source review passes checked comments, input preservation, fixture isolation, lifecycle ordering, retries/cancellation and configuration. Stale README migration and offline-asset statements were corrected.

Rollout evidence

Linux, OpenCode 1.17.11, SWE-bench 4.1.0, real Docker task images and nvidia/nemotron-3.5-super-vl-120b-a12b. The model endpoint was accessed through Gym with model-call capture. Dataset revision: 4e6662d51c48e475f7f346e4fa09a6f8b31fcaa5.

Run folder / task Observed result
calypso-01 / Automattic__wp-calypso-21409 Both input-image SHA256s match captured model requests. 36 real calls; 1,280-byte patch; Jest ran 33 assertions (30 passed, 3 failed); verification completed with reward 0, unmasked.
verified-text-01 / django__django-11099 Second pairing through configuration alone; 24 real calls; 901-byte patch; 22 Django tests passed; response completed, reward 1, unmasked.
chart-golden-03 / chartjs__Chart.js-10157 Production Resources golden-patch check with verifier networking disabled. All six reference PNG hashes were observed at their expected paths during evaluation; hidden fixtures were absent from the agent sandbox. Browser startup failed, so verification correctly returned incomplete/masked verifier_error, rather than a false positive. This is not a successful golden-patch score.

Both model runs passed health and the evidence inspector (healthy 1 / unhealthy 0 each), and logs show agent close before verification and final Resources close. All resources owned by these runs were cleaned up. Statistical repeated-task/run checks were unobserved because each run contains one task.

Calypso's final model call hit the smoke's 4,096-token per-call output cap (finish_reason=length), so its agent response is incomplete; the executed tests support its zero grade. Smoke agent budgets were 900 seconds for Calypso and 600 seconds for Django, with 600 seconds for verification. These are representative behavior checks, not a full benchmark or score-parity measurement. The benchmark remains experimental; Chart.js browser-image compatibility still needs separate qualification.

Stock OpenCode harness conformance also completed: all nine scenarios fulfilled, full P0 gate passed, including the compaction scenario. No checker, scenario or scripted reply was changed. Command: python scripts/run_harness_conformance.py --harness opencode --output <fresh-directory>.

Checks to finish before merge

Human review and repository CI remain required. The current CI classifier selects the full scope because the PR includes benchmark YAML. The new head needs maintainer CI authorization; this PR does not post its own /ok to test command.

ananthsub and others added 13 commits October 9, 2026 10:11
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]>
…ose released

Team review of the typed-session lifecycle found follow-ups to the ownership fix:

- A failed expiry stop is retried at most once per EXPIRY_RETRY_INTERVAL_S, and a request that queued behind
  a retry sees its new deadline, so one stuck sandbox no longer adds a stop attempt of up to STOP_TIMEOUT_S
  to every unrelated seed, verify and close.
- A claim that is never released no longer keeps close, expiry and shutdown from stopping the sandbox: the
  verify wrapper marks it released when it exits, and a wait that times out stops the sandbox anyway.
- shutdown stops the open sessions concurrently, at most SHUTDOWN_STOP_CONCURRENCY at a time; the supervisor
  allows a server about a second to exit.
- A failed task-sandbox stop after a captured patch fails verify only for a typed session, whose retry reuses
  the saved patch. A session seeded through /run has no saved capture and no close, so the stop is logged and
  grading continues, as before sessions.
- A seed whose cleanup stop also fails raises its own error instead of the stop's.
- SWE-Gym and R2E-Gym save the empty-patch fallback of a failed extraction with the session, so grading
  interrupted after the task sandbox stopped is retried on the same patch instead of answering SESSION_LOST.

Regression tests cover each change, and the real _create_sandbox registration of the grading sandbox, the
cleanup between inconclusive grading attempts, and seed replay and expiry edge cases the mutation run found
untested.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
… the Hermes sandbox alive for the episode

Team review of the SWE-bench consumer found follow-ups:

- A non-zero exit of the patch-extraction command is the agent's graded result again: it can remove .git or
  prune the seed commit, and the empty patch then fails to apply and scores 0. Only an exec that reported no
  exit code (error_type) is masked as a verifier error, so a broken repository no longer drops out of the mean.
- A failed task-sandbox stop after a captured patch fails verify only for a typed session, whose retry reuses
  the saved patch; a session seeded through /run logs it and grades, as before sessions.
- A flat seed records the workdir its start resolved, so verify does not ask the agent's sandbox for it.
- A flat seed whose cleanup stop also fails raises its own error instead of the stop's.
- The Hermes recipe sets sandbox ttl_s above the 21600 s episode deadline, since the resources session
  expires with its sandbox.

Tests cover each change, SESSION_EXPIRED through this server's own lost-session response, the seed head and its
ordering after the anti-cheat scrub, the flat-seed paths, the real _create_sandbox registration, the typed
extraction-error path, the TaskData and SWEBenchInstanceRequest field match, and resolution of the recipe.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…essions

Picks up the opencode_search component lock files (#5629) so the component-lock checks pass on this branch.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ped-seed

Merges the parent branch, which now includes main (the SWE-bench Multimodal benchmark, #5611). Its test_assets
now reach only the verifier sandbox, and the typed seed keeps the task sandbox free of them. TaskData keeps
image_assets optional, so the schema test no longer expects it to be required.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@copy-pr-bot

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

@yaoyu-33 yaoyu-33 added area:agent Agent harnesses and Responses API agent behavior feature New capabilities, enhancements, or enablement work labels Nov 5, 2026
@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 5, 2026 05:49
@yaoyu-33 yaoyu-33 added the needs-review PR is ready for code review and waiting on a reviewer label Nov 5, 2026

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

RISK — Add a matched before/after grading comparison. The changed patch-capture path changes extraction-error handling and consumes the task sandbox before creating the verifier. These changes affect existing SWE-bench consumers, not just the migrated recipe. The pinned rubric requires reward-profiling evidence for fixed-benchmark verifier changes. The reported single-task model smokes and incomplete Chart.js golden-patch check don't provide that comparison. This is an evidence gap, not a demonstrated scoring defect.

Add a base/head comparison using identical task rows and captured patches. Report aggregate rewards, completed and masked counts, and explain changed outcomes. Retain the established distinctions: staged and committed fixes receive their expected grades; agent-broken Git repositories receive an unmasked zero; provider extraction failures remain masked; reference images reach only the verifier; and incomplete failure-only suites remain masked. Acceptance is unchanged grading for matched valid cases, with any changed masks explicitly accounted for. No code patch is appropriate for this evidence request.

I completed the source review across all 14 changed files and their directly affected contracts. I didn't execute tests or independently reproduce the reported rollouts.

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

datasets:
- name: swebench_multimodal
type: benchmark
taskset: swebench:multimodal

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.

RISK — Remove the unsupported taskset field from the manifest dataset.

Loading this manifest fails because ManifestDataset forbids extra fields and doesn't declare taskset. Direct manifest validation therefore fails at datasets.0.taskset. Catalog discovery catches that manifest error and falls back to a legacy entry, losing the benchmark's manifest metadata. The base manifest didn't contain this field.

Delete this line only from the manifest; retain taskset: "swebench:multimodal" in the runtime recipe. That restores the manifest schema while preserving taskset routing. The composition mirror intentionally excludes taskset too.

Suggested patch at this location; verify before adopting:

 - name: swebench_multimodal
   type: benchmark
-  taskset: swebench:multimodal
   jsonl_fpath: benchmarks/swebench/data/swebench_multimodal_benchmark.jsonl

Proposed acceptance checks: load_manifest() succeeds for this file; catalog discovery returns swebench/multimodal/opencode with a non-null manifest_path, integration_profile == "custom-gym-agent-loop", and modality == "text,image"; composition validation reports no mirror differences. Retain the recipe regression test's taskset route, Resources dataset ownership, image-preservation, and three-repeat assertions. Keep strict rejection of unknown manifest fields rather than relaxing extra="forbid". These checks are proposed, not executed.

This branch has not been deployed

No deployments
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 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.

3 participants