-
Notifications
You must be signed in to change notification settings - Fork 132
[bot] suggestion diffs silently remove correct code (recurring) #1607
Description
Problem
Bot-generated GitHub suggestion blocks sometimes propose diffs that remove substantially more content than they add, meaning committing the suggestion would silently delete correct code. This is a recurring pattern across multiple PRs.
Known cases
-
pr-review: multi-line suggestion removes correct code along with the bug #1310 — PR Adds simplified install scripts #1309: suggestion to fix a PowerShell syntax error covered too many lines (
start_line: 18, line: 22) and would have removed the legitimategit-wtfallback branch along with the duplicate. -
pr-review: suggestion block eats code fence markers when target range includes backtick lines #1326 — PR fix(skill): add retry guard to prevent intra-run duplicate reviews #1322: suggestion anchored on lines 289–291 included a closing
```fence marker, which GitHub's suggestion syntax consumed as its own delimiter — applying it would break the markdown. -
fix: add confidence gates and evidence accumulation to review-reviewers #1598 (comment) — self-review suggestion to replace the "Reading historical evidence" + "Recording below-threshold findings" sections. The removed section was much larger than the added section, and committing the suggestion would have deleted the
gh issue viewcode block and surrounding instructions.
Pattern
The common thread: the bot constructs a suggestion block whose line range covers more content than it intends to replace. The replacement text is shorter, so the net effect is silent deletion of correct code.
This may be caused by:
- Incorrect
start_line/linerange calculation when the target spans multiple sections - Not accounting for GitHub's suggestion semantics (the suggestion replaces the entire range)
- Mixing "what to add" with "what to remove" without verifying the full replacement
Desired behavior
When proposing a suggestion, the bot should verify that the removed content and added content are semantically equivalent — i.e., the suggestion should not silently drop lines that aren't being intentionally replaced.