|
| 1 | +# Agent Impact A/B Benchmark |
| 2 | + |
| 3 | +This benchmark answers a different question than the compiler-only impact benchmark: |
| 4 | + |
| 5 | +> Does impact-analysis context make a top agent repair real breakage with fewer tokens, less wall time, fewer tool calls, or a higher success rate? |
| 6 | +
|
| 7 | +The comparison must isolate one variable: |
| 8 | + |
| 9 | +- **control:** agent receives the broken repository and task prompt. |
| 10 | +- **impact:** agent receives the same broken repository and task prompt, plus `IMPACT_ANALYSIS.md` and `impact-analysis.json`. |
| 11 | + |
| 12 | +Everything else is held constant: model, container image, repository commit, mutation, verifier, timeout, and prompt wording. |
| 13 | + |
| 14 | +## Protocol |
| 15 | + |
| 16 | +For each case: |
| 17 | + |
| 18 | +1. Clone a pinned public repository commit. |
| 19 | +2. Install dependencies inside Docker. |
| 20 | +3. Run the verifier once to prove the clean checkout is green. |
| 21 | +4. Apply a configured mutation or deletion. |
| 22 | +5. Run the verifier again and require that it fails with at least one real source/test/type failure. |
| 23 | +6. Run the control agent in a fresh Docker container. |
| 24 | +7. Run the impact-context agent in another fresh Docker container. |
| 25 | +8. Run the verifier after each agent. |
| 26 | +9. Record success, wall time, token usage, tool calls, files changed, final diff, stdout/stderr, and raw agent JSONL. |
| 27 | + |
| 28 | +The agent prompt forbids simply reverting the target mutation. The harness also checks that the configured `mutation.mustContain` text still exists after the agent run. |
| 29 | + |
| 30 | +## Ten-Repository Set |
| 31 | + |
| 32 | +The initial manifest is [agent-impact-repos.json](./agent-impact-repos.json). It uses 10 pinned public repositories: |
| 33 | + |
| 34 | +- `tinylibs/tinyspy` |
| 35 | +- `tinylibs/tinybench` |
| 36 | +- `sindresorhus/p-queue` |
| 37 | +- `sindresorhus/ky` |
| 38 | +- `sindresorhus/p-map` |
| 39 | +- `sindresorhus/p-retry` |
| 40 | +- `sindresorhus/p-timeout` |
| 41 | +- `sindresorhus/p-throttle` |
| 42 | +- `chalk/chalk` |
| 43 | +- `sindresorhus/yoctocolors` |
| 44 | + |
| 45 | +The set intentionally mixes implementation TypeScript, declaration-heavy packages, test/type-test repairs, class constructors, default exports, and shared helpers. |
| 46 | + |
| 47 | +## Build |
| 48 | + |
| 49 | +```bash |
| 50 | +docker build -t supermodel-agent-impact:local benchmark/agent-impact |
| 51 | +``` |
| 52 | + |
| 53 | +## Dry Run |
| 54 | + |
| 55 | +```bash |
| 56 | +node benchmark/agent-impact/run-agent-impact-ab.mjs --dry-run |
| 57 | +``` |
| 58 | + |
| 59 | +This validates the manifest shape and writes the prompts/run plan without invoking the model. |
| 60 | + |
| 61 | +## Implementation Tests |
| 62 | + |
| 63 | +The API ranking implementation is tested in the public API repository. From the paired public API checkout: |
| 64 | + |
| 65 | +```bash |
| 66 | +export SUPERMODEL_PUBLIC_API_REPO=/path/to/supermodel-public-api |
| 67 | +cd "$SUPERMODEL_PUBLIC_API_REPO/src/data-plane" |
| 68 | +npm test -- --runInBand \ |
| 69 | + impact-validation-ranking-regression.test.js |
| 70 | +``` |
| 71 | + |
| 72 | +Those tests cover scoped validation ranking behavior. The benchmark harness itself can be checked without invoking a model using the dry-run command above. |
| 73 | + |
| 74 | +## Full Run |
| 75 | + |
| 76 | +```bash |
| 77 | +node benchmark/agent-impact/run-agent-impact-ab.mjs \ |
| 78 | + --image supermodel-agent-impact:local \ |
| 79 | + --model gpt-5.5 \ |
| 80 | + --codex-home ~/.codex |
| 81 | +``` |
| 82 | + |
| 83 | +The runner writes one directory per case and arm under `target/agent-impact/`. |
| 84 | + |
| 85 | +The summary records: |
| 86 | + |
| 87 | +- `agentModel`, expected to be `gpt-5.5` for this run |
| 88 | +- `agentRunner`, expected to be `codex-cli 0.128.0` |
| 89 | +- per-arm aggregate success, time, tool calls, token usage, and agent file-level F1 |
| 90 | + |
| 91 | +Each arm directory contains: |
| 92 | + |
| 93 | +- `prompt.md` |
| 94 | +- `agent.jsonl` |
| 95 | +- `agent.stdout` |
| 96 | +- `agent.stderr` |
| 97 | +- `metrics.json` |
| 98 | +- `final.diff` |
| 99 | +- `verify-before.log` |
| 100 | +- `verify-after.log` |
| 101 | +- `impact-analysis.json` and `IMPACT_ANALYSIS.md` for the impact arm |
| 102 | + |
| 103 | +## Metrics |
| 104 | + |
| 105 | +Primary: |
| 106 | + |
| 107 | +- success rate |
| 108 | +- agent file-level F1 |
| 109 | +- wall-clock seconds |
| 110 | +- input tokens |
| 111 | +- output tokens |
| 112 | +- total tokens |
| 113 | +- tool calls |
| 114 | + |
| 115 | +Secondary: |
| 116 | + |
| 117 | +- verifier failure category |
| 118 | +- files changed |
| 119 | +- diff line count |
| 120 | +- whether changed files overlap predicted impact files |
| 121 | +- whether the mutation was illegally reverted |
| 122 | + |
| 123 | +Agent file-level F1 is computed as: |
| 124 | + |
| 125 | +```text |
| 126 | +actual files = files implicated by the broken verifier output after mutation |
| 127 | +agent files = files changed by the agent after the mutation is committed as the baseline |
| 128 | +precision = changed files that were actually implicated / changed files |
| 129 | +recall = implicated files changed by the agent / implicated files |
| 130 | +F1 = harmonic mean of precision and recall |
| 131 | +``` |
| 132 | + |
| 133 | +This is not a substitute for verifier success. It measures whether the agent edited the right files, while verifier success measures whether the repair actually worked. |
| 134 | + |
| 135 | +## Impact Context |
| 136 | + |
| 137 | +For production-quality runs, `impact-analysis.json` should come from the Supermodel impact endpoint or from the same local graph implementation used by that endpoint. |
| 138 | + |
| 139 | +The context file must not include compiler ground truth from after the mutation. It can include: |
| 140 | + |
| 141 | +- target file and symbol |
| 142 | +- direct callers |
| 143 | +- transitive callers |
| 144 | +- affected files with confidence tiers |
| 145 | +- entry points |
| 146 | +- risk score |
| 147 | + |
| 148 | +It must not include: |
| 149 | + |
| 150 | +- actual compiler errors from the mutated repository |
| 151 | +- the verifier output |
| 152 | +- hand-labeled files that were discovered after running the mutation |
| 153 | + |
| 154 | +## Reading Results |
| 155 | + |
| 156 | +The benchmark supports three conclusions: |
| 157 | + |
| 158 | +- **Positive:** impact arm succeeds more often or uses less time/tokens/tool calls with similar quality. |
| 159 | +- **Neutral:** impact context changes little; product should not claim agent-efficiency gains yet. |
| 160 | +- **Negative:** impact context increases distraction, false edits, or cost. |
| 161 | + |
| 162 | +The per-case logs matter more than the aggregate. A single false-positive-heavy impact file can make the agent inspect or edit the wrong place; those failures should be visible in `agent.jsonl`, `final.diff`, and verifier logs. |
| 163 | + |
| 164 | +## Result Artifacts |
| 165 | + |
| 166 | +Keep generated result artifacts separate from the harness PR so reviewers can evaluate runner logic and benchmark evidence independently. |
| 167 | + |
| 168 | +For real impact ranking runs, check in result artifacts under `benchmark/agent-impact/results/<run-id>/` on a results branch. A complete result artifact should include: |
| 169 | + |
| 170 | +- reproduction instructions with the exact API/CLI branches and command |
| 171 | +- aggregate precision, recall, and F1 tables |
| 172 | +- generated `report.md` |
| 173 | +- sanitized `summary.json` |
| 174 | +- per-case scoped packets when useful for audit |
0 commit comments