Skip to content

Telegram MarkdownV2 escape bug breaks blockquote messages (telegramify-markdown 1.3.2) #1102

@scriptmunkee

Description

@scriptmunkee

Summary

When the Telegram adapter sends a message containing a markdown blockquote (> ...) with any MarkdownV2 special character on that line (e.g. a trailing .), Telegram rejects the message with:

400: Bad Request: can't parse entities: Character '.' is reserved and must be escaped with the preceding '\'

The message is then re-sent as plain text via the existing fallback path, so the user still gets the content — but every workflow that emits a blockquote-containing notification (e.g. workflow start banners that quote the workflow's description:) loses its formatting and logs a telegram.markdownv2_failed warning.

Root cause

packages/adapters pins telegramify-markdown@^1.3.0, which currently resolves to 1.3.2. That version has a bug in blockquote handling: it escapes the > marker (it shouldn't — Telegram MarkdownV2 supports native > blockquotes) and it double-escapes any other special character on the same line.

Minimal reproduction

import telegramify from 'telegramify-markdown';
console.log(JSON.stringify(telegramify('> blockquote.', 'escape')));

Output on 1.3.2:

"\\> blockquote\\\\.\n"   // → literal: \> blockquote\\.   (INVALID — double backslash before .)

Output on 1.3.3:

"> blockquote\\.\n"       // → literal: > blockquote\.    (VALID)

The fix landed upstream in telegramify-markdown@1.3.3.

Real-world trigger

archon-adversarial-dev's description starts with a blockquote line ending in a period. When the workflow starts, Archon sends a 🚀 *Starting workflow* … notification that includes that description. The bot logs:

"telegram.markdownv2_failed"
"originalPreview": "🚀 **Starting workflow**: `archon-adversarial-dev`\n\n> \"adversarial build\", \"build app adversarially\", \"adversarial coding\"."
"formattedPreview": "🚀 *Starting workflow*: `archon-adversarial-dev`\n\n\\> \"adversarial build\"…\\\\."

Any workflow whose description: contains > plus a period (or any other escapable char) on the same line will hit this.

Suggested fix

Bump the dependency in packages/adapters/package.json:

-    "telegramify-markdown": "^1.3.0"
+    "telegramify-markdown": "^1.3.3"

…and run bun update telegramify-markdown to lock 1.3.3 (or newer) into bun.lock.

A regression test in packages/adapters/src/chat/telegram/markdown.test.ts for the blockquote-with-special-chars case would prevent this from coming back if the dependency loosens later:

it('escapes special chars exactly once inside blockquotes', () => {
  expect(convertToTelegramMarkdown('> hi.')).toBe('> hi\\.\n');
});

Environment

  • Archon dev branch (commit 536584db)
  • macOS 15.x (Darwin 25.3.0), arm64
  • Bun 1.3.11
  • telegramify-markdown@1.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority - Backlog, when time permitsarea: clientsAI assistant clientsbugSomething is brokeneffort/lowSingle file or function, one responsibility, isolated change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions