Local Scout: markup that arrives escaped twice is stripped from item text
Back to our planProblem
In plain words: some items from the City's feeds show up with stray <p> tags in the text our AI agents read, because the feed sends its markup escaped twice and the runner decodes it after it strips tags.
Found in the review of #1481 (the police incident reports feed): updated reports carry literal <p> tags in sourceText. runner/lib/text.mjs strips tags first and decodes entities after, so double-escaped markup (&lt;p&gt;) comes out as tags again. That contradicts the file's own rule that markup is removed before any model sees it. The helper is older code; this feed is the first to expose it.
Proposed fix
Strip markup after decoding entities (or decode until stable, with a limit), keeping the existing script and style removal and the angle-bracket removal.
Acceptance criteria
- Not done: A test with a double-escaped
<p>shows no tag insourceText. - Not done: Every existing text and parser test still passes.
Files likely touched
intelligence/runner/lib/text.mjs, intelligence/runner/test/
Must not touch
src/
Existing work compared
Searched open and closed issues for the text helper and for escaping; none. #993 and #1481 only record where it was found.
Area
tooling
Priority
low
Generated by Claude Code, opens in a new tab