fix(telegram): surface message.quote (selected fragment) in agent context - #70631
Closed
stefrogovskyi wants to merge 1 commit into
Closed
Conversation
…gent context Telegram delivers a native partial quote in message.quote when a user replies to a selected substring of a prior message. Hermes previously only surfaced this in reply metadata (reply_to_text), so the agent could not see what fragment the user was responding to. Inject the quote text into event.text with a clear marker so the agent answers on the quoted fragment's substance. - _handle_text_message: after _clean_bot_trigger_text, read msg.quote.text and prepend a [ПОЛЬЗОВАТЕЛЬ ПРОЦИТИРОВАЛ ФРАГМЕНТ: ...] marker to event.text - minimal, scoped to text messages only; does not affect replies/commands path beyond making the quoted fragment visible to the agent Fixes: agent blind to quoted/selected text in Telegram (reported by operator).
Contributor
|
Thanks for the focused Telegram report and implementation. Automated hermes-sweeper review found that current
The proposed addition would surface the same selected fragment a second time with an extra localized marker, so this PR is superseded by main. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Telegram delivers a native partial quote in
message.quotewhen a user replies to a selected substring of a prior message. Hermes previously only surfaced this in reply metadata (reply_to_text), so the agent could not see which fragment the user was responding to — it only saw the whole replied-to message or nothing.This injects the quoted fragment into
event.text(with a clear marker) so the agent answers on the substance of the quoted text.Where
plugins/platforms/telegram/adapter.py→_handle_text_message, right afterevent.text = self._clean_bot_trigger_text(event.text).Why minimal
reply_to_textextraction (used elsewhere for attribution); this is additive.Behavior
When a user quotes a fragment and asks a question, the agent now receives:
(The marker is operator-localized; happy to make it configurable / English if preferred.)
Test
Fixes a reported operator bug: agent was blind to quoted/selected text in Telegram.