fix(telegram): use native quote text for partial reply context - #22709
Closed
Ninso112 wants to merge 1 commit into
Closed
fix(telegram): use native quote text for partial reply context#22709Ninso112 wants to merge 1 commit into
Ninso112 wants to merge 1 commit into
Conversation
When a user replies using Telegram's native quote feature to select only part of a previous message, the adapter was ignoring message.quote and injecting the entire replied-to message as reply_to_text. This could materially change the user's intent by exposing unrelated text to the agent. Now checks for message.quote (TextQuote) first and uses quote.text when available, falling back to the full reply_to_message.text only when no native quote exists. Fixes NousResearch#22619
Collaborator
|
Duplicate of #22676 (merged). The same fix — honoring |
Contributor
|
This looks implemented on current main by the already-merged duplicate PR #22676. Evidence from this automated hermes-sweeper review:
Closing as already implemented on main. Thanks for the useful report and patch. |
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.
Summary
message.quote(TextQuote) is available, the adapter now usesquote.textasreply_to_text, falling back to the fullreply_to_message.textonly when no native quote existsWhy
When a user replies using Telegram's native quote feature to select only part of a previous message, the adapter was ignoring
message.quoteand injecting the entire replied-to message asreply_to_text. This could materially change the user's intent — for example, if Hermes sent a multi-item briefing and the user quoted just one item with "mark this done", the agent would see the entire briefing and might act on the wrong item.The fix uses
python-telegram-bot's existingMessage.quote/TextQuoteAPI (documented since v22.7) to respect the user's selected quote text.Closes #22619