Skip to content

Commit ccc7d07

Browse files
feat: scaffold SWE-bench-Pro baseline for the vero optimizer
WIP scaffold: a working agent + build/config skeleton for a SWE-bench-Pro optimization target, mirroring the gaia baseline layout. Two things are stubbed and must be completed before it runs: (1) the task_source digest in baseline/build.yaml is a clearly-marked placeholder that must be pinned to the real SWE-bench-Pro Harbor task package, and (2) the partitions/ files are empty placeholders that must be regenerated from the real task list via scripts/partition_swe_bench_pro.py. The agent wraps responses.create in a retry-with-backoff helper from the start (the unguarded call is what scored the gaia baseline 0.0). See harness-engineering-bench/swe-bench-pro/README.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0072a5c commit ccc7d07

13 files changed

Lines changed: 1211 additions & 0 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# SWE-bench-Pro (scaffold)
2+
3+
This benchmark optimizes a code-editing agent on SWE-bench-Pro tasks. Each task
4+
checks a real project out at `/app/repo` and describes a bug fix or feature. The
5+
editable agent (`baseline/target/src/swebench_pro_agent/agent.py`) edits the
6+
repository in place; the **task-source verifier** applies the resulting repo state
7+
and runs the task's hidden test suite for the reward. The agent does not
8+
self-grade and writes no answer file: reward comes entirely from the suite.
9+
10+
## Status: this is a SCAFFOLD, not a runnable benchmark
11+
12+
Everything except the actual task data is in place: a robust Harbor-native agent,
13+
a `build.yaml`, partition scaffolding, a split script, and this README. It will
14+
**not run yet** because the real SWE-bench-Pro task dataset must come from a Harbor
15+
task source that is not committed here.
16+
17+
### DONE (working skeleton)
18+
19+
- `baseline/target/src/swebench_pro_agent/agent.py`: a tool-using code-editing
20+
agent on the OpenAI Responses API (`run_shell`, `read_file`, `write_file`,
21+
`apply_patch`, `run_tests`, `submit`), `MAX_TURNS = 50`. The
22+
`self._client.responses.create(...)` call is wrapped in a retry-with-backoff
23+
helper from the start (the GAIA baseline scored 0.0 because an unguarded call
24+
crashed on a transient error; that retry was the optimizer's winning fix).
25+
- `baseline/build.yaml`: the full VeRO/Harbor optimization config (agent import
26+
path, inference gateway, partitions wiring, timeouts, secrets, W&B).
27+
- `baseline/target/pyproject.toml`, smoke test, `secrets.env.example`, `.gitignore`.
28+
- `scripts/partition_swe_bench_pro.py`: a deterministic, sha256-keyed stratified
29+
split with a `--check` mode, modeled on `gaia/scripts/partition_gaia.py`.
30+
31+
### STUBBED (must be completed before it runs)
32+
33+
Two things must be finished:
34+
35+
1. **Pin the real `task_source`.** `baseline/build.yaml` carries a clearly-marked
36+
placeholder:
37+
38+
```
39+
task_source: scale-ai/swe-bench-pro@sha256:REPLACE_WITH_REAL_DIGEST
40+
```
41+
42+
SWE-bench-Pro is a Scale benchmark. Find the real pinned task package in the
43+
Harbor task registry (ask the DEX-harness / Harbor team if it is not obvious).
44+
The baseline in this directory provides only the **agent + config**; the task
45+
package provides the **repos, tests, gold patches, and grading**. Replace the
46+
placeholder digest here and the `DATASET_DIGEST` constant in
47+
`scripts/partition_swe_bench_pro.py`.
48+
49+
2. **Regenerate the partitions from the real task list.** The committed
50+
`partitions/{development,validation,test}.json` are empty placeholders and
51+
`partitions/manifest.json` is a stub (`"_stub": true`). Once the task source is
52+
pinned, set `TOTAL_TASKS`/`TARGET_COUNTS` and confirm `_read_tasks` against the
53+
real `task.toml` layout in `scripts/partition_swe_bench_pro.py`, then generate
54+
and verify the split:
55+
56+
```bash
57+
uv run --python 3.12 \
58+
harness-engineering-bench/swe-bench-pro/scripts/partition_swe_bench_pro.py \
59+
--tasks-dir /path/to/exported/swe-bench-pro \
60+
--fetch-registry
61+
62+
uv run --python 3.12 \
63+
harness-engineering-bench/swe-bench-pro/scripts/partition_swe_bench_pro.py \
64+
--tasks-dir /path/to/exported/swe-bench-pro \
65+
--check
66+
```
67+
68+
Also update the placeholder `total_cases` under `agent_access` in
69+
`baseline/build.yaml` to real disclosure counts, and run `uv lock` in
70+
`baseline/target/` so the compiled task pins an exact resolution.
71+
72+
## Split design
73+
74+
The committed split is intended to be deterministic and stratified by source
75+
repository (so each represented codebase appears across all three partitions):
76+
77+
- development: 20% (full result disclosure to the optimizer)
78+
- validation: 40% (aggregate-only; used to select candidates)
79+
- test: 40% (held out until Harbor grades the completed outer task)
80+
81+
Exact counts are TODO until the task source is pinned.
82+
83+
## Build the outer Harbor task
84+
85+
From the repository root:
86+
87+
```bash
88+
cd vero
89+
VERO_SKIP_SECRET_CHECK=1 uv run vero harbor build \
90+
--config ../harness-engineering-bench/swe-bench-pro/baseline/build.yaml \
91+
--output ../harness-engineering-bench/swe-bench-pro/baseline/compiled
92+
```
93+
94+
Omit `VERO_SKIP_SECRET_CHECK=1` for a real build so VeRO verifies that the OpenAI
95+
and Modal credentials declared in `build.yaml` are present. Set `OPENAI_BASE_URL`
96+
to your OpenAI-compatible endpoint. The `compiled/` directory is generated and
97+
intentionally ignored. (This build will fail to resolve tasks until the
98+
placeholder `task_source` above is replaced with the real digest.)
99+
100+
## Run the optimization
101+
102+
`vero harbor run` compiles the `build.yaml` to a temporary task, wires credentials
103+
(relocating the upstream inference key to the gateway and handing the optimizer a
104+
scoped producer token), and invokes Harbor. Copy the secrets template first:
105+
106+
```bash
107+
cp harness-engineering-bench/swe-bench-pro/baseline/secrets.env.example \
108+
harness-engineering-bench/swe-bench-pro/baseline/secrets.env # then edit it
109+
110+
cd vero
111+
uv run vero harbor run \
112+
--config ../harness-engineering-bench/swe-bench-pro/baseline/build.yaml \
113+
--env-file ../harness-engineering-bench/swe-bench-pro/baseline/secrets.env \
114+
--environment modal \
115+
--agent codex \
116+
--model gpt-5.3-codex \
117+
--yes \
118+
-o ../runs/swe-bench-pro-full/jobs
119+
```
120+
121+
`--env-file` values override the ambient shell and are passed only through the
122+
subprocess environment, never on the command line. Anything after the known
123+
options (here `--yes -o ...`) is forwarded verbatim to `harbor run`.
124+
125+
The producer scope's allow-list in `build.yaml` is `gpt-5.3-codex`, so pass
126+
`--model gpt-5.3-codex` (or an aligned model) to keep the optimizer's model and
127+
the gateway allow-list in lockstep and avoid a 403 mismatch. The evaluation scope
128+
is pinned to `gpt-4o` (matching `model: openai/gpt-4o`).
129+
130+
**Modal endpoint requirement:** `--environment modal` runs eval sandboxes on
131+
Modal, which must be able to reach the model endpoint in `OPENAI_BASE_URL`. Use a
132+
Modal-reachable endpoint (for example the Azure
133+
`https://<resource>.openai.azure.com/openai/v1` endpoint), **not** a VPN-internal
134+
host that only resolves on the Scale network. Use `--environment docker` to run
135+
the optimizer locally against Modal eval backends instead.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
compiled/
2+
target/.venv/
3+
target/.pytest_cache/
4+
secrets.env
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: vero/optimize-swe-bench-pro-baseline
2+
description: >-
3+
Improve a code-editing SWE-bench-Pro agent while preserving the Harbor agent
4+
interface. The target must edit a checked-out repository so the task's hidden
5+
test suite passes; the task-source verifier runs the suite for the reward.
6+
agent_repo: target
7+
# TODO: pin the real SWE-bench-Pro Harbor task source (see README). This is a
8+
# clearly-marked placeholder, NOT a real digest, and will fail to resolve until
9+
# replaced with the actual `scale-ai/swe-bench-pro@sha256:<digest>` from the
10+
# Harbor task registry.
11+
task_source: scale-ai/swe-bench-pro@sha256:REPLACE_WITH_REAL_DIGEST # TODO: pin the real SWE-bench-Pro Harbor task source (see README)
12+
task_manifest: ../partitions/manifest.json
13+
agent_import_path: swebench_pro_agent.agent:SweBenchProAgent
14+
harbor_requirement: harbor[modal]==0.20.0
15+
16+
partition_files:
17+
development: ../partitions/development.json
18+
validation: ../partitions/validation.json
19+
test: ../partitions/test.json
20+
21+
# TODO: set real disclosure counts once the partitions are regenerated from the
22+
# pinned task list. total_cases below are placeholders scaled to the stub sizes.
23+
agent_access:
24+
- partition: development
25+
disclosure: full
26+
expose_case_resources: true
27+
total_cases: 0
28+
- partition: validation
29+
disclosure: aggregate
30+
expose_case_resources: false
31+
min_aggregate_cases: 5
32+
total_cases: 0
33+
34+
selection_partition: validation
35+
targets:
36+
- partition: test
37+
reward_key: reward
38+
failure_value: 0.0
39+
max_attempts: 1
40+
41+
evaluation_set_name: swe-bench-pro
42+
objective:
43+
selector:
44+
metric: score
45+
direction: maximize
46+
reward_mode: submit # agent picks; falls back to auto_best, then current version
47+
baseline_floor: false # gates on validation while reward is on test; opt-in only
48+
score_baseline: true
49+
rescore_top_k: 3
50+
rescore_attempts: 1
51+
52+
model: openai/gpt-4o
53+
environment_name: ${inner_env:-modal}
54+
# inner eval sandboxes share a dedicated Modal app instead of the __harbor__ default
55+
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench", "--ek", "sandbox_idle_timeout_secs=3600"]
56+
harbor_python_version: "3.12"
57+
n_attempts: 1
58+
max_retries: 1
59+
infrastructure_max_attempts: 3
60+
infrastructure_retry_delay_seconds: 5
61+
aggregate_attempts: best
62+
feedback_transcripts: true
63+
feedback_max_bytes: 16000
64+
expose_attempt_detail: false
65+
# Timeouts are bumped well above the GAIA baseline: SWE-bench-Pro tasks build a
66+
# real repository and run its (often slow) test suite, so both the per-case and
67+
# the verifier budgets need substantially more headroom than a short-answer task.
68+
timeout_seconds: 28800
69+
case_timeout_seconds: 1800
70+
task_agent_timeout_seconds: 3600
71+
max_concurrency: 8
72+
error_rate_threshold: 0.1
73+
verifier_timeout_seconds: 28800
74+
secrets:
75+
- MODAL_TOKEN_ID
76+
- MODAL_TOKEN_SECRET
77+
- WANDB_API_KEY
78+
- WANDB_BASE_URL # self-hosted W&B (scaleai.wandb.io)
79+
80+
# candidate harness runs as an unprivileged uid, unable to read held-out state.
81+
harness_user: harness
82+
83+
wandb:
84+
project: vero-swe-bench-pro
85+
group: swe-bench-pro
86+
log_traces: true
87+
88+
inference_gateway:
89+
upstream_api_key_env: OPENAI_API_KEY
90+
upstream_base_url_env: OPENAI_BASE_URL
91+
producer:
92+
# Both prefixed and bare forms: the gateway model match is prefix-sensitive.
93+
allowed_models: ["gpt-5.3-codex", "openai/gpt-5.3-codex"]
94+
max_concurrency: 8
95+
evaluation:
96+
allowed_models: ["gpt-4o", "openai/gpt-4o"]
97+
max_requests: 15000
98+
max_tokens: 100000000
99+
max_concurrency: 64
100+
instruct_multifidelity: true
101+
instruct_exhaust_budget: true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Run secrets for `vero harbor run --env-file`.
2+
# Copy to `secrets.env` (gitignored) and fill in. File values override the
3+
# ambient shell and never appear on the command line.
4+
5+
# Upstream inference credentials. VeRO reads these as the real provider key/URL
6+
# (per the compiled gateway's *_source fields), relocates them to the
7+
# VERO_INFERENCE_UPSTREAM_* target vars, and hands the optimizer a scoped
8+
# producer token instead — so the raw key never reaches the coding agent.
9+
#
10+
# For `--environment modal`, OPENAI_BASE_URL must be reachable from Modal's
11+
# network (for example the Azure `https://<resource>.openai.azure.com/openai/v1`
12+
# endpoint), NOT a VPN-internal host. See the README.
13+
OPENAI_API_KEY=sk-your-upstream-inference-key
14+
OPENAI_BASE_URL=https://your-openai-compatible-endpoint/v1
15+
16+
# Modal credentials for the eval sidecar backends (declared required by the
17+
# compiled task.toml). Copy from your ~/.modal.toml profile.
18+
MODAL_TOKEN_ID=ak-...
19+
MODAL_TOKEN_SECRET=as-...
20+
21+
# Self-hosted Weights & Biases (scaleai.wandb.io) for trace/metric logging.
22+
WANDB_API_KEY=your-wandb-key
23+
WANDB_BASE_URL=https://scaleai.wandb.io
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[project]
2+
name = "swebench-pro-agent"
3+
version = "0.1.0"
4+
description = "Editable Harbor-native SWE-bench-Pro baseline for VeRO"
5+
# Cap below 3.14: an uncapped ">=3.11" lets uv resolve to 3.14, whose litellm/pyo3
6+
# build fails. Keep this bounded until the toolchain supports 3.14.
7+
requires-python = ">=3.11,<3.14"
8+
dependencies = [
9+
"harbor==0.20.0",
10+
"openai==2.46.0",
11+
]
12+
13+
[build-system]
14+
requires = ["hatchling"]
15+
build-backend = "hatchling.build"
16+
17+
[tool.hatch.build.targets.wheel]
18+
packages = ["src/swebench_pro_agent"]
19+
20+
[dependency-groups]
21+
dev = [
22+
"pytest>=9.0.2",
23+
"pytest-asyncio>=1.3.0",
24+
]
25+
26+
[tool.pytest.ini_options]
27+
testpaths = ["tests"]
28+
29+
# NOTE: no uv.lock is committed yet. Run `uv lock` in this directory when
30+
# finalizing the baseline so the compiled task pins an exact resolution.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Harbor-native SWE-bench-Pro target agent."""
2+
3+
from swebench_pro_agent.agent import SweBenchProAgent
4+
5+
__all__ = ["SweBenchProAgent"]

0 commit comments

Comments
 (0)