Skip to content

fix(telegram): always inject reply context; use partial quote text - #2694

Closed
aleph-tr wants to merge 1 commit into
NousResearch:mainfrom
aleph-tr:fix/telegram-reply-context
Closed

fix(telegram): always inject reply context; use partial quote text#2694
aleph-tr wants to merge 1 commit into
NousResearch:mainfrom
aleph-tr:fix/telegram-reply-context

Conversation

@aleph-tr

Copy link
Copy Markdown

Problem

When a user replies to a message in the current session, the agent had no way to know which specific message was being referenced from a flat conversation history. The found_in_history check was silently dropping the [Replying to: "..."] prefix in this exact case, making replies ambiguous. Also ignoring Telegram's partial-quote feature (selected text), always using the full message instead.

Changes

gateway/run.py — removed found_in_history suppression. Reply context is now always injected.

gateway/platforms/telegram.py — use message.quote.text when available instead of full message text.

Testing

Verified on a live Telegram bot.

When a user replies to a message in the current session, the agent had
no way to know which specific message was being referenced from a flat
conversation history. The found_in_history check was silently dropping
the [Replying to: "..."] prefix in this exact case, making replies
ambiguous. Now reply context is always injected.

Also use message.quote.text when available so partial text selections
are used instead of the full message.
@aleph-tr aleph-tr closed this Apr 11, 2026
@aleph-tr
aleph-tr deleted the fix/telegram-reply-context branch April 11, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant