-
-
Notifications
You must be signed in to change notification settings - Fork 80.3k
issue(telegram): persistent rich messages collapse ordinary line breaks #95409
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
No fields configured for issues without a type.
Problem
Telegram
richMessagesfinal replies can collapse ordinary line breaks into a single paragraph, making structured assistant replies hard to read even though the same text renders correctly through the ordinarysendMessagepath.This affects the supported account-scoped persistent rich-message path, not the rejected
sendRichMessageDraftstreaming design.Latest main checked
openclaw/openclawupstream/mainat97b0b559ad17b6f567fc195d26c610b931f52d3bReproduction shape
Enable Telegram rich messages for the selected account:
channels.telegram.richMessages = truechannels.telegram.accounts.default.richMessages = trueSend a normal final assistant reply with plain line-separated text, e.g.:
The ordinary
sendMessagepath preserves the line breaks, but the rich-message final path can render the same content visually compressed.Source-level evidence
On current main,
extensions/telegram/src/rich-message.tsprepares rich HTML with only sanitize + nesting-limit handling:This means ordinary text newlines that survive Markdown/HTML conversion can be passed to
rich_message.htmlas raw\n. Telegram Rich HTML rendering does not treat those raw newlines like plainsendMessagetext; they need explicit<br>or block structure for reliable visual line breaks.Observed behavior
In a real Telegram direct-chat run with
richMessagesenabled, final replies using the official Bot API 10.1sendRichMessagepath lost the expected visual line separation. A local candidate change that converts text-node newlines to<br>before rich-message send restored the expected formatting while still usingsendRichMessage/rich_message.The candidate behavior was verified by inspecting the outbound call shape:
sendRichMessagerich_message.html<br>Expected behavior
Persistent Telegram rich final replies should preserve ordinary assistant line breaks at least as well as the non-rich
sendMessagepath.The fix should:
sendRichMessageDraftentirely;<br>or equivalent rich-message structure;<br>inside preformatted/code blocks;richMessages: falsefallback behavior unchanged.Why this is separate from #93438
#93438 was closed because native
sendRichMessageDraftconflicts with the established Telegram streaming contract. This issue is different: it targets only the currently supported persistent rich-message final/preview path (sendRichMessageandeditMessageTextwithrich_message) and does not propose using native drafts for answer streaming.Risk
Low-to-medium. The change is in rich HTML preparation for opted-in Telegram rich messages. It may affect rich HTML layout, so tests should cover:
<br>conversion inside<pre>/<code>;<br>HTML remains unchanged;