fix: filter inline review comments to files in the PR diff - #1040
Merged
Conversation
The review agent can flag findings in files not changed by the PR (e.g. stale docs). When these are posted as inline review comments, GitHub returns 422 Unprocessable Entity because the API only allows comments on files in the diff. Fetch the PR's changed files before submitting the review and drop inline comments that reference files outside the diff. The findings still appear in the sticky comment body, so nothing is lost. Fixes the 422 failure seen in fullsend-ai/.fullsend run 25942695364 where docs-currency findings targeted docs files outside PR #1035's diff. Signed-off-by: Wayne Sun <gsun@redhat.com>
Site previewPreview: https://3d95a784-site.fullsend-ai.workers.dev Commit: |
ReviewFindingsNo findings. Previous runReviewFindingsNo findings. Previous run (2)ReviewFindingsLow
Info
Previous run (3)ReviewFindingsNo findings. |
Add TestSubmitFormalReview_FiltersByPRFiles to verify the full pipeline (ListPullRequestFiles → build diffFiles map → filter → submit review) excludes inline comments on files not in the PR diff. Add TestSubmitFormalReview_ListPRFilesErrorFallsBack to verify graceful degradation when the file list API fails — all comments pass through unfiltered. Include the actual error in the degradation log message for debugging. Signed-off-by: Wayne Sun <gsun@redhat.com>
Review follow-upsCreated follow-up issues for actionable non-blocking review findings:
|
rh-hemartin
reviewed
May 18, 2026
rh-hemartin
approved these changes
May 18, 2026
Log a StepWarn with the count of filtered findings so CI logs show when agents are generating comments on files outside the PR diff. Signed-off-by: Wayne Sun <gsun@redhat.com>
Eliminates the second O(n) pass over findings to compute the warning count. The function now returns ([]ReviewComment, int) where int is the number of findings dropped because their file was not in the PR diff, removing the coupling between the warning logic and the function's internal filter criteria. Also: - Log a StepInfo when the PR file list is empty (non-error empty slice), so operators can see when filtering is silently disabled - Add a doc comment to ListPullRequestFiles in the forge.Client interface - Note GitHub's 3000-file cap in the LiveClient implementation - Add TestSubmitFormalReview_EmptyPRFileListFallsBack - Update TestFindingsToReviewComments* to assert filtered counts Signed-off-by: Wayne Sun <gsun@redhat.com>
This was referenced Jun 23, 2026
4 tasks
6 tasks
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.
Summary
ListPullRequestFilesto the forge client interface to fetch the changed file list from a PRsubmitFormalReviewto only include files present in the PR diffRoot cause: The review agent flagged docs-currency findings in
docs/guides/admin/installation.mdanddocs/ADRs/0033-per-repo-installation-mdfor PR #1035, but those files weren't changed by the PR. Whenfullsend post-reviewtried to submit them as inline review comments, GitHub returned422 Unprocessable Entitybecause the API only allows inline comments on files in the diff.Run: https://github.com/fullsend-ai/.fullsend/actions/runs/25942695364/job/76263838470
Test plan
go vet ./internal/cli/ ./internal/forge/...— cleango test ./internal/cli/— all pass, including newTestFindingsToReviewComments_FiltersByDiffFilesgo test ./internal/forge/...— all passmake lint— clean