Skip to content

fix: refuse a turn-end fix whose replacement words contain an HTML tag - #5936

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5935
Nov 14, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5935

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The turn-end check writes a stale passage's replacement words into index.html as text: fixed_source escapes each new word, and its check that the page then reads as before but for those words passes, because escaped markup reads as exactly the words the fork gave. So a fork replacement such as follow-up, <a href="…">#12</a>, is open landed as &lt;a href=…&gt;, and the agent's line quoted it with the tag unescaped, giving no sign the page showed markup.

fixed_source now refuses a fix whose new words open a tag (< before a letter, /, ! or ?, as HTML's tokenizer reads one). The finding then reaches the agent alone, as for any fix Leaf can't place, and the agent writes the link in its own revision. Supporting markup in a replacement instead would mean placing new elements in the source, which _place deliberately avoids: a fix of a few words swaps words within one run of text. A page that shows a tag as text, as code does, loses the automatic fix of those words too; the agent still hears the finding.

test_a_fix_leaf_cant_place_reaches_the_agent_as_the_finding gains a link and a code-span replacement; both wrote escaped markup into the page before the change and leave the page untouched after it. tests/model/test_clerk.py passes (43 tests).

The fork composed markup partly because turn-end-check.md asks for replacement words "written as the page writes", which reads as the page's HTML. Rewording it to ask for plain words would save the fixes this change now refuses, but it is shipped prompt text that leaf-dev eval 'turn-end-check*' should score before and after, which needs a Claude Code harness this session doesn't have, so it is left for a separate change.

Closes #5935 — automated triage

The turn-end check writes a stale passage's replacement words into
index.html as escaped text, so a link the fork wrote in them showed on the
page as its markup, and the agent, told the words with the tag unescaped,
had no sign that it did. `fixed_source` now refuses a fix whose new words
open a tag, and the finding reaches the agent alone, as for any fix Leaf
can't place. The test of fixes Leaf can't place gains a link and a code
span replacement.

Closes #5935
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Turn-end check writes a link in its replacement words as escaped text

1 participant