Repository navigation
fix(telegram): edit rich callback messages through the rich raw API (#123886) - #124173
Closed
licheer-zte wants to merge 1 commit into
Closed
licheer-zte wants to merge 1 commit into
licheer-zte wants to merge 1 commit into
Conversation
With channels.telegram.richMessages enabled the /models picker sends a rich message, but callback edits (provider/model selection, final confirmation) went through the legacy editMessageText text path, so Telegram for iOS rendered the new body over the stale rich picker text. Route callback edits through the rich raw API when rich messages are on (caller-authored HTML edits keep legacy parse_mode HTML semantics), with fallback to the legacy text edit when the rich edit fails. Fixes openclaw#123886
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
a-yeyang
pushed a commit
to a-yeyang/openclaw
that referenced
this pull request
Aug 24, 2026
…nclaw#123886) The /models picker sends its initial body as a rich message when richMessages is enabled; every lifecycle edit (provider list, model list, pagination) already routes through the rich funnel via createTelegramCallbackMessageActions. The final selection confirmation was the one exception: it always fell back to the legacy HTML editMessageText path, so Telegram rendered the new confirmation text mixed with/over the prior rich body's stale markup instead of fully replacing it. - Add TelegramCallbackRichTextOverride so a parse_mode: "HTML" edit can opt back onto the rich funnel with hand-built blocks, following the progress-draft-preview.ts precedent. - editCallbackMessage/editCallbackMessageWithButtons accept an optional richTextOverride; when richMessages is on, edits route through getTelegramRichRawApi(...).editMessageText with rich_message blocks instead of the legacy text funnel. - buildModelSelectionConfirmation builds both the HTML and rich-block confirmation bodies from shared text-building logic, escaping only in the HTML variant (rich blocks are not parsed as markup). - Split the ~290-line handleTelegramModelCallback function out of bot-handlers.callback-router.ts into bot-handlers.model-callback.ts to keep the router file under the repo's 700-line oxlint cap after the fix's additions. Non-rich accounts are unaffected; the legacy HTML path is unchanged for that funnel. Supersedes closed PR openclaw#124173, which fixed the rich-block introduction but left the confirmation edit on the legacy HTML path per ClawSweeper's own review of that PR (partial_overlap).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem
With
channels.telegram.richMessages: true, the/modelspicker is sent through the rich raw API (sendRichMessage), but every callback edit — provider/model selection steps and the final "Model changed" confirmation — went through the legacybot.api.editMessageText(chatId, messageId, text)text path. Telegram for iOS then rendered the new body over the stale rich picker body, producing overlapping, unreadable text (issue #123886).Why
createTelegramCallbackMessageActionsinextensions/telegram/src/bot-handlers.callback-actions.runtime.tsonly ever called the legacy texteditMessageTextsignature. The rich send funnel (send.ts,draft-stream.ts) already routes throughgetTelegramRichRawApi(api).editMessageText({ chat_id, message_id, rich_message, ... })— the callback-edit owner was the one path that missed the rich branch, so it edited a rich message as if it were plain text.User Impact
Telegram users with
richMessages: trueget a clean model picker: each step replaces the previous rich body in place, and the final confirmation no longer overlaps the stale "Select a provider:" text. Caller-authored HTML edits (e.g. the✅ Model changed to <b>…</b>confirmation) stay on the legacyparse_mode: HTMLpath per the rich-wire blocks-only contract, and any rich-edit failure falls back to the previous legacy text edit — so nothing regresses when the rich raw API is unavailable.Evidence
New unit tests in
extensions/telegram/src/bot-handlers.callback-actions.runtime.test.ts(6/6 pass) covering rich routing, legacy fallback, HTML-mode preservation, not-modified re-raise, and missing-raw-API fallback:Also verified with the full callback-related suites (
bot-handlers.callback-questions.runtime.test.ts,approval-handler.runtime.test.ts) — all 14 tests pass, andtsc -p extensions/telegram/tsconfig.jsonreports no new errors from these files (the 6 remaining errors in that project pre-exist onorigin/mainand touch unrelated files:inbound-debounce,bot-message-context,bot-native-commands,state-migrations).Note: this sandbox cannot run a live Telegram bot; per ClawSweeper's own review this is a source-reproducible representation mismatch with a clear focused test boundary (
clawsweeper:source-repro, noneeds-live-reprolabel).[AI-assisted]