Skip to content

Require inline review comments to anchor to changed lines#38

Merged
benlangfeld merged 1 commit intomainfrom
prompt-anchor-comments-to-diff
Apr 29, 2026
Merged

Require inline review comments to anchor to changed lines#38
benlangfeld merged 1 commit intomainfrom
prompt-anchor-comments-to-diff

Conversation

@jonwmarshall
Copy link
Copy Markdown
Contributor

Summary

  • A recent run on powerhome/nitro-web#58167 failed with a GitHub 422 because the reviewer placed an inline comment on components/nitro_theme/app/views/shared/_call_recording_player_modal.html.erb — a file that exists in the repo but is not part of the PR diff. GitHub rejects review comments on lines not in the diff, which drops the entire review.
  • Adds an "Anchoring comments to the diff" section to the review prompt instructing the reviewer to anchor inline comments to a changed line, reference unmodified files in the comment body when needed, or move the observation to the top-level summary if no changed line is a natural anchor.

Test plan

  • Next agentic review run posts successfully without 422s when the model wants to comment on collateral/unmodified files.

🤖 Generated with Claude Code

Previously the reviewer could attach a comment to any path it deemed
relevant, including files not in the PR diff. GitHub rejects such
comments with HTTP 422, which drops the entire review. Tell the
reviewer to anchor to a changed line and reference unmodified files in
the comment body, or fold the observation into the top-level summary.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@jonwmarshall jonwmarshall requested a review from a team as a code owner April 27, 2026 21:53
@benlangfeld benlangfeld merged commit 51b2885 into main Apr 29, 2026
4 checks passed
@benlangfeld benlangfeld deleted the prompt-anchor-comments-to-diff branch April 29, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants