--- license: apache-2.0 pretty_name: AACR-Bench Harbor tags: - code-review - harbor - benchmark --- # AACR-Bench Harbor AACR-Bench Harbor packages [AACR-Bench](https://github.com/alibaba/aacr-bench) as independent Harbor tasks for code-review agents. Each task checks out one pull request at its pinned head commit, keeps the base as `aacr-base`, and grades a structured findings file with AACR-Bench's path, side, line, and semantic matching stages. This repository is not a fork of AACR-Bench or Harbor. ## Install Requirements: - Python 3.12 or newer - [uv](https://docs.astral.sh/uv/) - Git - [Harbor](https://harborframework.com/) 0.21.0 - Docker for local task runs, or Harbor's `hf-sandbox` extra for Hugging Face Sandboxes ```bash git clone https://huggingface.co/datasets/osolmaz/aacr-bench-harbor cd aacr-bench-harbor uv sync --locked --dev ``` The Hugging Face dataset repository is the single canonical repository. It contains the code and immutable source packs needed to build tasks without cloning upstream repositories. If a Git client leaves large files as pointers, hydrate the exact corpus revision: ```bash uv run aacr-source-pack hydrate \ --manifest source-packs/manifest.json \ --revision b1faf33764460fa7246e92bf9d3e89ba804ad17e ``` ## Generate tasks The default source is pinned to AACR-Bench commit `b3072489eace26efca8bcf2b1ac6a24ba64f82c1` and SHA-256 `d8683cb240249bc4e0aff6428802bdffa7b7573ace600552cab1cd0cb7e905c9`. Generate one released sealed task from the local source packs: ```bash uv run aacr-bench \ --output-dir datasets/aacr-bench \ --source-pack-manifest source-packs/manifest.json \ --task-ids appwrite-appwrite-pr-9999-710b8bda565c ``` Generate any released task with `--task-ids`. Existing task directories are never replaced unless `--overwrite` is present. Task generation verifies the archive, commit, tree, diff, clean checkout, and absence of Git remotes before writing Harbor files. It performs no repository network access. Maintainers can verify every released pack with: ```bash uv run aacr-source-pack verify --manifest source-packs/manifest.json ``` Generated Harbor datasets are ignored by Git. ## Run with Harbor Verify generated tasks with the oracle first: ```bash harbor run -p datasets/aacr-bench --agent oracle ``` Run GPT-5.6 Luna through Codex's native review harness. Put this repository on Python's import path so official Harbor can load the custom agent module: ```bash PYTHONPATH="$PWD" harbor run \ -p datasets/aacr-bench \ --agent agents.codex_review:CodexReview \ --model openai/gpt-5.6-luna ``` `OPENAI_API_KEY` must already be present in the invoking environment. The custom agent uses an isolated temporary `CODEX_HOME`, calls `codex review --base aacr-base`, validates the structured review, and writes `/workspace/aacr-review.json` outside the read-only review session. For Hugging Face Sandbox execution, install the official `harbor[hf-sandbox]==0.21.0` release and add: ```bash -e agents.hf_sandbox:AACRHFSandboxEnvironment \ --ek flavor=cpu-basic \ --ek forward_hf_token=true \ --ek job_timeout=35m ``` The corrected DeepSeek runs keep the official Harbor package unchanged. A thin benchmark-owned environment adapter creates the configured task workdir from the image root and runs installed-agent commands with Bash, which Harbor's agent helper requires for `pipefail`. It uploads large task archives through public Sandbox file operations in 1 MiB chunks, with four concurrent writes and three bounded attempts per chunk. Artifact reads use three bounded transport attempts, and a transient status-poll transport error can recover for up to six 5-second polls without killing the review. Run Pi Reviewer jobs through the AACR wrapper: ```bash AACR_JUDGE_MODE=mock uv run aacr-harbor-run --config path/to/job-config.json ``` The wrapper leaves Harbor unchanged. It waits for Harbor to finish redacting trial files, then validates each final native Pi JSONL file and writes its mode-`0600` receipt atomically. Mock judging uses an empty default for `OPENAI_API_KEY`; production judging uses the host key when it is present. A terminal trial without a valid native session makes the wrapper fail. Select the Pi model through the Harbor agent entry and bind it to a reviewed manifest: ```json { "import_path": "agents.pi_reviewer:PiReviewer", "model_name": "huggingface/deepseek-ai/DeepSeek-V4.1-Flash:novita", "kwargs": { "model_manifest_path": "experiments/model-manifests/deepseek-v4.1-flash-novita.json", "model_manifest_sha256": "9003e7cd58eb29ce0f3cf5d1c4ee6a33e52aaec17c70b80e4b111925476f3169", "model_source_revision": "dba1be0a40aa45a94ad051997016db3960a90277", "expected_response_model": "deepseek/deepseek-v4.1-flash", "thinking": "high" } } ``` The adapter rejects a model, provider route, manifest digest, or source revision mismatch. The complete reviewed configuration is in `experiments/runner-manifests/deepseek-v4.1-flash-novita.json`. The benchmark image uses the official release tag `node:24.7.0-bullseye`. Its recorded OCI index digest is `sha256:1684133274a44010e6d6011d6eec100cf756309678c77700779ac44a5ac36715`, and its `linux/amd64` manifest digest is `sha256:14671502e8e7b000cd644c1ad56934bab4a82077457af6461d084fd5d0e85c05`. HF Sandbox cannot execute Docker digest references reliably, so runs must attest that the release tag still resolves to those digests before launch. Do not place credentials in task files, generated images, command arguments, logs, or run manifests. ## Findings Agents submit one strict JSON document. See [the findings format](docs/AACR_FINDINGS_FORMAT.md). The verifier writes raw expected, generated, line-match, and semantic-match counts plus per-task metrics. The dataset-level `metric.py` sums counts across tasks before computing precision, recall, and F1, matching AACR-Bench's micro aggregation. Missing rewards and judge errors fail closed and suppress headline aggregate scores. ## Model study status The fixed five-task canary completed for Luna, Terra, and two earlier DeepSeek/Pi configurations. Luna and Terra completed every trial. The earlier DeepSeek runs used a destructive 20-minute deadline and are retained only as diagnostic evidence. The corrected DeepSeek protocol pins the provenance-signed `@osolmaz/pi-reviewer` 0.1.4 npm package, gives one Pi session 10 minutes to investigate and 2 minutes to submit, retries one stalled final-submission request halfway through that grace period, and uses official Harbor 0.21.0 without source patches. The registered 10-task Harbor HF canary produced 9 valid submissions, exactly meeting its operational gate. The current execution runs each of the 57 released tasks once. The canary has no margin and does not establish a stable 90% completion rate. The frozen split named 59 sealed tasks. Four deleted Keycloak commits were recovered exactly from Software Heritage. Keycloak PR #35645 and Node.js PR #56185 were absent from checked public archives, leaving 57 released tasks and 462 references. The approved study contains 684 trials with an $80 hard ceiling. See the [source corpus](experiments/source-corpus.json), [canary results](experiments/2026-08-08-canary-results.json), and [implementation plan](docs/2026-08-08-harbor-native-aacr-bench-plan.md). ## Development ```bash scripts/check.sh uv run slophammer-py check . --execute npx -y @simpledoc/simpledoc check git diff --check ``` The [implementation plan](docs/2026-08-08-harbor-native-aacr-bench-plan.md) records the source baseline, hidden-verifier boundary, model-study protocol, and remaining publication work. ## License [Apache-2.0](LICENSE)