Skip to content

Telegram outbound replies leak/drop react/media directives instead of applying native reactions/GIFs #71140

Description

@Cuttingwater

Summary

Telegram outbound delivery drops or leaks reaction / media directives instead of turning them into native Telegram behavior.

In live Telegram use, replies like:

  • [[react_to_current:🔥]]
  • MEDIA:/path/to/file.gif

were being rendered as literal text in chat or partially dropped, even though the Telegram extension already has native support for:

  • setMessageReaction
  • sendAnimation
  • sendPhoto

This turned out to be a core outbound normalization + Telegram adapter gap, not a local config problem.

User-visible symptoms

  • Raw [[react_to_current:🔥]] leaked into Telegram instead of applying a reaction
  • MEDIA: lines leaked into Telegram as plain text in some paths
  • Reaction-only replies were treated as invalid (reply missing text/media)
  • Telegram transport primitives worked when invoked directly, but normal assistant delivery still failed

Root cause

There were three related gaps:

  1. Shared outbound payload normalization did not parse [[react...]] / [[react_to_current:...]] into structured channel data
  2. Telegram reply delivery rejected reaction-only replies because it required text or media
  3. Telegram outbound adapter did not preserve/execute channelData.telegram.reaction in sendPayload

Source areas involved

Likely source files:

  • src/auto-reply/reply/reply-directives.ts
  • src/infra/outbound/payloads.ts
  • extensions/telegram/src/bot/delivery.replies.ts
  • extensions/telegram/src/outbound-adapter.ts

Working fix outline

A local hotfix against the installed build worked in live Telegram and should be ported cleanly to source:

1) Parse reaction directives during reply normalization

  • detect [[react:...]] and [[react_to_current:...]]
  • strip the directive from visible text
  • carry the value into channelData.telegram.reaction

2) Allow reaction-only Telegram replies

  • if a reply has no text/media but does have channelData.telegram.reaction, do not reject it
  • resolve the reaction target from replyToId
  • call Telegram reaction transport before optional text/media delivery

3) Execute reaction channelData in outbound adapter

  • in sendTelegramPayloadMessages(...), read channelData.telegram.reaction
  • call reactMessageTelegram(...) when replyToMessageId is present
  • allow reaction-only payloads to return a synthetic success result instead of forcing a text/media send

Validation performed

Confirmed in a live Telegram chat after patching the installed package:

  • direct transport reaction test returned success
  • direct GIF/media send returned success
  • full assistant-lane reply using [[react_to_current:🔥]] plus MEDIA:<gif> worked correctly in the real chat
  • user confirmed the live fix was working

Why this matters

This is not just a Telegram UX paper cut. It breaks a cross-surface control-directive contract:

  • directives are parsed/consumed correctly in some lanes
  • Telegram was leaking internal control syntax to end users

That makes reaction/GIF behavior unreliable and discourages use of otherwise-supported features.

Suggested acceptance criteria

  • [[react_to_current:🔥]] in a Telegram reply applies a native Telegram reaction, not visible text
  • reaction-only replies are accepted when a valid reply target exists
  • sendPayload honors channelData.telegram.reaction
  • payload normalization preserves reaction intent in structured channel data
  • tests cover both normalization and Telegram adapter behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions