diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index 1a87e66cde4..e136a9476a6 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -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 " diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.py index f1d87c7fc14..a77c24f34a7 100644 --- a/tests/agent/test_prompt_builder.py +++ b/tests/agent/test_prompt_builder.py @@ -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