Repository navigation
fix(telegram): preserve delivery without rich API - #92946
Glucksberg wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 22, 2026, 3:58 AM ET / 07:58 UTC. Summary PR surface: Source +221, Tests +256. Total +477 across 9 files. Reproducibility: yes. at source level: enable Telegram richMessages and use a Bot API root that rejects sendRichMessage; current main has no legacy fallback in the normal send, bot delivery, or preview paths. I did not run live Telegram in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land one Telegram-plugin fallback that narrowly detects missing rich methods, keeps visible and recorded stream state aligned, defines long edit-limit behavior, and includes redacted current-head Telegram proof. Do we have a high-confidence way to reproduce the issue? Yes, at source level: enable Telegram richMessages and use a Bot API root that rejects sendRichMessage; current main has no legacy fallback in the normal send, bot delivery, or preview paths. I did not run live Telegram in this read-only review. Is this the best way to solve the issue? No as submitted. The Telegram plugin is the right boundary, but this head needs narrower error classification, corrected long-preview accounting, defined long-edit behavior, and current-head real Telegram proof before it is the best fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d3f7f7d1fc91. Label changesLabel justifications:
Evidence reviewedPR surface: Source +221, Tests +256. Total +477 across 9 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@openclaw-mantis capture Telegram Desktop proof for this PR. Prefer proof that demonstrates final text delivery still reaches the real Telegram user from the PR branch when rich Bot API delivery is not available; if the harness cannot simulate a non-rich Bot API root, capture candidate real-user Telegram delivery on the PR branch and leave a concise manifest explaining the proof scope. |
|
@clawsweeper re-review Updated the PR head to re-chunk legacy Telegram fallback sends to the 4096-character Bot API text limit and avoid replaying already-delivered chunks when a later HTML fallback chunk needs plain text. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Real behavior proof has been added to the PR body. It includes a real Telegram bot/user run at PR head 5558aed2 with a local Bot API proxy returning 404 for sendRichMessage, followed by successful legacy sendMessage delivery with chat id redacted. |
|
can you just update the bot api instance you're running? use-less PR IMO |
5558aed to
8fdfb71
Compare
2e782a0 to
b6e3855
Compare
b6e3855 to
0841f2f
Compare
0841f2f to
19d7a7e
Compare
19d7a7e to
aa666c3
Compare
aa666c3 to
42b6fd9
Compare
42b6fd9 to
2dbef8e
Compare
2dbef8e to
92e3af1
Compare
|
richMessage is now behind a flag, what's the point of fallback? don't enable it if your client doesn't support |
|
Closing this for now. Since rich messages are opt-in/default-off, I agree unsupported Bot API roots should avoid enabling them instead of depending on a fallback. This implementation is also too broad: it can mask real rich-message errors, and the current proof does not cover the long/preview/edit delivery paths. |
Summary
sendRichMessage/ rich text edit to legacysendMessage/editMessageText.Why this matters
OpenClaw's Telegram plugin now uses Telegram's newer rich Bot API methods for better formatting, but not every supported deployment reaches the official latest Bot API directly. Some users run through custom
apiRootdeployments, self-hosted Bot API services, proxies, or lagging infrastructure where classicsendMessagestill works butsendRichMessagedoes not exist yet.Without this fallback, a formatting upgrade can turn into a message-delivery outage: ordinary text replies, edits, and stream previews can fail even though Telegram still supports the legacy send path. This PR keeps the new rich path as the preferred behavior while preserving basic Telegram delivery on older or custom Bot API surfaces, which is the safer compatibility posture for a channel plugin.
The fix stays local to the Telegram plugin, adds no new config surface, and follows Telegram's legacy 4096-character text contract so long replies do not fail after falling back.
Verification
node scripts/run-vitest.mjs extensions/telegram/src/network-errors.test.ts extensions/telegram/src/send.test.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/draft-stream.test.tspnpm tsgo:extensionspnpm tsgo:extensions:testnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/telegram/src/rich-message.ts extensions/telegram/src/network-errors.ts extensions/telegram/src/network-errors.test.ts extensions/telegram/src/send.ts extensions/telegram/src/send.test.ts extensions/telegram/src/bot/delivery.send.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/draft-stream.ts extensions/telegram/src/draft-stream.test.tspnpm exec oxfmt --check --threads=1 extensions/telegram/src/rich-message.ts extensions/telegram/src/send.ts extensions/telegram/src/send.test.ts extensions/telegram/src/bot/delivery.send.ts extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/draft-stream.ts extensions/telegram/src/draft-stream.test.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode localReal behavior proof
Behavior addressed: Telegram final text delivery still reaches a real Telegram user when the rich Bot API method is unavailable and OpenClaw has to fall back to legacy
sendMessage.Real environment tested: Local OpenClaw PR head
5558aed2d66a49d232e2c75e3c233b2f30e99a7eagainst a real Telegram bot and real Telegram user chat, using a local Bot API proxy that intentionally returns404forsendRichMessagewhile forwarding legacysendMessageto Telegram's official Bot API.Exact steps or command run after this patch:
Evidence after fix:
{ "pass": true, "result": { "messageId": "5", "chatId": "[redacted]" }, "proxyEvents": [ { "method": "sendRichMessage", "richUnavailable": true, "status": 404 }, { "method": "sendMessage", "ok": true, "messageId": 5, "textLength": 54 } ] }Observed result after fix: The local proxy rejected the rich Telegram method with
404, OpenClaw retried through legacysendMessage, Telegram accepted the real API call, and the marker message appeared in the Telegram client.What was not tested: This manual proof did not use the official Mantis/Crabbox burner-account workflow because the current contributor credentials cannot apply
mantis: telegram-visible-proofor dispatch the maintainer-only workflow.