fix: Rich markup crash on [/HINT], [/NOTE], etc. in agent responses

Rich Panel() interprets [brackets] as markup tags. When the agent's
response contained text like [/HINT] or [WARNING], Rich threw:
  'closing tag [/HINT] at position N doesn't match any open tag'

Fix: wrap response in Text.from_ansi() before passing to Panel().
This preserves ANSI color codes from the response while treating
all bracket content as literal text.

Fixed in both the main response panel and background task panel.
This commit is contained in:
teknium1 2026-03-13 02:00:01 -07:00
parent 6873c9f7db
commit 28563d6152
1 changed files with 4 additions and 2 deletions

6
cli.py
View File

@ -3016,9 +3016,10 @@ class HermesCLI:
label = "⚕ Hermes"
_resp_color = "#CD7F32"
from rich.text import Text as _RichText
_chat_console = ChatConsole()
_chat_console.print(Panel(
response,
_RichText.from_ansi(response),
title=f"[bold]{label} (background #{task_num})[/bold]",
title_align="left",
border_style=_resp_color,
@ -3687,9 +3688,10 @@ class HermesCLI:
label = "⚕ Hermes"
_resp_color = "#CD7F32"
from rich.text import Text as _RichText
_chat_console = ChatConsole()
_chat_console.print(Panel(
response,
_RichText.from_ansi(response),
title=f"[bold]{label}[/bold]",
title_align="left",
border_style=_resp_color,