From 1f99d91f8db54fe209bd2acefd0cb29bd4e5a162 Mon Sep 17 00:00:00 2001 From: illusoryw <98226453+illusoryw@users.noreply.github.com> Date: Tue, 1 Dec 2026 19:12:50 +0000 Subject: [PATCH] DeepSWE through Harbor: the hub's 113 tasks, graded as DeepSWE grades them examples/deepswe/ packages DeepSWE v1.1 (datacurve/deep-swe-1-1@1 on the Harbor hub, 113 tasks of 91 repositories) as the other Harbor benchmarks are: a benchmark file whose dataset block prepare reads, the lock of the 113 tasks and the images' sizes, splits (every task a test task: DeepSWE is held-out evaluation data, so the protocol is SWE-bench Verified's transfer), baseline configs for both CLI profiles the other benchmarks have, task-info and README. DeepSWE grades the agent's commits in a verifier container of their own, which Harbor 0.25.0 runs as published. Two things are the example's own: - utils/patches.py: each task's [[verifier.collect]] diff leaves out everything Hermit's deployment of an adapter writes at the repository's root (the adapter's folder, the context file, the CLI's places, the deployment's record, the hooks' audit). The instruction asks the agent to commit everything, so without this an arm with an adapter would be graded on a tree holding those files and an arm with none without them; a test deploys AHE's template as a run does and fails if any entry it writes there is not left out. - utils/judge.py: DeepSWE's test.sh writes reward -1 when its grader crashed before grading any test; the judge records that as no score (Unscored, counted as infra by hermit.harbor.report) instead of a -1. --- CHANGELOG.md | 5 + docs/framework/task.md | 2 +- examples/README.md | 16 +- examples/deepswe/.gitignore | 2 + examples/deepswe/README.md | 115 ++++++++++++ examples/deepswe/baseline/claude.yaml | 34 ++++ examples/deepswe/baseline/codex.yaml | 33 ++++ examples/deepswe/utils/benchmark.yaml | 26 +++ examples/deepswe/utils/dataset.lock | 127 ++++++++++++++ examples/deepswe/utils/image_sizes.json | 116 ++++++++++++ examples/deepswe/utils/judge.py | 33 ++++ examples/deepswe/utils/patches.py | 61 +++++++ examples/deepswe/utils/splits/all.txt | 113 ++++++++++++ examples/deepswe/utils/splits/smoke.txt | 2 + examples/deepswe/utils/splits/test.txt | 113 ++++++++++++ examples/deepswe/utils/splits/train.txt | 113 ++++++++++++ examples/deepswe/utils/splits/val.txt | 0 examples/deepswe/utils/task-info/README.md | 26 +++ .../utils/tests/test_collected_commits.py | 166 ++++++++++++++++++ .../utils/tests/test_crash_sentinel.py | 61 +++++++ tests/core/test_harbor_examples.py | 2 +- 21 files changed, 1160 insertions(+), 6 deletions(-) create mode 100644 examples/deepswe/.gitignore create mode 100644 examples/deepswe/README.md create mode 100644 examples/deepswe/baseline/claude.yaml create mode 100644 examples/deepswe/baseline/codex.yaml create mode 100644 examples/deepswe/utils/benchmark.yaml create mode 100644 examples/deepswe/utils/dataset.lock create mode 100644 examples/deepswe/utils/image_sizes.json create mode 100644 examples/deepswe/utils/judge.py create mode 100644 examples/deepswe/utils/patches.py create mode 100644 examples/deepswe/utils/splits/all.txt create mode 100644 examples/deepswe/utils/splits/smoke.txt create mode 100644 examples/deepswe/utils/splits/test.txt create mode 100644 examples/deepswe/utils/splits/train.txt create mode 100644 examples/deepswe/utils/splits/val.txt create mode 100644 examples/deepswe/utils/task-info/README.md create mode 100644 examples/deepswe/utils/tests/test_collected_commits.py create mode 100644 examples/deepswe/utils/tests/test_crash_sentinel.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 91e80f5f..959ba190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,6 +157,11 @@ Changes are grouped by software version. Entries under Unreleased describe work message's `` scored by the paper's `reward.py` (the OfficeQA repository's at its commit) at a 0.0% relative error, with 0.1%, 1% and 5% recorded. A Codex event stream must show a completed final reply. The agent uses a network allowlist and the verifier runs offline. No-adapter baseline configs cover Codex and Claude Code. +- `examples/deepswe/`: DeepSWE v1.1 (113 long-horizon engineering tasks, the Harbor hub's `datacurve/deep-swe-1-1`, + pinned) graded as DeepSWE grades it in each task's Harbor environment: the agent's commits collected as `model.patch` + and applied in a verifier container of their own. What Hermit's deployment of an adapter writes is left out of the + collected commits (`utils/patches.py`), and a grader's crash (reward -1) is no score (`utils/judge.py`). No-adapter + baseline configs cover Codex and Claude Code, and test an adapter trained elsewhere, frozen. - `hermit convert` names the adapter's folder and files as a deployment does: a Claude Code plugin prints, from a `SessionStart` hook, where its embedded adapter is and the files no export connects (the list a deployment's context gives); Codex, Pi and Hermes plugins list those files under `unnamed_files` in the result and their README. diff --git a/docs/framework/task.md b/docs/framework/task.md index 71845187..3460443c 100644 --- a/docs/framework/task.md +++ b/docs/framework/task.md @@ -268,7 +268,7 @@ itself (B). | `task.toml` limits | applied by Harbor; Hermit adds the agent's model hosts to `allowed_hosts` | the agent's timeout and the network applied by Hermit; a task that needs more memory than `environment.resources.memory_mb` is refused; `cpus` is not applied | | Harbor at run time | needed (in a venv of its own) | not needed (`hermit/task/directory.py` reads the format) | | Not supported yet (refused) | the adapter's tools, the agent's mounts, `prepare` and `collect`, multi-step tasks | files placed in the agent's workspace before it starts, multi-step tasks | -| Examples | `terminal_bench_2_0`, `terminal_bench_science`, `swebench_verified`, `algotune`, `labbench`, `officeqa_harbor`, `officeqa/gepa/run_codex_harbor.yaml` | `libero`, `robosuite`, `robodojo_sim`, `clbench_*`, `servelearnbench`, `agentdyn`, `agentdojo`, `officeqa` | +| Examples | `terminal_bench_2_0`, `terminal_bench_science`, `swebench_verified`, `deepswe`, `algotune`, `labbench`, `officeqa_harbor`, `officeqa/gepa/run_codex_harbor.yaml` | `libero`, `robosuite`, `robodojo_sim`, `clbench_*`, `servelearnbench`, `agentdyn`, `agentdojo`, `officeqa` | The task format is the same, so a task set of B moves to A when its tasks need stricter isolation: give each task's `environment/` a Dockerfile (or a `docker_image`) and the run config `environment.harbor`. OfficeQA runs both ways: diff --git a/examples/README.md b/examples/README.md index 8f84f1f6..d87b17f3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -46,7 +46,8 @@ a `.hermit/CARD.md`. ## Harbor benchmarks -Five benchmarks of Harbor's registry and OfficeQA from Harbor's dataset repository, each with a baseline and, for the +Five benchmarks of Harbor's registry, DeepSWE from the Harbor hub and OfficeQA from Harbor's dataset repository, each +with a baseline and, for the five, the method whose paper's protocol fits it, packaged so that any of their runs can be handed to someone with a Docker host. Each task runs in its own Harbor environment (`environment.harbor`): Harbor starts the task's container and verifies the agent's work with the task's tests; the @@ -63,6 +64,7 @@ Claude Haiku 5.5 on a Claude subscription (`*claude*.yaml`), both at medium effo | [`swebench_verified/`](swebench_verified/) | 500 GitHub issues | resolve rate | no adapter, each issue once | nothing trains: Terminal-Bench 2.0's final AHE adapter, frozen, against AHE's seed (the AHE and RRSI papers' transfer test) | | [`algotune/`](algotune/) | 154 speedup tasks | harmonic mean of the speedups | no adapter, the 108 test tasks | [`skillopt`](algotune/skillopt/): SkillOpt's split 2:1:7, 4 epochs, its gate, slow update and meta skill | | [`terminal_bench_science/`](terminal_bench_science/) | 70 science workflows, 8 hours each | pass@1 | no adapter, each task twice (#3, #4) | Terminal-Bench 2.0's AHE adapter, frozen; [`ahe_adapter`](terminal_bench_science/ahe_adapter/) in Terminal-Bench 2.0's protocol | +| [`deepswe/`](deepswe/) | 113 long-horizon engineering tasks of DeepSWE v1.1 (Python, TypeScript, Go, JavaScript, Rust), 90 min each; the agent's commits graded in a verifier container of their own | pass@1 | no adapter, each task once | nothing trains (held-out evaluation data): Terminal-Bench 2.0's final AHE adapter, frozen, against AHE's seed, as for SWE-bench Verified | | [`labbench/`](labbench/) | 181 FigQA figure questions | accuracy | no adapter, the 127 test questions | [`skillopt`](labbench/skillopt/), as for AlgoTune | | [`officeqa_harbor/`](officeqa_harbor/) | 246 questions about U.S. Treasury Bulletins, in the OfficeQA paper's evaluation | the OfficeQA scorer at a 0.0% relative error | Codex with no adapter (50 train, 24 validation, 172 test): the 2026-11-25 run scored 58.1% on all 172 test questions and 43.0% on its 93 OfficeQA Pro questions, before the verifier update for interrupted turns | none yet | @@ -83,14 +85,16 @@ Claude Haiku 5.5 on a Claude subscription (`*claude*.yaml`), both at medium effo environment (or a config mounts one of this machine's and names it as `agent..bin`); a method run also needs it on this machine, where its learners run. The sign-in reaches the CLI in each task's environment (Codex's sign-in file, taken back and removed before the verifier; Claude Code's token by name, then on a descriptor), where the - session's commands run and, in these task sets but OfficeQA's, reach the public network: a command that read it could send it out. + session's commands run and, in these task sets but OfficeQA's and DeepSWE's (whose agents reach only the model's + hosts), reach the public network: a command that read it could send it out. Run them on a sign-in you accept that risk for. - Room. No task's environment starts while Docker's disk has less than 25 GB free (the benchmark files' `disk_gate_gb`); a task's image is built or pulled for it: Terminal-Bench 2.0's prebuilt images from Docker Hub, 120-150 GB in all, each removed after its rollouts and so pulled again at every AHE step (sign in with `docker login` for Docker Hub's pull limits, or keep them where the disk holds them: [Terminal-Bench 2.0](terminal_bench_2_0/README.md#prepare)); SWE-bench's image of the issue, one for each of the 500, which stays in Docker's build cache (their size on disk is not measured here: this - machine pulled three of them); AlgoTune's 8 GB, the same layers for every task. An AlgoTune container takes 8 CPUs and + machine pulled three of them); DeepSWE's prebuilt image of each task from Amazon ECR, about 111 GB compressed for the + 113, each removed after its task; AlgoTune's 8 GB, the same layers for every task. An AlgoTune container takes 8 CPUs and up to 64 GB, six at a time. No environment starts either while the host's `/tmp` has less than 1 GB free (`tmp_gate_gb`). Each gate holds a task up to six hours (`disk_gate_wait_s`), one after the other (so up to twelve), then the task's run fails as not the agent's result. @@ -143,6 +147,9 @@ table. An AHE run also sends back its best iteration's in-sample pass@1, numbers | `swebench_verified` | baseline | `hermit eval --config baseline/

.yaml --adapter none` | 500 | 50 min | | | AHE's seed | `... --adapter "$PWD/hermit/adapter/templates/ahe"` | 500 | | | | transfer | `... --adapter "$PWD/"`, after Terminal-Bench 2.0's AHE run | 500 | | +| `deepswe` | baseline | `hermit eval --config baseline/

.yaml --adapter none` | 113 | 90 min | +| | AHE's seed | `... --adapter "$PWD/hermit/adapter/templates/ahe"` | 113 | | +| | transfer | `... --adapter "$PWD/"`, after Terminal-Bench 2.0's AHE run | 113 | | | `algotune` | baseline | `hermit eval --config baseline/

.yaml --adapter none` | 108 | 1 h, and the timing | | | the empty skill | `hermit eval --config skillopt/run_

.yaml --adapter root`, after SkillOpt's training | 108 | | | | SkillOpt | `hermit train --config skillopt/run_

.yaml`, then `hermit eval ... --adapter final` | at most 364 (more if resumed mid-step), then 108 | | @@ -160,7 +167,8 @@ again in a fresh environment when the provider could not serve its session (`env n-th after n x `busy_wait_s`, 120 s, not counted in `infra_retries`) or its login's plan refused it (once the plan allows, not counted), and a row's tokens are all its runs'. Before a long training, its method's `smoke_

.yaml` checks the task set, the CLI in the containers and the method's learners -together. SWE-bench Verified trains nothing and has no smoke config: its baseline config runs its 2 smoke tasks apart +together. SWE-bench Verified trains nothing and has no smoke config (nor does DeepSWE, the same with `deepswe`): its baseline +config runs its 2 smoke tasks apart from the baseline's run and trials, as the methods' smokes run apart from theirs, with ```bash diff --git a/examples/deepswe/.gitignore b/examples/deepswe/.gitignore new file mode 100644 index 00000000..409fdd09 --- /dev/null +++ b/examples/deepswe/.gitignore @@ -0,0 +1,2 @@ +utils/tasks.jsonl +*/runs/ diff --git a/examples/deepswe/README.md b/examples/deepswe/README.md new file mode 100644 index 00000000..195ab51e --- /dev/null +++ b/examples/deepswe/README.md @@ -0,0 +1,115 @@ +# DeepSWE + +[DeepSWE](https://github.com/datacurve-ai/deep-swe) v1.1 through Harbor: 113 original, long-horizon engineering tasks +on 91 open-source repositories (tasks in Python 34, TypeScript 35, Go 34, JavaScript 5, Rust 5), each in its own container +with the repository at the task's base commit, scored 1 when every test the change must make pass passes and none it +must keep passing breaks, else 0. The task set is the Harbor hub's `datacurve/deep-swe-1-1` at revision 1, locked in +`utils/dataset.lock`. DeepSWE is held-out evaluation data, so nothing trains here: as for +[SWE-bench Verified](../swebench_verified/), the protocol is a transfer, a frozen adapter evolved elsewhere tested on +all 113 tasks against the same acting agent with no adapter. + +| Folder | What it runs | +|---|---| +| `utils/benchmark.yaml` | the task set and the settings every config shares: each task's own 5,400 s, no network for the agent but its model's, the disk gate, each image removed after its task | +| `utils/patches.py` | Hermit's deployment of the adapter left out of the commits DeepSWE grades | +| `utils/judge.py` | the verifier's reward as the score, its grader's crash (reward -1) never a score | +| `baseline/` | `codex.yaml`, `claude.yaml`: `hermit eval` on the 113 tasks, with no adapter or with an adapter directory | + +Each config comes twice: Codex with GPT-5.6-Luna on a ChatGPT login, and Claude Code with Claude Haiku 5.5 on a Claude +subscription, both at medium effort. [Run the Harbor benchmarks](../README.md#harbor-benchmarks) says what a machine +needs and how to switch to another model or CLI. + +## Prepare + +```bash +python -m hermit.harbor.dataset prepare examples/deepswe/utils/benchmark.yaml +``` + +It downloads the 113 tasks from the Harbor hub, runs `patches.py` on them, checks them against the lock, and writes +`utils/tasks.jsonl` (one row per task, and the smoke rows `mashumaro-flattened-dataclass-fields#0`, a Python task, and +`tengo-callable-instance-isolation#0`, a Go one), `utils/splits/` (`test.txt`: all 113) and `utils/image_sizes.json`. +Each task's image is pulled from `public.ecr.aws/d3j8x8q7/swe-bench-202605` when its trial starts, the verifier's built +on it with the hidden tests, and removed after it: 0.75 to 2.5 GB compressed each, about 111 GB for the 113. + +## How a task is graded + +DeepSWE's own protocol, which Harbor 0.25.0 runs as published: the agent's phase has no network (Hermit lets the +session reach its model's hosts alone); the instruction ends "work on this in a new branch from main and commit +everything when you are done"; once the agent stopped, a `[[verifier.collect]]` command writes its commits (`git diff +--binary HEAD`) as `/logs/artifacts/model.patch`; the verifier runs in a container of its own (`[verifier] +environment_mode = "separate"`, the task's verifier image, no network), applies the patch to the pristine repository +and runs the hidden tests. Work the agent did not commit is not graded. + +Two things are Hermit's: + +- `patches.py` adds a pathspec to each collect command that leaves out what Hermit's deployment of the adapter puts at + the repository's root (`hermit/`, `AGENTS.md`, `CLAUDE.md`, `.codex/`, `.claude/`, `.mcp.json`, `.hermit-deploy.json`, + the hooks' `.hermit-hooks/`, `tool-calls.jsonl`): + an agent that commits everything commits them too, and an arm with an adapter would otherwise be graded on a tree + with those files and an arm with none without them. No task's reference solution or test patch touches them. +- `utils/judge.py`: DeepSWE's verifier writes reward -1 when its grader crashed (no test graded), which the environment + judge would score as the agent's -1. The judge records such a trial as no score (`Unscored`): `python -m + hermit.harbor.report` counts it as infra, apart from the trials its pass@1 is over, and `hermit eval`'s `mean_score` + counts it as 0. The run does not run it again by itself. To grade it, run `hermit eval` again on its row under a run + of its own, not the eval's (the same run name would write over the eval's `results.jsonl` and `summary.json`): + + ```bash + hermit eval --config examples/deepswe/baseline/

.yaml --adapter none data.test= \ + trainer.run_name=

-rerun environment.harbor.jobs_dir=~/.cache/hermit/harbor/jobs/deepswe-

-rerun + ``` + + The eval's folder still counts the row as infra; the rerun's folder holds its score. + +## Baseline + +```bash +hermit eval --config examples/deepswe/baseline/codex.yaml --adapter none +``` + +113 trials, once each. The score is the `pass_at_1` of `python -m hermit.harbor.report` on the eval's folder +(`examples/deepswe/baseline/runs/codex-baseline/eval/none/`), over the trials that are the agent's result; the +summary's `mean_score` counts an infra trial as 0. Published DeepSWE numbers average pass@1 over several attempts +per task, and the count differs between reports: set `eval.repeats` to that of the report compared against. + +The two smoke tasks run apart from the baseline's run and trials, as SWE-bench Verified's do: + +```bash +hermit eval --config examples/deepswe/baseline/

.yaml --adapter none data.test=../utils/splits/smoke.txt \ + trainer.run_name=

-smoke environment.harbor.jobs_dir=~/.cache/hermit/harbor/jobs/deepswe-

-smoke +``` + +## Transfer + +The same config tests an adapter trained elsewhere, frozen, as [SWE-bench Verified](../swebench_verified/README.md) +does with Terminal-Bench 2.0's final AHE adapter and AHE's seed: + +```bash +hermit eval --config examples/deepswe/baseline/codex.yaml --adapter "$PWD/examples/terminal_bench_2_0/ahe_adapter/runs/ahe-final-codex" +hermit eval --config examples/deepswe/baseline/codex.yaml --adapter "$PWD/hermit/adapter/templates/ahe" +``` + +## Known limits + +- DeepSWE recommends its own runner, Pier; its tasks are Harbor's format and run here on Harbor 0.25.0, whose separate + verifier and collect commands they need. +- A task's container gets 2 CPUs and 8 GB, and its verifier as much again while it runs: the configs run 4 tasks at a + time. + +## Results + +The smoke (the command in [Baseline](#baseline), `codex.yaml`, no adapter): both tasks +scored (no infra, no error), 0 of 2 resolved. Codex committed its work on a branch of its own, as the instruction asks, +and its patch applied in the verifier's container; DeepSWE's all-or-nothing reward scores each 0 (on `mashumaro` it +made every test it had to make pass pass and broke one it had to keep passing). + +| Task | Agent's time | Tokens | Tests it must make pass | Tests it must keep passing | Reward | +|---|---|---|---|---|---| +| `mashumaro-flattened-dataclass-fields` (Python) | 316 s | 1,386K | 66 / 66 | 30,013 / 30,014 | 0 | +| `tengo-callable-instance-isolation` (Go) | 526 s | 3,395K | 4 / 23 | 122 / 122 | 0 | + +The full runs: not run yet. + +| Acting agent | No adapter | AHE's seed | AHE's final adapter from Terminal-Bench 2.0 | +|---|---|---|---| +| Codex, GPT-5.6-Luna | | | | +| Claude Code, Claude Haiku 5.5 | | | | diff --git a/examples/deepswe/baseline/claude.yaml b/examples/deepswe/baseline/claude.yaml new file mode 100644 index 00000000..a37f32db --- /dev/null +++ b/examples/deepswe/baseline/claude.yaml @@ -0,0 +1,34 @@ +# DeepSWE, the baseline: Claude Code with no adapter on all 113 tasks, once each, each task's own 5,400 s, +# no web search. Claude Code runs Claude Haiku 5.5 at medium effort on a Claude subscription (`claude setup-token`, the +# token exported as CLAUDE_CODE_OAUTH_TOKEN; no API key) in each task's container. The same config tests an adapter +# trained elsewhere, frozen (the transfer protocol of ../README.md): +# +# hermit eval --config examples/deepswe/baseline/claude.yaml --adapter none +# hermit eval --config examples/deepswe/baseline/claude.yaml --adapter +# +# The resolve rate is the pass_at_1 of `python -m hermit.harbor.report` on the eval's folder +# (runs/claude-baseline/eval/none/ beside this file; eval// for an adapter directory), over the trials that +# are the agent's result; the summary's mean_score counts an infra trial as 0. +data: + tasks: ../utils/tasks.jsonl + train: ../utils/splits/smoke.txt # placeholder, as template and evolver are: hermit eval reads it, trains nothing + test: ../utils/splits/test.txt # the 113 tasks +agent: + base: claude # Claude Code in each task's own Harbor environment, installed there by Harbor + concurrency: 4 # a task takes 2 CPUs and 8 GB, and its verifier as much again + model: {name: claude-haiku-5-5, login: claude, effort: medium} # the subscription's plan, shared + claude: {web_search: false} # the CLI's web search off +environment: + harbor: # each task in its own Harbor environment, verified by Harbor's verifier + benchmark: ../utils/benchmark.yaml # the settings every config of this example shares + jobs_dir: ~/.cache/hermit/harbor/jobs/deepswe-claude # the Claude Code configs' environments (each task's trial) +judge: + path: ../utils/judge.py # Harbor's verifier's reward, its grader's crash (-1) never a score (utils/judge.py) +template: prompt-only@1.0 # placeholder (see data.train) +task_info: ../utils/task-info # what hermit check asks of a training config +evolver: {name: eval-only} # placeholder: no Evolver of this name, so hermit train refuses this config +trainer: + run_name: claude-baseline + output_dir: runs +eval: + repeats: 1 diff --git a/examples/deepswe/baseline/codex.yaml b/examples/deepswe/baseline/codex.yaml new file mode 100644 index 00000000..86be7355 --- /dev/null +++ b/examples/deepswe/baseline/codex.yaml @@ -0,0 +1,33 @@ +# DeepSWE, the baseline: Codex with no adapter on all 113 tasks, once each, each task's own 5,400 s, no web +# search. Codex runs GPT-5.6-Luna at medium effort on the ChatGPT login (`codex login`, no API key) in each task's +# container. The same config tests an adapter trained elsewhere, frozen (the transfer protocol of ../README.md): +# +# hermit eval --config examples/deepswe/baseline/codex.yaml --adapter none +# hermit eval --config examples/deepswe/baseline/codex.yaml --adapter +# +# The resolve rate is the pass_at_1 of `python -m hermit.harbor.report` on the eval's folder +# (runs/codex-baseline/eval/none/ beside this file; eval// for an adapter directory), over the trials that are +# the agent's result; the summary's mean_score counts an infra trial as 0. +data: + tasks: ../utils/tasks.jsonl + train: ../utils/splits/smoke.txt # placeholder, as template and evolver are: hermit eval reads it, trains nothing + test: ../utils/splits/test.txt # the 113 tasks +agent: + base: codex # Codex in each task's own Harbor environment, installed there by Harbor + concurrency: 4 # a task takes 2 CPUs and 8 GB, and its verifier as much again + model: {name: gpt-5.6-luna, login: chatgpt, effort: medium} # the ChatGPT plan, shared + codex: {web_search: false} # the CLI's web search off +environment: + harbor: # each task in its own Harbor environment, verified by Harbor's verifier + benchmark: ../utils/benchmark.yaml # the settings every config of this example shares + jobs_dir: ~/.cache/hermit/harbor/jobs/deepswe-codex # the Codex configs' environments (each task's trial) +judge: + path: ../utils/judge.py # Harbor's verifier's reward, its grader's crash (-1) never a score (utils/judge.py) +template: prompt-only@1.0 # placeholder (see data.train) +task_info: ../utils/task-info # what hermit check asks of a training config +evolver: {name: eval-only} # placeholder: no Evolver of this name, so hermit train refuses this config +trainer: + run_name: codex-baseline + output_dir: runs +eval: + repeats: 1 diff --git a/examples/deepswe/utils/benchmark.yaml b/examples/deepswe/utils/benchmark.yaml new file mode 100644 index 00000000..aa3cb93b --- /dev/null +++ b/examples/deepswe/utils/benchmark.yaml @@ -0,0 +1,26 @@ +# DeepSWE in Harbor's environments: the environment.harbor settings every config of this example shares +# (environment.harbor.benchmark; a config's own settings override these), and the task set (the dataset: block, which +# `python -m hermit.harbor.dataset prepare` reads). One rollout is one task in its own Harbor environment: Harbor pulls +# the task's prebuilt image (the repository at the task's base commit in /app, public.ecr.aws/d3j8x8q7/swe-bench-202605), +# the acting agent works there with no network but its model's and commits its work, and once it stopped its commits +# are collected as model.patch (patches.py leaves Hermit's deployment of the adapter out) and graded in a container of +# their own (the task's verifier image: the same image with the hidden tests), with no network: 1 if every test the +# change must make pass passes and none it must keep passing breaks, else 0. The acting agent, its model and its +# sign-in are each config's. +dataset: + ref: datacurve/deep-swe-1-1@1 # DeepSWE v1.1 on the Harbor hub: 113 tasks of 91 repositories (Python 34, + # TypeScript 35, Go 34, JavaScript 5, Rust 5); revision 1, the hub's latest + split: in_sample # every task is a test task: DeepSWE is held-out evaluation data, nothing + # trains here + smoke: # two small tasks, rows #0 (splits/smoke.txt): Python and Go + - mashumaro-flattened-dataclass-fields + - tengo-callable-instance-isolation + patch: patches.py:exclude_deployment # Hermit's deployment of the adapter not in the graded commits + image_sizes: true # image_sizes.json: each task image's size, for the disk gate +tasks_dir: tasks # the 113 task directories (prepare's link, outside the checkout) +agent_timeout_sec: null # each task's own limit (5,400 s for every task) +docker_cleanup: rmi_task_image # a task's image is removed after its rollout: the 113 images are about 111 GB + # compressed (0.75-2.5 GB each) +image_sizes: image_sizes.json # the disk gate keeps room for the images still to be pulled +disk_gate_gb: 25 # no environment starts with less than this free on Docker's data root +disk_gate_wait_s: 21600 diff --git a/examples/deepswe/utils/dataset.lock b/examples/deepswe/utils/dataset.lock new file mode 100644 index 00000000..b1c5379f --- /dev/null +++ b/examples/deepswe/utils/dataset.lock @@ -0,0 +1,127 @@ +{ + "schema": 1, + "source": { + "ref": "datacurve/deep-swe-1-1@1", + "patch": { + "hook": "patches.py:exclude_deployment", + "sha256": "e97548748d64b29701d46edeecf57c227df2e87edfe7c34ffa4acf9145138fbc", + "said": "collect without Hermit's deployment: 113 patched, 0 already patched" + } + }, + "created": "2026-12-01T18:28:18+00:00", + "tasks": { + "abs-module-cache-flags": "c63879899ebe9c408b1329392ad80c8799ef755d6942dfa299808bc254c3de10", + "abs-stepped-slices": "abc869274bbf11775b032ae2061d06815d409019ccfc8bffa1ee08fd9fa3d3d1", + "actionlint-action-pinning-lint": "55a942f0521eac40b0f7a6b608e64ff89f69f38feb40f6de3d334dc8ba121f06", + "adaptix-name-mapping-aliases": "f449a759a83f92ba9114989a37df0099195a8177a164e4544ecc5a3fdfce7266", + "aiomonitor-task-snapshots-diff": "5da221cfd0441dcdfe56ca990977d858c69395e0dd9a796d32995b1340131fe9", + "anko-default-function-arguments": "c76e71c31435754315f649f0f4e1178b06138032a422169176fad08f32ac8dd2", + "anko-typed-variable-bindings": "26bd10ab2d8deb9a5b0611bf57248329be0659fc6ba46991b73d87bd0c7edd02", + "arcane-drift-detection-baselines": "8535baf5b97feb23f10e98adaf4a3e873f7f7bd9f3abf9fdb599b7f0f2605d9f", + "arktype-json-schema-refs-dependencies": "ecf48abdc399a34d0013c83d6efa858b0771e052ac9f0c6ed624306167538bde", + "awilix-async-container-initialization": "57502cbe82267a5214d48f65269d6accbd1a3566004ef7728e4fd356f242d931", + "bandit-incremental-cache-control": "e2e07e5f98c548c73a3c6865e5f3324ac3b37f0f4977085c4b20ae7bba9837bc", + "bandit-interprocedural-taint-checks": "e881bc16e2414e409527b334f5905d8a2212e812539a658a0f719b2c2ea8536c", + "bandit-structured-nosec-directives": "ccdeb2b392ffcdc522e3368b9e1d7494882a037541aed83f915e80243b90a38d", + "boa-hierarchical-evaluation-cancellation": "65316c6b05f7586dda1103c1c01a995e828743f7f9a325476379e7a35286a943", + "cattrs-partial-structuring-recovery": "60bfb9ca1c8c4ab1e00de38a7930668962cead386c060b5d8dd9f33b16677e60", + "clack-async-autocomplete-options": "e67cd2875a6aceefcb159fc40f09643008d3e0a1d47038398d392ce7b1a86cb2", + "claude-code-by-agents-recursive-delegation": "562b5f70e870246152317569c6b64e648b43628b000a6c7610d0486e986cab77", + "cliffy-config-file-parsing": "f3e065a35bf24028d37e44912408407a07df517038f10cf0f1adf9238bca2112", + "csstree-shorthand-expansion-compression": "2adb2eff81fc334821d6715d9a84ca43a3827865c7c13dce9f779a0d48201722", + "dasel-html-document-format": "76adbae8af18a0a27826f251d096bc94f8a3f3c8ed20cb4abafb95abdc78c00f", + "dateutil-rfc5545-timezone-interop": "27a3ec85dda72d369ed1ac933353017d635dc9ba254630e955d0459bac9e0387", + "drizzle-orm-window-function-builders": "bae6c7283635ad03d1cd71662645d74ad353d2490960208c510bcdef805cc155", + "dynamodb-toolbox-conditional-attribute-requirements": "41de172f52153649dfa3a448656037b26fc25605817e19e6f315115ff8da901b", + "dynamodb-toolbox-lazy-recursive-schemas": "bc9baff6b56f3f2275781c0cd4b3f3ba9ef9033167ca4925147e25a5e920b8de", + "effect-sse-httpapi-streaming": "e50644b77a1e11deee9ae156784da8ae87bb24207214f89108e4d9ac004e6919", + "eicrud-keyset-pagination-cursor": "1f09faf67ed1d0ee8304be83864ecceb46146280bdaba12e6c168c761209ee2b", + "etree-xml-diff-patch": "2f36d0ebdba01a1b7e1b3dbaf370aac2316bff4c010193aa0ad32b6caff30810", + "expr-try-catch-errors": "f5c54cef9133f2bd58e9eca3268542bb6398d7fd32fd42c66f27beb79155dacb", + "fastapi-deprecation-response-headers": "921c778bba7f82e2105f0a761bb191a083325aba1c967f4f275eab7e9e5f9050", + "fastapi-implicit-head-options": "96c5a207d9ef9cd4291a66da157f8e2bd33180a0ba974d5ecc6e0aed50cd6ab6", + "fd-deterministic-multi-key-sorting": "d5f6a2eeaaa1b379cf633769c62028c5753f3adb6ef6274fb0a4373ac2d90c05", + "geo-shapeindex-serialization": "0865986d2201250301a6b608e3c4c3a25f21b5c1ffcf017f39957704c2fd3476", + "go-critic-doc-link-checker": "a4341f781f5ec75e394de1d52c85067830050f3e67ccf00af49928c1dfd79cdc", + "go-genai-streamed-function-args": "4e98ad1c81caff020727aa218128179047baad43b030eefd8e1170de31b2f6ce", + "go-git-worktree-merge-conflicts": "38d0a8c3168c4da9203da36f1c65d9f2e3f1e50eab7112da3c8b9b6a5b1923aa", + "goreleaser-retry-publish-auditing": "4a6f76bfe90c270139d54123c55b924d669548c49cdb863ece3f6260554b22d4", + "gql-incremental-graphql-delivery": "9ba7495e905e9e7c10830d2dedd25e1b94eca6f94e2d8ed5090f5015c4c5c41d", + "happy-dom-abort-pending-body-reads": "b6bd5310f16b83224a67e8c23d96a55fc23f5fef75ced83b6e2f68c8c59b81ee", + "happy-dom-deterministic-intersectionobserver": "32ceadfa09518a4f14f766a7304fb9714468eb3854056a84fde6c9729dee920e", + "helm-array-merge-strategies": "14efefca7fb303c61856200b42ebe35d444d50c8c7487e05cfb19b6270e03518", + "helm-unified-manifest-stream": "8f387962f01444faea03dcfd0278aae6cae19249b20fdac51bd3b54421fc098e", + "httpx-deterministic-cookie-store": "752e1cfe50b203d521822a810d538ef885690ca3133eac8b9eec6e3f62812487", + "httpx-multipart-response-parsing": "c39743a5657d1371094ae38d16582d2b10cdf27afb5c9f4a1c3cc2f7533cf927", + "httpx-streaming-json-iteration": "879112549abe853affa1eec81cca0645aca38f905506130ce865a7ac7c1c7774", + "igel-persist-feature-schema": "b9f25a58f1d98cbb749589289e9811cbdc9a266fe20e5dbaba40f5181e4a09f8", + "ink-grid-box-layout": "5f2d2a2e8db876ce2990c94f78f3ea6a4e653a009bb8f7d944af8a76366635ad", + "ipython-session-bundle-replay": "b2c4ec186de4a02a1edcc198d6eb9f4705b4a7e5b2eca8a49d42cf0f2488cce0", + "katex-multicolumn-array-spans": "6bf7499f504f3687374fa95f32b594e485edefa0552f4f3387eb1c474a49e7ae", + "kcp-go-multiplexed-kcp-streams": "310cc4d6403be6255d6e5c5761377e5b411156c5b1a7a5ddb8a557d083c7cc71", + "kea-atomic-signal-selectors": "fa4a7e6e72d456e8f42b3af799dcb0e163ccf73e58ac393c38cb39377bded6df", + "kgateway-consistent-hash-policy": "b84d0d6a4ce706c4a30be8fbba385c642c5d619ce6f889cfe36ff2a2d9a1ba64", + "kombu-single-active-consumer-priority": "53d58e7f895e2f467f18502726fba8b0602a14691211928b376ca199af1d0dfd", + "kombu-virtual-queue-dead-lettering": "b8dd8b59ecf8484ad64fb84e490b9a305f8cf2e9dfc81852d17e3c1b7cbba309", + "koota-composite-trait-aspects": "85b0e83bcd1c960f143fa8eee7abce07a0afcb5a72ca14a86d6f2bb720ec3dcf", + "koota-deferred-mutation-buffer": "814999285e32ac73d205982917c2cff14830fab9496777929008a1e215d5e7e2", + "koota-entity-snapshot-rollback": "bedb58c76383899a69c42796c77af4fa4130712849ee87ffed6cec8387b48fa4", + "koota-pair-relation-tracking": "8110360034059d52295887062f3d38671b4625066c1ed25ad4e8e230e746c1d8", + "koota-query-predicates": "8a3dc3dee7d3e3a1f76430b4870f9cfda7414302cc39358729a1d98dabc5702d", + "kysely-window-grouping-helpers": "a94ca40e79c915a5a7a5d36163f57dfb46cce5d49863c712cae343accfc9874f", + "langchain-request-coalescing": "531f79ef04c7f38860c0dfd4f38f212cb77aa4b36e415904807ca4c7a536daf6", + "mashumaro-flattened-dataclass-fields": "8ab43c5f3edbb299f1b8d7be05bb4ab831ed2e652e93496c7761c4b0c6402494", + "meriyah-explicit-resource-declarations": "9a4bc5e81b3fd7e70457231f35e9cfcb9c73d6d6893ecff256d1f4a15034e69c", + "mnamer-daemon-watch-lifecycle": "ba3a1ec334355d09ad1d7518772890e4b7f5ce85c24be6b19448aed74aacbd80", + "mobly-grouped-test-barriers": "572405c4cd305825f33e973727a82b1ea84dcce52f189a4c3fb63e6893d61c8f", + "narwhals-rolling-window-suite": "4c91d0a0f357e2154a287e1a0a118ce5e7d3ad1c0b1e016aff8f8054da8be55f", + "numba-stencil-boundary-modes": "e99706269efeefab39a2944f12d5b6c235b1dcc5a0031802e0a2e671d94d8ae1", + "obsidian-linter-auto-table-of-contents": "d686532ee018a195aaafaf6365211ce6a92f16937d469ca9146347d747e6d2a7", + "obsidian-linter-link-format-conversion": "434da19c512d222d35e0083cc41510269d8210d456b18968d68dbf1214df1691", + "obsidian-linter-scoped-ignore-markers": "31661b2cf33f11f5fc17701beba114acf77831f4775d1c295e658e4d7645aa8a", + "ofetch-per-origin-circuit-breaker": "6ab0cb6705ded97004ac2338b6680b6fa8e81827b623f9407bb0e183479ef8c6", + "onedump-dump-encryption-pipeline": "7efd59ead7bb1d7817566b5fc85e3aac30b407f79c36570ecb37272fc46a9d6b", + "opa-rego-rule-profiling": "f1e2b6d52c66585d8513c7936e0b6484ddacb47f69495012b4120dabf0409b47", + "opa-template-string-reconstruction": "b7c396d58de02ef46332c9ce353f4a9d9293e2606d6c0aabe19d6aa36957a1fe", + "optique-conditional-option-dependencies": "bc6b51bbd2cdfd0ebd6fec9cd13d8c3912e9a1035a9042836931f206a60fc9e4", + "oxvg-structural-selector-preservation": "92ba1c2efbecb0bb95bb761ada92672be983e6ed1a6d272b2bf052ce4913d42d", + "participle-grammar-conflict-analysis": "f02e953494012a150170cb907b36874b60f7cf35c30bd4e7267d1cacd5db635f", + "pebble-durability-wait-apis": "b634b46c6c962f304bcfa044c8800b6e426cafeaea92443496b74856312b598e", + "pest-character-class-coalescing": "64ba158319af3cd941d431b5f913e2e901fdbd507c56ec4f79d8f19ad89bd0b3", + "prometheus-transactional-reload-status": "32ae3baa207387703844ddc82e3bec46fef581817a0d293e1dafd96a9653ccae", + "prometheus-typed-label-sorting": "d5e66fc798845377d71c2817d11bd2051bf78cc1c463e5597c605d0a97222236", + "psd-tools-blend-range-api": "5176fc5f5e052d6568263ad4e2dab0df3c0c551c304ac0919c58d054e7b17d59", + "pwntools-tube-multiplexing": "c0e4464cad44f9f7ddc3a0252d7c4fc106cb6b3c80a11eb66f3dc63c8a3928a7", + "python-statemachine-state-data-scoping": "29783d15fbd2d635ca49ff6641b6f5a4b3857dc8bd5333dd52dec4dd83039af9", + "query-persist-restored-query-state": "3116d87950eb38dd7107648fe61e70ca8098da3cb5320f700d2c39e0197a5a21", + "quill-shared-toolbar-focus": "980f087f7f5a1d7c2e6e6d4353f72f2a8cc4e8b7c3a1d7c97cd03cefc0a5541e", + "returns-validated-error-accumulation": "903f958f7fb3dfbcec61a62ad223610da589e8e920af09cd636525d4187b270c", + "scc-bounded-memory-spilling": "d56d5df68f57a9bb1325fe8bfc441dcef54ae507560b18dad88b23d74e8d5cd6", + "scriggo-method-declarations": "e55b578f09f736b89958fc9ee3aac7c3937b6e5187e1b6e5a4d016e10278c6aa", + "skrub-duration-encoding": "4b29bf68d61a0df5b3c4eed20edbafbfff3808dcf88fe0b6728f11ddef41d5cb", + "sql-formatter-bigquery-pipe-formatting": "b403753bfd44adcc21f4d96f4f4de12c3e8302c5beef829e3467617eb65b8acf", + "sqlfmt-create-table-ddl-formatting": "ab035a275c406e6f92ab7a68b9cdc161aa7cd29ee4d6eda50fb41719652e889d", + "sqlite-utils-safe-import-checkpoints": "60e9e1f36e5f9194e489276962884212cce95e85ba17b0cebddad62adfb3dd04", + "superjson-error-stack-serialization": "ee10614604db9f035e7d748702a48acdaa85eb8b2c2201a2c9cc19479cc71ecb", + "task-task-graph-export": "6a2572087b9be6faae7e3f2864d0f1755a166a2041128edde63343f5e83c47d7", + "tengo-callable-instance-isolation": "87954806577677f0a000d0dee09b5b9879c988cd0bc7796fb84a30f46f3ec541", + "tengo-destructuring-bindings": "60d40cf2ee526d2bc1e7270d0f41807211ded9827cfb8fb496b6f126eb6d3aaf", + "termenv-preserve-ansi-resets": "418277980da4ceb479a64ea2add4696404c24a6a2c945079a2d0dea2264eb297", + "testem-bail-on-test-failure": "0d564a07081e43f179b6c6697f7823caf1deac6ca276ecb4d0b53aaaddef325b", + "testem-per-launcher-reports": "af43d014423eaeb0d7664bf3b465dbc70994f803ea17b0da0ea65ffa8c47b61a", + "textual-kitty-key-phases": "e7ee40918b33203813e759c80928455483108c16a68b3b4593c0f6d891cf6c67", + "textual-richlog-follow-state": "3e8115a6fe89751f718e17897024357fa5680dce917bb2cacc2abe06356072c8", + "tomlkit-toml-table-converters": "68e5cc4043bbde322305878bf02edf30c251b26c290443cc684d161e2e39b949", + "true-myth-iterable-collection-combinators": "8d05344f6035c0dcb04332743afa20ac3afa24c052d711994c88461e1c0b5dae", + "ts-pattern-match-each": "94af8884031f949f7aa10be28c2445e1b7adbfecd632f1bbeb23bccc0811e270", + "updo-policy-alerting": "33b197c2ce1dd7b9a8900ab58fd760753ac486d5c216b4c87a439980f1f8d071", + "valibot-recursive-schema-composition": "fe89d6a8a3b84a423cd49718c46bbeb824e54f8521bb9dedf25ab2c9adbd3957", + "vitest-duration-sharding": "4903bdca188cc323aa3f563f9b1eb7c4f66eaac9b14b4cb703e1ae2efb38dbd5", + "vulture-persistent-analysis-cache": "eb9654aaf7b36b7dea7e5ec6bd9f52d6e02a276e284498b44a11287a90c65f6f", + "wasmi-trap-coredumps": "961d33866f77b7dc8a1de4f106052e6ee72e11746200f6c427655e8522d971d7", + "wazero-multi-module-snapshots": "a6bb80f1b80757e6210b47b58c04c6630f9befd1aa4ec40592613fed34f67608", + "yaegi-go-embed-directives": "3578027e594d7e6d463f5b4999e6329b3159e7d9c7b8678433311179df4ee130", + "yjs-map-conflict-detection": "e7e09a1a8225f4a77b7500623376c6b189ec71c6ca4bafab5e39e1b735f3e70f", + "ytt-jsonpath-query-api": "44cf0693c2b35e521245c76272168b8d4ab8b6fa40964bd4a856b2d916b6d0d4" + } +} diff --git a/examples/deepswe/utils/image_sizes.json b/examples/deepswe/utils/image_sizes.json new file mode 100644 index 00000000..a316b483 --- /dev/null +++ b/examples/deepswe/utils/image_sizes.json @@ -0,0 +1,116 @@ +{ + "_comment": "compressed bytes of each task's prebuilt image (docker manifest inspect -v, linux/amd64): the runner's disk gate keeps 2.5x this free for an image not pulled yet", + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh701jywhzgddknqwzsq6npjv98226tq-v1.1": 881808809, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh70247kxfz01g03p1dpz9fqv183g47e-v1.1": 874007932, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh705e1hgmtj22pyetcmqa8ygs83bh33-v1.1": 882299292, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh70bg8gy4xks4eyh1s71ecmk9822p9c-v1.1": 819273434, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh70cshdjenz3z5gq2wrqzhjmn82xbb0-v1.1": 1200951363, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh70h37djmvc9ac48jeh25gwz582xgqv-v1.1": 1120995415, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh70k6aj3y457hgtraar0rmgdn822qx8-v1.1": 755769995, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh70nj38qyatmsmj1d5zh57j25820vrx-v1.1": 2149575268, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh712k0bfwxew9fvg12k70g59n83pw33-v1.1": 886253571, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7191qb52n5pfwh0a4yhahmt18343sn-v1.1": 839537206, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh719np6e210pf8skawv132rw183pfyy-v1.1": 809639899, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71b98xenay7p45357036xq5x82tcdf-v1.1": 882297032, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71gkadwafw4ry4r6g37era0182qpms-v1.1": 781096590, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71j0gr2axgn6v1f92cam6s6x82rkv6-v1.1": 805862916, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71jf6d7mtqaw5z1h69krrarx820dys-v1.1": 768275124, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71kat2v58yys3pnyybkgycax832vj2-v1.1": 2144176677, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71t2fb7qvx4y0svvv77e5p3182hnvq-v1.1": 760656716, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71vrtr4b1jj5vavv6aybnvjd83pcar-v1.1": 841140948, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh71y4gxtry9p0m42wvg4th515831mwz-v1.1": 1261228743, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72088pg9vkc6peacnkc35yy9832jff-v1.1": 835983308, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh724kgmvy32trvakc1q6a6sa583fdx7-v1.1": 836434399, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh727w7pxd9cv476t3cxptxcg182e1e5-v1.1": 776908363, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72a3qcr0kjpdr153havavn8s83bx8t-v1.1": 1111969913, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72dq33t9djm894gqagmgpkhd82yvjv-v1.1": 945042339, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72mtcjbhgxmwq036jccx77dh83dj5n-v1.1": 896965411, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72pgvncj82fnbfq2bvmy1qs183jdc5-v1.1": 841138084, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72qraccnjwdet6ynagsccr4x82y65c-v1.1": 781948578, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh72w47mwm321wh9xj47vskc8d822e9t-v1.1": 781072236, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh731cskx45z0t0961464d9ezx8220nt-v1.1": 774099010, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7322qjz1xfjspavxy0kamf9h83277p-v1.1": 845616080, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh734ehfw2s3bztf7pzc9xf3x18212bs-v1.1": 960086494, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7398skqnxqwg9hbmdj7ncmk1822aa0-v1.1": 918795055, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh73dq4n55jdxasppe6jjmth4183d47n-v1.1": 788210390, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh73faxghpn90rtyxsrjmpjpsx83f4ws-v1.1": 801285145, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh73sgee6751fmh72hwwctyscx832frj-v1.1": 1611732744, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh73snc7v9x3psk69rg4eqvjgs836v5a-v1.1": 899031086, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh73t6ych6s1a4vtkbgr61ecr1823tt2-v1.1": 1000835455, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh73xpqyc0vqx9prf3m106nqe5821dcb-v1.1": 759909745, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh749pxv8w35vksyfhe7p8tg8x82p0vg-v1.1": 1034725833, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74b2m0tjfn59vq8btqrj774s821570-v1.1": 757488450, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74gd4v9cty7573mr6k7va39183ngrq-v1.1": 769269310, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74gnp94dw8fx3h047h4m4ht9830bat-v1.1": 1754419829, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74j15mp1vrxx737y8b47tc8h832a37-v1.1": 838451224, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74m2j63pskf6htk1sxxevvv1823hvd-v1.1": 767767425, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74mb9dzz76a6zgdqmmf5mvk1833cnk-v1.1": 811123324, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh74r2t7kdnt7h2efdk0hf5asx82zr0s-v1.1": 867427760, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh754n098chwgtm24jakheqsw5833ec6-v1.1": 762080479, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh75679ajj3b8dtd7se3h7z0a1833y6r-v1.1": 839606281, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh757d8ggvnfaszv8zcav3msy982ma7f-v1.1": 780372124, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh75azsnb5eqs3mf4xm0zkzha582rvcd-v1.1": 839741458, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh75ggdejhnymjbhkbtkxvhz758352br-v1.1": 958466921, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh75kn07w0t92m4xxd3dy0cgp982jz6m-v1.1": 852416609, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh75rc2q0zhmsqwk7wewfwwtrx830v2n-v1.1": 815643745, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh75wxkjyha9441e7m9tpetb2582mn63-v1.1": 892009975, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh76dadw64v8013j689380xsg182yhfc-v1.1": 1638024477, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh76g3pdaddrcg12k7jse0xrzn83a5fd-v1.1": 1578505911, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh771gpr8crkjsnt9pj81bafgs8229em-v1.1": 1052825340, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77k18d31qx7jj0c7nyv0xd8s82cznp-v1.1": 846269776, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77krxpg096a66tm8s8ztcarn82zzyv-v1.1": 982450218, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77n9t7ybdq9387d08jzdp1y183ffe6-v1.1": 767827921, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77sbk25h3f5383rz7xqx98th822fd4-v1.1": 811061004, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77w0w2z8qs6m904k2hs9eg058325j8-v1.1": 894197867, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77y2107s6xkqyf61mj1dsm0983kmp1-v1.1": 1274499917, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh77yap0nc4zwm5bysc954xbr182tptg-v1.1": 775099533, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh786tyr77qk4ycrz24nm2kynh82zaam-v1.1": 963433205, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh788hvxvxaz825205djm3ctth822xms-v1.1": 1037365889, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh78c5dwwna57y757p2y5ktw79836dnv-v1.1": 853800060, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh78zjag0xnxppgym5v4sshav982y8s4-v1.1": 2092627585, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7987m8hz4g19ngkk2zfe3v4n82y0e2-v1.1": 1210328624, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7992s6336c7yhv34x198jqy182zpmt-v1.1": 813971822, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh799f394epg9pb2j9fhzky98183e8ec-v1.1": 1004025003, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79betfed7ets4an20cr4j57182y9wt-v1.1": 785931047, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79dnvkvq8j9bs22ededmsc79823akj-v1.1": 778516131, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79s1ny2ab454f8caet44rv5n82za06-v1.1": 1013312119, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79vadftp8bjw2qzqjw8a0b9s82ytpj-v1.1": 819182025, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79vgnwnp3wfz0b63ft8zbs81822re8-v1.1": 1187066181, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79vjbp8dv1pyk7t09zdb9xx9821628-v1.1": 805265846, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh79xyw12drtaz3reht4enc2hs83ef6v-v1.1": 896965411, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7adk413brr6nnvzntz1qvb51833me1-v1.1": 786986153, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ag6w2nh5a47ta6bg7hj2mk1823qwj-v1.1": 1085038558, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ahy57bb3jmdjzmbvq257swh8353nm-v1.1": 805865748, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ajcjberhnnhk914qezwwt0x830v6v-v1.1": 1168585378, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ajwvesks1d5kkpeqx7y79sd8238zn-v1.1": 767827921, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7anfdjd1c4e5ejxncny0j1ed82xjm4-v1.1": 838434920, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7anwezzyc0zgk160c9peh13n82r12z-v1.1": 818797830, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7aq6h38q4e91mragyvr8cd3n82xxxr-v1.1": 826144390, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7b36e22me6fzbav0na7kt14h82wk1m-v1.1": 1022312835, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7bmp04pqht2pcvp8qce1afm582ph2j-v1.1": 1128959023, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7bnb92eb32zvxx50fzjnshes822db0-v1.1": 922324569, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7brwh7cv23ggeshkz85ac5fx831x5k-v1.1": 1037645750, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7c2re7cvbseq7xz6samd1xr182y1dc-v1.1": 958351515, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7c7rrg3zke74w7068nawak9x82t6am-v1.1": 825094985, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7cc4hqw7wb87h3kwwnkq0pv1830gjz-v1.1": 2547822746, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ccr1w93zymhy42k5hs2m9w1831xpx-v1.1": 899031086, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7cshjqfe84fmtb2ye37nrd6h82dds6-v1.1": 882299292, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7czqrrmrm1vnwfx1nhtjh9as833esn-v1.1": 768053605, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7d5m4ed35zfp7gyhx7wdahed82yw72-v1.1": 839606281, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7dk7mmh6ewnyc9h46wyag19d831gmy-v1.1": 819120861, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7dkes3xb054yt1fd3g6nym5s83bz2h-v1.1": 882299292, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7drfg2vkvdvfh9xx0nfd5pz9821xr7-v1.1": 776343776, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7dvkse99x41x83c5z6f2eq7n82w8fm-v1.1": 1099690693, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7e0e2z02keqh6j7db6bcg1c9822140-v1.1": 766864040, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ejvdhks3x059j6jwfncaj4982yxrv-v1.1": 1215220543, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7eq7eek21pjhv1zx8c2cmmed82yd7v-v1.1": 2092630934, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7evrvtwkk64hraqvefgx9ndd821j43-v1.1": 881967232, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7ezsk4ze1jyjta967ypwnxhh83etpm-v1.1": 838087746, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7f7cahc5ddm1qzpxz13kpmrh8235pc-v1.1": 760533976, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7faaexjnnv9h4vt84e0r1v4d82qtv7-v1.1": 1805375600, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7fj3hc92zehtc8azrm32xzb182w9dr-v1.1": 769437731, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7fkjmy67qny9z98mt6bj52m182ygdy-v1.1": 1022492235, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7fmf1y6r9ajpg3htmaj237h182vztd-v1.1": 838451404, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7fr6f1yw1289ye5ttsfvaqen8319dq-v1.1": 899031086, + "public.ecr.aws/d3j8x8q7/swe-bench-202605:kh7fwz4nedevfex8ssk2p8xbt9836scp-v1.1": 833036921 +} diff --git a/examples/deepswe/utils/judge.py b/examples/deepswe/utils/judge.py new file mode 100644 index 00000000..50f2141a --- /dev/null +++ b/examples/deepswe/utils/judge.py @@ -0,0 +1,33 @@ +"""DeepSWE's judge: the verdict of Harbor's verifier in the task's environment (hermit.task.verify.environment), with +the verifier's own crash never taken for the agent's score. + +DeepSWE's verifier (each task's `tests/test.sh` and `tests/grader.py`) writes `reward.json` with the reward, 1 when +every test the change must make pass passes and none it must keep passing breaks, else 0, and the counts beside it +(`f2p_passed`, `f2p_total`, `p2p_passed`, `p2p_total`). When the grader itself fails before it writes that file (an +infrastructure error, in its own words), the script's exit trap writes `reward.txt` = -1, its crash sentinel: no test +was graded. Read as a reward, that would be a score of -1 in every mean. Here it is no score (`Unscored`, as the +environment judge refuses a trial whose environment failed), so the run records a failed run, which `python -m +hermit.harbor.report` counts as infra, apart from the scored trials its pass@1 is over, and `hermit eval`'s +`mean_score` counts as 0. The run does not run that trial again by itself (its environment's verdict was the +verifier's, not an infra one). To grade it, run `hermit eval` again on its row under a run of its own: `data.test` a +file that names the row, and a `trainer.run_name` and `environment.harbor.jobs_dir` of their own (the eval's run name +would make it write over the eval's records, results.jsonl and summary.json). The eval's folder still counts the row as +infra; the rerun's folder holds its score. + + judge: + path: ../utils/judge.py +""" +from __future__ import annotations + +from hermit.task.verify import Unscored, environment + +CRASHED = -1.0 # what DeepSWE's test.sh writes when its grader crashed (tests/test.sh's EXIT trap) + + +def score(task: dict, output) -> dict: + verdict = environment(task, output) # an infra trial: Unscored, raised before any reward is read + raw = ((output.extra or {}).get("verified") or {}).get("reward") + if raw is not None and float(raw) == CRASHED: + raise Unscored("DeepSWE's verifier wrote reward -1, its sentinel for a grader that crashed before it graded " + "any test: not the agent's result, no score") + return {"score": verdict.score, "feedback": verdict.feedback, **verdict.extra} diff --git a/examples/deepswe/utils/patches.py b/examples/deepswe/utils/patches.py new file mode 100644 index 00000000..202254da --- /dev/null +++ b/examples/deepswe/utils/patches.py @@ -0,0 +1,61 @@ +"""The patch `python -m hermit.harbor.dataset prepare` runs on DeepSWE's tasks (benchmark.yaml: dataset.patch), on a +download and again on a reuse. It keeps Hermit's harness out of what DeepSWE grades. + +DeepSWE grades the agent's commits: once the agent stopped, each task's `[[verifier.collect]]` command writes +`git diff --binary HEAD` in the agent's container as `/logs/artifacts/model.patch`, and the verifier, in +a container of its own, applies that patch to the pristine repository and runs the hidden tests. The instruction ends +"commit everything when you are done", so an agent that does (`git add -A && git commit`) commits whatever is in the +repository, Hermit's deployment of the adapter included: the adapter's folder `hermit//`, the context it puts in +AGENTS.md (Codex) or CLAUDE.md (Claude Code), the CLI's settings, skills and roles (`.codex/`, `.claude/`, +`.mcp.json`), the deployment's record (`.hermit-deploy.json`, which names this machine's paths) and the tools' audit +(`tool-calls.jsonl`), all at the repository's root (hermit.hosts.codex, hermit.hosts.claude_code), and the audit and +state an adapter's hooks keep there (`.hermit-hooks/`, hook_runner.LOGS_DIR). An arm with an adapter would then be +graded on a tree with those files and an arm with none without them. The patch adds a pathspec to each collect command that leaves them out (`DEPLOYED`); no task's reference +solution or test patch touches any of them. Everything else (the instruction, the images, the verifier, the grader) is +DeepSWE's. +""" +from __future__ import annotations + +from pathlib import Path +import re + +DEPLOYED = ("hermit", "AGENTS.md", "CLAUDE.md", ".codex", ".claude", ".mcp.json", ".hermit-deploy.json", + ".hermit-hooks", "tool-calls.jsonl") +EXCLUDE = " -- . " + " ".join(f"':(exclude){p}'" for p in DEPLOYED) +# the collect command as published: its diff of the agent's commits, then where it writes it +PUBLISHED = re.compile(r'^(command = "cd /app && mkdir -p /logs/artifacts && git config --global --add safe\.directory ' + r'/app && git diff --binary [0-9a-f]{7,40} HEAD)( > /logs/artifacts/model\.patch")$', re.M) +MARK = "# Hermit's patch (examples/deepswe/utils/patches.py): Hermit's deployment of the adapter is not the agent's change" + + +def _toml(text: str) -> str | None: + """The task.toml whose collect command leaves Hermit's deployment out; None when it already does.""" + if MARK in text and EXCLUDE in text: + return None + found = PUBLISHED.findall(text) + if len(found) != 1 or text.count("[[verifier.collect]]") != 1: + raise ValueError("not the task.toml this patch knows: not one [[verifier.collect]] with the published command") + out = PUBLISHED.sub(lambda m: m.group(1) + EXCLUDE + m.group(2), text) + return out.replace("[[verifier.collect]]", MARK + "\n[[verifier.collect]]", 1) + + +def exclude_deployment(tasks: Path) -> str: + """Every task's collect command without Hermit's deployment; what was done. Idempotent: a task already patched is + left as it is. A task in neither form is refused, with no task changed, so that someone reads it first.""" + tasks = Path(tasks) + files = sorted(tasks.glob("*/task.toml")) + if not files: + raise ValueError(f"no */task.toml under {tasks}: not DeepSWE's tasks") + edits, already = [], 0 + for path in files: + try: + new = _toml(path.read_text(encoding="utf-8")) + except ValueError as exc: + raise ValueError(f"{path}: {exc}; read it before running the tasks") from None + if new is None: + already += 1 + else: + edits.append((path, new)) + for path, text in edits: + path.write_text(text, encoding="utf-8") + return f"collect without Hermit's deployment: {len(edits)} patched, {already} already patched" diff --git a/examples/deepswe/utils/splits/all.txt b/examples/deepswe/utils/splits/all.txt new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/examples/deepswe/utils/splits/all.txt @@ -0,0 +1,113 @@ +abs-module-cache-flags +abs-stepped-slices +actionlint-action-pinning-lint +adaptix-name-mapping-aliases +aiomonitor-task-snapshots-diff +anko-default-function-arguments +anko-typed-variable-bindings +arcane-drift-detection-baselines +arktype-json-schema-refs-dependencies +awilix-async-container-initialization +bandit-incremental-cache-control +bandit-interprocedural-taint-checks +bandit-structured-nosec-directives +boa-hierarchical-evaluation-cancellation +cattrs-partial-structuring-recovery +clack-async-autocomplete-options +claude-code-by-agents-recursive-delegation +cliffy-config-file-parsing +csstree-shorthand-expansion-compression +dasel-html-document-format +dateutil-rfc5545-timezone-interop +drizzle-orm-window-function-builders +dynamodb-toolbox-conditional-attribute-requirements +dynamodb-toolbox-lazy-recursive-schemas +effect-sse-httpapi-streaming +eicrud-keyset-pagination-cursor +etree-xml-diff-patch +expr-try-catch-errors +fastapi-deprecation-response-headers +fastapi-implicit-head-options +fd-deterministic-multi-key-sorting +geo-shapeindex-serialization +go-critic-doc-link-checker +go-genai-streamed-function-args +go-git-worktree-merge-conflicts +goreleaser-retry-publish-auditing +gql-incremental-graphql-delivery +happy-dom-abort-pending-body-reads +happy-dom-deterministic-intersectionobserver +helm-array-merge-strategies +helm-unified-manifest-stream +httpx-deterministic-cookie-store +httpx-multipart-response-parsing +httpx-streaming-json-iteration +igel-persist-feature-schema +ink-grid-box-layout +ipython-session-bundle-replay +katex-multicolumn-array-spans +kcp-go-multiplexed-kcp-streams +kea-atomic-signal-selectors +kgateway-consistent-hash-policy +kombu-single-active-consumer-priority +kombu-virtual-queue-dead-lettering +koota-composite-trait-aspects +koota-deferred-mutation-buffer +koota-entity-snapshot-rollback +koota-pair-relation-tracking +koota-query-predicates +kysely-window-grouping-helpers +langchain-request-coalescing +mashumaro-flattened-dataclass-fields +meriyah-explicit-resource-declarations +mnamer-daemon-watch-lifecycle +mobly-grouped-test-barriers +narwhals-rolling-window-suite +numba-stencil-boundary-modes +obsidian-linter-auto-table-of-contents +obsidian-linter-link-format-conversion +obsidian-linter-scoped-ignore-markers +ofetch-per-origin-circuit-breaker +onedump-dump-encryption-pipeline +opa-rego-rule-profiling +opa-template-string-reconstruction +optique-conditional-option-dependencies +oxvg-structural-selector-preservation +participle-grammar-conflict-analysis +pebble-durability-wait-apis +pest-character-class-coalescing +prometheus-transactional-reload-status +prometheus-typed-label-sorting +psd-tools-blend-range-api +pwntools-tube-multiplexing +python-statemachine-state-data-scoping +query-persist-restored-query-state +quill-shared-toolbar-focus +returns-validated-error-accumulation +scc-bounded-memory-spilling +scriggo-method-declarations +skrub-duration-encoding +sql-formatter-bigquery-pipe-formatting +sqlfmt-create-table-ddl-formatting +sqlite-utils-safe-import-checkpoints +superjson-error-stack-serialization +task-task-graph-export +tengo-callable-instance-isolation +tengo-destructuring-bindings +termenv-preserve-ansi-resets +testem-bail-on-test-failure +testem-per-launcher-reports +textual-kitty-key-phases +textual-richlog-follow-state +tomlkit-toml-table-converters +true-myth-iterable-collection-combinators +ts-pattern-match-each +updo-policy-alerting +valibot-recursive-schema-composition +vitest-duration-sharding +vulture-persistent-analysis-cache +wasmi-trap-coredumps +wazero-multi-module-snapshots +yaegi-go-embed-directives +yjs-map-conflict-detection +ytt-jsonpath-query-api diff --git a/examples/deepswe/utils/splits/smoke.txt b/examples/deepswe/utils/splits/smoke.txt new file mode 100644 index 00000000..186f9b57 --- /dev/null +++ b/examples/deepswe/utils/splits/smoke.txt @@ -0,0 +1,2 @@ +mashumaro-flattened-dataclass-fields#0 +tengo-callable-instance-isolation#0 diff --git a/examples/deepswe/utils/splits/test.txt b/examples/deepswe/utils/splits/test.txt new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/examples/deepswe/utils/splits/test.txt @@ -0,0 +1,113 @@ +abs-module-cache-flags +abs-stepped-slices +actionlint-action-pinning-lint +adaptix-name-mapping-aliases +aiomonitor-task-snapshots-diff +anko-default-function-arguments +anko-typed-variable-bindings +arcane-drift-detection-baselines +arktype-json-schema-refs-dependencies +awilix-async-container-initialization +bandit-incremental-cache-control +bandit-interprocedural-taint-checks +bandit-structured-nosec-directives +boa-hierarchical-evaluation-cancellation +cattrs-partial-structuring-recovery +clack-async-autocomplete-options +claude-code-by-agents-recursive-delegation +cliffy-config-file-parsing +csstree-shorthand-expansion-compression +dasel-html-document-format +dateutil-rfc5545-timezone-interop +drizzle-orm-window-function-builders +dynamodb-toolbox-conditional-attribute-requirements +dynamodb-toolbox-lazy-recursive-schemas +effect-sse-httpapi-streaming +eicrud-keyset-pagination-cursor +etree-xml-diff-patch +expr-try-catch-errors +fastapi-deprecation-response-headers +fastapi-implicit-head-options +fd-deterministic-multi-key-sorting +geo-shapeindex-serialization +go-critic-doc-link-checker +go-genai-streamed-function-args +go-git-worktree-merge-conflicts +goreleaser-retry-publish-auditing +gql-incremental-graphql-delivery +happy-dom-abort-pending-body-reads +happy-dom-deterministic-intersectionobserver +helm-array-merge-strategies +helm-unified-manifest-stream +httpx-deterministic-cookie-store +httpx-multipart-response-parsing +httpx-streaming-json-iteration +igel-persist-feature-schema +ink-grid-box-layout +ipython-session-bundle-replay +katex-multicolumn-array-spans +kcp-go-multiplexed-kcp-streams +kea-atomic-signal-selectors +kgateway-consistent-hash-policy +kombu-single-active-consumer-priority +kombu-virtual-queue-dead-lettering +koota-composite-trait-aspects +koota-deferred-mutation-buffer +koota-entity-snapshot-rollback +koota-pair-relation-tracking +koota-query-predicates +kysely-window-grouping-helpers +langchain-request-coalescing +mashumaro-flattened-dataclass-fields +meriyah-explicit-resource-declarations +mnamer-daemon-watch-lifecycle +mobly-grouped-test-barriers +narwhals-rolling-window-suite +numba-stencil-boundary-modes +obsidian-linter-auto-table-of-contents +obsidian-linter-link-format-conversion +obsidian-linter-scoped-ignore-markers +ofetch-per-origin-circuit-breaker +onedump-dump-encryption-pipeline +opa-rego-rule-profiling +opa-template-string-reconstruction +optique-conditional-option-dependencies +oxvg-structural-selector-preservation +participle-grammar-conflict-analysis +pebble-durability-wait-apis +pest-character-class-coalescing +prometheus-transactional-reload-status +prometheus-typed-label-sorting +psd-tools-blend-range-api +pwntools-tube-multiplexing +python-statemachine-state-data-scoping +query-persist-restored-query-state +quill-shared-toolbar-focus +returns-validated-error-accumulation +scc-bounded-memory-spilling +scriggo-method-declarations +skrub-duration-encoding +sql-formatter-bigquery-pipe-formatting +sqlfmt-create-table-ddl-formatting +sqlite-utils-safe-import-checkpoints +superjson-error-stack-serialization +task-task-graph-export +tengo-callable-instance-isolation +tengo-destructuring-bindings +termenv-preserve-ansi-resets +testem-bail-on-test-failure +testem-per-launcher-reports +textual-kitty-key-phases +textual-richlog-follow-state +tomlkit-toml-table-converters +true-myth-iterable-collection-combinators +ts-pattern-match-each +updo-policy-alerting +valibot-recursive-schema-composition +vitest-duration-sharding +vulture-persistent-analysis-cache +wasmi-trap-coredumps +wazero-multi-module-snapshots +yaegi-go-embed-directives +yjs-map-conflict-detection +ytt-jsonpath-query-api diff --git a/examples/deepswe/utils/splits/train.txt b/examples/deepswe/utils/splits/train.txt new file mode 100644 index 00000000..e94e3323 --- /dev/null +++ b/examples/deepswe/utils/splits/train.txt @@ -0,0 +1,113 @@ +abs-module-cache-flags +abs-stepped-slices +actionlint-action-pinning-lint +adaptix-name-mapping-aliases +aiomonitor-task-snapshots-diff +anko-default-function-arguments +anko-typed-variable-bindings +arcane-drift-detection-baselines +arktype-json-schema-refs-dependencies +awilix-async-container-initialization +bandit-incremental-cache-control +bandit-interprocedural-taint-checks +bandit-structured-nosec-directives +boa-hierarchical-evaluation-cancellation +cattrs-partial-structuring-recovery +clack-async-autocomplete-options +claude-code-by-agents-recursive-delegation +cliffy-config-file-parsing +csstree-shorthand-expansion-compression +dasel-html-document-format +dateutil-rfc5545-timezone-interop +drizzle-orm-window-function-builders +dynamodb-toolbox-conditional-attribute-requirements +dynamodb-toolbox-lazy-recursive-schemas +effect-sse-httpapi-streaming +eicrud-keyset-pagination-cursor +etree-xml-diff-patch +expr-try-catch-errors +fastapi-deprecation-response-headers +fastapi-implicit-head-options +fd-deterministic-multi-key-sorting +geo-shapeindex-serialization +go-critic-doc-link-checker +go-genai-streamed-function-args +go-git-worktree-merge-conflicts +goreleaser-retry-publish-auditing +gql-incremental-graphql-delivery +happy-dom-abort-pending-body-reads +happy-dom-deterministic-intersectionobserver +helm-array-merge-strategies +helm-unified-manifest-stream +httpx-deterministic-cookie-store +httpx-multipart-response-parsing +httpx-streaming-json-iteration +igel-persist-feature-schema +ink-grid-box-layout +ipython-session-bundle-replay +katex-multicolumn-array-spans +kcp-go-multiplexed-kcp-streams +kea-atomic-signal-selectors +kgateway-consistent-hash-policy +kombu-single-active-consumer-priority +kombu-virtual-queue-dead-lettering +koota-composite-trait-aspects +koota-deferred-mutation-buffer +koota-entity-snapshot-rollback +koota-pair-relation-tracking +koota-query-predicates +kysely-window-grouping-helpers +langchain-request-coalescing +mashumaro-flattened-dataclass-fields +meriyah-explicit-resource-declarations +mnamer-daemon-watch-lifecycle +mobly-grouped-test-barriers +narwhals-rolling-window-suite +numba-stencil-boundary-modes +obsidian-linter-auto-table-of-contents +obsidian-linter-link-format-conversion +obsidian-linter-scoped-ignore-markers +ofetch-per-origin-circuit-breaker +onedump-dump-encryption-pipeline +opa-rego-rule-profiling +opa-template-string-reconstruction +optique-conditional-option-dependencies +oxvg-structural-selector-preservation +participle-grammar-conflict-analysis +pebble-durability-wait-apis +pest-character-class-coalescing +prometheus-transactional-reload-status +prometheus-typed-label-sorting +psd-tools-blend-range-api +pwntools-tube-multiplexing +python-statemachine-state-data-scoping +query-persist-restored-query-state +quill-shared-toolbar-focus +returns-validated-error-accumulation +scc-bounded-memory-spilling +scriggo-method-declarations +skrub-duration-encoding +sql-formatter-bigquery-pipe-formatting +sqlfmt-create-table-ddl-formatting +sqlite-utils-safe-import-checkpoints +superjson-error-stack-serialization +task-task-graph-export +tengo-callable-instance-isolation +tengo-destructuring-bindings +termenv-preserve-ansi-resets +testem-bail-on-test-failure +testem-per-launcher-reports +textual-kitty-key-phases +textual-richlog-follow-state +tomlkit-toml-table-converters +true-myth-iterable-collection-combinators +ts-pattern-match-each +updo-policy-alerting +valibot-recursive-schema-composition +vitest-duration-sharding +vulture-persistent-analysis-cache +wasmi-trap-coredumps +wazero-multi-module-snapshots +yaegi-go-embed-directives +yjs-map-conflict-detection +ytt-jsonpath-query-api diff --git a/examples/deepswe/utils/splits/val.txt b/examples/deepswe/utils/splits/val.txt new file mode 100644 index 00000000..e69de29b diff --git a/examples/deepswe/utils/task-info/README.md b/examples/deepswe/utils/task-info/README.md new file mode 100644 index 00000000..00cd2320 --- /dev/null +++ b/examples/deepswe/utils/task-info/README.md @@ -0,0 +1,26 @@ +# DeepSWE + +113 original, long-horizon engineering tasks on 91 open-source repositories (tasks in Python 34, TypeScript 35, Go 34, +JavaScript 5, Rust 5), DeepSWE v1.1 by Datacurve, from the Harbor hub's `datacurve/deep-swe-1-1`. Each task asks for a +feature or a hardening of an existing project, stated as the behaviours it must have; its hidden tests are written +against those behaviours, not against the reference solution's names. Each runs in its own Docker container holding +the repository at the task's base commit in `/app`, its dependencies installed, with no network but the model's. The +agent works on a new branch and commits everything when it is done (the instruction says so), until it stops or 5,400 +seconds run out. Its commits (the diff of the base commit and HEAD) are then applied, in a container of their own, +to the pristine repository, where the task's hidden tests decide the score: 1 if every test the change must make pass +passes and no test it must keep passing breaks, else 0. Work the agent did not commit is not graded. + +The agent is a coding CLI that Harbor runs inside the task's container, as the container's user with every permission +(no approval prompts) and without web search: Codex (GPT-5.6-Luna) or Claude Code (Claude Haiku 5.5), as the run's +config names. Its loop and its tools are fixed; the adapter is what changes. The adapter is deployed into the task's +working directory as `hermit deploy` lays it out for that CLI: + +- every file of the adapter but `.hermit/` is copied to `hermit//`; +- `ADAPTER.md` is the agent's instructions: a block of the working directory's `AGENTS.md` (Codex) or `CLAUDE.md` + (Claude Code), after a line that names the folder above; +- `exports.yaml` connects the rest in the CLI's own places: skills, roles (sub-agents) and hooks (run on the CLI's + lifecycle events, from the adapter's folder). An adapter that exports tools does not run in a task's container: the + session there is refused. + +These deployed files are never part of what is graded, even when the agent commits them. A task's container gets 2 +CPUs and 8 GB of memory. Nothing the agent writes in one task reaches another. diff --git a/examples/deepswe/utils/tests/test_collected_commits.py b/examples/deepswe/utils/tests/test_collected_commits.py new file mode 100644 index 00000000..9f3d906c --- /dev/null +++ b/examples/deepswe/utils/tests/test_collected_commits.py @@ -0,0 +1,166 @@ +"""DeepSWE's patch (utils/patches.py:exclude_deployment), which `python -m hermit.harbor.dataset prepare` runs on every +download, and the files that pin the task set (the lock, the splits). The task directories are built under tmp_path in the published form (task.toml as DeepSWE ships it, +reduced to what the patch reads). The collect command runs here as the trial runs it, on a git repository under +tmp_path standing in for the agent's container (its /app and /logs/artifacts rewritten to tmp_path, git's global config +a file of its own). No network, no Harbor, no Docker.""" +from __future__ import annotations + +import importlib.util +import json +import os +from pathlib import Path +import re +import subprocess +import sys +import tomllib + +import pytest + +UTILS = Path(__file__).resolve().parents[1] +BASE = "cb1b3b671d0ee9fa9da9f7b02f86967953ffd10a" +COMMAND = ("cd /app && mkdir -p /logs/artifacts && git config --global --add safe.directory /app && git diff --binary " + "{base} HEAD > /logs/artifacts/model.patch") +TOML = '''schema_version = "1.3" +artifacts = ["/logs/artifacts/model.patch"] +[task] +name = "datacurve/{name}" +[verifier] +network_mode = "no-network" +environment_mode = "separate" +timeout_sec = 1800.0 + +[verifier.env] +[verifier.environment] +cpus = 2 + +[[verifier.collect]] +command = "{command}" +timeout_sec = 300.0 + +[agent] +network_mode = "no-network" +timeout_sec = 5400.0 +''' + + +def load(): + spec = importlib.util.spec_from_file_location("deepswe_patches", UTILS / "patches.py") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def task(root: Path, name: str, base: str = BASE, toml: str = TOML, command: str = COMMAND) -> Path: + path = root / name + path.mkdir(parents=True) + (path / "task.toml").write_text(toml.format(name=name, command=command.format(base=base))) + return path + + +def test_the_patch_leaves_hermits_deployment_out_of_the_collected_commits_and_runs_once(tmp_path): + patches = load() + task(tmp_path, "abs-module-cache-flags") + task(tmp_path, "short-base", base="68dafce") # three tasks name their base by a short id + assert patches.exclude_deployment(tmp_path).endswith("2 patched, 0 already patched") + config = tomllib.loads((tmp_path / "abs-module-cache-flags" / "task.toml").read_text()) + [collect] = config["verifier"]["collect"] + assert collect["command"] == COMMAND.format(base=BASE).replace(" > /logs", patches.EXCLUDE + " > /logs") + assert collect["timeout_sec"] == 300.0 and config["verifier"]["environment_mode"] == "separate" + assert config["artifacts"] == ["/logs/artifacts/model.patch"] and config["agent"]["timeout_sec"] == 5400.0 + before = {p: p.read_bytes() for p in tmp_path.rglob("task.toml")} + assert patches.exclude_deployment(tmp_path).endswith("0 patched, 2 already patched") # a reuse: as it is + assert {p: p.read_bytes() for p in tmp_path.rglob("task.toml")} == before + + +@pytest.mark.parametrize("toml, command, why", [ + (TOML, COMMAND.replace("git diff --binary", "git diff"), "the published command"), + (TOML + '\n[[verifier.collect]]\ncommand = "true"\n', COMMAND, "not one [[verifier.collect]]"), +]) +def test_a_task_in_neither_form_is_refused_and_no_task_is_changed(tmp_path, toml, command, why): + patches = load() + good = task(tmp_path, "a-good-one") + task(tmp_path, "b-other", toml=toml, command=command) + before = (good / "task.toml").read_text() + with pytest.raises(ValueError, match=re.escape(why)): + patches.exclude_deployment(tmp_path) + assert (good / "task.toml").read_text() == before + with pytest.raises(ValueError, match="not DeepSWE's tasks"): + patches.exclude_deployment(tmp_path / "empty") + + +def git(repo: Path, *args: str, env: dict) -> str: + return subprocess.run(["git", "-C", str(repo), *args], check=True, capture_output=True, text=True, env=env).stdout + + +def test_an_agent_that_commits_everything_is_graded_on_its_own_change_alone(tmp_path): + """The agent works on a branch, as the instruction asks, and commits everything with `git add -A`, Hermit's + deployment (the adapter's folder, its context in AGENTS.md, the CLI's settings) included. The patched collect + command's model.patch holds the agent's change, and none of Hermit's files.""" + patches = load() + home = tmp_path / "home" + home.mkdir() + env = {**os.environ, "HOME": str(home), "GIT_CONFIG_GLOBAL": str(home / ".gitconfig"), "GIT_CONFIG_NOSYSTEM": "1", + "GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "t@t", "GIT_COMMITTER_NAME": "t", "GIT_COMMITTER_EMAIL": "t@t"} + repo = tmp_path / "app" + repo.mkdir() + git(repo, "init", "-q", "-b", "main", env=env) + (repo / "lib.go").write_text("package lib\n") + git(repo, "add", "-A", env=env) + git(repo, "commit", "-qm", "base", env=env) + base = git(repo, "rev-parse", "HEAD", env=env).strip() + git(repo, "checkout", "-q", "-b", "feature", env=env) + (repo / "lib.go").write_text("package lib\n\nfunc F() int { return 1 }\n") + (repo / "lib_extra.go").write_text("package lib\n") + for path in ("hermit/ahe/ADAPTER.md", "AGENTS.md", ".codex/config.toml", ".mcp.json", "tool-calls.jsonl", + ".hermit-deploy.json", ".hermit-hooks/hook-calls.jsonl"): + (repo / path).parent.mkdir(parents=True, exist_ok=True) + (repo / path).write_text("Hermit's\n") + git(repo, "add", "-A", env=env) + git(repo, "commit", "-qm", "done", env=env) + task(tmp_path / "tasks", "t", base=base) + patches.exclude_deployment(tmp_path / "tasks") + [collect] = tomllib.loads((tmp_path / "tasks" / "t" / "task.toml").read_text())["verifier"]["collect"] + command = collect["command"].replace("/logs/artifacts", str(tmp_path / "artifacts")).replace("/app", str(repo)) + subprocess.run(["bash", "-c", command], check=True, env=env) + patch = (tmp_path / "artifacts" / "model.patch").read_text() + changed = re.findall(r"^diff --git a/(\S+) ", patch, flags=re.M) + assert changed == ["lib.go", "lib_extra.go"] + + +def test_every_path_a_deployment_writes_at_the_repositorys_root_is_left_out(tmp_path, monkeypatch): + """What the run uploads into the task's working directory, the repository, is the staging folder of a remote + deployment (hermit.agent.acting.workspace._deploy with remote=True, each top-level entry uploaded): deployed here for + Codex and Claude Code from AHE's template (the adapter of the transfer arm, with hooks), every entry must be in + DEPLOYED, and so must the folder where an adapter's hooks keep their audit and state in that directory + (hook_runner.LOGS_DIR). A path a host deployer adds later fails here instead of reaching the graded commits.""" + from hermit.agent.acting import workspace + patches = load() + root = Path(__file__).resolve().parents[4] + ahe = root / "hermit" / "adapter" / "templates" / "ahe" + # the exports are rendered by `python3` on PATH: this interpreter's, which has the framework's packages + monkeypatch.setenv("PATH", f"{Path(sys.executable).parent}{os.pathsep}{os.environ.get('PATH', '')}") + for backend in ("codex", "claude"): + work = tmp_path / backend + workspace._deploy({"id": "t"}, ahe, work, backend, {}, remote=True) + written = {entry.name for entry in work.iterdir()} + assert written and written <= set(patches.DEPLOYED), (backend, written - set(patches.DEPLOYED)) + spec = importlib.util.spec_from_file_location("ahe_hook_runner", ahe / "hook_runner.py") + runner = importlib.util.module_from_spec(spec) + spec.loader.exec_module(runner) + assert runner.LOGS_DIR in patches.DEPLOYED + + +def lines(path: Path) -> list[str]: + return [line.strip() for line in path.read_text().splitlines() if line.strip()] + + +def test_the_locked_tasks_are_the_hubs_113_and_every_one_is_a_test_task(): + lock = json.loads((UTILS / "dataset.lock").read_text()) + tasks = sorted(lock["tasks"]) + assert len(tasks) == 113 and lock["source"]["ref"] == "datacurve/deep-swe-1-1@1" + assert lock["source"]["patch"]["hook"] == "patches.py:exclude_deployment" + assert lines(UTILS / "splits" / "test.txt") == tasks + smoke = lines(UTILS / "splits" / "smoke.txt") + assert len(smoke) == 2 and {row.removesuffix("#0") for row in smoke} <= set(tasks) + assert not set(smoke) & set(tasks) # a smoke trial is never an eval trial's row + diff --git a/examples/deepswe/utils/tests/test_crash_sentinel.py b/examples/deepswe/utils/tests/test_crash_sentinel.py new file mode 100644 index 00000000..8d6b20e4 --- /dev/null +++ b/examples/deepswe/utils/tests/test_crash_sentinel.py @@ -0,0 +1,61 @@ +"""DeepSWE's judge (utils/judge.py:score), as `hermit eval` reaches it: the baseline config through `Config.load`, its +judge loaded as the run loads it (hermit.isolate.judge_for), called by the rollout (hermit.trainer.rollout._judged) +on an output holding the verdict the task's Harbor environment gives (HarborEnvironments.verdict, from the rewards +DeepSWE's verifier writes), and the row it records read by `python -m hermit.harbor.report`. The verdicts are built +from the reward files DeepSWE's test.sh and grader.py write (reward.json with the counts; reward.txt = -1 from the +script's exit trap when the grader crashed). Harbor's command is stood in for (this interpreter); no environment +starts, no network.""" +from __future__ import annotations + +from pathlib import Path +import sys +import time + +import pytest + +from hermit.common import RunOutput +from hermit.config import Config +from hermit.environment.harbor import HarborEnvironments +from hermit.harbor import report +from hermit.isolate import judge_for +from hermit.task import Task +from hermit.task.verify import judge_verifier +from hermit.trainer.rollout import _judged + +EXAMPLE = Path(__file__).resolve().parents[2] + + +@pytest.fixture(params=["codex", "claude"]) +def judged(request, tmp_path): + """The row the run records for one trial whose verifier wrote `rewards`, under a baseline config.""" + config = Config.load(EXAMPLE / "baseline" / f"{request.param}.yaml") + verify = judge_verifier(judge_for(config, pipeline=None)) + environments = HarborEnvironments({**config.data["environment"]["harbor"], "harbor": sys.executable, + "jobs_dir": str(tmp_path / "jobs")}, base=config.base) + task = Task.from_row({"id": "mashumaro-flattened-dataclass-fields#1", + "harbor_task": "mashumaro-flattened-dataclass-fields"}) + + def run(rewards: dict) -> dict: + verified = environments.verdict({"rewards": rewards}) + out = RunOutput(output={"reward": verified["reward"]}, extra={"verified": verified}) + return _judged(task, task.row(), out, verify, time.time()) + return run + + +def test_a_graded_trial_scores_the_verifiers_binary_reward(judged): + resolved = judged({"reward": 1, "f2p_total": 23, "f2p_passed": 23, "p2p_total": 122, "p2p_passed": 122}) + assert (resolved["status"], resolved["judge"]["score"], report.kind(resolved)) == ("ok", 1.0, "scored") + assert report.passed(resolved) is True and report.passed(judged({"reward": 0})) is False + one_short = judged({"reward": 0, "f2p_total": 23, "f2p_passed": 22, "p2p_total": 122, "p2p_passed": 122}) + assert (one_short["status"], one_short["judge"]["score"], report.kind(one_short)) == ("ok", 0.0, "scored") + + +def test_a_grader_that_crashed_is_no_score_and_the_report_counts_it_apart(judged): + """Without the judge's check the environment judge scores the sentinel as the agent's -1, which pulls every mean + below what the agent earned; here it is a failed run the report counts as infra, never in pass@1.""" + crashed = judged({"reward": -1}) + assert crashed["status"] == "judge_error" and crashed["judge"]["score"] == 0.0 + assert "Unscored" in crashed["error"] and "-1" in crashed["error"] + assert report.kind(crashed) == "infra" + figures = report.summary([crashed, judged({"reward": 1})]) + assert (figures["scored"], figures["infra"], figures["mean_scored"]) == (1, 1, 1.0) diff --git a/tests/core/test_harbor_examples.py b/tests/core/test_harbor_examples.py index 6127ba97..214eb297 100644 --- a/tests/core/test_harbor_examples.py +++ b/tests/core/test_harbor_examples.py @@ -30,7 +30,7 @@ IN_SAMPLE = ["terminal_bench_2_0", "terminal_bench_science"] SKILLOPT_SPLIT = ["algotune", "labbench"] METHODS = {"terminal_bench_2_0": "ahe_adapter", "terminal_bench_science": "ahe_adapter", "algotune": "skillopt", - "labbench": "skillopt", "swebench_verified": None, "officeqa_harbor": None} + "labbench": "skillopt", "swebench_verified": None, "deepswe": None, "officeqa_harbor": None} PROFILES = {"codex": {"cli": "codex", "model": "gpt-5.6-luna", "login": "chatgpt"}, "claude": {"cli": "claude", "model": "claude-haiku-5-5", "login": "claude"}} LEARNS_ON = {"ahe_adapter": ("../utils/rows/train.txt", None), # (data.train, data.val) of a method's run