The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(telegram): honor the direct-messages-topic alias in the fresh-final gate
kshitijk4poorbad2ed866c16
diff --git a/plugins/platforms/telegram/adapter.py b/plugins/platforms/telegram/adapter.pyindex 6bd42ea17be..1642ee039e2 100644--- a/plugins/platforms/telegram/adapter.py+++ b/plugins/platforms/telegram/adapter.py@@ -2107,7 +2107,7 @@ class TelegramAdapter(BasePlatformAdapter):metadata = metadata or {}if not (metadata.get("telegram_dm_topic_reply_fallback")- or metadata.get("direct_messages_topic_id")+ or self._metadata_direct_messages_topic_id(metadata)):return Falsereturn self._rich_eligible(content)diff --git a/tests/gateway/test_telegram_rich_messages.py b/tests/gateway/test_telegram_rich_messages.pyindex 2023eacbf3b..1e895eee696 100644--- a/tests/gateway/test_telegram_rich_messages.py+++ b/tests/gateway/test_telegram_rich_messages.py@@ -400,6 +400,12 @@ def test_prefers_fresh_final_streaming_for_dm_topic_tables():assert adapter.prefers_fresh_final_streaming(RICH_CONTENT, {"direct_messages_topic_id": "20189"}) is True+ # The documented telegram_-prefixed alias is honored through the same+ # canonical accessor the send path uses (gateway/delivery.py treats the+ # two keys as equivalent) — an alias-only lane must not flatten tables.+ assert adapter.prefers_fresh_final_streaming(+ RICH_CONTENT, {"telegram_direct_messages_topic_id": "20189"}+ ) is True@pytest.mark.asyncio@@ -551,7 +557,10 @@ async def test_dm_topic_table_stream_uses_send_rich_message():assert draft_kwargs["text"] == TOPIC_TABLEassert draft_kwargs["message_thread_id"] == 20189rich_endpoints = [call.args[0] for call in adapter._bot.do_api_request.await_args_list]- assert rich_endpoints == ["sendRichMessage"]+ # Invariant, not a frozen call list: the persistent final goes through+ # sendRichMessage, and no rich DRAFT frames fire (rich_drafts is off).+ assert "sendRichMessage" in rich_endpoints+ assert "sendRichMessageDraft" not in rich_endpointsadapter._bot.send_message.assert_not_called()