Repository navigation
fix(telegram): enable HTML formatting for model switch messages - #60042
Conversation
Greptile SummaryThis PR fixes Telegram model-switch confirmation messages rendering raw Markdown ( Confidence Score: 5/5Safe to merge — the fix is narrowly scoped, backward-compatible, and the prior HTML-escaping concern has been resolved. All remaining findings are P2 or lower. The HTML escaping concern raised in the prior review thread is now addressed. The No files require special attention. Reviews (2): Last reviewed commit: "fix(telegram): escape HTML entities in m..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd89d66e66
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram.
Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation.
|
Thanks for the fix here, @GitZhangChi. I added the regression test and changelog follow-up needed for maintainer land, and this is now merged in |
I’d give you a gold star if I had one!🌟 |
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
…claw#60042) * fix(telegram): enable HTML formatting for model switch messages The model switch confirmation message was displaying raw Markdown (**text**) instead of bold formatting because parse_mode was not set. Changes: - Add optional extra parameter to editMessageWithButtons for parse_mode - Change format from Markdown ** to HTML <b> tags - Pass parse_mode: 'HTML' when editing model switch message Fixes the issue where model names appeared as **provider/model** instead of bold text in Telegram. * fix(telegram): escape HTML entities in model switch confirmation Add defensive `escapeHtml` helper to sanitize `selection.provider` and `selection.model` before interpolating them into the HTML callback message. This prevents potential API rejection (HTTP 400) if future provider or model names contain `<`, `>`, or `&`. Addresses review feedback on unescaped HTML interpolation. * test(telegram): cover HTML model switch confirmation --------- Co-authored-by: Frank Yang <[email protected]>
Summary
Fix Telegram model switch message formatting by enabling HTML parse mode.
Problem
When switching models via inline buttons in Telegram, the confirmation message displayed raw Markdown syntax (
**cliproxyapi/qwen3.5-plus-ali**) instead of bold text. This occurred becauseparse_modewas not being set when editing the callback message.Change Type (select all)
Scope (select all touched areas)
Root Cause / Regression History (if applicable)
editCallbackMessagecall in the model switch flow did not specify aparse_mode, causing Telegram to render the message in default plain text mode.User-visible / Behavior Changes
**asterisks.Solution & Design Choices
editMessageWithButtonshelper: Added an optionalextraparameter to accept Telegram formatting options (likeparse_mode), keeping the base function backwards-compatible.HTMLoverMarkdown/MarkdownV2: Telegram's Markdown parser is highly strict and requires manual escaping for characters like-and.(which are common in model IDs likegpt-3.5-turbo). Failing to escape throws a400 Bad Request. UsingHTML(<b>...</b>) gracefully sidesteps this issue.escapeHtmlhelper to sanitizeselection.providerandselection.modelbefore interpolation, ensuring future model names containing<or>won't break the UI.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoReview Conversations