Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/nullius/catalogue/agents/mini-swe-agent/agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
}
},
"only_for": [
"swe-bench-verified"
"swe-bench-verified",
"swe-bench-multilingual"
]
}
104 changes: 104 additions & 0 deletions app/nullius/catalogue/benchmarks/swe-bench-multilingual/benchmark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"key": "swe-bench-multilingual",
"title": "SWE-bench Multilingual",
"category": "Coding",
"domain": "Software engineering: fix a real GitHub issue in one of nine programming languages so the failing tests pass.",
"scoring": "Tests",
"harness": [
"standard",
"harbor"
],
"origin": "official",
"published": {
"agent": "mini-swe-agent",
"says": "mini-SWE-agent, the SWE-bench authors' own agent, which their Multilingual leaderboard runs every model with and Harbor registers; a model of your choice runs it."
},
"good_to_know": [
"The 300 images are 186 GB to download, 0.2 to 2.5 GB each, and take more disk space once unpacked."
],
"upstream_limitations": [
"26 instances download their test runner at every run: those of apache/druid, apache/lucene, google/gson, javaparser/javaparser and reactivex/rxjava. On a slow connection reactivex__rxjava-7597 fails whatever the patch."
],
"limitations": [
"On Nullius, the agent works in the instance's own container and the tests run there after it. Test files are reset first, so editing them does not help.",
"On Nullius, the agent can reach only its model, so it cannot run the tests of the 26 instances that download their test runner. The tests get internet access after the agent ends.",
"mini-SWE-agent runs here with its general prompt and no step or cost limit of its own. The leaderboard runs it with its SWE-bench prompt, 250 steps, 3 USD per instance and internet access.",
"On Nullius, the recorded patch is all that differs from the base commit, including what the image's build left there: an agent that changes nothing can still show a patch.",
"On Nullius, axios__axios-5085 cannot be resolved: one of its tests calls a public service through axios, and the tests' proxy refuses that request.",
"SWE-agent, the paper's agent, is not offered: it needs a python command in the instance's image, which 42 of the 300 images have.",
"Only instances of apache/druid, fmtlib/fmt, gin-gonic/gin, preactjs/preact, reactivex/rxjava and vuejs/core have been run through Nullius."
],
"datasets": [
{
"key": "swe-bench-multilingual",
"title": "SWE-bench Multilingual",
"tasks": 300,
"official": "https://github.com/SWE-bench/SWE-bench",
"registry": "swebench_multilingual@1.0",
"hub": "",
"verifier": "The failing tests must pass and the passing ones keep passing.",
"notes": "300 tasks from 41 repositories in C, C++, Go, Java, JavaScript, TypeScript, PHP, Ruby and Rust.",
"source": "Harbor registry"
}
],
"report": {
"sources": [
"swe-bench-multilingual"
],
"file": "verifier/report.json",
"required": true,
"under_task": true,
"succeeded": "resolved",
"produced": "patch_exists",
"produced_unless": "patch_is_None",
"usable": "patch_successfully_applied",
"gained": {
"pass": [
"tests_status.FAIL_TO_PASS.success"
],
"fail": [
"tests_status.FAIL_TO_PASS.failure"
]
},
"held": {
"pass": [
"tests_status.PASS_TO_PASS.success"
],
"fail": [
"tests_status.PASS_TO_PASS.failure",
"tests_status.PASS_TO_FAIL.success",
"tests_status.PASS_TO_FAIL.failure",
"tests_status.FAIL_TO_FAIL.success",
"tests_status.FAIL_TO_FAIL.failure"
]
},
"words": {
"gained": "Fail → Pass",
"gained_abbr": "F→P",
"gained_term": "FAIL_TO_PASS",
"held": "Pass → Pass",
"held_abbr": "P→P",
"held_term": "PASS_TO_PASS",
"has_patch": true
}
},
"citation": "@misc{yang2025swesmith,\n title={SWE-smith: Scaling Data for Software Engineering Agents},\n author={John Yang and Kilian Lieret and Carlos E. Jimenez and Alexander Wettig and Kabir Khandpur and Yanzhe Zhang and Binyuan Hui and Ofir Press and Ludwig Schmidt and Diyi Yang},\n year={2025},\n eprint={2504.21798},\n archivePrefix={arXiv},\n primaryClass={cs.SE},\n url={https://arxiv.org/abs/2504.21798},\n}",
"citation_source": "https://github.com/SWE-bench/SWE-bench",
"evidence": [
{
"label": "Why",
"path": "why"
},
{
"label": "Infrastructure failure",
"path": "infra_failure"
},
{
"label": "Timed out",
"path": "timed_out",
"unless": [
"no"
]
}
]
}
135 changes: 135 additions & 0 deletions app/nullius/catalogue/benchmarks/swe-bench-multilingual/driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
"""SWE-bench Multilingual's driver for the Nullius standard (JSON lines on stdin and stdout).

Each instance has the authors' container, the repository in ``/testbed``. The dataset (the SWE-bench
organisation's own, on Hugging Face, at a pinned revision) carries, per
instance, the problem statement, the gold patch, the image's name, the eval
script the harness runs and the name of the log parser that reads its output.

units - the instance ids, in the dataset's order
describe - the problem statement as its text, its first line as its title;
its repository as a category
setup - the problem statement as the prompt, verbatim; the instance's own
image (``image``: the authors' prebuilt image, pulled by the digest
its tag had when pinned here, ``images.json``), ``/testbed`` as the
working directory, and the check (``verify``: the harness's eval
script for the instance, written into the container once the agent
has ended and run there with a way out to download what it installs). The agent's
changes are tested where it made them; the harness would re-apply
them as a patch in a fresh container.
``env``: the images keep Go's modules and build cache, and the
pnpm and yarn that corepack fetched, under root's home, where the
tests find them; the agent's home is the run's, so it is told where
they are.
``JVM_PROXY``: the check's way out is a proxy named in
``HTTPS_PROXY``, which the JVM does not read; the check tells it,
since an instance's tests may download what runs them (Maven's
test runner).
score - the harness's own grading (``swebench.harness.grading.get_eval_report``)
of the patch and eval script's output: resolved when a patch exists,
every FAIL_TO_PASS test passes and every PASS_TO_PASS test still passes. Its report is kept
as ``verifier/report.json``, in the harness's own shape; the diff
from the instance's base commit, captured before testing, is kept
as ``verifier/model.patch`` and given to the grader.
oracle - the reference control: the gold patch applied in the container with
``git apply``, as the harness applies a prediction.

The driver never runs docker: the run does each step in the unit's container.
"""
import json
import os
import shlex
import sys

import pyarrow.parquet as pq
from swebench.harness.grading import get_eval_report
from swebench.harness.utils import make_test_spec

HERE = os.path.dirname(os.path.abspath(__file__))
WORKDIR = "/testbed"
EVAL_SECONDS = 1800 # the harness's own --timeout default for one instance's tests
SOLVE_SECONDS = 300
RESULTS = "/tmp/nullius-swebench-verifier"
# What the images keep under root's home, where the tests find it: an agent's home is the run's, not root's.
AGENT_ENV = {"GOPATH": "/root/go", "GOCACHE": "/root/.cache/go-build", "COREPACK_HOME": "/root/.cache/node/corepack"}
# The check's proxy as the JVM takes one: its proxy properties, and Maven's resolver told to read them.
JVM_PROXY = ('if [ -n "${HTTPS_PROXY:-}" ]; then p="${HTTPS_PROXY#*://}"; p="${p%/}"; '
'export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:+$JAVA_TOOL_OPTIONS }'
'-Dhttp.proxyHost=${p%:*} -Dhttp.proxyPort=${p##*:} -Dhttps.proxyHost=${p%:*} -Dhttps.proxyPort=${p##*:} '
'-Daether.connector.http.useSystemProperties=true"; fi')

with open(os.path.join(HERE, "images.json")) as f:
IMAGES = json.load(f)

_rows = None


def rows() -> dict:
"""The dataset's instances by id, read once from the parquet file the run checked."""
global _rows
if _rows is None:
_rows = {r["instance_id"]: r for r in pq.read_table(os.environ["NULLIUS_DATASET"]).to_pylist()}
return _rows


def row(unit: str) -> dict:
if unit not in rows():
raise ValueError(f"{unit} is not an instance of this dataset")
return rows()[unit]


def units(dataset):
return {"units": list(rows())}


def describe(dataset=None, **_):
out = {}
for unit, r in rows().items():
text = r["problem_statement"]
title = next((line.strip() for line in text.splitlines() if line.strip()), "")
out[unit] = {"title": title, "text": text, "categories": {"repo": r["repo"]}}
return {"units": out}


def setup(unit, dir):
r = row(unit)
capture = (f"cd {WORKDIR} && git add -A && "
f"git diff --cached --binary --no-ext-diff --no-textconv {shlex.quote(r['base_commit'])} -- "
f"> {RESULTS}/model.patch && {JVM_PROXY} && exec /bin/bash /eval.sh")
return {"prompt": r["problem_statement"], "environment": "task", "image": {"pull": IMAGES[unit]}, "workdir": WORKDIR,
"env": AGENT_ENV,
"verify": {"write": {"/eval.sh": make_test_spec(r).eval_script}, "run": ["/bin/bash", "-c", capture],
"collect": RESULTS, "seconds": EVAL_SECONDS, "network": True}}


def score(unit, dir, transcript, answer, verified=None):
if not verified:
return {"reward": 0.0, "passed": False, "detail": {"why": "the instance's tests did not run"}}
log = os.path.join(verified["dir"], "test-stdout.txt")
# the grader asks only whether there is a patch: a changed file in another encoding must not fail the score
with open(os.path.join(verified["dir"], "model.patch"), encoding="utf-8", errors="replace") as f:
patch = f.read()
report = get_eval_report(make_test_spec(row(unit)), {"instance_id": unit, "model_patch": patch or None}, log, True)
with open(os.path.join(verified["dir"], "report.json"), "w") as f:
json.dump(report, f, indent=1)
r = report[unit]
tests = {k: {kk: len(vv) for kk, vv in v.items()} for k, v in (r.get("tests_status") or {}).items()}
detail = {"exit": verified.get("exit"), "timed_out": verified.get("timed_out"), "resolved": r["resolved"],
"patch_successfully_applied": r["patch_successfully_applied"], "tests": tests}
if r.get("infra_failure_reason"):
detail["infra_failure"] = r["infra_failure_reason"]
return {"reward": 1.0 if r["resolved"] else 0.0, "passed": bool(r["resolved"]), "detail": detail}


def oracle(unit, dir):
return {"answer": "", "solve": {"write": {"/tmp/gold.patch": row(unit)["patch"]},
"run": ["git", "-C", WORKDIR, "apply", "-v", "/tmp/gold.patch"], "seconds": SOLVE_SECONDS}}


HANDLERS = {"units": units, "describe": describe, "setup": setup, "score": score, "oracle": oracle}
for line in sys.stdin:
try:
req = json.loads(line)
out = HANDLERS[req.pop("op")](**req)
except Exception as e:
out = {"error": f"{type(e).__name__}: {e}"}
print(json.dumps(out), flush=True)
Loading