Telegram: Plain-Text-Fallback bei Parse-Fehler, tag-sichere Kürzung auf 4096. Matrix: bytebewusste Kürzung. Downtime: lesender Abgleich nach dem POST, generische Fehlermeldung im Chat. Agent: Platzhalter für nicht ausgeführte Tool-Calls, Text im letzten Schritt erzwingen, Zeitreserve, Kompaktierung, Limit pro Antwort. CLAUDE.md: Fallbacks für Phase 6d. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
23 lines
687 B
Python
23 lines
687 B
Python
from app.agent import AgentResult
|
|
from app.commands.ai import agent_reply
|
|
|
|
|
|
def test_agent_reply_escapes_html():
|
|
result = AgentResult("CPU & RAM <hoch>", ())
|
|
reply = agent_reply(result)
|
|
assert reply.text == "CPU & RAM <hoch>"
|
|
assert reply.html == "CPU & RAM <hoch>"
|
|
|
|
|
|
def test_agent_reply_escaped_length_stays_within_limit():
|
|
result = AgentResult("&" * 3000, ())
|
|
reply = agent_reply(result)
|
|
assert len(reply.html) <= 3000
|
|
assert reply.html == "&" * (len(reply.html) // 5)
|
|
|
|
|
|
def test_agent_reply_plain_text_truncated_to_answer_max():
|
|
result = AgentResult("x" * 4000, ())
|
|
reply = agent_reply(result)
|
|
assert len(reply.text) == 3000
|