fix(telegram): Preserve Telegram forum topic for message tool sends#2772
Open
bogdanovich wants to merge 1 commit intosipeed:mainfrom
Open
fix(telegram): Preserve Telegram forum topic for message tool sends#2772bogdanovich wants to merge 1 commit intosipeed:mainfrom
bogdanovich wants to merge 1 commit intosipeed:mainfrom
Conversation
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
This PR preserves Telegram forum topic routing for messages sent through the
messagetool.When an agent is handling a Telegram forum topic, normal final assistant responses already preserve the inbound
TopicID. However, interim messages sent through themessagetool could lose the topic when the model supplied an explicitchat_idwithout a forum thread suffix.Problem
For Telegram forum groups, this sequence could happen:
6.messagetool with an explicit target like:{"channel":"telegram","chat_id":"-1001234567890","content":"Working on it..."}messagetool builds a fresh outbound context with only channel/chat/reply fields.sendMessagewithoutmessage_thread_id.Final assistant responses did not have this issue because they are built from the inbound context and keep
TopicID.Fix
The
messagetool send callback now inherits the current topic when:It supports both scope forms PicoClaw already uses:
topicdimension values liketopic:6, andchatscope value, e.g.group:-1001234567890/6.The fix does not override an explicitly provided topic and does not apply when sending to a different chat.
Validation
Added a regression test covering a Telegram forum message where the model calls
messagewith an explicitchat_id; the outbound message now keepsContext.TopicID == "6".Ran: