Benchmark your coding agent on your own repo
For engineers
Scenario lesson and practice set combining Evaluating AI agents, Agent-sized tasks and Testing new models yourself. Completing it counts as evidence for every listed skill.
The one-sentence idea: choose a coding agent by testing it on your own closed issues, in a clean sandbox, with tasks sized so each result means something.
Why it matters
Public leaderboards such as SWE-bench measure agents on other people's repositories. Your repo has its own build, conventions and flaky tests. A leaderboard score cannot tell you whether an agent will fix a bug in your billing code. A benchmark built from your own work can. It costs a few days, and it replaces a debate about taste with numbers you can repeat.
This scenario follows Priya, a staff engineer at Harbor Logistics. Her team maintains parcel-api, a TypeScript service. Two coding agents, Cedar and Birch, are on the shortlist. The lead wants a decision in two weeks.
How to do it
- Collect tasks. Pick 20 closed issues from the last year, each with a merged fix and a test that failed before it. Mix easy, medium and hard. Prefer fixes newer than the models' training data, and keep the list private.
- Size every task. An agent-sized task has bounded scope, a known starting point, a check the agent can run and a diff a person can review in one sitting. If the cause is unknown, run a throwaway spike first, then write the task. If the work is large, slice it into vertical steps that each build and pass tests.
- Write checkable criteria. Replace "make it work" with a command and an observable result: the test command, the exact response for a known input, the files allowed to change.
- Build the harness. Each trial starts from a clean checkout at the commit before the fix, in a fresh container, with no network access and no copy of the real remote. The grading tests are copied in after the agent finishes, so the agent never sees them.
- Run it fairly. Give both agents the same instructions file, the same time limit and the same tasks. Run each task several times. A single run tells you little, because agents vary from run to run.
- Grade the end state and the path. The main score is whether the hidden tests pass. Also record tool calls, out-of-scope edits and destructive commands. Read the trajectory of suspicious runs: an agent that deletes a failing test is not a pass.
- Compare blind. Strip agent names from diffs before a reviewer scores them against a written rubric. Score correctness separately from style, so longer output does not win on volume.
- Decide in writing. Weigh pass rate, cost per resolved task, time including human help, scope and data terms. Then record adopt, trial or wait.
Before and after
Before: "Run both agents on a few issues and see which feels better." One run each, different instructions, the agent's own summary as proof, and a verdict of "Birch won 14 to 11, adopt it everywhere."
After: 20 tasks, three runs each, identical setup, hidden tests as the pass rule and a results sheet with pass^3, cost per passing run, human minutes and out-of-scope edits. The call says: trial Birch on one more repository for two weeks, because its terms need checking and three tasks of difference is within noise.
What goes wrong
- The agent games the grader. If it can read or edit the tests, it can pass without fixing the bug.
- State leaks between trials. A reused working copy carries files and packages from one run into the next, so runs are not independent.
- Contamination. An agent with internet access and the real remote can find the commit that closed the issue.
- Oversized tasks. Many failed attempts, a growing diff and a nearly full context mean the task was too big, not that the agent is weak.
- Averages hide reliability. pass@k asks whether any run worked. Unattended use needs pass^k, where every run works.
- Unfair setups. Different model tiers or instructions files measure the setup, not the agents.
Treat the benchmark as a small, repeatable experiment. Rerun it when a new agent or model arrives, and keep the task list private so it stays useful.
Steps
Build the task list from closed issues
Pick 20 closed issues from the last year, each with a merged fix and a failing-then-passing test. Mix easy, medium and hard, keep the list private, and write each task's pass rule before any agent runs. Prefer fixes newer than the models' training data so the answer cannot be memorised.
Task list excerpt First rows of the benchmark sheet Task Issue Size Pass rule PA-101 Reject negative weight Small test/weight.test.ts passes PA-157 Wrong zone lookup Medium test/zone.test.ts passes PA-212 Delivery-window rule Medium test/windows.test.ts passes Size and specify each task
Check each task is bounded, has a known starting point, a command the agent can run and a diff a reviewer can read in one sitting. Spike unclear reports, slice big ones, and turn vague wishes into acceptance criteria with a command and an expected result.
Make the harness reproducible
Start every trial from a fresh container at the commit before the fix. Turn off network access and remove the real remote. Copy the hidden tests in only after the agent finishes, and reset all state between trials.
Sandbox settings sandbox.yaml
image: node:20-slimnetwork: nonecheckout: base_commithidden_tests: copied_after_runreset_between_trials: truetimeout_minutes: 30Run both agents with matched settings
Give Cedar and Birch the same instructions file, time limit and tasks, and run each task three times. Record every output, the cost, the time and each human intervention in one sheet.
Grade outcomes, paths and side effects
Score hidden-test passes as the main metric and report pass^k for reliability. Add assertions on recorded tool calls, a diff check for edits outside allowed paths, and a flag for destructive commands. Read the trajectory of every run that passed suspiciously fast.
Compare blind and decide
Remove agent names, shuffle diffs and score them against a written rubric with correctness separate from style. Compute cost per passing run, add human minutes, check data terms and write the call as adopt, trial or wait with the evidence.
Skills this scenario uses
Where to study
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues? (Jimenez et al.) (opens in a new tab)PaperFree
The original paper on building agent benchmarks from real closed issues with hidden tests.
- SWE-bench (opens in a new tab)ToolFree
Shows the public benchmark whose task format you copy for your own repo.
- Demystifying evals for AI agents (Anthropic) (opens in a new tab)ArticleFree
Practical advice on grading agent outcomes, trajectories and reliability.
- Inspect: open-source framework for LLM evaluations (UK AISI) (opens in a new tab)ToolFree
A sandboxed, open-source harness for running repeatable agent evals.
- Best practices for Claude Code (Claude Code docs) (opens in a new tab)DocsFree
Advice on verification, planning first and managing a filling context.
- Small CLs (Google Engineering Practices) (opens in a new tab)ArticleFree
Why small, reviewable changes are the right size for review, human or agent.