feat(#788): minimize stale inline review comments on re-review - #820
feat(#788): minimize stale inline review comments on re-review#820fullsend-ai-coder[bot] wants to merge 2 commits into
Conversation
Before this change, when the review agent re-reviewed a PR, inline
comments from prior runs accumulated in the diff view. The sticky
comment handled history correctly (collapsing old runs into <details>
blocks), and formal review bodies were minimized, but inline review
comments — what developers actually see on each code line — were
never cleaned up between runs.
Add ListPullRequestReviewComments to the forge.Client interface to
retrieve existing inline comments on a PR. On re-review, the new
minimizeStaleInlineComments function finds all inline comments posted
by the bot and minimizes them as OUTDATED before posting the current
run's findings. This mirrors the existing minimizeStaleReviews pattern
for review bodies.
Changes:
- forge.go: add PullRequestReviewComment struct and
ListPullRequestReviewComments to Client interface
- github.go: implement using GET /pulls/{number}/comments with
pagination
- gitlab/mr.go: return ErrNotSupported (GitLab has no comment
minimize feature)
- fake.go: add PRReviewComments field and method implementation
- postreview.go: add minimizeStaleInlineComments(), call it from
submitFormalReview after minimizing stale review bodies
- postreview_test.go: add tests for the new function including
own-comments-only filtering, error tolerance, ErrNotSupported
silent skip, and full integration with submitFormalReview
Closes #788
|
🤖 Finished Review · ✅ Success · Started 3:06 AM UTC · Completed 3:16 AM UTC |
ReviewFindingsLow
Previous runLooks good to me. Clean implementation that follows existing patterns ( Minor observationsLow
Labels: PR adds forge interface method and post-review behavior for inline comment management |
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 6:48 AM UTC · Completed 6:54 AM UTC |
Move minimizeStaleInlineComments outside the ListPullRequestReviews- dependent else block so it runs independently. The function makes its own ListPullRequestReviewComments call and does not need the reviews variable — a transient ListPullRequestReviews failure should not prevent inline comment cleanup. Addresses review feedback on #820
🔧 Fix agent — iteration 1 (human-triggered)Addressed 1 actionable finding (unnecessary-coupling) by restructuring the if-else chain so minimizeStaleInlineComments runs independently of ListPullRequestReviews success. The second finding (interface-extension) was observational with no action required. Fixed (1):
Disagreed (1):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 6:59 AM UTC · Completed 7:12 AM UTC |
| var out bytes.Buffer | ||
| printer := ui.New(&out) | ||
| minimizeStaleInlineComments(context.Background(), fc, "acme", "repo", 1, "fullsend-bot", printer) | ||
|
|
There was a problem hiding this comment.
[low] test-adequacy
TestMinimizeStaleInlineComments_MinimizeErrorIsNonFatal asserts the warning string appears in output but does not verify both comments were attempted. The FakeClient's error injection returns the same error for every MinimizeComment call without recording it, so MinimizedComments is empty. The test cannot distinguish 'loop continued after first error' from 'loop stopped after first error.'
Suggested fix: Assert both node IDs (PRC_1 and PRC_2) appear in the warning output to confirm both minimize attempts were made.
|
|
||
| // minimizeStaleInlineComments finds all inline review comments posted | ||
| // by the given user on the PR and minimizes them. This prevents | ||
| // duplicate inline comments from accumulating across re-review runs. |
There was a problem hiding this comment.
[low] error-handling-consistency
minimizeStaleInlineComments checks forge.IsNotSupported(err) to silently skip on GitLab, but the existing ListPullRequestReviews error handler (line 316) does not distinguish error types. The IsNotSupported check is well-motivated here but the same argument applies to ListPullRequestReviews.
Suggested fix: Consider aligning both error handling patterns, either by adding IsNotSupported to ListPullRequestReviews or documenting why the difference is intentional.
|
This pull request has been automatically marked as stale because it has not had any activity in the last month. It will be closed in 2 weeks if no further activity occurs. Remove the |
Summary
Minimize stale inline review comments on re-review to prevent duplicate inline comments from accumulating across review runs. The sticky comment already preserves full review history, so minimizing prior inline comments loses no information.
Related Issue
Closes #788
Changes
PullRequestReviewCommentstruct andListPullRequestReviewCommentsmethod to theforge.ClientinterfaceGET /repos/{owner}/{repo}/pulls/{number}/commentswith paginationErrNotSupported(no comment minimize feature)minimizeStaleInlineComments()inpostreview.go— finds all inline comments posted by the bot user and minimizes them as OUTDATED before posting new findingssubmitFormalReview()after minimizing stale review bodies, following the existing patternErrNotSupportedsilent skip, and fullsubmitFormalReviewintegrationTesting
go vet ./...passesCloses #788
Post-script verification
agent/788-dedup-inline-review-comments)ba77dbdbbd17e9bb18c47bf6efa023c98b697158..HEAD)