diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..9a1c1d3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,31 @@ +name: Bug report +description: Something broke or gave a wrong result +labels: ["bug"] +body: + - type: dropdown + id: piece + attributes: + label: Which piece + options: [Not sure, harness, repo2env, cheatcatcher, sandbox, timemachine, arena, Docker image or Compose] + validations: + required: true + - type: textarea + id: what + attributes: + label: What happened + description: What you ran, what you expected and what you got. Paste the error. + validations: + required: true + - type: textarea + id: repro + attributes: + label: Steps to reproduce + description: The exact commands. A repo URL helps if a build or a mine failed. + render: bash + validations: + required: true + - type: input + id: env + attributes: + label: Environment + placeholder: macOS 15, Docker 27, Python 3.12 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/new_cheat.yml b/.github/ISSUE_TEMPLATE/new_cheat.yml new file mode 100644 index 0000000..ca7e5fb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new_cheat.yml @@ -0,0 +1,23 @@ +name: I beat the grader +description: A run that scores above 0 without fixing the bug +labels: ["help wanted"] +body: + - type: textarea + id: trick + attributes: + label: The trick + description: What the agent does and why the grader misses it. + validations: + required: true + - type: textarea + id: repro + attributes: + label: How to reproduce + description: The task id, the patch or policy, and the reward you got. + validations: + required: true + - type: textarea + id: fix + attributes: + label: Idea for a fix + description: Optional. A report with no fix is still welcome. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b3a1aa3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,6 @@ +## What this changes + +## How I tested it + +- [ ] A test fails without this change and passes with it +- [ ] `uv run pytest` and `uv run ruff check` pass in the repo I touched diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4529f17 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,58 @@ +# Contributing to Gauntlet + +Thanks for looking. Gauntlet is young, so a small fix or a good bug report moves it a long way. + +## Where things live + +Gauntlet is seven repos. This one is the front door: the Docker image, the Compose files and the docs. The code is in the pieces. + +| You want to change | Repo | +|---|---| +| How a PR becomes a task, grading, cheats, reports | [gauntlet-harness](https://github.com/abhishekcpp007/gauntlet-harness) | +| Building an env for a repo, mining tasks | [gauntlet-repo2env](https://github.com/abhishekcpp007/gauntlet-repo2env) | +| Reward hacking detectors | [gauntlet-cheatcatcher](https://github.com/abhishekcpp007/gauntlet-cheatcatcher) | +| Containers and trajectories | [gauntlet-sandbox](https://github.com/abhishekcpp007/gauntlet-sandbox) | +| Replay and the HTML viewer | [gauntlet-timemachine](https://github.com/abhishekcpp007/gauntlet-timemachine) | +| The web UI and matches | [gauntlet-arena](https://github.com/abhishekcpp007/gauntlet-arena) | + +Not sure which one? Open the issue here and I'll move it. + +## Good ways to start + +- **Try a repo.** Run `repo2env build` and `repo2env mine` on a small, well-tested Python or JS repo and tell me how many tasks came out. A repo that gives zero tasks is a useful report too. +- **Write a cheat.** The grader is meant to be attacked. If you can make a run score above 0 without fixing the bug, that's the best issue you can file. See `ZOO` in `src/gauntlet_harness/policies.py` for the ones that exist. +- **Add a detector.** Cheat Catcher's rules are in `src/gauntlet_cheatcatcher/rules.py`. Every rule needs a test that fires on a cheat and a test that stays quiet on honest work. +- **Pick an issue** labelled [good first issue](https://github.com/abhishekcpp007/gauntlet/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or [help wanted](https://github.com/abhishekcpp007/gauntlet/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). + +## Set up + +Each piece is a normal Python package. + +```bash +git clone https://github.com/abhishekcpp007/gauntlet-harness +cd gauntlet-harness +uv sync +uv run pytest # Docker tests skip if Docker isn't running +uv run ruff check +``` + +To run the whole stack from local folders, follow "Hacking on it" in the [README](README.md#hacking-on-it). + +## Before you open a PR + +- Add a test that fails without your change and passes with it. +- Run `uv run pytest` and `uv run ruff check` in the repo you touched. +- Keep the diff small. One fix per PR. +- If you change a number in a README, say which command produced it. + +## AI tools + +Use them if you like. I do. Two asks: run the tests yourself, and be able to explain the change in your own words when I ask about it. + +## Reporting a security problem + +If you find a way out of the sandbox, please don't post the details in public. Open an issue that only says you found one, and I'll get in touch to take the details privately. + +## Be kind + +Assume good faith, keep it about the code, and remember everyone here is doing this in their spare time. diff --git a/README.md b/README.md index 4a50f16..d3903b3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Gauntlet -[![CI](https://github.com/abhishekcpp007/gauntlet/actions/workflows/ci.yml/badge.svg)](https://github.com/abhishekcpp007/gauntlet/actions/workflows/ci.yml) -[![Harness CI](https://github.com/abhishekcpp007/gauntlet-harness/actions/workflows/ci.yml/badge.svg)](https://github.com/abhishekcpp007/gauntlet-harness/actions/workflows/ci.yml) +[![CI](https://github.com/abhishekcpp007/gauntlet/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/abhishekcpp007/gauntlet/actions/workflows/ci.yml?query=branch%3Amain) +[![Harness CI](https://github.com/abhishekcpp007/gauntlet-harness/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/abhishekcpp007/gauntlet-harness/actions/workflows/ci.yml?query=branch%3Amain) [![Nightly calibrate](https://github.com/abhishekcpp007/gauntlet-harness/actions/workflows/calibrate.yml/badge.svg)](https://github.com/abhishekcpp007/gauntlet-harness/actions/workflows/calibrate.yml) ![Tasks](https://img.shields.io/badge/shipped%20tasks-147-orange) ![Languages](https://img.shields.io/badge/python%20%7C%20js%20%7C%20ts-pytest%20%7C%20vitest%20%7C%20jest-blue) @@ -47,25 +47,51 @@ Coding agent benchmarks are expensive to build, go stale once their fixes land i So Gauntlet keeps making new tasks out of PRs merged after a model's cutoff, proves each one is leak-free and solvable before keeping it, and treats the grader as something to attack rather than trust. It's six small libraries that each make sense alone, plus an arena that snaps them together. -## The pieces +## How it measures, in six steps + +The same order every eval design should be argued in. Each step links to where the claim is checked. + +**1. Construct validity.** The claim is narrow on purpose: given a real repository at the commit before a merged change, can an agent make that change so the project's own hidden tests pass, without touching the tests or the runner? It doesn't claim to measure coding skill in general. The biggest threat to it is a grader that can be fooled, because then the score measures cheating, so step 3 is built around that. + +**2. Dataset construction.** Tasks come from PRs merged this week, or from a whole release range (`vX` to `vY`) for the long-horizon set. Each candidate gets an env image at its base commit and runs three times, so every test is classified as fail-to-pass, new, skipped-to-pass or pass-to-pass, and anything flaky is dropped. Most PRs don't survive: the Python Live set kept 53 tasks out of 186 PRs, the JS set 69 out of 219. Every task carries an env fingerprint, and CI recomputes all 147 on every push. + +**3. Grading.** Hidden tests go on after the agent finishes, and its edits to tests and runner config are stripped first. Then the grader plants canary tests, renames the target tests and hashes every test file before and after the run, so a forged report, a sniffed test name or a tampered file costs the reward instead of earning it. Nine purpose-built cheats were thrown at it over three rounds, and the best one now scores 0. Under Harbor the same grader runs in a separate verifier container that never saw the agent. + +**4. Contamination.** A task is only as fresh as its merge date, so the sets are rebuilt weekly from new PRs and `--cutoff YYYY-MM-DD` splits every number at a model's training cutoff. A leak check with nine separate checks runs on each task before it's kept. It once caught `flit_core` vendoring a newer tomli inside site-packages, which would have handed the agent the answer. + +**5. Baseline.** Before any model, the floor and the ceiling: `oracle` applies the merged fix (53 of 53, 68 of 69, 25 of 25), `noop` does nothing, and the cheat zoo stands in for a model that games the grader. Every pass rate comes with a 95% Wilson interval, and McNemar's exact test is run between every pair of policies, with a warning when there are too few disagreeing tasks to call anything significant. No frontier model has been run on the published sets yet, so there is no model leaderboard. + +**6. Failure analysis.** Running on real repos found more than 30 bugs in the harness itself, each fixed with a regression test named after the PR that exposed it. The grader's own error rates are measured, not assumed: a canary-aware cheat dodges 6.25% of canary layouts (95% CI 5.27 to 7.40%), which is why Cheat Catcher backs it up, and Cheat Catcher flags 0 of the 53 real merged fixes as cheating. Fresh tasks rot too. 2 of the 53 Live tasks stopped building within four days because their repo force-pushed. + +## Architecture + +Seven repos, one path from a merged PR to a reward: ```mermaid -flowchart LR - R[GitHub repo] --> E[repo2env
build env + mine tasks] - E -->|tasks| A[arena
matches + leaderboard] - A -->|one sandbox per contestant| S[sandbox
locked-down Docker + trajectories] - S -->|trajectory| T[timemachine
replay, branch, viewer] - S -->|trajectory + patch| C[cheatcatcher
reward hacking checks] - E -->|hidden tests| G{graded} - C --> G - G --> L[leaderboard] - T --> A - PR[fresh merged PRs] --> H[harness
leak-free RL envs, F2P/P2P judging] - S --> H - C --> H - H --> D[(SFT / GRPO / DPO data)] +flowchart TB + subgraph build["Dataset construction: gauntlet-harness + gauntlet-repo2env"] + PR["PRs merged this week,
or a whole release range"] --> ENV["repo2env: env image
at the base commit"] + ENV --> VAL["3 runs each: F2P, N2P, S2P, P2P
flaky tests dropped"] + VAL --> LEAK["leak check, 9 checks"] + LEAK --> TS[("task set
tasks.jsonl + env fingerprints")] + end + TS -->|"gauntlet export --format harbor"| HT[("Harbor task folders")] + subgraph run["Running an agent"] + HT --> AG["Harbor agent container
offline, no hidden tests"] + TS --> SB["gauntlet run
gauntlet-sandbox, one container per episode"] + end + AG -->|"collect hook: git diff"| VF["separate Harbor verifier container
gauntlet harbor-grade"] + VF --> GR + SB --> GR["grader: hidden tests, canaries,
renamed targets, file hashes"] + CC["gauntlet-cheatcatcher
patch and trajectory rules"] --> GR + GR --> RW["reward + report
Wilson intervals, McNemar"] + RW --> DATA[("SFT / GRPO / DPO rows")] + SB --> TM["gauntlet-timemachine
replay, branch, diff"] + TS --> AR["gauntlet-arena
live matches, leaderboard"] ``` +The grader is the same code on both paths. Inside Gauntlet it boots its own sandbox. Under Harbor the verifier container is that sandbox: a fresh copy of the env that never saw the agent, with the agent's diff as the only thing carried over. + | Repo | What it does | Tests | |---|---|---| | [gauntlet-harness](https://github.com/abhishekcpp007/gauntlet-harness) | Turns freshly merged PRs and release ranges into leak-free RL environments, red-teams its own grader, reports pass@k with intervals and paired tests, exports SFT, GRPO and DPO data | 340 | @@ -89,6 +115,19 @@ OPENAI_BASE_URL=http://localhost:11434/v1 gauntlet run --tasks tasks.jsonl --pol The report puts a 95% interval next to every pass@1 and runs McNemar's exact test between every pair of models, so a gap that isn't real gets called that. `--cutoff YYYY-MM-DD` splits every number at a model's training cutoff. It also plugs into RL code as a Python `SWEEnv`, a Gymnasium env (`gauntlet/SWE-v0`) or an HTTP server, and `gauntlet export` turns episodes into SFT, GRPO or DPO data. +## Run it on Harbor + +Every task also exports to [Harbor](https://github.com/harbor-framework/harbor)'s layout, so any agent Harbor drives runs on Gauntlet tasks, and Harbor records the trajectories: + +```bash +gauntlet export --format harbor --tasks datasets/gauntlet-live-2026-11/tasks.jsonl -o harbor/live +harbor run -p harbor/live -a oracle +``` + +Both containers start offline. An agent that installs itself or calls a model API from inside its container needs those hosts let through at export time with `--agent-host`, and GitHub should never be one of them. + +Grading doesn't move into the agent's container. A collect hook carries the agent's diff to a separate verifier container built from the same Dockerfile, and Gauntlet's own grader runs there. A workflow in the harness checks it on every push, offline: the oracle wins on a pytest task and a vitest task, `nop` loses, and a forged conftest gets caught. The weekly live build publishes its tasks as Harbor folders. [Details in the harness README](https://github.com/abhishekcpp007/gauntlet-harness#run-it-on-harbor). + ## A match, start to finish 1. repo2env builds the env image once and mines tasks. Each task is a commit's parent, the hidden tests from that commit, and the lists of tests that should flip to passing or stay passing. @@ -149,6 +188,10 @@ cd gauntlet && docker compose -f compose.dev.yaml up --build Each piece uses uv, ruff and pytest, and its CI runs the Docker tests on real containers. +## Contributing + +Gauntlet gets better when people attack it. The most useful things you can do are try it on a repo of your own, or write a cheat that beats the grader. [CONTRIBUTING.md](CONTRIBUTING.md) has the setup and a map of which repo holds what. Issues tagged [good first issue](https://github.com/abhishekcpp007/gauntlet/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) are small on purpose. + ## Limits, honestly - Python with pytest, and JS/TS with vitest or jest. No other languages yet, and no JS workspaces or repos whose tests import a build.