fix: populate currentThreadTs in threading tool context fallback (#52217)#52900
Merged
obviyus merged 1 commit intoopenclaw:mainfrom Mar 24, 2026
Merged
fix: populate currentThreadTs in threading tool context fallback (#52217)#52900obviyus merged 1 commit intoopenclaw:mainfrom
obviyus merged 1 commit intoopenclaw:mainfrom
Conversation
Contributor
Greptile SummaryThis PR fixes a one-line routing bug in the threading tool context fallback path: when a channel plugin (e.g. Telegram) has no custom
Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix: populate currentThreadTs in threadi..." | Re-trigger Greptile |
…Telegram DM topics (openclaw#52217) When a channel plugin lacks a custom buildToolContext (e.g. Telegram), the fallback path in buildThreadingToolContext did not set currentThreadTs from the inbound MessageThreadId. This caused resolveTelegramAutoThreadId to return undefined, so message tool sends without explicit threadId would route to the main chat instead of the originating DM topic. Fixes openclaw#52217
90049d4 to
c3da194
Compare
Contributor
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.
Problem
When a channel plugin lacks a custom
buildToolContextin its threading adapter (e.g. Telegram), the fallback path inbuildThreadingToolContext()did not includecurrentThreadTsfrom the inboundMessageThreadId.This caused
resolveTelegramAutoThreadId()to returnundefined(because it requires bothcurrentThreadTsANDcurrentChannelId), so anymessage(action=send)without an explicitthreadIdwould route to the main chat instead of the originating DM topic.Reproduction
1045687)lastThreadIdin session entry)message(action=send)with buttons/media without explicitthreadIdFix
Add
currentThreadTsderived fromsessionCtx.MessageThreadIdto the fallback return inbuildThreadingToolContext()whenthreading?.buildToolContextis absent.This ensures
resolveTelegramAutoThreadId()can auto-inject the correctmessage_thread_idfor Telegram DM topics, matching the behavior that channels with custombuildToolContextalready have.Changes
src/auto-reply/reply/agent-runner-utils.ts: AddcurrentThreadTsto fallback path (3 lines)Testing
message-action-runner.threading.test.ts,channel.test.ts)message(action=send)withoutthreadIdnow correctly routes to topic after the user interacts with main chatFixes #52217