fix(discord): ensure autoThread replies route to existing threads#8302
Merged
thewilloftheshadow merged 2 commits intoopenclaw:mainfrom Feb 13, 2026
Merged
Conversation
Fixes openclaw#8278 When autoThread is enabled and a thread already exists (user continues conversation in thread), replies were sometimes routing to the root channel instead of the thread. This happened because the reply delivery plan only explicitly set the thread target when a NEW thread was created (createdThreadId), but not when the message was in an existing thread. The fix adds a fallback case: when threadChannel is set (we're in an existing thread) but no new thread was created, explicitly route to the thread's channel ID. This ensures all thread replies go to the correct destination.
ea1af82 to
a31b7b1
Compare
Member
|
Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build (tests skipped per request)\n- Land commit: 7193952\n- Merge commit: 7193952\n\nThanks @gavinbmoore! |
zhangyang-crazy-one
pushed a commit
to zhangyang-crazy-one/openclaw
that referenced
this pull request
Feb 13, 2026
steipete
pushed a commit
to azade-c/openclaw
that referenced
this pull request
Feb 14, 2026
Hansen1018
pushed a commit
to Hansen1018/openclaw
that referenced
this pull request
Feb 14, 2026
GwonHyeok
pushed a commit
to learners-superpumped/openclaw
that referenced
this pull request
Feb 15, 2026
cloud-neutral
pushed a commit
to cloud-neutral-toolkit/openclawbot.svc.plus
that referenced
this pull request
Feb 15, 2026
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
Fixes #8278
When
autoThread: trueis configured for a Discord channel, replies were sometimes routing to the root channel instead of the thread after the thread was created.Root Cause
The
resolveDiscordReplyDeliveryPlanfunction was only setting the explicit thread delivery target when a NEW thread was created (whencreatedThreadIdis truthy). For subsequent messages in an existing thread (wherethreadChannelis set butcreatedThreadIdis null), the delivery target fell back to theoriginalReplyTargetwhich relied onmessage.channelId.While
message.channelIdshould be the thread ID for thread messages, there could be edge cases where this doesn't resolve correctly, or where the reply target resolution differs.Fix
Added explicit handling for existing threads: when
threadChannelis set (we're in an existing thread) but no new thread was created, explicitly route tochannel:${threadChannel.id}. This ensures all replies in a thread context go to the thread, not the root channel.Testing
Greptile Overview
Greptile Summary
This PR updates
resolveDiscordReplyDeliveryPlanto explicitly setdeliverTarget/replyTargetto the current thread’s channel ID not only when a new thread is created (createdThreadId), but also whenthreadChannelindicates the message is already in an existing thread. This preventsautoThread: truefollow-up replies from occasionally falling back to the root channel via the originalreplyTarget.Change is localized to
src/discord/monitor/threading.tsand keeps existing reply-reference behavior by disabling references when the delivery target is rewritten away from the original reply target.Confidence Score: 5/5
Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)