From 6d2732e78602871408dcf72a1deebb3fc9912b56 Mon Sep 17 00:00:00 2001 From: ruangraung Date: Mon, 8 Jun 2026 16:29:34 +0700 Subject: [PATCH] fix(gateway): apply MarkdownV2 formatting on progress message edits When a platform adapter sets REQUIRES_EDIT_FINALIZE=True (e.g. TelegramAdapter), tool progress edits now pass finalize=True so format_message() is applied before sending to the platform. Previously, the initial send() formatted the message correctly via MarkdownV2, but subsequent edit_message() calls skipped formatting (finalize=False), causing raw markdown (e.g. triple backticks for bash code blocks) to render as plain text on Telegram. Refs: #41955, #41732 --- gateway/run.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gateway/run.py b/gateway/run.py index 109c666c4f3..d445a8ee3fd 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -13106,6 +13106,8 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew "message_id": message_id, "content": content, } + if getattr(adapter, "REQUIRES_EDIT_FINALIZE", False): + kwargs["finalize"] = True if _edit_accepts_metadata: kwargs["metadata"] = _progress_metadata return await adapter.edit_message(**kwargs)