-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Telegram group replies to bot messages can lose reply context under group allowlist #82002
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Version
OpenClaw
2026.5.12stable.Problem
In a Telegram group that is configured as a dedicated agent group with an allowlist, replying to a message sent by the OpenClaw Telegram bot itself can lose the quoted/replied-to message context before the turn reaches the agent.
The incoming Telegram update does include
reply_to_messagewith the bot message text, and the message is also present in the local Telegram message cache. However, the final agent turn may only receive the user's short text, such aswhat happened?, without theReply target of current user message/ reply-chain context.This makes the agent answer from stale conversation context instead of the referenced bot notification.
Expected Behavior
If a user replies to a bot-sent message in Telegram, that bot message should be included as visible supplemental quote/reply context.
This also matches the docs expectation that:
Observed Behavior
For a Telegram group with
requireMention=falseand group allowlist enabled:reply_to_message.text.Likely Cause
In the Telegram inbound context builder,
shouldIncludeGroupSupplementalContext()computessenderAllowedby checking the quote/reply target sender againsteffectiveGroupAllow.For a quoted bot/self message, the sender is the Telegram bot account. That sender may not be in the group allowlist, so the quote/reply target is filtered out even though it is the bot's own message and should be safe/visible context.
Local Workaround
We applied a minimal local patch:
We also added a conservative local fallback to record text messages delivered by the Telegram delivery path into the same
.telegram-messages.jsonreply cache, so cron/system notifications sent by the bot are available for future reply-chain hydration even if Telegram returns only a shallow parent.Suggested Fix
Treat Telegram bot/self messages as allowed supplemental context when they are the
reply_to_message/ quote target, regardless of group allowlist membership.Optionally, persist outbound Telegram bot messages with body text into the observed message cache, so bot-originated cron/system notifications can reliably participate in reply-chain hydration.