197 lines
12 KiB
Markdown
197 lines
12 KiB
Markdown
# Reviewer merge trials
|
|
|
|
These trials ask one question: can larv-review run fewer, merged reviewers without losing findings?
|
|
A merged reviewer is one agent that does the work of two or three separate reviewers in one run.
|
|
It costs less, because it reads the change once.
|
|
|
|
## Verdicts
|
|
|
|
No merge tested is safe. Each one lost the findings of one pass it absorbed, while the other pass held.
|
|
|
|
| Candidate | Reviewers merged | Verdict |
|
|
|---|---|---|
|
|
| 1 | stability + product-owner + prose | Unsafe. Prose findings drop well outside the noise. |
|
|
| 2 | systems-architect + principles-auditor | Unsafe. Principles findings halve, and both principles 🔴 are lost. |
|
|
| 3 | override-reviewer folded into stability | No data. No archived override round has a 🔴 or 🟡. |
|
|
| 4 | stability + product-owner, prose kept separate | Unsafe. Product-owner findings drop outside the noise; stability holds. |
|
|
|
|
The three-way and architect merges cut cost about in half. The stability and product-owner merge cuts it by about a third.
|
|
|
|
## Terms
|
|
|
|
- **Pass:** one kind of review, run by one reviewer agent. The passes here are stability, product-owner, prose, architecture and principles.
|
|
- **Round:** one run of one pass on one change, archived with its report.
|
|
- **Archived finding:** a 🔴 (blocker) or 🟡 (should fix) that an archived round reported.
|
|
- **Recovered:** a replay's report raises an archived finding again, as 🔴 or 🟡.
|
|
- **New finding:** a 🔴 or 🟡 in a replay's report that matches no archived finding. New findings are counted only; nobody checked whether they are real.
|
|
- **Noise:** how much two runs of the same reviewer on the same round differ.
|
|
|
|
## Method
|
|
|
|
1. Pick archived round-1 review rounds where every pass under test ran on the same chunk.
|
|
2. Replay each round with review-replay's own functions, from `bin/review_replay/` and `bin/rung_replay/` in claude-config.
|
|
3. Each replay runs on Opus 5.5 at medium effort.
|
|
4. Each replay runs in a throwaway clone of the project at the reviewed commit.
|
|
5. Each replay gets a copy of the review folder holding only the reports written before the case's first round. So no variant sees another pass's findings.
|
|
6. The separate variant runs each reviewer unchanged, with the worker's archived brief.
|
|
7. The merged variant passes one agent through `--agents`. Its definition holds the full text of every reviewer it replaces, under a short preamble. The preamble asks for one report with one heading per pass. Its prompt joins the worker's archived briefs to each pass.
|
|
8. review-replay's matcher, on Opus 5.5 at medium, counts which archived findings each report recovers.
|
|
9. A second call on the same rung lists the report's new findings.
|
|
|
|
### The noise lesson
|
|
|
|
Two runs of the same separate reviewers on the same rounds differ a lot.
|
|
In candidate 1, run 1 recovered 47 of 77 findings and run 2 recovered 52.
|
|
Run 1 found 8 that run 2 missed, and run 2 found 13 that run 1 missed.
|
|
So one run per variant cannot tell a small loss from chance.
|
|
A verdict needs a noise figure: at least two runs of each variant.
|
|
Only a loss larger than the spread between runs counts.
|
|
|
|
### The reviewed-commit bug
|
|
|
|
review-replay must find the commit the archived reviewer read.
|
|
It took the first commit in `git log` order authored by the round's time.
|
|
A commit authored early but merged late, such as a dependency bump, then wins.
|
|
Two plainpages rounds would have been replayed at a commit older than their own base.
|
|
A log round would have been replayed at the wrong one of two commits sharing an author time.
|
|
|
|
The fix, in `driver.py` → `code_of`, takes the commit with the newest author time by then, with log order breaking ties.
|
|
Every trial here used the fix.
|
|
Archived replays made with the unfixed review-replay may have reviewed the wrong code.
|
|
|
|
## Samples
|
|
|
|
Candidates 1 and 4 use the same 6 chunks. The commit is the one each replay reviewed; the base is the default branch as the chunk began.
|
|
|
|
| Project | Chunk | Reviewed commit | Base |
|
|
|---|---|---|---|
|
|
| claude-config | item-230 | b37d03056c3277cd4a460c91cbbbaa025e7fd672 | 2a07feebecbb7b73ff692bfad9f6f5519423fb84 |
|
|
| plainpages | item-2 | dd39c7a07ad3e497792a645a0c94c4eb496db9e4 | 34dfbea156649fd54ff4ea17221d98d19d0d53df |
|
|
| plainpages | item-23 | 80070762e7337fbdd21a59ebce2cb75d98dcd2f6 | 01f368d663e9b66e2ba488de4b75d64559106b63 |
|
|
| fejkdata | item-223 | a3967a01956bb67d25a83caf8f9be45426cec837 | f40bdd0dcefc01b821feae72d86e70ad606d4c99 |
|
|
| log | item-7 | 08fe3562230affe87ca5aa4661f199831189de91 | 08e8945eaa182fcf06689337d8140ebf91b2a2e7 |
|
|
| adf-codec | item-45 | ca6016b4b6627159f369f3ce047ebb4d1727a95a | 9dfa14a095222c5b8fd4d4d435e2940720483feb |
|
|
|
|
Candidate 2 uses round 1 of the 5 release reviews where both the architect and the auditor ran.
|
|
|
|
| Project | Chunk | Reviewed commit | Base |
|
|
|---|---|---|---|
|
|
| adf-codec | release-review-0.3.0 | 8e6d7efff16f0df15892916549a7515d25b97886 | 27e8f33f30a46bfa7dc1bc52f6ca85d342ec4d2c |
|
|
| fejkdata | release-review-0.3.0 | 5e1c3464c2b8d39d7f989323b287b6a8eda0f02e | 453a020864f3e5aa5aca728a48faac9b553bea9c |
|
|
| fejkdata | release-review-0.4.0 | a5dd82ca691d9b4135f1c7fed8e97efb4076459b | 4cd2f6d8693091e6e710db9bf5ef7b58f83b89aa |
|
|
| plainpages-plugin-fastjira | release-review-0.2.0 | 3ffedfee6203a95053f12ef674b0ae69d903555b | 6345fc75fb24562e8a975eccae05a865d33fc003 |
|
|
| plainpages-plugin-fastjira | release-review-0.3.0 | 30a4a61b5bde493ce0d76d10dda281b94a14aad2 | 468d89c9186a6b4bad3bbd372e2e9035e47fc7b6 |
|
|
|
|
## Candidate 4: stability + product-owner, prose kept separate
|
|
|
|
Candidate 4 merges only the two passes that held up inside candidate 1's merge.
|
|
It uses candidate 1's 6 chunks, without their prose rounds.
|
|
They hold 43 archived findings: stability 27, product-owner 16. Two are 🔴, one per pass.
|
|
|
|
The separate figures reuse candidate 1's runs 1 and 2. Nothing was rerun for them.
|
|
Their stability and product-owner reports were matched again, against these 43 findings only.
|
|
So no prose report can recover a finding here, unlike candidate 1's figures.
|
|
The merged pair ran twice, so it has its own noise figure.
|
|
|
|
| | Separate, run 1 | Separate, run 2 | Merged, run 1 | Merged, run 2 |
|
|
|---|---|---|---|---|
|
|
| Recovered, both passes (of 43) | 20 | 28 | 20 | 17 |
|
|
| Stability (of 27) | 13 | 18 | 15 | 13 |
|
|
| **Product-owner (of 16)** | **7** | **10** | **5** | **4** |
|
|
| 🔴 recovered (of 2) | 0 | 2 | 2 | 2 |
|
|
| 🔴/🟡 written under stability | 19 | 19 | 19 | 16 |
|
|
| **🔴/🟡 written under product-owner** | **8** | **9** | **2** | **3** |
|
|
| New 🔴/🟡 | 6 | 6 | 4 | 4 |
|
|
| Cost | $12.28 | $12.76 | **$8.49** | **$8.04** |
|
|
| Tokens | 13.0M | 14.7M | 11.0M | 9.7M |
|
|
|
|
- Separate runs recover 20 to 28. Merged runs recover 17 to 20.
|
|
- Stability stays inside the noise: 13 to 18 separate, 13 to 15 merged.
|
|
- Product-owner does not: 7 to 10 separate, 4 to 5 merged. The ranges don't overlap.
|
|
- The merged reviewer writes about a third as many product-owner findings.
|
|
- The merged runs missed 12 to 14 of separate run 2's recoveries, half of them product-owner.
|
|
- Both merged runs recovered both 🔴. Separate run 1 recovered neither.
|
|
- The two merged runs differ by 9 and 6 findings each way, about as much as the separate runs.
|
|
- The separate runs' new-finding counts are candidate 1's, kept where they sit under stability or product-owner. They were counted against all 77 archived findings, not these 43.
|
|
|
|
**Verdict: unsafe.** Product-owner findings fall outside the noise in both merged runs. The sample is small, 16 product-owner findings. But the drop has the same shape as in candidates 1 and 2: the merged reviewer does the first brief's job and writes little for the second. The merge saves about a third of the cost, less than the half the larger merges saved.
|
|
|
|
## Candidate 1: stability + product-owner + prose
|
|
|
|
The 6 chunks hold 77 archived findings: stability 27, product-owner 16, prose 34. Four are 🔴.
|
|
|
|
| | Separate, run 1 | Separate, run 2 | Merged |
|
|
|---|---|---|---|
|
|
| Recovered, all (of 77) | 47 | 52 | 45 |
|
|
| Stability (of 27) | 15 | 19 | 20 |
|
|
| Product-owner (of 16) | 9 | 11 | 10 |
|
|
| **Prose (of 34)** | **23** | **22** | **15** |
|
|
| 🔴 recovered (of 4) | 2 | 4 | 4 |
|
|
| 🔴/🟡 written under prose | 29 | 24 | **9** |
|
|
| New 🔴/🟡 | 11 | 12 | 11 |
|
|
| Cost | $17.03 | $17.14 | **$9.77** |
|
|
| Tokens | 15.8M | 17.5M | 12.9M |
|
|
|
|
- The merged reviewer missed 14 of run 1's recoveries, 12 of them prose.
|
|
- It missed 16 of run 2's recoveries, 11 of them prose.
|
|
- Stability and product-owner stayed inside the noise.
|
|
|
|
**Verdict: unsafe.** The totals sit inside the noise, but the prose loss is systematic. The merged reviewer wrote about a third as many prose findings.
|
|
|
|
The recovery figures here match each archived finding against all three reports together. A report of one pass can recover another pass's finding.
|
|
|
|
## Candidate 2: systems-architect + principles-auditor
|
|
|
|
The 5 release reviews hold 64 archived findings: architecture 47, principles 17. Four are 🔴, two per pass.
|
|
|
|
| | Separate | Merged |
|
|
|---|---|---|
|
|
| Recovered, all (of 64) | 36 | 31 |
|
|
| Architecture (of 47) | 26 | 26 |
|
|
| **Principles (of 17)** | **10** | **5** |
|
|
| 🔴 recovered (of 4) | 3 | 1 |
|
|
| 🔴/🟡 written under principles | 34 | **10** |
|
|
| New 🔴/🟡 | 23 (4 🔴) | 20 (1 🔴) |
|
|
| Cost | $29.40 | **$15.62** |
|
|
| Tokens | 41.6M | 20.7M |
|
|
|
|
- The merged reviewer lost both principles 🔴.
|
|
- Every variant reviewed the architect's round-1 commit. The archived auditor read later code, after the architect's fixes. This affects both variants equally.
|
|
- Two rounds' file lists were regenerated from the clone. Their places lists were not archived.
|
|
- There is no noise run, because the budget did not allow one.
|
|
|
|
**Verdict: unsafe.** The merged reviewer acts like an architect that audits a little. The drop has the same shape and size as candidate 1's prose drop.
|
|
|
|
## Candidate 3: override-reviewer folded into stability
|
|
|
|
The archive holds 38 override-reviewer runs. None has a 🔴 or 🟡, so there is nothing to recover. Nothing was replayed.
|
|
|
|
**Verdict: no data.**
|
|
|
|
## Cost
|
|
|
|
All costs are at list prices, as Claude Code reports them.
|
|
|
|
| Trial | Reviewer replays | Matching |
|
|
|---|---|---|
|
|
| Candidates 1 and 2, with candidate 1's noise run | about $89 | about $5 |
|
|
| Candidate 4, two merged runs | $16.53 | about $6 |
|
|
|
|
Candidate 4 reused candidate 1's separate replays, so its separate figures cost only their matching.
|
|
Each match and new-finding count costs about $0.30 on Opus 5.5 at medium.
|
|
|
|
## How to rerun
|
|
|
|
All scripts sit in this folder. They import review-replay from `~/code/claude-config/bin`, and run on the host's Python.
|
|
|
|
1. `collect.py` reads loop-claude's archive and writes every archived reviewer round to `runs.pkl`.
|
|
2. `mkcases1.py` writes `cases-wave3.json`, candidate 1's cases. `cases-release.json` holds candidate 2's.
|
|
3. `build_agents.py` writes candidate 1's and 2's merged agents, `agents-wave3.json` and `agents-release.json`, from `~/.claude/agents/`.
|
|
4. `build_pair.py` writes candidate 4's merged agent, `agents-pair.json`, from candidate 1's brief texts. It also writes `cases-pair.json`: candidate 1's cases without the prose round.
|
|
5. `driver.py <candidate> <sep|merged> <run>` replays one variant. Candidates are `wave3`, `release` and `pair`. `AT_ONCE` sets how many replays run at once, 4 by default. Results land in `results/<candidate>/<variant>-<run>/`.
|
|
6. `analyze.py <candidate> <variant>-<run>...` matches each report and counts new findings. `analyze_metered.py` does the same and prints what the matching cost. With `BASELINE=wave3` it reuses that candidate's new-finding counts instead of counting again.
|
|
7. `summarize.py <candidate> <variant>-<run>...` prints the tables' figures. `counts.py` counts the findings each report wrote, per pass.
|
|
8. `shas.py <candidate>...` prints each case's reviewed commit and base.
|
|
|
|
A replay or match that exists on disk is not rerun. Delete its file to run it again.
|