Skip to content

Conversation

@justinegeffen
Copy link
Contributor

@justinegeffen justinegeffen commented Jan 30, 2026

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.sh to:

✅ Inline Suggestions (One-Click Fix)

  1. Fetch PR diff to identify which lines are in the changed files
  2. Filter suggestions to only lines visible in the PR
  3. Post inline suggestions with "Commit suggestion" button

✅ Additional Issues Comment (For Awareness)

  1. Collect filtered-out suggestions (issues on unchanged lines)
  2. Post separate comment listing all other issues found
  3. Group by file with line numbers for easy reference

Example Output

Inline Review (on changed lines):

## 📝 Editorial Review with Inline Suggestions

I've reviewed the documentation and found areas for improvement.
Click **Commit suggestion** on each inline comment to apply the fix.

[3 inline comments with one-click fixes]

Additional Issues (on unchanged lines):

## 📋 Additional Issues Found in Unchanged Lines

I found 12 additional issues in unchanged lines of the files you modified.
Consider fixing them in a follow-up:

### `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"

💡 Tip: These issues are in code outside the PR diff.

Benefits

  • No 422 errors - only valid suggestions posted inline
  • Nothing hidden - all issues visible to reviewers
  • Best UX - one-click fixes where possible, awareness elsewhere
  • Comprehensive - agents still review entire files
  • No wasted work - all findings are surfaced

Changes

  • Modified: .github/scripts/post-inline-suggestions.sh
    • Lines 129-174: Filtering logic with dual tracking
    • Lines 197-235: Additional issues summary comment

Expected Behavior

Before (broken):

gh: Unprocessable Entity (HTTP 422)
Line could not be resolved × 48
Error: Process completed with exit code 1

After (fixed):

Filtered suggestions: 3 postable inline, 45 on unchanged lines
✅ Posted review with 3 inline suggestions
📋 Posting 45 additional issues found on unchanged lines
✅ Posted additional issues summary

Testing

  • ✅ Bash syntax validated locally
  • ✅ Script uses bash 4+ associative arrays (available in GitHub Actions)
  • ⏳ Will test on PR Update to AWS Batch docs #953 after merge

Related: #953 (will automatically pick up this fix after merge)

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>
@netlify
Copy link

netlify bot commented Jan 30, 2026

Deploy Preview for seqera-docs ready!

Name Link
🔨 Latest commit 47d668c
🔍 Latest deploy log https://app.netlify.com/projects/seqera-docs/deploys/6980aec025f3af0008e3357c
😎 Deploy Preview https://deploy-preview-1094--seqera-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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>
@justinegeffen justinegeffen added the 1. Editor review Needs a language review label Jan 31, 2026
@justinegeffen justinegeffen added automation-fix Automation bug fix. automation-improvement Automation enhancement for existing automation that's working but could be better. claude-code-assisted Vibe-coded but with human oversight and guidance. Must be validated by another human and co-pilot. labels Jan 31, 2026
Copy link
Contributor

Copilot AI left a 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_comments equals "[]", the function returns early. Line 169 assigns filtered_comments to comments, so comments can 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.

@justinegeffen justinegeffen added 2. Reviews complete Reviews complete. Remove label when confirmed in prod. and removed 1. Editor review Needs a language review labels Feb 2, 2026
@justinegeffen justinegeffen merged commit b963ce1 into master Feb 2, 2026
7 checks passed
@justinegeffen justinegeffen deleted the justine/editorial-v3 branch February 2, 2026 16:01
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 <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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. Reviews complete Reviews complete. Remove label when confirmed in prod. automation-fix Automation bug fix. automation-improvement Automation enhancement for existing automation that's working but could be better. claude-code-assisted Vibe-coded but with human oversight and guidance. Must be validated by another human and co-pilot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants