fix(skill): warn about code fence collisions in suggestion blocks#1327
fix(skill): warn about code fence collisions in suggestion blocks#1327worktrunk-bot wants to merge 1 commit intomainfrom
Conversation
When a suggestion's target range includes a line that is itself triple backticks (a code fence marker), GitHub's suggestion syntax collides with the content. This caused a broken suggestion on PR #1322 where applying it would have eaten the closing code fence. Add explicit guidance to exclude fence marker lines from the range or reproduce them in the suggestion body. Closes #1326 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
can you explain exactly what request was sent to |
|
The bot posted a review comment on PR #1322 via Line 291 is the closing The suggestion body in the API request was: GitHub suggestions replace every line in [ The fix was straightforward: either narrow the range to That said — this guidance is pretty niche and may not be worth the added complexity in the skill file. Happy to close this if you'd rather not carry it. |
|
how did the bot post the review comment? what exact command did it run? |
|
I don't have the exact command from that run's logs — Claude Code's tool calls aren't captured in GitHub Actions output. But based on the review-pr skill instructions and the actual comment metadata, the command would have been: gh api "repos/$REPO/pulls/1322/reviews" \
--method POST \
-f event=COMMENT \
-f body="..." \
-f 'comments[0][path]=.claude/skills/review-pr/SKILL.md' \
-f 'comments[0][start_line]=289' \
-f 'comments[0][line]=291' \
-f 'comments[0][body]=```suggestion
gh api "repos/$REPO/pulls/<number>/reviews" \\
--jq "[.[] | select(.user.login == \"$BOT_LOGIN\" and .commit_id == \"$HEAD_SHA\")] | last | .submitted_at // empty"
```'The range That said — I agree with what I noted in my earlier comment: this is pretty niche. Happy to close this if the added skill complexity isn't worth it. |
|
I see. Can you think of the generality of what went wrong? Or is it really so specific as this? |
|
The more general issue is: suggestions silently delete any line in the range that isn't reproduced in the suggestion body. The fence collision is one symptom, but the root cause is anchoring the suggestion to a wider range than the lines actually being changed. That general principle is already stated in the bullet just above this new one: "verify that every line in [ The fence case is slightly special because the rendered suggestion looks correct (GitHub's markdown rendering hides the collision), so it's harder to catch by visual inspection. But I don't think that's enough to justify its own bullet point. Happy to close this — the existing guidance covers the general case well enough. |
Summary
```line, the suggestion's own delimiters collide with it, causing the fence marker to be eaten if appliedEvidence
Run 22790184425 posted a suggestion on PR #1322 anchored at lines 289–291, where line 291 was the closing
```of a code fence. max-sixty caught this: applying the suggestion would have removed the closing backticks and broken the markdown.Closes #1326
Test plan
🤖 Generated with Claude Code