Skip to content

[bot] suggestion diffs silently remove correct code (recurring) #1607

@worktrunk-bot

Description

@worktrunk-bot

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

  1. 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 legitimate git-wt fallback branch along with the duplicate.

  2. 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.

  3. 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 view code 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 / line range 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude-behaviorIssues with Claude CI bot behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions