Stop the reviewer re-posting inline findings it already delivered - #122
Closed
FeliLucero1 wants to merge 1 commit into
Closed
FeliLucero1 wants to merge 1 commit into
FeliLucero1 wants to merge 1 commit into
Conversation
The review prompt tells the model to skip issues already raised in an inline review comment, but nothing ever gave it those comments. fetch-pr-context.py builds existing_findings by scanning bot summary comments for lines starting with "- " that contain backticks; inline threads are never collected. So an open inline finding on unchanged code was invisible to the next run and got posted again, verbatim. On ConductorOne/baton-admin#928 that produced 19 inline comments for 11 distinct findings: after each push the reviewer re-posted every still-open finding byte-for-byte, burying the ones that were actually new. resolve-outdated-threads.py already fetches every thread with its path, line, bodies, authors and resolution state, and throws all of it away except the outdated ones it resolves. It now also writes open_findings and settled_findings, and the prompt's Step 3 and Step 6 dedup against them. A finding whose thread has a human reply is marked so the reviewer leaves it alone entirely. Step 3 says where a still-relevant repeat belongs instead: one line in the summary, not a second inline copy. Auto-resolution behavior is unchanged; tests cover that it did not widen. Also wire the pr-review script tests into make test-scripts. Both existing test files were run by nothing -- not the Makefile, not any workflow. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
base-pr-review.mdStep 6 tells the model to "skip any issue that was already raised in an existing PR comment or inline review comment". Nothing ever gave it the inline ones.fetch-pr-context.pybuildsexisting_findingsby scanning the bot's summary comments for lines starting with-that contain a backtick (L576-L582). Inline review threads are never collected. So an open inline finding on unchanged code is invisible to the next run, and gets posted again — byte for byte.resolve-outdated-threads.pydoes not cover the gap either: it only auto-resolves threads GitHub marksisOutdatedwhose commenters are all bots. A current thread stays open and unrecorded, and once anyone replies it is permanently disqualified from auto-resolution too.Measured
On ConductorOne/baton-admin#928, six pushes over about 25 minutes produced 19 inline comments for 11 distinct findings. I diffed four of the suspected duplicate pairs and all four were byte-identical re-posts. The 8 duplicates buried the genuinely new findings — which were real, and one of them was a production bug.
The fix
resolve-outdated-threads.pyalready fetches every thread withpath,line,isResolved,isOutdated, comment bodies and authors, then discards all of it except the outdated ones it resolves. It now also writes two buckets into.github/resolved-threads.json:open_findings— reviewer findings still open. Each carriespath,line, a truncatedbody, andhas_human_reply.settled_findings— findings now resolved, whether by this run or by a human. (A human resolving a thread was the other invisible case: nothing recorded it.)Bodies are capped at 600 chars and each bucket at 60 entries, with
findings_truncatedset so the model knows to be conservative when it is capped.The prompt then uses them:
has_human_reply: trueis off limits entirely — it has been discussed, so the summary is the only place to revisit it.No new API calls: this is data the script already had in memory.
Not changed
Auto-resolution behavior.
should_resolveis untouched, and there are tests asserting it did not widen — in particular that a thread with a human reply still never auto-resolves.Testing
New
test_resolve_outdated_threads.py, 14 cases overis_bot_finding_thread,finding_digestand the unchangedshould_resolve.While writing it I found that neither existing test file in this directory is run by anything — not
make test-scripts, not any workflow.make test-scriptsnow runs the suite.(
make test-scriptsin full needsyq, which I do not have locally; the step that fails istest-release-workflow-tag-pin.sh, unrelated to this change.)Related
ci-review.mdso CI and local reviewers stop contradicting each other.🤖 Generated with Claude Code