Skip to content

fix(telegram): suppress bare NO_REPLY sends#38659

Closed
Narcooo wants to merge 1 commit intoopenclaw:mainfrom
Narcooo:fix/38603-telegram-silent-reply
Closed

fix(telegram): suppress bare NO_REPLY sends#38659
Narcooo wants to merge 1 commit intoopenclaw:mainfrom
Narcooo:fix/38603-telegram-silent-reply

Conversation

@Narcooo
Copy link
Copy Markdown
Contributor

@Narcooo Narcooo commented Mar 7, 2026

Summary

  • suppress exact NO_REPLY telegram sends before any API call when there is no media or reply markup
  • return a synthetic suppressed result using the parsed telegram target
  • add regression coverage for the bare-token guard

Why

Pure NO_REPLY payloads should not hit the Telegram send path at all. This matches the existing Slack-side defensive guard and avoids leaking a transient bare token to Telegram before later suppression logic runs.

Verification

  • pnpm exec vitest run src/telegram/send.test.ts
  • pnpm exec oxfmt --check src/telegram/send.ts src/telegram/send.test.ts

Closes #38603

@openclaw-barnacle openclaw-barnacle bot added channel: telegram Channel integration: telegram size: XS labels Mar 7, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR adds a pre-flight guard to sendMessageTelegram that short-circuits and returns a synthetic suppressed result when the payload is a bare NO_REPLY token with no media or inline keyboard — mirroring the equivalent Slack-side guard. The change prevents a transient bare token from reaching the Telegram API and brings the suppression logic ahead of the (expensive) Bot-client initialisation.

Key changes:

  • parseTelegramTarget, mediaUrl extraction, and buildInlineKeyboard are now computed before resolveTelegramApiContext so the early-exit can use them without touching the API client.
  • The guard correctly delegates to the existing isSilentReplyText utility (which already handles surrounding whitespace via ^\s*NO_REPLY\s*$), so the pre-trim() in trimmedText is redundant but harmless.
  • TelegramSendResult is fully satisfied by { messageId: "suppressed", chatId: target.chatId }.
  • One regression test covers the basic suppression path; the inverse cases (NO_REPLY + media, NO_REPLY + buttons) are not tested but are low-risk given the straightforward boolean guard.

Confidence Score: 4/5

  • Safe to merge — the guard is logically correct, non-breaking, and backed by a regression test.
  • The change is narrow and well-scoped: it only adds an early-exit path that returns before any API call, leaving all existing send logic untouched. The pure helper functions moved ahead of the guard have no side effects. The return type contract is satisfied. The only gap is missing inverse-case tests (NO_REPLY with media or buttons), but the boolean guard is simple enough that the risk is very low.
  • No files require special attention.

Last reviewed commit: 917bba6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram: sendMessageTelegram missing isSilentReply guard (causes flash of streamed text before NO_REPLY suppression)

1 participant