openclaw - 💡(How to fix) Fix bug(telegram): media captions can exceed 1024 after HTML rendering

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Telegram media caption splitting currently checks the raw caption length before Telegram HTML rendering. A caption can be <= 1024 raw UTF-16 code units, be accepted as an inline caption by OpenClaw, then expand beyond Telegram's 1024 caption limit after HTML escaping / Markdown rendering.

This can cause Telegram media delivery failures or confusing cut/truncated delivery around media replies. It is related to the Telegram HTML/caption transport area, but is distinct from the existing angle-bracket truncation bug.

Root Cause

  • raw caption length: 300
  • rendered Telegram HTML caption length: 1500, because & becomes &amp;
  • current splitTelegramCaption() keeps it inline because it only sees 300 <= 1024

Fix Action

Fix / Workaround

Local mitigation tested

A local hot patch checks rendered caption length after renderTelegramHtmlText() and moves oversized rendered captions to follow-up text. Runtime import/config/restart passed on v2026.5.12.

Code Example

"&".repeat(300)

---

"[" + "link".repeat(20) + "](https://example.com/" + "x".repeat(900) + ")"
RAW_BUFFERClick to expand / collapse

Summary

Telegram media caption splitting currently checks the raw caption length before Telegram HTML rendering. A caption can be <= 1024 raw UTF-16 code units, be accepted as an inline caption by OpenClaw, then expand beyond Telegram's 1024 caption limit after HTML escaping / Markdown rendering.

This can cause Telegram media delivery failures or confusing cut/truncated delivery around media replies. It is related to the Telegram HTML/caption transport area, but is distinct from the existing angle-bracket truncation bug.

Repro

Raw caption:

"&".repeat(300)

Observed planning today:

  • raw caption length: 300
  • rendered Telegram HTML caption length: 1500, because & becomes &amp;
  • current splitTelegramCaption() keeps it inline because it only sees 300 <= 1024

Another repro:

"[" + "link".repeat(20) + "](https://example.com/" + "x".repeat(900) + ")"

Observed:

  • raw length: 1024
  • rendered Telegram HTML length: 1035
  • still selected as caption before rendering

Expected

OpenClaw should decide whether to send media text as a caption after rendering to the actual Telegram HTML payload. If rendered caption length exceeds 1024, media should be sent without caption and the text should be sent as follow-up text.

Local mitigation tested

A local hot patch checks rendered caption length after renderTelegramHtmlText() and moves oversized rendered captions to follow-up text. Runtime import/config/restart passed on v2026.5.12.

Candidate fix shape

Add a rendered-caption splitter/helper, e.g.:

  • split raw caption by existing raw >1024 guard
  • render candidate caption to Telegram HTML
  • if rendered HTML length >1024, return followUpText
  • reuse this in both direct Telegram send and reply media delivery paths

Environment

  • OpenClaw: 2026.5.12
  • Channel: Telegram
  • Path observed in package build: extensions/telegram/src/caption.ts, extensions/telegram/src/send.ts, extensions/telegram/src/bot/delivery.replies.ts

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix bug(telegram): media captions can exceed 1024 after HTML rendering