Commit c5d62b3
fix(review-pr): add verification checklist for multi-line suggestions (#1608)
## Summary
- Replaces the vague "minimize the range" instruction for multi-line
suggestions with a concrete 4-step verification checklist
- Addresses the root cause of #1607: the bot constructs suggestion
ranges that are wider than the replacement text, silently deleting
correct code when applied
## Root cause analysis
Investigated all three known cases:
1. **#1310** (PR #1309): `start_line: 18, line: 22` — 5-line range
replaced with fewer lines, deleting the `git-wt` fallback branch
2. **#1326** (PR #1322): `start_line: 289, line: 291` — range included a
closing ` ``` ` fence that GitHub consumed as the suggestion's own
delimiter
3. **#1598**: `start_line: 93, line: 127` — 35-line range replaced with
a shorter rewrite, deleting the `gh issue view` code block
Common thread: the bot sets a line range covering more content than it
intends to replace. The replacement text is shorter, so the surplus
lines are silently deleted. The existing instruction ("minimize the
range") didn't give the bot a way to verify correctness.
## Fix
The new checklist requires the bot to:
1. **Read the exact lines** in the range before posting
2. **Verify no silent deletions** — every line must appear in the
replacement or be intentionally removed
3. **Cap range at ~10 lines** — larger suggestions should be split or
pushed as commits
4. **Avoid spanning markdown fences** — prevents delimiter collision
## Test plan
- [ ] Review a PR with a multi-line suggestion opportunity and verify
the bot follows the checklist
- [ ] Verify the bot splits or commits changes larger than ~10 lines
instead of using a suggestion
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent eec328c commit c5d62b3
1 file changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
281 | 295 | | |
282 | 296 | | |
283 | 297 | | |
| |||
0 commit comments