diff --git a/AGENTS.md b/AGENTS.md index 8fea26a6..b5ad48b6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,7 +80,7 @@ and its resources. tinyproxy of a unit's own for the tasks that ask for a proxy) and, in `startup/`, `sitecustomize`: its VMs' disk write limit in every process its driver starts), `catalogue/agents//` (the reference `agent`; DigitalMate's `run` and `gateway` (product startup and task submission); - JiuwenSwarm's `agent` and mini-swe-agent's `run`, the wrappers that start them) and `catalogue/capabilities//` (the keyword-memory `capability`); `workspace` (and + JiuwenSwarm's `agent`, mini-swe-agent's `run` and SWE-agent's `run`, the wrappers that start them) and `catalogue/capabilities//` (the keyword-memory `capability`); `workspace` (and `workspace_cli`, its shell command), `cli` and `__main__` (the unified `nullius` and `python -m nullius` commands), `paths` (user config, data and cache locations), `ondisk` (a file written whole then renamed into place, a lock, a digest), `prices` (the user's model price list: fetched on request and before a capped run; what a cost is estimated from), `migrate` (explicit copying of legacy checkout storage), `settings`, `hosts`, `constraints` (what Nullius may use on each machine: one table, the container and systemd scope probes, the warnings), `execution`, `progress` (what a run is doing, one line per stage), `prerequisites` (what a recipe needs of each machine it runs on, asked before Run and again as it starts), `onboarding` (the Getting started checklist: what this machine diff --git a/app/nullius/catalogue/agents/swe-agent/agent.json b/app/nullius/catalogue/agents/swe-agent/agent.json new file mode 100644 index 00000000..cd0a3684 --- /dev/null +++ b/app/nullius/catalogue/agents/swe-agent/agent.json @@ -0,0 +1,178 @@ +{ + "schema": "nullius.agent/v1", + "key": "swe-agent", + "label": "SWE-agent", + "summary": "Princeton\u2019s software engineering agent with its upstream tool bundles.", + "upstream": { + "repository": "https://github.com/SWE-agent/SWE-agent", + "tag": "v1.1.0", + "tested": "0f3acafacabc0def8cc76b4e48acb4b6cf302cb9", + "version": "1.1.0", + "license": "MIT" + }, + "install": { + "python": "3.12", + "project": ".", + "pip": [ + "aiohappyeyeballs==2.7.1", + "aiohttp==3.14.5", + "aiosignal==1.4.0", + "annotated-doc==0.0.7", + "annotated-types==0.8.0", + "anyio==4.16.0", + "attrs==26.1.0", + "bashlex==0.18", + "bidict==0.24.1", + "blinker==1.9.0", + "boto3==1.44.9", + "botocore==1.44.9", + "certifi==2026.11.20", + "charset-normalizer==3.5.2", + "click==8.5.1", + "datasets==5.2.0", + "dill==0.4.1", + "distro==1.9.0", + "docstring-parser==0.18.0", + "fastapi==0.165.0", + "fastcore==2.2.46", + "fastspec==0.2.9", + "fasttransport==0.0.4", + "fastuuid==0.14.0", + "filelock==3.32.7", + "flask==3.1.3", + "flask-cors==6.0.5", + "flask-socketio==5.7.2", + "frozenlist==1.8.0", + "fsspec==2026.9.0", + "ghapi==2.1.5", + "gitdb==4.0.12", + "gitpython==3.2.1", + "h11==0.16.0", + "h2==4.4.1", + "hf-xet==1.8.0", + "hpack==4.2.0", + "httpcore==1.0.9", + "httpcore2==2.16.2", + "httpx==0.28.1", + "httpx2==2.16.2", + "huggingface-hub==1.33.0", + "hyperframe==6.1.0", + "idna==3.20", + "importlib-metadata==8.9.0", + "itsdangerous==2.2.0", + "jinja2==3.1.6", + "jiter==0.19.0", + "jmespath==1.1.0", + "jsonschema==4.26.0", + "jsonschema-specifications==2025.9.1", + "linkify-it-py==2.2.0", + "litellm==1.105.7", + "markdown-it-py==4.3.0", + "markupsafe==3.0.4", + "mdit-py-plugins==0.7.0", + "mdurl==0.1.2", + "multidict==7.2.1", + "multiprocess==0.70.19", + "numpy==2.5.5", + "openai==2.54.0", + "opentelemetry-api==1.45.2", + "packaging==26.3", + "pandas==3.1.1", + "pexpect==4.9.0", + "platformdirs==4.14.8", + "propcache==0.5.4", + "ptyprocess==0.7.0", + "pyarrow==26.0.1", + "pydantic==2.14.4", + "pydantic-core==2.50.5", + "pydantic-settings==2.16.3", + "pygments==2.21.0", + "python-dateutil==2.9.0.post0", + "python-dotenv==1.2.4", + "python-engineio==4.15.1", + "python-multipart==0.0.34", + "python-socketio==5.18.1", + "pyyaml==6.0.4", + "referencing==0.37.0", + "regex==2026.11.19", + "requests==2.34.2", + "rich==15.0.0", + "rich-argparse==1.8.0", + "rpds-py==2026.9.1", + "ruamel-yaml==0.19.1", + "s3transfer==0.19.3", + "simple-parsing==0.1.9", + "simple-websocket==1.1.0", + "six==1.17.0", + "smmap==5.0.3", + "sniffio==1.3.1", + "starlette==1.10.0", + "swe-rex==1.2.1", + "tabulate==0.10.0", + "tenacity==9.2.1", + "textual==8.2.8", + "tiktoken==0.14.0", + "tokenizers==0.23.3", + "tqdm==4.70.1", + "truststore==0.10.5", + "typing-extensions==4.16.0", + "typing-inspection==0.4.5", + "unidiff==1.0.1", + "urllib3==2.8.0", + "uvicorn==0.54.0", + "werkzeug==3.1.9", + "wsproto==1.3.2", + "xxhash==4.1.0", + "yarl==1.25.1", + "zipp==4.1.2" + ] + }, + "prepare": { + "run": [ + "{install}/.venv/bin/python", + "{here}/run.py", + "prepare" + ], + "network": true, + "seconds": 600 + }, + "start": { + "command": [ + "{install}/.venv/bin/python", + "{here}/run.py", + "run", + "{prompt}" + ] + }, + "model": { + "apis": [ + "chat" + ], + "env": { + "NULLIUS_SWE_MODEL": "openai/{model}", + "NULLIUS_SWE_BASE": "{base_url}", + "NULLIUS_SWE_KEY": "{key}" + } + }, + "offers": [ + "agent.workspace/v1" + ], + "proven": { + "agent.workspace/v1": { + "passed": "2/2", + "model": "openai/gpt-4.1", + "provider": "openrouter", + "version": "1.1.0", + "kit_version": 1, + "backend": "container", + "fixture": { + "image": "docker.io/swebench/sweb.eval.x86_64.django_1776_django-17087@sha256:fef77b052bf6729f7b6326b3b485b8a63ac1dc39b6e1c7040242aa2d3b2dc656", + "user": "0", + "kit": "agent-workspace-v1" + } + } + }, + "only_for": [ + "swe-bench-verified" + ] +} diff --git a/app/nullius/catalogue/agents/swe-agent/run.py b/app/nullius/catalogue/agents/swe-agent/run.py new file mode 100644 index 00000000..297739cf --- /dev/null +++ b/app/nullius/catalogue/agents/swe-agent/run.py @@ -0,0 +1,99 @@ +"""Start SWE-agent v1.1.0 through its public configuration and environment APIs. + +Preparation calls its ToolHandler.install without creating a model. Execution +uses its default configuration and RunSingle, including its normal tool setup. +""" +import os +import importlib.util +from pathlib import Path +import sys +import subprocess +import json +import shutil +import shlex +from contextlib import contextmanager + + +def check_tool_python(): + """Refuse an incompatible task interpreter without replacing its environment.""" + result = subprocess.run( + ["python", "-c", "import json, sys; print(json.dumps(list(sys.version_info[:3])))"], + check=True, capture_output=True, text=True, timeout=30, + ) + version = json.loads(result.stdout) + if tuple(version) < (3, 8): + raise RuntimeError( + "SWE-agent's default editor requires tree-sitter==0.21.3 (Python >=3.8); " + "the task PATH selects Python " + ".".join(map(str, version)) + ". " + "Nullius will not replace the benchmark's Python environment." + ) + + +@contextmanager +def tool_staging(root=Path("/root/tools")): + """Own only preparation's temporary uploads, not installed dependencies.""" + if root.exists() or root.is_symlink(): + raise RuntimeError("SWE-agent preparation requires an unused /root/tools directory") + try: + yield + finally: + if root.is_symlink(): + root.unlink() + elif root.exists(): + shutil.rmtree(root) + + +def main(): + check_tool_python() + os.environ["PIP_CONSTRAINT"] = str(Path(__file__).with_name("tools.constraints.txt")) + # The pinned checkout is mounted read-only and owned by the host user. + # Permit GitPython's provenance lookup for this one path, process-locally. + source = Path(importlib.util.find_spec("sweagent").origin).parent.parent + index = int(os.environ.get("GIT_CONFIG_COUNT", "0")) + os.environ.update({"GIT_CONFIG_COUNT": str(index + 1), + f"GIT_CONFIG_KEY_{index}": "safe.directory", + f"GIT_CONFIG_VALUE_{index}": str(source)}) + import yaml + from sweagent import REPO_ROOT + from sweagent.environment.swe_env import EnvironmentConfig, SWEEnv + from sweagent.tools.tools import ToolConfig, ToolHandler + + config = yaml.safe_load((REPO_ROOT / 'config/default.yaml').read_text()) + # SWE-ReX intentionally starts shells with a fresh environment. Use the + # upstream tool environment option for pip constraints and preparation's + # temporary proxy; normal execution receives no proxy variables. + values = config['agent']['tools'].setdefault('env_variables', {}) + for name in ('PIP_CONSTRAINT', 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', + 'http_proxy', 'https_proxy', 'no_proxy'): + if name in os.environ: + values[name] = os.environ[name] + # Set the task PATH once, before ToolHandler adds its bundle directories. + # ToolConfig.env_variables is applied again on reset and would hide them. + environment = {'deployment': {'type': 'local'}, + 'post_startup_commands': ['export PATH=' + shlex.quote(os.environ['PATH'])]} + if sys.argv[1] == 'prepare': + env = SWEEnv.from_config(EnvironmentConfig.model_validate(environment)) + try: + env.start() + with tool_staging(): + handler = ToolHandler(ToolConfig.model_validate(config['agent']['tools'])) + handler.install(env) + # Installation checks before reset; ensure reset kept the tools. + for command in handler.config.commands: + env.communicate('command -v ' + shlex.quote(command.name), check='raise') + finally: + env.close() + return + from sweagent.run.run_single import RunSingle, RunSingleConfig + environment['repo'] = {'type': 'preexisting', 'repo_name': str(Path.cwd()).lstrip('/')} + config['env'] = environment + config['agent']['model'] = {'name': os.environ['NULLIUS_SWE_MODEL'], + 'api_base': os.environ['NULLIUS_SWE_BASE'], + 'api_key': os.environ['NULLIUS_SWE_KEY']} + config['problem_statement'] = {'type': 'text', 'text': sys.argv[2]} + config['output_dir'] = str(Path.home() / 'swe-agent-output') + RunSingle.from_config(RunSingleConfig.model_validate(config)).run() + + +if __name__ == '__main__': + main() diff --git a/app/nullius/catalogue/agents/swe-agent/tools.constraints.txt b/app/nullius/catalogue/agents/swe-agent/tools.constraints.txt new file mode 100644 index 00000000..15a6df16 --- /dev/null +++ b/app/nullius/catalogue/agents/swe-agent/tools.constraints.txt @@ -0,0 +1,3 @@ +# Upstream edit_anthropic/install.sh dependencies, constrained without editing it. +tree-sitter==0.21.3 +tree-sitter-languages==1.10.2 diff --git a/app/nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json b/app/nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json index 731b2cae..789b156c 100644 --- a/app/nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json +++ b/app/nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json @@ -23,7 +23,7 @@ "On Nullius, the agent can reach only its model. The tests get internet access after the agent ends.", "The prompt is the issue's title and body, without the hints, as on the leaderboard.", "Each instance's image is pinned. An image the authors rebuild is not used until the pin is refreshed.", - "SWE-agent, the authors' own agent, runs only on Harbor." + "SWE-agent passes its root workspace fixture and requires task Python >=3.8. A scored instance remains unproven; the selected attempt ended at its spending cap before grading." ], "datasets": [ { diff --git a/app/nullius/standard/backends/container.py b/app/nullius/standard/backends/container.py index c34dd8d9..dacd6305 100644 --- a/app/nullius/standard/backends/container.py +++ b/app/nullius/standard/backends/container.py @@ -116,6 +116,7 @@ from nullius import constraints, ondisk, paths from nullius.standard.contract import definitions +from nullius.standard.contract.definitions import step_problems from nullius.standard.requirements import install def _runs_podman(path: str) -> bool: @@ -1284,7 +1285,6 @@ def stop(self): PYTHON_VERSION = "3.12.14" # the standalone Python an agent started as python3 runs on there; moves with UV_VERSION _PULL = re.compile(r"^[a-z0-9][a-z0-9._/:-]*@sha256:[0-9a-f]{64}$") IMAGE_SPEC = ("build", "pull", "memory_mb", "cpus") -STEP = ("copy", "write", "run", "collect", "seconds", "network", "keep_processes") KEEP_ALIVE = ["sh", "-c", "while :; do sleep 3600; done"] INIT = "/usr/sbin/docker-init" # what --init mounts: docker's, not the unit's @@ -1387,40 +1387,6 @@ def task_env_problems(env, reserved: Iterable[str] = ()) -> List[str]: return bad -def step_problems(step, *, collect: bool) -> List[str]: - """What is wrong with a step run in a unit's box (``verify``, ``solve``): - ``copy`` {relative path in the upstream: absolute path inside}, ``write`` - {absolute path inside: its text - a file the driver has by content, an - eval script or a patch the dataset carries}, ``run`` - (argv), ``collect`` (a folder inside, ``verify`` only), ``seconds``, - ``network`` (true: a way out to public addresses, :meth:`Box.online`), - ``keep_processes`` (``verify`` only - true: what the agent left running is - not stopped before the check, :meth:`Box.settle`).""" - if not isinstance(step, dict): - return ["a step: {copy?, write?, run, collect?, seconds?, network?, keep_processes?}"] - bad = [f"{k}: not a field ({', '.join(STEP)})" for k in step - if k not in STEP or (k in ("collect", "keep_processes") and not collect)] - run = step.get("run") - if not isinstance(run, list) or not run or not all(isinstance(w, str) and w for w in run): - bad.append("run: the command, a list of words") - copy = step.get("copy") or {} - if not isinstance(copy, dict) or not all(isinstance(d, str) and d.startswith("/") for d in copy.values()): - bad.append("copy: {path in the upstream: absolute path inside}") - write = step.get("write") or {} - if not isinstance(write, dict) or not all(isinstance(d, str) and d.startswith("/") and isinstance(t, str) - for d, t in write.items()): - bad.append("write: {absolute path inside: the file's text}") - if "collect" in step and not (isinstance(step["collect"], str) and step["collect"].startswith("/")): - bad.append("collect: an absolute path inside") - if "seconds" in step and (not isinstance(step["seconds"], (int, float)) or step["seconds"] <= 0): - bad.append("seconds: a positive number") - if "network" in step and not isinstance(step["network"], bool): - bad.append("network: true or false") - if "keep_processes" in step and not isinstance(step["keep_processes"], bool): - bad.append("keep_processes: true or false") - return bad - - def own_context(path: str) -> Dict[str, str]: """An own image's build context: every file of its folder, by its path there, and its sha256.""" diff --git a/app/nullius/standard/cli.py b/app/nullius/standard/cli.py index 229ca2fc..34f471e3 100644 --- a/app/nullius/standard/cli.py +++ b/app/nullius/standard/cli.py @@ -505,10 +505,17 @@ def _retries(value: str) -> int: def cmd_conform(a): o = _other(a.other) + if a.max_usd_per_unit is not None: + try: + price_list.update() + except ValueError as e: + print("refused: capped conformance needs current model prices:", e) + return 2 try: got = conform.check(o, model=a.model, provider=a.provider, which=a.port or None, jobs_root=a.jobs, say=print, unsandboxed=a.unsandboxed, stamp=a.stamp, backend=a.backend, env=run_env(a.provider) if a.from_run else None, - options=options(a.option), repeat=a.repeat) + options=options(a.option), repeat=a.repeat, fixture_image=a.fixture_image, + max_usd_per_unit=a.max_usd_per_unit, max_calls=a.max_calls) except run.Refused as e: print("refused:", e) return 2 @@ -805,6 +812,9 @@ def main(argv=None): if name == "fidelity": p.add_argument("--passes", type=int, default=2, help="runs of each way (default 2: the second shows the noise)") elif name == "conform": + p.add_argument("--fixture-image", help="digest-pinned root image for the workspace kit") + p.add_argument("--max-usd-per-unit", type=float, help="spending cap per kit check") + p.add_argument("--max-calls", type=int, help="model call cap per kit check") p.add_argument("--port", type=definitions.names.port, action="append", help="only this port's kit (repeatable)") p.add_argument("--stamp", help="the time stamp the kit jobs are named with (default: now)") p.add_argument("--attempts", "--repeat", dest="repeat", type=int, default=1, metavar="K", diff --git a/app/nullius/standard/contract/definitions.py b/app/nullius/standard/contract/definitions.py index 97b8198e..e7c8ddf4 100644 --- a/app/nullius/standard/contract/definitions.py +++ b/app/nullius/standard/contract/definitions.py @@ -1485,6 +1485,36 @@ def _own_agents(d: dict) -> List[str]: return bad +STEP = ("copy", "write", "run", "collect", "seconds", "network", "keep_processes") + + +def step_problems(step, *, collect: bool) -> List[str]: + """Validate a preparation, solve or verification step in a unit container.""" + if not isinstance(step, dict): + return ["a step: {copy?, write?, run, collect?, seconds?, network?, keep_processes?}"] + bad = [f"{k}: not a field ({', '.join(STEP)})" for k in step + if k not in STEP or (k in ("collect", "keep_processes") and not collect)] + run = step.get("run") + if not isinstance(run, list) or not run or not all(isinstance(w, str) and w for w in run): + bad.append("run: the command, a list of words") + copy = step.get("copy") or {} + if not isinstance(copy, dict) or not all(isinstance(d, str) and d.startswith("/") for d in copy.values()): + bad.append("copy: {path in the upstream: absolute path inside}") + write = step.get("write") or {} + if not isinstance(write, dict) or not all(isinstance(d, str) and d.startswith("/") and isinstance(t, str) + for d, t in write.items()): + bad.append("write: {absolute path inside: the file's text}") + if "collect" in step and not (isinstance(step["collect"], str) and step["collect"].startswith("/")): + bad.append("collect: an absolute path inside") + if "seconds" in step and (not isinstance(step["seconds"], (int, float)) or step["seconds"] <= 0): + bad.append("seconds: a positive number") + if "network" in step and not isinstance(step["network"], bool): + bad.append("network: true or false") + if "keep_processes" in step and not isinstance(step["keep_processes"], bool): + bad.append("keep_processes: true or false") + return bad + + def problems(d: dict, kind: str) -> List[str]: """What is wrong with definition ``d`` of ``kind``; empty when it may be offered.""" kind = names.kind(kind) @@ -1612,6 +1642,10 @@ def problems(d: dict, kind: str) -> List[str]: elif kind == "agent" and "driver" in (d.get("start") or {}): bad += _driver_agent(d) elif kind == "agent": + if "prepare" in d: + bad += ["prepare." + p for p in step_problems(d["prepare"], collect=False)] + if isinstance(d["prepare"], dict): + bad += _command("prepare.run", d["prepare"].get("run"), {"here", "install"}) st = d.get("start") or {} if ("acp" in st) == ("command" in st): bad.append("start: acp or command, one of them") diff --git a/app/nullius/standard/kits/agent-workspace-v1/driver.py b/app/nullius/standard/kits/agent-workspace-v1/driver.py index b247cdcf..2526d5ca 100644 --- a/app/nullius/standard/kits/agent-workspace-v1/driver.py +++ b/app/nullius/standard/kits/agent-workspace-v1/driver.py @@ -16,6 +16,22 @@ def units(dataset): def setup(unit, dir): + if "--fixture-image" in sys.argv: + image = sys.argv[sys.argv.index("--fixture-image") + 1] + normal = setup_plain(unit, dir) + files = {"/workspace/calc.py": CALC, "/workspace/test_calc.py": TEST} if unit == "fix" else {} + # The same kit input and original test; only the execution location differs. + return {**normal, "image": {"pull": image}, "workdir": "/workspace", + "prepare": {"write": files, "run": ["sh", "-c", + "git init -q && git -c user.name=kit -c user.email=kit.invalid commit -qm initial --allow-empty && " + "git add . && git -c user.name=kit -c user.email=kit.invalid commit -qm files --allow-empty"]}, + "verify": {"write": {"/workspace/test_calc.py": TEST} if unit == "fix" else {}, + "run": ["python3", "-c", "from pathlib import Path; p = Path('result.txt'); assert not p.is_symlink() and p.is_file() and p.read_text().strip() == 'nullius-ok'"] + if unit == "write" else ["python3", "test_calc.py"]}} + return setup_plain(unit, dir) + + +def setup_plain(unit, dir): if unit == "write": return {"prompt": "In the current working directory, create a file named result.txt whose whole content is: nullius-ok"} with open(os.path.join(dir, "calc.py"), "w") as f: @@ -25,7 +41,10 @@ def setup(unit, dir): return {"prompt": "In the current working directory, calc.py has a bug: `python3 test_calc.py` fails. Fix calc.py so the test prints OK. Do not change test_calc.py."} -def score(unit, dir, transcript, answer): +def score(unit, dir, transcript, answer, verified=None): + if "--fixture-image" in sys.argv: + ok = bool(verified) and verified.get("exit") == 0 and (unit == "write" or "OK" in verified.get("output", "")) + return {"reward": float(ok), "passed": ok, "detail": verified or {}} if unit == "write": got = _read_plain(os.path.join(dir, "result.txt")) ok = got == "nullius-ok" @@ -53,6 +72,9 @@ def _read_plain(path): def oracle(unit, dir): + if "--fixture-image" in sys.argv: + files = {"/workspace/result.txt": "nullius-ok\n"} if unit == "write" else {"/workspace/calc.py": CALC.replace("a - b", "a + b")} + return {"answer": "", "solve": {"write": files, "run": ["true"]}} if unit == "write": with open(os.path.join(dir, "result.txt"), "w") as f: f.write("nullius-ok\n") diff --git a/app/nullius/standard/proofs/conform.py b/app/nullius/standard/proofs/conform.py index 6985320b..f2e8eaa8 100644 --- a/app/nullius/standard/proofs/conform.py +++ b/app/nullius/standard/proofs/conform.py @@ -104,7 +104,8 @@ def said(port: str, rec: dict) -> List[str]: def check(other: dict, *, model: str, provider: str, which: Optional[List[str]] = None, jobs_root: str = "jobs", write: bool = True, say: Callable[[str], None] = print, env=None, unsandboxed: bool = False, stamp: Optional[str] = None, backend: str = "local", options: Optional[dict] = None, - repeat: int = 1) -> Dict[str, dict]: + repeat: int = 1, fixture_image: Optional[str] = None, + max_usd_per_unit: Optional[float] = None, max_calls: Optional[int] = None) -> Dict[str, dict]: """Run the kits of ``which`` (every candidate port by default) and, with ``write``, record the result in the definition. Returns {port: record}. Each kit's job is named ``__kit____`` (:func:`job_name`), @@ -125,6 +126,26 @@ def check(other: dict, *, model: str, provider: str, which: Optional[List[str]] env = env if env is not None else os.environ repeat = max(1, int(repeat or 1)) kits = [(p, definitions.kit(p)) for p in which or candidates(other)] + if fixture_image: + from ..backends import container + import copy + if backend not in ("container", "docker") or which != ["agent.workspace/v1"]: + raise run.Refused("fixture_image requires the container backend and only agent.workspace/v1") + bad = container.spec_problems({"pull": fixture_image}) + if bad: + raise run.Refused("fixture_image: " + "; ".join(bad)) + kits = copy.deepcopy(kits) + for _, kit in kits: + try: + image = container.own_image(kit, {"pull": fixture_image}, kit["_here"]) + user = container.image_config(image)["user"] + except (container.Unavailable, ValueError) as e: + raise run.Refused(f"fixture_image: {e}") from e + if user not in ("", "0", "root", "0:0", "root:root"): + raise run.Refused("fixture_image must run as root by default") + kit["environments"] = {"fixture": {"summary": "Explicit root workspace fixture.", "image": "own"}} + kit["datasets"][0]["environment"] = "fixture" + kit["driver"]["command"] += ["--fixture-image", fixture_image] if any(kit for _, kit in kits): run.provider_endpoint(provider, env) # the key is the whole command's: missing, no kit is begun got: Dict[str, dict] = {} @@ -135,10 +156,17 @@ def check(other: dict, *, model: str, provider: str, which: Optional[List[str]] continue say(f"{p}: {kit['summary']}") try: - job_dir = run.run(kit, other, model=model, provider=provider, jobs_root=jobs_root, concurrency=2, + # A benchmark-restricted catalogue agent must still be able to prove + # its ports. Permit this kit only in the run's copy; retain the + # original restriction in the saved definition and normal pairing. + proof_other = other + if other.get("only_for") and not other.get("benchmark"): + proof_other = dict(other, only_for=[*other["only_for"], kit["key"]]) + job_dir = run.run(kit, proof_other, model=model, provider=provider, jobs_root=jobs_root, concurrency=2, name=job_name(stamp or time.strftime(STAMP), kit["key"], definitions.job_word(other)), say=lambda s: say(" " + s), env=env, proving=True, unsandboxed=unsandboxed, backend=backend, options=options, repeat=repeat, + max_usd_per_unit=max_usd_per_unit, max_calls=max_calls, # a unit the provider's rate limit refused runs once more, after its pause: a proof says # what the agent does, never how busy the endpoint was retries=1, retry_if=retries.rate_limited) @@ -153,6 +181,8 @@ def check(other: dict, *, model: str, provider: str, which: Optional[List[str]] "version": str((other.get("upstream") or {}).get("version") or ""), "kit_version": definitions.kit_version(kit), "backend": backend, "job": os.path.basename(job_dir), **{k: o[k] for k in ("repeat", "checks", "skills") if k in o}} + if fixture_image: + got[p]["fixture"] = {"image": fixture_image, "user": "0", "kit": kit["key"]} changed = {k: v for k, v in (options or {}).items() if v != ((other.get("options") or {}).get(k) or {}).get("default")} if changed: got[p]["options"] = changed diff --git a/app/nullius/standard/runner/run.py b/app/nullius/standard/runner/run.py index f234a140..347b31a2 100644 --- a/app/nullius/standard/runner/run.py +++ b/app/nullius/standard/runner/run.py @@ -1423,6 +1423,10 @@ def sent(): box = self.own_box(tag, setup, rl, home) if setup.get("prepare") is not None: self.prepare(setup["prepare"], box, trial) + if self.other.get("prepare") is not None and self.other["_kind"] == "agent": + if box is None: + raise _Ended("EnvironmentSetupError", "agent preparation requires an own-image container", retryable=False) + self.prepare(self.other["prepare"], box, trial, agent=True) with self.unit_vm(ws, home, trial, setup): # boat: the VM up and given its files before the agent's time starts try: with self.agent_internet(setup, box, rl, trial): @@ -2149,7 +2153,7 @@ def in_box(self, box, step: dict, *, collect: bool, what: str, out: Optional[str except (container.Unavailable, ValueError) as e: raise _Ended("VerifierError" if collect else "NonZeroAgentExitCodeError", f"{what}: {e}") - def prepare(self, step: dict, box, trial: str) -> None: + def prepare(self, step: dict, box, trial: str, *, agent: bool = False) -> None: """The benchmark's preparation of the unit's container (``prepare``), before the agent or a control starts: what the task's own harness adds to every image (Terminal-Bench's tmux). Its files copied and written @@ -2160,34 +2164,46 @@ def prepare(self, step: dict, box, trial: str) -> None: out but its model, as it would have without one. Its output and what the proxy let through are kept (``setup/prepare.txt``, ``setup/egress.log``). Any failure, closing the way out included, is - the environment's (``EnvironmentSetupError``), never the agent's.""" - out = os.path.join(trial, "setup") + the environment's (``EnvironmentSetupError``), never the agent's. + + With ``agent=True``, resolve files and command slots from the agent's + definition and install, preserving separate evidence under ``agent/``. + The preparation receives no model configuration or provider key.""" + out = os.path.join(trial, "agent" if agent else "setup") os.makedirs(out, exist_ok=True) - root = self.up or self.bench["_here"] + root = self.other["_here"] if agent else self.up or self.bench["_here"] + who = "agent" if agent else "benchmark" + command = install.words(step["run"], {"here": root, "install": self.inst}) if agent else step["run"] done = None try: for src, dest in (step.get("copy") or {}).items(): box.copy_in(container.within(root, src), dest) for dest, text in (step.get("write") or {}).items(): box.write_in(dest, text) - env = box.online() if step.get("network") else None try: - done = box.run(step["run"], self.step_limit("setup", step), user="0", env=env) + env = box.online() if step.get("network") else None + if agent: + task_env = getattr(box, "env", {}) + path = ":".join(p for p in (task_env.get("PATH"), getattr(box, "path", None)) if p) + env = {**task_env, **({"PATH": path} if path else {}), **(env or {})} + done = box.run(command, self.step_limit("setup", step), user="0", env=env) finally: - said = box.egress_said() - if said: - with open(os.path.join(out, "egress.log"), "w") as f: - f.write(said) - box.offline() - box.settle() - except (container.Unavailable, ValueError) as e: - raise _Ended("EnvironmentSetupError", f"the benchmark's preparation: {e}") + try: + said = box.egress_said() + if said: + with open(os.path.join(out, "prepare-egress.log" if agent else "egress.log"), "w") as f: + f.write(said) + finally: + box.offline() + box.settle() + except (container.Unavailable, ValueError, OSError) as e: + raise _Ended("EnvironmentSetupError", f"the {who}'s preparation: {e}") finally: if done is not None: with open(os.path.join(out, "prepare.txt"), "w") as f: f.write(done["output"]) if done["exit"] != 0: - raise _Ended("EnvironmentSetupError", "the benchmark's preparation " + raise _Ended("EnvironmentSetupError", f"the {who}'s preparation " + ("did not end in time" if done["timed_out"] else f"ended with exit {done['exit']}") + ": " + done["output"].strip()[-300:], retryable=not done["timed_out"]) diff --git a/app/tests/test_agent_preparation.py b/app/tests/test_agent_preparation.py new file mode 100644 index 00000000..60b6fcae --- /dev/null +++ b/app/tests/test_agent_preparation.py @@ -0,0 +1,210 @@ +"""Preparation fails closed, including failures while opening or recording the proxy.""" +import os +import tempfile +import unittest +from unittest import mock + +from nullius.standard.backends import container +from nullius.standard.contract import definitions +from nullius.standard.runner import run +from nullius.standard.proofs import conform +from tests.test_standard_check_safety import FakeBox + + +class Preparation(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.r = run.Run.__new__(run.Run) + self.r.other = {'_here': self.tmp.name} + self.r.inst = '/agent-install' + self.r.turn_seconds = 60 + self.step = {'run': ['{install}/python', '{here}/setup.py'], 'network': True} + + def test_agent_command_and_evidence_are_separate(self): + box = FakeBox() + self.r.prepare(self.step, box, self.tmp.name, agent=True) + self.assertIn(('run', '/agent-install/python', {'HTTPS_PROXY': 'http://egress:3128'}), box.did) + self.assertTrue(os.path.isfile(os.path.join(self.tmp.name, 'agent', 'prepare.txt'))) + self.assertFalse(os.path.exists(os.path.join(self.tmp.name, 'setup'))) + self.assertTrue(os.path.isfile(os.path.join(self.tmp.name, 'agent', 'prepare-egress.log'))) + self.assertFalse(os.path.exists(os.path.join(self.tmp.name, 'agent', 'egress.log'))) + self.assertEqual(box.did[-2:], ['offline', 'settle']) + + def test_preparation_preserves_the_tasks_python_before_image_python(self): + box = FakeBox() + box.path, box.env = "/usr/bin", {"PATH": "/opt/conda/envs/testbed/bin"} + self.r.prepare(self.step, box, self.tmp.name, agent=True) + command = next(x for x in box.did if isinstance(x, tuple)) + self.assertEqual(command[2]["PATH"], "/opt/conda/envs/testbed/bin:/usr/bin") + + def test_partial_proxy_start_is_closed(self): + box = FakeBox() + with mock.patch.object(box, 'online', side_effect=container.Unavailable('partial start')): + with self.assertRaises(run._Ended): + self.r.prepare(self.step, box, self.tmp.name, agent=True) + self.assertEqual(box.did, ['offline', 'settle']) + + def test_log_failure_still_closes_proxy_and_stops_processes(self): + box = FakeBox() + with mock.patch.object(box, 'egress_said', side_effect=OSError('disk full')): + with self.assertRaises(run._Ended) as failure: + self.r.prepare(self.step, box, self.tmp.name, agent=True) + self.assertEqual(failure.exception.kind, 'EnvironmentSetupError') + self.assertEqual(box.did[-2:], ['offline', 'settle']) + + def test_definition_rejects_prompt_and_invalid_network(self): + a = definitions.get('agent', 'swe-agent') + a['prepare'] = {'run': ['echo', '{prompt}'], 'network': 'yes'} + bad = definitions.problems(a, 'agent') + self.assertTrue(any('prepare.network' in x for x in bad), bad) + self.assertTrue(any('prepare.run' in x for x in bad), bad) + + def test_fixture_requires_digest_and_explicit_workspace_port(self): + a = definitions.get('agent', 'swe-agent') + for image, ports in [('python:3.12', ['agent.workspace/v1']), ('x@sha256:' + 'a'*64, None)]: + with self.assertRaises(run.Refused): + conform.check(a, model='unused', provider='unused', backend='container', + fixture_image=image, which=ports, write=False) + + +class WorkspaceFixture(unittest.TestCase): + def test_fixture_uses_original_test_and_oracle(self): + import runpy + from pathlib import Path + driver = Path(__file__).parents[1] / 'nullius/standard/kits/agent-workspace-v1/driver.py' + image = 'fixture@sha256:' + 'a' * 64 + with mock.patch('nullius.standard.protocols.jsonl.serve'), mock.patch('sys.argv', [str(driver), '--fixture-image', image]): + kit = runpy.run_path(str(driver)) + with tempfile.TemporaryDirectory() as folder: + setup = kit['setup']('fix', folder) + self.assertEqual(setup['verify']['write']['/workspace/test_calc.py'], kit['TEST']) + self.assertEqual(setup['image'], {'pull': image}) + solution = kit['oracle']('fix', folder) + self.assertEqual(solution['solve']['write']['/workspace/calc.py'], kit['CALC'].replace('a - b', 'a + b')) + for verified, expected in [({'exit': 0, 'output': 'OK'}, 1), ({'exit': 1, 'output': 'OK'}, 0), ({'exit': 0, 'output': ''}, 0)]: + self.assertEqual(kit['score']('fix', folder, [], '', verified)['reward'], expected) + + +class FixtureProvenance(unittest.TestCase): + def test_nonroot_image_is_refused_before_running(self): + image = 'fixture@sha256:' + 'a' * 64 + with mock.patch.object(container, 'own_image', return_value=image), \ + mock.patch.object(container, 'image_config', return_value={'user': '1000'}), \ + mock.patch.object(run, 'run') as ran: + with self.assertRaisesRegex(run.Refused, 'root'): + conform.check(definitions.get('agent', 'swe-agent'), model='unused', provider='unused', + which=['agent.workspace/v1'], backend='container', fixture_image=image) + ran.assert_not_called() + + def test_fixture_and_caps_are_recorded_without_mutating_default_kit(self): + from types import SimpleNamespace + image = 'fixture@sha256:' + 'a' * 64 + job = SimpleNamespace(trials=[SimpleNamespace(task_name='kit/write', reward=1.), + SimpleNamespace(task_name='kit/fix', reward=1.)]) + with mock.patch.object(container, 'own_image', return_value=image), \ + mock.patch.object(container, 'image_config', return_value={'user': ''}), \ + mock.patch.object(run, 'provider_endpoint'), \ + mock.patch.object(run, 'run', return_value='/tmp/proof') as ran, \ + mock.patch.object(conform.parse, 'parse_job', return_value=job): + got = conform.check(definitions.get('agent', 'swe-agent'), model='unused', provider='unused', + which=['agent.workspace/v1'], backend='container', fixture_image=image, + max_usd_per_unit=.25, max_calls=8, write=False, say=lambda _: None) + self.assertEqual(got['agent.workspace/v1']['fixture'], {'image': image, 'user': '0', 'kit': 'agent-workspace-v1'}) + self.assertEqual(ran.call_args.kwargs['max_calls'], 8) + self.assertEqual(ran.call_args.kwargs['max_usd_per_unit'], .25) + self.assertNotIn('environments', definitions.kit('agent.workspace/v1')) + + +from tests import docker_tier + + +@unittest.skipIf(docker_tier.why_not(), docker_tier.why_not() or '') +class PreparationInDocker(unittest.TestCase): + def test_agent_preparation_closes_access_on_success_and_failure(self): + with tempfile.TemporaryDirectory() as folder: + r = run.Run.__new__(run.Run) + r.other, r.inst, r.turn_seconds = {'_here': folder}, folder, 60 + box = container.Box('nullius-agent-preparation-test', 'one', container.base_tag(), workdir='/').start() + try: + for command in (['sh', '-c', 'getent hosts egress && touch /tmp/prepared'], ['sh', '-c', 'exit 7']): + step = {'run': command, 'network': True} + if command[-1] == 'exit 7': + with self.assertRaises(run._Ended): + r.prepare(step, box, folder, agent=True) + else: + r.prepare(step, box, folder, agent=True) + self.assertIsNone(box.egress) + self.assertNotEqual(box.run(['getent', 'hosts', 'egress'], 30)['exit'], 0) + self.assertEqual(box.settle(), []) + self.assertEqual(box.run(['test', '-f', '/tmp/prepared'], 30)['exit'], 0) + finally: + box.stop() + + +class SweAgentToolCompatibility(unittest.TestCase): + def test_task_python_is_checked_without_loading_agent_or_changing_path(self): + import runpy + from pathlib import Path + from types import SimpleNamespace + wrapper = Path(__file__).parents[1] / 'nullius/catalogue/agents/swe-agent/run.py' + check = runpy.run_path(str(wrapper))['check_tool_python'] + with mock.patch.dict(os.environ, {'PATH': '/task/bin:/usr/bin'}): + for version in ('[3, 5, 6]', '[3, 7, 17]'): + with self.subTest(version=version), mock.patch('subprocess.run', return_value=SimpleNamespace(stdout=version)) as called: + with self.assertRaisesRegex(RuntimeError, "tree-sitter==0.21.3"): + check() + self.assertEqual(called.call_args.args[0][0], 'python') + self.assertNotIn('env', called.call_args.kwargs) + self.assertEqual(os.environ['PATH'], '/task/bin:/usr/bin') + for version in ('[3, 8, 0]', '[3, 12, 15]'): + with self.subTest(version=version), mock.patch('subprocess.run', return_value=SimpleNamespace(stdout=version)): + check() + + +class SweAgentToolStaging(unittest.TestCase): + def setUp(self): + import runpy + from pathlib import Path + wrapper = Path(__file__).parents[1] / 'nullius/catalogue/agents/swe-agent/run.py' + self.stage = runpy.run_path(str(wrapper))['tool_staging'] + + def test_cleanup_allows_fresh_uploads_and_keeps_installed_dependencies(self): + from pathlib import Path + with tempfile.TemporaryDirectory() as folder: + root = Path(folder) / 'tools' + dependency = Path(folder) / 'site-packages' / 'installed' + for _ in range(2): + with self.stage(root): + (root / 'registry').mkdir(parents=True) + (root / 'registry' / 'tool').write_text('upstream') + dependency.parent.mkdir(exist_ok=True) + dependency.write_text('installed') + self.assertFalse(root.exists()) + self.assertEqual(dependency.read_text(), 'installed') + + def test_partial_upload_is_cleaned_on_failure(self): + from pathlib import Path + with tempfile.TemporaryDirectory() as folder: + root = Path(folder) / 'tools' + with self.assertRaisesRegex(RuntimeError, 'install failed'): + with self.stage(root): + root.mkdir() + raise RuntimeError('install failed') + self.assertFalse(root.exists()) + + def test_preexisting_directory_or_symlink_is_preserved(self): + from pathlib import Path + with tempfile.TemporaryDirectory() as folder: + existing = Path(folder) / 'existing' + existing.mkdir() + marker = existing / 'keep' + marker.write_text('benchmark data') + link = Path(folder) / 'tools' + link.symlink_to(existing, target_is_directory=True) + for root in (existing, link): + with self.assertRaisesRegex(RuntimeError, 'unused'): + with self.stage(root): + self.fail('preexisting uploads accepted') + self.assertEqual(marker.read_text(), 'benchmark data') + self.assertTrue(link.is_symlink()) diff --git a/app/tests/test_catalogue_docs.py b/app/tests/test_catalogue_docs.py index b6426c89..f59e6192 100644 --- a/app/tests/test_catalogue_docs.py +++ b/app/tests/test_catalogue_docs.py @@ -42,12 +42,12 @@ def named(key, text): # a key is a code chip: markdown's in a table, HTML's on a card self.assertTrue(f"`{key}`" in text or f"{key}" in text, key) agents = catalogue_docs.render_agents_index() - for key in ("digitalmate", "codex@2.2.2", "codex@0.16.0", "goose", "jiuwenswarm@0.2.7", "jiuwenswarm@0.2.8", "mini-swe-agent", "opencode", "terminus-2"): + for key in ("digitalmate", "codex@2.2.2", "codex@0.16.0", "goose", "jiuwenswarm@0.2.7", "jiuwenswarm@0.2.8", "mini-swe-agent", "opencode", "swe-agent", "terminus-2"): named(key, agents) for port in ("agent.task/v1", "agent.workspace/v1", "agent.tools/v1", "agent.conversation/v1"): self.assertIn(f"`{port}`", agents) pages = catalogue_docs.render_pages("agents") - self.assertEqual(sorted(pages), ["codex.md", "digitalmate.md", "goose.md", "jiuwenswarm.md", "mini-swe-agent.md", "opencode.md", "terminus-2.md"]) + self.assertEqual(sorted(pages), ["codex.md", "digitalmate.md", "goose.md", "jiuwenswarm.md", "mini-swe-agent.md", "opencode.md", "swe-agent.md", "terminus-2.md"]) named("codex@0.16.0", pages["codex.md"]) for text in (agents, *pages.values()): self.assertNotIn("2026-", text, "no proof dates on a page") diff --git a/app/tests/test_settings.py b/app/tests/test_settings.py index 2a19d0e1..86fba3d8 100644 --- a/app/tests/test_settings.py +++ b/app/tests/test_settings.py @@ -25,7 +25,7 @@ def test_every_variable_the_application_reads_is_in_the_table(self): src = (HERE.parent / "app.py").read_text() + "".join(p.read_text() for p in list((HERE.parent / "nullius").rglob("*.py")) + list((HERE.parent / "web").glob("*.py")) if p.name != "settings.py" and own(p)) import re read = set(re.findall(r'environ(?:\.get\(|\[)\s*"([A-Z][A-Z0-9_]*)"', src)) | set(re.findall(r'env\.get\("([A-Z][A-Z0-9_]*)"', src)) - read -= {"HOME"} # the user's home directory, not a Nullius setting + read -= {"HOME", "PATH"} # OS home and executable paths, not Nullius settings read -= {"GH_TOKEN"} # stripped from subprocesses, never read read -= {"LOCALAPPDATA"} # Windows's user directory, not a Nullius setting read -= {"OPENAI_BASE_URL"} # what a run's launcher hands it (execution.URL_NAMES), read by the run: standard cli --from-run diff --git a/app/tests/test_standard_conform.py b/app/tests/test_standard_conform.py index 95a4fa87..47eafcc0 100644 --- a/app/tests/test_standard_conform.py +++ b/app/tests/test_standard_conform.py @@ -41,6 +41,16 @@ def check(self, kind, key, which): say=lambda s: None, env={"MODEL_API_URL": "http://127.0.0.1:9/v1"}, unsandboxed=True) return got, definitions.get(kind, key, self.root) + def test_benchmark_restriction_allows_kit_but_survives_proof(self): + d = definitions.get("capability", "fakemem", self.root) + definitions.save(d, lambda current: current.update(only_for=["intended-benchmark"])) + got, saved = self.check("capability", "fakemem", ["cap.memory/v1"]) + self.assertTrue(got["cap.memory/v1"]["ok"]) + self.assertEqual(saved["only_for"], ["intended-benchmark"]) + kit = definitions.kit("cap.memory/v1") + self.assertTrue(match.fit(kit, saved)) + self.assertEqual(match.fit(dict(kit, key="intended-benchmark"), saved), []) + def test_a_kit_that_passes_names_its_job_and_its_record_does_not(self): with mock.patch.object(conform.run, "run", wraps=conform.run.run) as ran: got, d = self.check("capability", "fakemem", ["cap.memory/v1"]) @@ -230,5 +240,25 @@ def test_invalid_agent_options_still_end_the_command(self): save.assert_not_called() +class CappedConformanceCLI(unittest.TestCase): + def test_prices_are_fetched_before_capped_proof(self): + events = [] + with mock.patch.object(cli, '_other', return_value={}), \ + mock.patch.object(cli.price_list, 'update', side_effect=lambda: events.append('prices')), \ + mock.patch.object(conform, 'check', side_effect=lambda *a, **kw: events.append('proof') or {}): + status = cli.main(['conform', 'fake', '--model', 'm', '--max-usd-per-unit', '0.25']) + self.assertEqual(status, 0) + self.assertEqual(events, ['prices', 'proof']) + + def test_price_failure_never_starts_uncapped_proof(self): + with mock.patch.object(cli, '_other', return_value={}), \ + mock.patch.object(cli.price_list, 'update', side_effect=ValueError('offline')), \ + mock.patch.object(conform, 'check') as ran, redirect_stdout(io.StringIO()) as output: + status = cli.main(['conform', 'fake', '--model', 'm', '--max-usd-per-unit', '0.25']) + self.assertEqual(status, 2) + self.assertIn('refused:', output.getvalue()) + ran.assert_not_called() + + if __name__ == "__main__": unittest.main() diff --git a/docs/agents/supported/README.md b/docs/agents/supported/README.md index ea5db9c0..d3d37997 100644 --- a/docs/agents/supported/README.md +++ b/docs/agents/supported/README.md @@ -14,6 +14,7 @@ Every agent in the catalogue, the ports each version has proven, and the benchma | [JiuwenSwarm](jiuwenswarm.md) | `jiuwenswarm@0.2.7`, `jiuwenswarm@0.2.8` | openJiuwen's agent. | ACP | PyPI | Apache-2.0 | | [mini-swe-agent](mini-swe-agent.md) | `mini-swe-agent` | Princeton's 100-line agent, bash only. | a command | PyPI | MIT | | [OpenCode](opencode.md) | `opencode` | The open-source terminal coding agent. | ACP | npm | MIT | +| [SWE-agent](swe-agent.md) | `swe-agent` | Princeton’s software engineering agent with its upstream tool bundles. | a command | repository | MIT | | [Terminus 2](terminus-2.md) | `terminus-2` | Harbor's terminal agent, used by Terminal-Bench. | a command | PyPI | Apache-2.0 | - ACP (`start.acp`) can prove task, workspace, tools, conversation and search; a command (`start.command` with `{prompt}`) task, workspace and search only. @@ -43,6 +44,7 @@ Every agent in the catalogue, the ports each version has proven, and the benchma mini-swe-agent–✓––––––– opencode✓✓✓✓✓–✓✓✓ reference✓✓✓✓––✓✓✓ +swe-agent–✓––––––– terminus-2–✓––––––– @@ -62,6 +64,7 @@ Every agent in the catalogue, the ports each version has proven, and the benchma mini-swe-agent✗✗✗✗✗✗✓✗✗ opencode✓✓✓✓✗✗✓✓✓ reference✗✓✓✓✗✗✓✓✓ +swe-agent✗✗✗✗✗✗✓✗✗ terminus-2✗✗✗✗✗✗✗✗✓ diff --git a/docs/agents/supported/swe-agent.md b/docs/agents/supported/swe-agent.md new file mode 100644 index 00000000..9413747e --- /dev/null +++ b/docs/agents/supported/swe-agent.md @@ -0,0 +1,36 @@ + + +# SWE-agent + +Princeton’s software engineering agent with its upstream tool bundles. + + + + + + + + +
Keyswe-agent
Driven overa command
Fromrepository
Installedgithub.com/SWE-agent/SWE-agent at 0f3acafacabc; aiohappyeyeballs==2.7.1, aiohttp==3.14.5, aiosignal==1.4.0, annotated-doc==0.0.7, annotated-types==0.8.0, anyio==4.16.0, attrs==26.1.0, bashlex==0.18, bidict==0.24.1, blinker==1.9.0, boto3==1.44.9, botocore==1.44.9, certifi==2026.11.20, charset-normalizer==3.5.2, click==8.5.1, datasets==5.2.0, dill==0.4.1, distro==1.9.0, docstring-parser==0.18.0, fastapi==0.165.0, fastcore==2.2.46, fastspec==0.2.9, fasttransport==0.0.4, fastuuid==0.14.0, filelock==3.32.7, flask==3.1.3, flask-cors==6.0.5, flask-socketio==5.7.2, frozenlist==1.8.0, fsspec==2026.9.0, ghapi==2.1.5, gitdb==4.0.12, gitpython==3.2.1, h11==0.16.0, h2==4.4.1, hf-xet==1.8.0, hpack==4.2.0, httpcore==1.0.9, httpcore2==2.16.2, httpx==0.28.1, httpx2==2.16.2, huggingface-hub==1.33.0, hyperframe==6.1.0, idna==3.20, importlib-metadata==8.9.0, itsdangerous==2.2.0, jinja2==3.1.6, jiter==0.19.0, jmespath==1.1.0, jsonschema==4.26.0, jsonschema-specifications==2025.9.1, linkify-it-py==2.2.0, litellm==1.105.7, markdown-it-py==4.3.0, markupsafe==3.0.4, mdit-py-plugins==0.7.0, mdurl==0.1.2, multidict==7.2.1, multiprocess==0.70.19, numpy==2.5.5, openai==2.54.0, opentelemetry-api==1.45.2, packaging==26.3, pandas==3.1.1, pexpect==4.9.0, platformdirs==4.14.8, propcache==0.5.4, ptyprocess==0.7.0, pyarrow==26.0.1, pydantic==2.14.4, pydantic-core==2.50.5, pydantic-settings==2.16.3, pygments==2.21.0, python-dateutil==2.9.0.post0, python-dotenv==1.2.4, python-engineio==4.15.1, python-multipart==0.0.34, python-socketio==5.18.1, pyyaml==6.0.4, referencing==0.37.0, regex==2026.11.19, requests==2.34.2, rich==15.0.0, rich-argparse==1.8.0, rpds-py==2026.9.1, ruamel-yaml==0.19.1, s3transfer==0.19.3, simple-parsing==0.1.9, simple-websocket==1.1.0, six==1.17.0, smmap==5.0.3, sniffio==1.3.1, starlette==1.10.0, swe-rex==1.2.1, tabulate==0.10.0, tenacity==9.2.1, textual==8.2.8, tiktoken==0.14.0, tokenizers==0.23.3, tqdm==4.70.1, truststore==0.10.5, typing-extensions==4.16.0, typing-inspection==0.4.5, unidiff==1.0.1, urllib3==2.8.0, uvicorn==0.54.0, werkzeug==3.1.9, wsproto==1.3.2, xxhash==4.1.0, yarl==1.25.1, zipp==4.1.2
LicenceMIT
+ +## Versions + + + + + +
VersionUpstreamPortsTools
One taskWorkspace filesMCP toolsConversationSearchComputer usedecoyschainretry
swe-agent1.1.0–✓–––––––
+ +## Options + +None declared. + +## Benchmarks it fits + + + + + +
GAIAGSM8KHumanEvalOpen TelcoOSWorld1OSWorld2SWE-bench Verifiedτ³-benchTerminal-Bench 2.0
One task, Workspace files, SearchOne taskWorkspace filesOne taskComputer useComputer useWorkspace filesMCP tools, ConversationWorkspace files
swe-agent✗✗✗✗✗✗✓✗✗
+ +- ✗: the missing port, on hover. diff --git a/docs/agents/swe-agent.md b/docs/agents/swe-agent.md new file mode 100644 index 00000000..63ad3ec5 --- /dev/null +++ b/docs/agents/swe-agent.md @@ -0,0 +1,23 @@ +# SWE-agent + +Workspace conformance: **2/2 on an explicit root fixture**. A scored +SWE-bench instance remains unproven: the selected attempt ended at its +spending cap before grading. Harbor remains available. + +- Upstream: v1.1.0, `0f3acafacabc0def8cc76b4e48acb4b6cf302cb9`, unchanged. +- Route: upstream `RunSingle`, local deployment, preexisting repository. +- Requires an own-image container with root as its default user. +- Task Python must be ≥3.8 for the default editor's pinned + [tree-sitter 0.21.3](https://pypi.org/project/tree-sitter/0.21.3/). + Legacy Python 3.5 images are refused; the task interpreter is never replaced. +- Agent dependencies and tool dependencies are pinned. +- Preparation installs dependencies through upstream tools and checks that + commands remain available after tool reset. Existing upload directories are + refused; temporary uploads are removed while installed dependencies remain. +- SWE-bench agent work stays offline; preparation's proxy is removed first. +- Task PATH is set through upstream's startup option, preserving the tool + directories added afterward. + +Intermittent shell-startup timeouts remain observed with SWE-ReX 1.2.1. +Successful preparation does not establish agent capability. The agent remains +restricted to SWE-bench Verified even after passing its workspace kit. diff --git a/docs/benchmarks/supported/swe-bench-verified.md b/docs/benchmarks/supported/swe-bench-verified.md index a02cfe1d..fa48f624 100644 --- a/docs/benchmarks/supported/swe-bench-verified.md +++ b/docs/benchmarks/supported/swe-bench-verified.md @@ -52,7 +52,7 @@ Software engineering: fix a real GitHub issue so the failing tests pass. - On Nullius, the agent can reach only its model. The tests get internet access after the agent ends. - The prompt is the issue's title and body, without the hints, as on the leaderboard. - Each instance's image is pinned. An image the authors rebuild is not used until the pin is refreshed. -- SWE-agent, the authors' own agent, runs only on Harbor. +- SWE-agent passes its root workspace fixture and requires task Python >=3.8. A scored instance remains unproven; the selected attempt ended at its spending cap before grading. ## Cite diff --git a/docs/standard.md b/docs/standard.md index 1efad743..6e3c2e4d 100644 --- a/docs/standard.md +++ b/docs/standard.md @@ -507,6 +507,14 @@ The upstream's dependencies go in `driver.install` (a capability's `install` is Follow [Add an agent manually](agents/add-manually.md). +Agent `prepare` runs as root in own-image containers only. Requested public +access ends and leftover processes stop before startup; failure refuses the unit. + +Root workspace conformance uses `--fixture-image` with a digest-pinned image +running as root, with Python and git. The proof records its image and root user; it does +not prove a benchmark instance or broaden benchmark restrictions. Capped +conformance requires current prices for every model called. + ### A capability Follow [Add a capability manually](capabilities/add-manually.md). diff --git a/pyproject.toml b/pyproject.toml index dd09b371..c3a236f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ _nullius_app = "app" dependencies = {file = ["app/requirements.txt"]} [tool.setuptools.package-data] -"nullius.catalogue" = ["agents/*/*.json", "agents/*/*.py", "agents/*/*.toml", "agents/*/*.yaml", "benchmarks/*/env/*", "benchmarks/*/*.json", "benchmarks/*/*.py", "benchmarks/*/*.yml", "benchmarks/*/startup/*.py", "capabilities/*/*.json", "capabilities/*/*.py"] +"nullius.catalogue" = ["agents/*/*.json", "agents/*/*.py", "agents/*/*.toml", "agents/*/*.yaml", "agents/*/*.txt", "benchmarks/*/env/*", "benchmarks/*/*.json", "benchmarks/*/*.py", "benchmarks/*/*.yml", "benchmarks/*/startup/*.py", "capabilities/*/*.json", "capabilities/*/*.py"] "nullius.standard" = ["kits/*/*.json", "kits/*/*.py", "kits/*/*.Dockerfile", "kits/*/*.txt"] "nullius.judge" = ["floors.json"] _nullius_app = ["templates/**/*.html", "templates/*.svg", "static/**/*.css", "static/**/*.js", "static/**/*.svg", "static/**/*.png", "static/**/*.json", "static/**/*.woff2", "static/**/*.ttf", "static/**/*.txt", "static/**/*.md", "requirements.txt", ".env.example"]