SWE-bench
Marina’s coding agent can be measured on SWE-bench without any
benchmark-specific behavior inside Marina. bun run swebench is a thin adapter over the general
one-shot coding entry point (marina -p "<task>" <dir>, see Coding):
- Checkout: each instance gets a fresh repository holding the base commit and nothing else (see Workspace hygiene). Attempts never share a working tree and never touch the Marina checkout that runs them.
- Task: the agent receives the issue text only (
problem_statement). Hints, the gold patch and the test patch are never exported bybenchmarks/swebench/export.py, so nothing downstream can read them. - Work:
marina -pboots a folder-scoped Marina, and its coding agent edits the checkout. Host execution stays allowlist-only, and a non-interactive run never escalates. - Patch: the working-tree change, including new files, is collected as
model_patch. - Trajectory and cost: the streamed session, plus the session’s Marina database (every turn,
tool call and spend row), is kept as the trajectory. Cost is the session’s
spend_dailytotal. Each session’s daily spend cap is $25. Withrun --max-usd X, the run’s total, including attempts already recorded, is capped at X instead: every attempt gets an even share of what is left as its session’s cap (SpendGuard.share), and no attempt starts once X is spent. - Scoring: the official SWE-bench harness, run unmodified.
- Ledger: the scored run is filed into the benchmark ledger in a replicate group, so
benchmark compare,leaderboardandreplicatesrank it with everything else Marina has measured.
Workspace hygiene
Section titled “Workspace hygiene”A full clone of an upstream repository also contains every commit made after the task’s base
commit, including the fix the benchmark grades against. Other branches, tags, remotes, packed refs,
the reflog, FETCH_HEAD and shared object stores all reach those commits, so a solver could recover
the reference patch with git log --all, git show <sha>, git reflog or git fsck. The
workspace is built so that none of these routes exists:
-
Layout. Repositories are mirrored once under
<data>/mirrors, but the mirror is only ever fetched from. Each attempt runsgit initin an empty directory and fetches the base commit alone (--depth=1 --no-tags --no-write-fetch-head), then detaches HEAD at it. The workspace has no branches, tags, remotes, alternates, reflog (core.logAllRefUpdates=false, and the checkout’slogs/are removed), stash,FETCH_HEADorORIG_HEAD, and no objects beyond the base tree. -
Same sha, same patch. HEAD is the real base commit, so
git diff HEAD(the collectedmodel_patch) applies to the base exactly as the grader applies it. -
No earlier history either. The fetch is shallow, so commits before the base are not available.
git logshows the base commit only andgit blameattributes every line to it. -
Fail closed. Every prepared workspace is checked before the agent starts (
assertWorkspaceIsolatedinbenchmarks/swebench/adapter.ts). The instance fails, with no attempt recorded, when:- HEAD is not the base;
- any ref, remote, reflog entry or pointer file (
packed-refs,FETCH_HEAD,ORIG_HEAD, alternates,worktrees/,modules/) exists; - any commit other than the base is reachable;
- the object store holds any object not reachable from the base tree;
- a known forbidden sha (for example a gold commit, when one is supplied) resolves.
filerecords an instance with no recorded attempt as unresolved. -
Environment images. With
--env-image, the agent’s commands run in the instance’s official image. Its/testbedrepository is prepared by the SWE-bench image builder: later tags are deleted, the remote is removed, the reflog is expired and the object store is pruned. The image keeps the history before the base, plus one synthetic setup commit on top of it. The patch is still collected from the isolated host workspace described above.
Commands
Section titled “Commands”# Solver-visible fields only, written outside the repository:python benchmarks/swebench/export.py ~/.local/share/marina-swebench/data/verified.jsonl
bun run swebench subset --n 50 --seed 7 # seeded ids, mixed across repositoriesbun run swebench run --arm single --model <model> --replicate 1bun run swebench run --arm verify --model <model> --review-model <model2> --replicate 1SWEBENCH_PYTHON=<venv>/bin/python bun run swebench score --arm single --replicate 1bun run swebench file --arm single --replicate 1 --db marina.db- The
verifyarm is the verification formation, built from the same entry point. After the implementer, a reviewer (usually another vendor) reads the change against the issue. It edits only when the change is wrong or incomplete. - Resuming:
runskips instances already recorded in the run’sattempts.jsonl, so an interrupted run picks up where it stopped. It records the arm, mode and subset (--n/--seedor--ids) inarm.jsonand refuses to continue a replicate under another configuration. - One subset per run:
runandfileread the idssubsetwrote, so give every step the same--nand--seed(or--ids);filerecords the seed fromarm.json.bun run swebench exportwrites the task fields withSWEBENCH_PYTHONwhen<data>/verified.jsonlis missing. - Re-filing is a no-op: the ledger result is stamped with the last attempt’s write, never the filing time, and every replicate of an arm records the same target (no replicate number or path).
- Location: everything is written under
--data(default~/.local/share/marina-swebench/data). --env-image(opt-in): the agent’s commands run inside the instance’s official environment image (swebench/sweb.eval.x86_64.<id>, pulled or built beforehand) through Marina’s general container runner, in patch sync at/testbedwith thetestbedconda env and no network. The agent can then run the project’s existing tests while it works (a full agent run instead of agentless). Without the flag, runs stay agentless.- In-loop verification: with
--env-image,code verifyandcode testrun in that same image, including candidate checks. Preparation follows the detected project type: for a Python repository it probes the image’s environment (the instance image already has it) and never runs a JavaScript installer, even when the repository carries apackage.jsonor the agent asks fordependencies:bun. Tests relevant to the change run first. Each verification endspassed,failed,not_run(nothing could be checked, with the reason) orerror(the runtime failed). Each attempt inattempts.jsonlcarries these counts (verification), and the filed ledger result sums them inmetadata.verification. They describe the agent’s process only: grading is the harness’s alone, and anot_runis never counted as a failed or passed check. - Budget-forced patches:
marina -pgives each attempt a time budget just insideMARINA_CODE_TASK_TIMEOUT_MS. A summary submitted past the budget’s final-answer point is the forced best effort;-p --jsonreports it asbudgetForced. The adapter reads the label from the session database, and each attempt inattempts.jsonlcarriesbudgetForced. The filed ledger item carriesbudget_forced(true when any attempt in the session was forced, false when a budgeted attempt ended without it), andmetadata.budgetForcedcounts the forced items.benchmark resultreports the count. It is a label only: the harness grades the patch as usual.
SWE-bench Pro
Section titled “SWE-bench Pro”SWE-bench Pro (public set, v2: 642 tasks
from 11 repositories in Go, Python, JavaScript and TypeScript) uses the same adapter with
--benchmark pro. Its harness is
scaleapi/SWE-bench_Pro-os (MIT; task content
follows each upstream repository’s license).
python benchmarks/swebench/export.py <data>/pro.jsonl ScaleAI/SWE-bench_Pro testgit clone https://github.com/scaleapi/SWE-bench_Pro-os <harness>bun run swebench subset --benchmark pro --data <data> --n 45 --seed 7bun run swebench run --benchmark pro --data <data> --arm single --model <model> --replicate 1SWEBENCH_PYTHON=python3 bun run swebench score --benchmark pro --data <data> \ --tasks <harness>/v2/tasks --arm single --replicate 1bun run swebench file --benchmark pro --data <data> --arm single --replicate 1 --db marina.db- Task text: a Pro task is the PR description plus its
requirementsandinterfacesections, as in the official task text. The exporter writes those fields and nothing else: no gold patch, no test patch and no test lists. - Grading (ledger judge: “swebench-pro verifier (local replay of the official verifier)”):
benchmarks/swebench/pro_grade.pyruns each task’s own verifier, unmodified (tests/test.sh,run_script.sh,parser.py,config.json), in a fresh container of the task’s pristine image (ghcr.io/scaleapi/swe-bench_pro-v2:<instance_id>).- Patch: applied with the harness’s patch-replay fallback chain.
- Task limits: each task’s timeout, CPU and memory limits are honoured.
- Hardening: the container runs with
--network none(override with--network <mode>only for a task set whose verifier must fetch),--cap-drop ALLplus the file-ownership and process capabilities a root test run needs,no-new-privileges, a PID limit and no swap beyond the memory limit. The root filesystem stays writable: the patch lands in/appand the verifier writes/logs/verifier, so--read-onlycannot grade. Instance ids must be plain names (no path separators). The--goldself-check proves a task set grades under these flags. - Result:
reward.txtdecides resolved (1) or not (0). - Errors: a pull, start or missing-reward failure is an error and is excluded from the ledger; it is never scored 0.
- Why not Harbor: this replaces Harbor’s own container backends on hosts where they cannot run,
such as rootless Podman without bridge networking. With Harbor available, its
PatchReplayAgentis the reference grader.
- Self-check before measuring:
pro_grade.py --ids <file> --goldmust resolve every task, and--emptymust resolve none. - The official protocol runs the agent offline, with only the model endpoint reachable, and bars looking up solutions. The task text carries the harness’s no-lookup constraint.
Running the official harness with Podman
Section titled “Running the official harness with Podman”The harness talks to a Docker-compatible API. With rootless Podman:
systemctl --user start podman.socketexport DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sockIf containers fail to start with netavark: create bridge … Operation not supported, the kernel has
no bridge support. Make pasta the default rootless network instead, in
~/.config/containers/containers.conf:
[containers]netns = "pasta"Limits
Section titled “Limits”- Tests during the agent’s work need
--env-image. A host checkout has no installed dependencies, so by default runs are agentless: the agent reasons from the code. With--env-image, Marina’s container runner (docs/guides/coding.md→ “Run commands in a container image”) executes the agent’s commands in the instance’s environment image; the images must already be present (the harness builds or pulls them), and each image needs a supported test runner shape (python -m pytest,python tests/runtests.py,go test,npm run test, …) to be useful. Patch sync starts every command from the image, so verification never installs dependencies there: an image without the project environment yieldsnot_run, not a failure. - No submission. Nothing is submitted anywhere. A leaderboard submission (a pull request to
SWE-bench/experimentswith predictions, logs and trajectories) is a separate act that its owner approves.
