fix(server): tell agents how to nest fenced code inside code blocks - #1
Open
pc-style wants to merge 1 commit into
Open
fix(server): tell agents how to nest fenced code inside code blocks#1pc-style wants to merge 1 commit into
pc-style wants to merge 1 commit into
Conversation
A code block whose body contains triple backticks was rendered broken in chat: the inner closing fence ended the outer block, and the rest spilled out as prose. That is correct CommonMark, so the fix is to tell every provider up front to use a longer fence in that case. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner
Author
|
@coderabbitai review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an agent replies with a code block that itself contains a fenced block (a prompt to paste, a README snippet), the chat renders it broken: the inner closing fence ends the outer block and the rest of the content spills out as plain prose. The renderer is right, that is standard CommonMark. The agent just never knew it had to use a longer fence.
This adds one sentence to the shared runtime instructions every provider adapter appends (Codex, Claude, Cursor, Grok, OpenCode, Antigravity): a code block containing triple backticks must be fenced with four backticks or
~~~. No parser change, since diverging from CommonMark would break copy/paste round-trips with GitHub and every other markdown surface.Validation:
vp test run apps/server/src/provider/RuntimeInstructions.test.tspasses (6 tests, including a new one for the guidance).Done with Claude Fable 5.1 in Claude Code.
🤖 Generated with Claude Code