June 8, 2026

Fallback markdown-to-HTML for user-facing responses

Models occasionally leak markdown despite the HTML-only system prompt

Models occasionally leak markdown despite the HTML-only system prompt. Added markup.markdown_to_html() — an inline-only rewrite of **bold**<b>, *italic*<i>, _under_<u>, and `code`<code>, with code spans masked first to preserve inner markers and snake_case guarded against false underline. Applied at the single point the final response leaves the ACT loop, ahead of recording, assistant row writing, post-turn hooks, and API-layer sanitization. Gated on broadcast_to=='user' so background channels that emit JSON/plain text are never mangled.

  • Added markup.markdown_to_html() heuristic rewrite: bold, italic, underline, inline code.

  • Code spans are masked first to preserve inner formatting markers; snake_case avoids false underline.

  • Applied at _format_final_response, the single exit point of the ACT loop.

  • Gated to user-facing responses only (broadcast_to=='user') to avoid mangling background channel outputs.

  • Added 4 feature tests driving the real loop path with stubbed LLM boundary; 48 regression tests green.