-
Notifications
You must be signed in to change notification settings - Fork 5
Fix: Filter editorial suggestions to only changed lines in PR #1094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes HTTP 422 "Line could not be resolved" errors when posting review comments. The script now: - Fetches PR diff to identify changed lines - Filters suggestions to only lines in the diff - Posts friendly message if all suggestions are on unchanged lines - Shows filtering stats in logs (e.g., "5 of 48 suggestions apply") This prevents agents from suggesting changes on lines outside the PR's diff, which GitHub API rejects. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
✅ Deploy Preview for seqera-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Enhances the editorial review to show ALL issues found, not just those on changed lines: INLINE SUGGESTIONS (with one-click fix): - Posted on lines in the PR diff - Users can click "Commit suggestion" to apply ADDITIONAL ISSUES COMMENT (for awareness): - Lists issues found on unchanged lines - Grouped by file with line numbers - Suggests fixing in follow-up PR EXAMPLE OUTPUT: ## Additional Issues Found in Unchanged Lines I found 12 additional issues in unchanged lines... ### `quickstart.md` - Line 42: Use active voice instead of passive - Line 150: Remove hedging language ### `aws-batch.md` - Line 200: Use "you" instead of "the user" This ensures: - No issues are hidden from reviewers - Users know about ALL problems in their files - GitHub API limitations don't prevent visibility - Clear UX: clickable fixes vs awareness items Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes HTTP 422 errors ("Line could not be resolved") in the editorial review workflow by filtering suggestions to only include lines that are actually in the PR diff. The solution implements a hybrid approach: posting inline suggestions for changed lines with one-click fixes, and posting a separate comment listing issues found on unchanged lines.
Changes:
- Added diff parsing logic to identify which lines are in the PR diff
- Added filtering to separate suggestions into postable inline comments and additional issues
- Added generation of a summary comment for issues found on unchanged lines
Comments suppressed due to low confidence (1)
.github/scripts/post-inline-suggestions.sh:174
- This check is redundant and represents dead code. At line 162-166, if
filtered_commentsequals"[]", the function returns early. Line 169 assignsfiltered_commentstocomments, socommentscan never be"[]"at line 171. Consider removing this redundant check.
if [[ "$comments" == "[]" ]]; then
echo "No suggestions to post"
return 0
fi
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Fix: Filter inline suggestions to only changed lines in PR Fixes HTTP 422 "Line could not be resolved" errors when posting review comments. The script now: - Fetches PR diff to identify changed lines - Filters suggestions to only lines in the diff - Posts friendly message if all suggestions are on unchanged lines - Shows filtering stats in logs (e.g., "5 of 48 suggestions apply") This prevents agents from suggesting changes on lines outside the PR's diff, which GitHub API rejects. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * feat: Post summary of issues found on unchanged lines Enhances the editorial review to show ALL issues found, not just those on changed lines: INLINE SUGGESTIONS (with one-click fix): - Posted on lines in the PR diff - Users can click "Commit suggestion" to apply ADDITIONAL ISSUES COMMENT (for awareness): - Lists issues found on unchanged lines - Grouped by file with line numbers - Suggests fixing in follow-up PR EXAMPLE OUTPUT: ## Additional Issues Found in Unchanged Lines I found 12 additional issues in unchanged lines... ### `quickstart.md` - Line 42: Use active voice instead of passive - Line 150: Remove hedging language ### `aws-batch.md` - Line 200: Use "you" instead of "the user" This ensures: - No issues are hidden from reviewers - Users know about ALL problems in their files - GitHub API limitations don't prevent visibility - Clear UX: clickable fixes vs awareness items Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Problem
The editorial review workflow was failing with HTTP 422 errors: "Line could not be resolved" (×48 in recent runs).
Root cause: Agents review entire files and generate suggestions on all lines, but GitHub's PR review API only accepts comments on lines that are actually in the PR diff. When agents suggest changes on unchanged lines, GitHub rejects them with 422 errors.
Solution: Hybrid Approach
Modified
post-inline-suggestions.shto:✅ Inline Suggestions (One-Click Fix)
✅ Additional Issues Comment (For Awareness)
Example Output
Inline Review (on changed lines):
Additional Issues (on unchanged lines):
Benefits
Changes
.github/scripts/post-inline-suggestions.shExpected Behavior
Before (broken):
After (fixed):
Testing
Related: #953 (will automatically pick up this fix after merge)