* fix(telegram): deliver content instead of throwing when tag overhead fills chunk
When HTML tag overhead (open + close tags) exceeds the chunk limit,
appendText threw an error causing complete message delivery failure.
Instead, force the text into the chunk so the message is still delivered
even if the chunk slightly exceeds the limit.
Closes#102910
* fix(telegram): strip rich formatting when tag overhead fills chunk
When HTML tag overhead fills an empty chunk with no room for text, strip
rich formatting and retry as plain text instead of delivering an oversized
chunk or throwing. Orphan close tags from the stripped formatting are
skipped to keep the output well-formed and within the chunk limit.
This preserves the existing plain-text fallback paths in send.ts and
rich-message.ts.
Closes#102910
* fix(telegram): preserve delivery when HTML tag overhead overflows
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Bot API 10.1 rich messages parse structured HTML, so bare newlines
collapse as insignificant whitespace and flatten multi-paragraph replies
and bullet runs into a single line. Materialize logical line breaks as
<br> in prepareTelegramRichHtml -- the shared rich send/edit/draft
chokepoint covering both the Markdown and explicit-HTML text modes --
while keeping newlines literal inside code/pre/math and where they only
separate structural tags (block elements plus table/figure/details
container children, so pretty-printed rich HTML keeps valid markup).
Refs #95409
Summary:
- The PR changes Telegram legacy HTML rendering so raw HTML table tags are converted to `<pre><code>` pipe-tab ... ks before unsupported-tag escaping, while preserving pre/code literals and rich-message table sanitization.
- PR surface: Source +38, Tests +31. Total +69 across 2 files.
- Reproducibility: yes. Source inspection shows current main's legacy HTML renderer sends raw tables directly ... the linked issue describes that same escaped output; I did not run tests because this review was read-only.
Automerge notes:
- No ClawSweeper repair was needed after automerge opt-in.
Validation:
- ClawSweeper review passed for head 5944f8e4d2.
- Required merge gates passed before the squash merge.
Prepared head SHA: 5944f8e4d2
Review: https://github.com/openclaw/openclaw/pull/94856#issuecomment-4749452707
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: zhangqueping <3436352+zhangqueping@users.noreply.github.com>
Harden Telegram HTML parse fallback so plain-text retries render readable labels and links instead of raw anchors.
Co-authored-by: Sam (OpenClaw) <sam.kpg5stars@gmail.com>