mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-01 12:02:05 +00:00
fix(gateway): WhatsApp/Signal hints affirm markdown instead of forbidding it (#53564)
The 'whatsapp' and 'signal' PLATFORM_HINTS told the agent 'Please do not use markdown as it does not render' — factually wrong. Both adapters actively convert markdown to native formatting: - whatsapp_common.format_message(): **bold**, ~~strike~~, # headers, links, code blocks -> WhatsApp native syntax - signal_format.markdown_to_signal(): same conversions via bodyRanges, plus '- item' / '* item' bullets -> '• ' Unicode bullets The wrong hint made the agent strip bullets and bold the adapter would have rendered (#12224). Rewrote both hints to mirror whatsapp_cloud: markdown is auto-converted, bullet lists work, tables are not supported. Added a contract test asserting markdown-converting platforms never forbid markdown in their hint.
This commit is contained in:
parent
a5d1f68c74
commit
ec769e49d2
2 changed files with 24 additions and 2 deletions
|
|
@ -617,7 +617,12 @@ DEVELOPER_ROLE_MODELS = ("gpt-5", "codex")
|
|||
PLATFORM_HINTS = {
|
||||
"whatsapp": (
|
||||
"You are on a text messaging communication platform, WhatsApp. "
|
||||
"Please do not use markdown as it does not render. "
|
||||
"Standard markdown (**bold**, *italic*, ~~strike~~, # headers, "
|
||||
"`code`, ```code blocks```, [links](url)) is auto-converted to "
|
||||
"WhatsApp's native syntax (*bold*, _italic_, ~strike~, monospace) — "
|
||||
"feel free to write in markdown, and use bullet lists ('- item') "
|
||||
"freely. Tables are NOT supported — prefer bullet lists or labeled "
|
||||
"key:value pairs. "
|
||||
"You can send media files natively: to deliver a file to the user, "
|
||||
"include MEDIA:/absolute/path/to/file in your response. The file "
|
||||
"will be sent as a native WhatsApp attachment — images (.jpg, .png, "
|
||||
|
|
@ -682,7 +687,11 @@ PLATFORM_HINTS = {
|
|||
),
|
||||
"signal": (
|
||||
"You are on a text messaging communication platform, Signal. "
|
||||
"Please do not use markdown as it does not render. "
|
||||
"Standard markdown (**bold**, *italic*, ~~strike~~, # headers, "
|
||||
"`code`, ```code blocks```) is auto-converted to Signal's native "
|
||||
"rich formatting — feel free to write in markdown, and use bullet "
|
||||
"lists ('- item') freely (they render as • bullets). Tables are NOT "
|
||||
"supported — prefer bullet lists or labeled key:value pairs. "
|
||||
"You can send media files natively: to deliver a file to the user, "
|
||||
"include MEDIA:/absolute/path/to/file in your response. Images "
|
||||
"(.png, .jpg, .webp) appear as photos, audio as attachments, and other "
|
||||
|
|
|
|||
|
|
@ -1018,6 +1018,19 @@ class TestPromptBuilderConstants:
|
|||
hint = PLATFORM_HINTS["whatsapp_cloud"]
|
||||
assert "MEDIA:" in hint
|
||||
|
||||
def test_markdown_converting_platform_hints_do_not_forbid_markdown(self):
|
||||
"""#12224 — WhatsApp (Baileys) and Signal adapters actively convert
|
||||
markdown to native formatting (gateway/platforms/whatsapp_common.py
|
||||
format_message + signal_format.markdown_to_signal: bold, italic,
|
||||
strikethrough, headers, bullets). Their hints previously told the
|
||||
agent "do not use markdown", which made it strip bullets/bold the
|
||||
adapter would have rendered. The hint must affirm markdown, not
|
||||
forbid it."""
|
||||
for key in ("whatsapp", "signal"):
|
||||
hint = PLATFORM_HINTS[key]
|
||||
assert "do not use markdown" not in hint.lower()
|
||||
assert "markdown" in hint.lower()
|
||||
|
||||
def test_cli_hint_does_not_suggest_media_tags(self):
|
||||
# Regression: MEDIA:/path tags are intercepted only by messaging
|
||||
# gateway platforms. On the CLI they render as literal text and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue