-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
sessions_send announce step fails to deliver to Telegram topics — "group:" prefix not stripped #51624
Description
Bug Description
When sessions_send triggers the announce step for a Telegram group topic session, the delivery fails with:
Error: Telegram recipient must be a numeric chat ID
Root Cause
resolveAnnounceTargetFromKey() parses the sessionKey agent:<name>:telegram:group:<chatId>:topic:<topicId> and generates to: "group:<chatId>".
However, normalizeTelegramLookupTarget() → stripTelegramInternalPrefixes() only strips the group: prefix if preceded by telegram: or tg:.
Since the announce target comes without that prefix, group: is NOT stripped, and group:-1003743251787 fails the numeric chat ID regex check.
Expected Behavior
Announce step should deliver agent response to the Telegram group topic.
Actual Behavior
Gateway log:
[ws] res send errorCode=UNAVAILABLE errorMessage=Error: Telegram recipient must be a numeric chat ID channel=telegram
[agents/sessions-send] sessions_send announce delivery failed
Suggested Fix
In resolveAnnounceTargetFromKey(), apply Telegram normalizeTarget on the to field, or update stripTelegramInternalPrefixes() to always strip group: prefix regardless.
Workaround
Agents post via Bot API directly using notify-topic.sh.
Environment
- OpenClaw 2026.3.13 (61d171a)
- Ubuntu 24.04 LTS