Fix: Filter editorial suggestions to only changed lines in PR#1094
Merged
justinegeffen merged 3 commits intomasterfrom Feb 2, 2026
Merged
Fix: Filter editorial suggestions to only changed lines in PR#1094justinegeffen merged 3 commits intomasterfrom
justinegeffen merged 3 commits intomasterfrom
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 <[email protected]>
✅ 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 <[email protected]>
Contributor
There was a problem hiding this comment.
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.
christopher-hakkaart
approved these changes
Feb 2, 2026
bebosudo
pushed a commit
that referenced
this pull request
Feb 3, 2026
* 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 <[email protected]> * 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 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.5 <[email protected]>
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.
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)