From 08994c52a8296754e18dd907c6ea148c916f8e2f Mon Sep 17 00:00:00 2001 From: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:03:28 +0000 Subject: [PATCH] fix(review-pr): add verification checklist for multi-line suggestions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bot was generating suggestion blocks with over-wide line ranges, silently deleting correct code when applied. Root cause: the existing "minimize the range" instruction was too vague — the bot didn't verify that every line in the range was accounted for in the replacement. Adds concrete pre-posting checks: read the exact lines, verify no silent deletions, cap range at ~10 lines, and avoid spanning markdown fences. Fixes #1607 Co-Authored-By: Claude Opus 4.6 --- .claude/skills/review-pr/SKILL.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.claude/skills/review-pr/SKILL.md b/.claude/skills/review-pr/SKILL.md index c529ce2aa7..f3844fb9ed 100644 --- a/.claude/skills/review-pr/SKILL.md +++ b/.claude/skills/review-pr/SKILL.md @@ -276,8 +276,22 @@ array indices to object keys, which GitHub rejects. - If a review has both suggestions and prose observations, put the suggestions as inline comments and the prose in the review body. - Multi-line suggestions: set `start_line` and `line` to define the range. - **Minimize the range** — only include lines that actually need changing. A - range that's too wide can delete correct code adjacent to the fix. + GitHub **replaces** every line in that range with the suggestion content — any + line in the range that isn't reproduced in the replacement is **deleted**. + + **Before posting any multi-line suggestion, verify it:** + + 1. **Read the exact lines** `start_line` through `line` from the diff hunk. + 2. **Diff mentally**: every line in that range must either appear (possibly + modified) in the replacement text, or be a line you intend to delete. If + any line would be silently dropped, **shrink the range** or include the + line in the replacement. + 3. **Cap the range at ~10 lines.** Larger suggestions are error-prone and hard + to review. For changes spanning more than 10 lines, split into multiple + suggestions or push a fix commit instead. + 4. **Never span markdown fences.** If the range includes a `` ``` `` line, + GitHub's suggestion parser may consume it as a delimiter, corrupting the + result. Either shrink the range to avoid the fence or push a commit. ### 5. Monitor CI