Revert "feat(telegram): pin incoming user message for duration of agent turn"

This reverts commit a724c3b9cf.
This commit is contained in:
Teknium
2026-05-18 23:54:56 -07:00
parent 7f40767393
commit 03f7bc056f
+15 -32
View File
@@ -5432,25 +5432,16 @@ class TelegramAdapter(BasePlatformAdapter):
return False
async def on_processing_start(self, event: MessageEvent) -> None:
"""Add an in-progress reaction and pin the message when processing begins."""
"""Add an in-progress reaction when message processing begins."""
if not self._reactions_enabled():
return
chat_id = getattr(event.source, "chat_id", None)
message_id = getattr(event, "message_id", None)
if chat_id and message_id:
if self._reactions_enabled():
await self._set_reaction(chat_id, message_id, "\U0001f440")
# Pin the incoming message for the duration of the turn
if self._bot:
try:
await self._bot.pin_chat_message(
chat_id=int(chat_id),
message_id=int(message_id),
disable_notification=True,
)
except Exception:
logger.debug("[Telegram] Failed to pin message %s in chat %s", message_id, chat_id)
await self._set_reaction(chat_id, message_id, "\U0001f440")
async def on_processing_complete(self, event: MessageEvent, outcome: ProcessingOutcome) -> None:
"""Swap the in-progress reaction for a final success/failure reaction and unpin.
"""Swap the in-progress reaction for a final success/failure reaction.
Unlike Discord (additive reactions), Telegram's set_message_reaction
replaces all existing reactions in one call — no remove step needed.
@@ -5462,25 +5453,17 @@ class TelegramAdapter(BasePlatformAdapter):
another agent run to swap it to 👍/👎 — which never happens if the
cancellation was the last activity in the chat.
"""
if not self._reactions_enabled():
return
chat_id = getattr(event.source, "chat_id", None)
message_id = getattr(event, "message_id", None)
if not (chat_id and message_id):
return
if self._reactions_enabled():
if outcome == ProcessingOutcome.CANCELLED:
await self._clear_reactions(chat_id, message_id)
else:
await self._set_reaction(
chat_id,
message_id,
"\U0001f44d" if outcome == ProcessingOutcome.SUCCESS else "\U0001f44e",
)
# Unpin the message when processing is complete
if self._bot:
try:
await self._bot.unpin_chat_message(
chat_id=int(chat_id),
message_id=int(message_id),
)
except Exception:
logger.debug("[Telegram] Failed to unpin message %s in chat %s", message_id, chat_id)
if outcome == ProcessingOutcome.CANCELLED:
await self._clear_reactions(chat_id, message_id)
else:
await self._set_reaction(
chat_id,
message_id,
"\U0001f44d" if outcome == ProcessingOutcome.SUCCESS else "\U0001f44e",
)