Skip to content

feat: a script re-prepares a pull request with another model and compares the findings with the bundle it has - #100

Merged
fiddur merged 3 commits into
developfrom
feat/93-compare-script
Sep 7, 2026
Merged

feat: a script re-prepares a pull request with another model and compares the findings with the bundle it has#100
fiddur merged 3 commits into
developfrom
feat/93-compare-script

Conversation

@fiddur

@fiddur fiddur commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

scripts/inbox-compare.ts <owner/repo#n> [--head sha] [--model m] [--effort e] measures a
candidate drafter against what the inbox already found, so agent.model is decided on findings
rather than on price.

It takes the newest bundle for the pull request under ~/.diffity/inbox/bundles as the baseline,
prepares the same head again through preparePr with the candidate settings (no filter, no
validate pass, no MCP), and prints a markdown table: per severity how many baseline findings were
reproduced and how many candidate findings are new, plus the run's cost, minutes, turns and output
tokens. A finding counts as reproduced on the same file with an overlapping line range, a one-line
finding taken as its line ±2. --json prints the same numbers; --out writes the markdown.

The worktree and every diffity data directory the run uses live under a fresh temp directory
(--scratch to name it), so nothing is written into ~/.diffity and a running daemon is
undisturbed. A worktree can only be cut at whatever refs/pull/<n>/head points at, so the script
asks for that head first and refuses — before spending an agent run — when the pull request has
moved past the baseline. Exit 0 on a comparison, 2 on a candidate that skipped or failed, 1 on a
usage error.

development.md gains a section on reading the table, including the caveat that the baseline
bundles were prepared by the old pipeline (reviewer's settings, skills and MCP loaded, toolchain
runs allowed), so a difference is prompt and model.

Verified: 34 new unit tests over the pure parts (argument parsing, newest-bundle selection, the
±2 matching and the tallies, general and dismissed threads excluded, the markdown and the JSON
shape); the whole scripts/ directory is now typechecked, which is wired into npm run typecheck;
full npm test green. The script's pre-agent paths were exercised against a throwaway local clone
— usage errors, missing clone, missing bundle, and the moved-head refusal — and the rendering
against the real 14550 and 14493 bundles. The comparison itself has not been run: each run spends
real agent time, and that is the reviewer's call after this merges.

Part of #93

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w

fiddur and others added 3 commits September 7, 2026 21:04
…ares the findings with the bundle it has

`scripts/inbox-compare.ts <owner/repo#n> [--model m] [--effort e]` takes the newest bundle the
inbox has for a pull request as the baseline, prepares the same head again with the candidate
settings, and prints a markdown table of what was reproduced, what is new, and what the run spent.

The candidate gets its own scratch worktree and diffity data directory under a temp directory, so
nothing is written into ~/.diffity and a running daemon is undisturbed. A worktree can only be cut
at whatever refs/pull/<n>/head points at, so the script asks for that head before spending an
agent run and refuses when the pull request has moved past the baseline.

The scripts directory is now typechecked too, which is what keeps this one honest.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
A worktree is not limited to whatever refs/pull/<n>/head points at now: an earlier head of the
pull request is usually an ancestor of the current one, and the forge serves any commit reachable
from an advertised ref by sha. `prepareWorktree` takes an optional pinHead and checks that commit
out — present already, fetched by sha, or refused as force-pushed away — and `preparePr` passes it
through from PrepareOpts. The daemon sets neither and behaves exactly as before.

The compare script pins the baseline's head and drops the pre-flight refusal, so the six bundles
on this machine whose pull requests have moved on are comparable again — including #14550, one of
the two P1-in-a-tiny-diff cases the adoption gate needs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
@fiddur
fiddur marked this pull request as ready for review September 7, 2026 19:18
@fiddur
fiddur merged commit 634cde1 into develop Sep 7, 2026
2 checks passed
@fiddur
fiddur deleted the feat/93-compare-script branch September 7, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant