Repository navigation
fix: refuse a turn-end fix whose replacement words contain an HTML tag - #5936
Merged
Merged
Conversation
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
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.
The turn-end check writes a stale passage's replacement words into
index.htmlas text:fixed_sourceescapes 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 asfollow-up, <a href="…">#12</a>, is openlanded as<a href=…>, and the agent's line quoted it with the tag unescaped, giving no sign the page showed markup.fixed_sourcenow 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_placedeliberately 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_findinggains 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.pypasses (43 tests).The fork composed markup partly because
turn-end-check.mdasks 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 thatleaf-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