What happened
On June 22, 2026, two consecutive review runs for PR #625 failed with GitHub API 422 errors when submitting inline review comments. Run 27981425941 logged 2 inline comment(s) omitted (file not in PR diff) and 1 finding(s) posted as file-level comment(s) (line outside diff hunk) — indicating the existing filtering logic ran — but the API call still returned 422. Run 27982865970 hit the identical failure on retry. The post-review step treated the 422 as fatal, so no review was posted for either run, wasting two full agent invocations.
What could go better
Issue #1067 tracks this failure mode, and issue #1349 claims PR #1348 already fixed it by adding diff-hunk header validation in findingsToReviewComments (internal/cli/postreview.go). However, the June 22 failures prove the fix is incomplete — there are edge cases where inline comments still reference positions GitHub cannot resolve. Likely scenarios: (a) the hunk-header parser does not handle all diff formats (e.g., combined diffs, renamed files, binary files), (b) GitHub's position model differs from what the validator computes (GitHub uses a relative position within the hunk, not an absolute line number), or (c) multi-line comment ranges span hunk boundaries. Confidence: high that this is a regression or gap in PR #1348's fix, based on log evidence showing the filter ran but didn't prevent the 422.
Proposed change
In internal/cli/postreview.go (the findingsToReviewComments function and the review submission path), add a fallback: when CreatePullRequestReview returns 422, retry the submission without inline comments by embedding all findings as markdown in the review body. This ensures the review verdict and findings are always posted even if position validation fails. Additionally, add structured error logging that captures which specific inline comment triggered the 422 (GitHub's error response includes details about invalid parameters) to make future debugging easier. Finally, reopen or update issue #1067 with the June 22 failure evidence, since issue #1349's claim that it was fixed is contradicted by this recurrence.
Validation criteria
After the fix: (1) review runs that encounter 422 errors on inline comment submission should degrade gracefully by posting the review body with findings in markdown, rather than failing the entire run. (2) The next 10 review runs across the org that produce out-of-diff findings should all post reviews successfully (zero 422-induced run failures). (3) Structured logs should capture the specific comment that caused the 422 when it occurs.
Generated by retro agent from #625
What happened
On June 22, 2026, two consecutive review runs for PR #625 failed with GitHub API 422 errors when submitting inline review comments. Run 27981425941 logged
2 inline comment(s) omitted (file not in PR diff)and1 finding(s) posted as file-level comment(s) (line outside diff hunk)— indicating the existing filtering logic ran — but the API call still returned 422. Run 27982865970 hit the identical failure on retry. Thepost-reviewstep treated the 422 as fatal, so no review was posted for either run, wasting two full agent invocations.What could go better
Issue #1067 tracks this failure mode, and issue #1349 claims PR #1348 already fixed it by adding diff-hunk header validation in
findingsToReviewComments(internal/cli/postreview.go). However, the June 22 failures prove the fix is incomplete — there are edge cases where inline comments still reference positions GitHub cannot resolve. Likely scenarios: (a) the hunk-header parser does not handle all diff formats (e.g., combined diffs, renamed files, binary files), (b) GitHub's position model differs from what the validator computes (GitHub uses a relative position within the hunk, not an absolute line number), or (c) multi-line comment ranges span hunk boundaries. Confidence: high that this is a regression or gap in PR #1348's fix, based on log evidence showing the filter ran but didn't prevent the 422.Proposed change
In
internal/cli/postreview.go(thefindingsToReviewCommentsfunction and the review submission path), add a fallback: whenCreatePullRequestReviewreturns 422, retry the submission without inline comments by embedding all findings as markdown in the review body. This ensures the review verdict and findings are always posted even if position validation fails. Additionally, add structured error logging that captures which specific inline comment triggered the 422 (GitHub's error response includes details about invalid parameters) to make future debugging easier. Finally, reopen or update issue #1067 with the June 22 failure evidence, since issue #1349's claim that it was fixed is contradicted by this recurrence.Validation criteria
After the fix: (1) review runs that encounter 422 errors on inline comment submission should degrade gracefully by posting the review body with findings in markdown, rather than failing the entire run. (2) The next 10 review runs across the org that produce out-of-diff findings should all post reviews successfully (zero 422-induced run failures). (3) Structured logs should capture the specific comment that caused the 422 when it occurs.
Generated by retro agent from #625