fix: neutralize author fences that desync the markdown reply skeleton (confirmation-pass-2) - #54
Merged
Merged
Conversation
… (confirmation-pass-2) The LOUD sibling of the pass-2 silent-injection fix (#46). A literal triple-backtick fence in author-supplied field text — a label, help text, or an OPTION — opened a stray code fence in the rendered form, so `_FENCE_RE` on ingestion no longer saw the trailing `answers` skeleton cleanly delimited and paste-back failed loudly ("fenced code block is not valid JSON"). - `_defuse_fences` weaves a zero-width break through runs of 3+ backticks in every author/host line rendered by `form_to_markdown` and the `problems_to_markdown` re-ask; inline `code` (runs under three) is untouched. - `_skeleton_block` emits the skeleton's backticks as the ``` JSON escape, which `json.loads` restores, so a fence-bearing value that reaches the skeleton (a default/recommended/suggested option) can't close its own ```json fence early, and exact matching holds. Regression tests in TestConfirmationPass2; widget surface HTML-escapes and was already immune. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
silversurfer562
force-pushed
the
claude/suspicious-austin-a15697
branch
from
August 20, 2026 13:16
b7ce517 to
a921e96
Compare
# Conflicts: # src/attune_forms/markdown_surface.py
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.
What
The LOUD sibling of the pass-2 silent-injection fix (#46). A literal triple-backtick fence in author-supplied field text (a label,
help_text, or an option) opened a stray code fence in the rendered markdown form, so_FENCE_REon ingestion no longer saw the trailinganswersskeleton cleanly delimited — paste-back failed loudly with"fenced code block is not valid JSON"and a pile of namedunparseable lineproblems.Fix
_defuse_fencesweaves a zero-width break through any run of 3+ backticks in every author/host line rendered byform_to_markdownand theproblems_to_markdownre-ask. Inline`code`(runs under three) renders untouched._skeleton_blockemits the skeleton's backticks as theJSON escape, which `json.loads` restores on ingestion — so a fence-bearing value that reaches the skeleton itself (a `default`/`recommended`/`suggested` option) can't close its own `json ` fence early, and exact option matching is unchanged.Tests
Four regressions in
TestConfirmationPass2(fence-bearing option round-trip, fence in a skeleton default, fence in a re-asked field, and inline-backtick preservation). Full suite: 682 passed. Widget surface HTML-escapes and was already immune.Source: confirmation-pass-2 needs-a-look ledger, 2026-08-20.
🤖 Generated with Claude Code