feat(slack): sticky thread routing — bypass @mention in active threads#16223
feat(slack): sticky thread routing — bypass @mention in active threads#16223iamfuntime wants to merge 3 commits intoopenclaw:mainfrom
Conversation
When a user has recently interacted in a Slack thread, route follow-up messages directly to the bot without requiring an @mention. This reduces friction in ongoing conversations by tracking thread activity with a configurable TTL (stickyThreadTtlMs). Adds a new sticky-threads module, config schema fields, and integration into the monitor message pipeline. Closes openclaw#16133 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ype replyToMode DM threads were being recorded in the sticky store even though implicitMention already guards DMs. Additionally, the monitor resolved replyToMode once at startup ignoring per-chat-type overrides (replyToModeByChatType.direct / dm.replyToMode). - Add !prepared.isDirectMessage guard to sticky thread recording - Resolve replyToMode per chat type in prepare.ts, pass through PreparedSlackMessage so dispatch.ts uses the effective value - Use prepared.replyToMode instead of ctx.replyToMode in dispatch.ts for thread targets, reply plan, and sticky recording - Fix test fixture to include top-level replyToMode on account Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bfc1ccb to
f92900f
Compare
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
tested working. I rebased on latest main @iamfuntime . context still bloating unnecessarily (as if the stick thread is not in session context) I tried to address that here but it needs more work #27609 |
|
obviously since it is in memory this approach does not survive gateway restarts. no |
|
@iamfuntime! rebased on latest main in draft PR: #28902 |
|
Thanks for the contribution and the detailed work here. Closing this PR for now because it is superseded by a tighter Workstream 3 path that we are landing to avoid overlapping Slack threading/session changes in parallel. What we are keeping:
If you want, I can cross-reference any specific test or edge case from this PR into the active salvage PRs so your coverage is preserved. |
Summary
stickyThreadTtlMs)sticky-threadsmodule with in-memory Map and automatic expiryProblem
Users in active Slack threads had to @mention the bot on every message, even when the bot was already engaged in the conversation. This created unnecessary friction in ongoing discussions.
Closes #16133
Changes
src/slack/monitor/sticky-threads.tsStickyThreadStoreclass withtouch()/isSticky()/ cleanupsrc/config/types.slack.tsstickyThreadTtlMsto Slack provider typesrc/config/zod-schema.providers-core.tssrc/config/schema.help.tsstickyThreadTtlMssrc/config/schema.labels.tssrc/slack/monitor/context.tssrc/slack/monitor/provider.tssrc/slack/monitor/message-handler/prepare.tssrc/slack/monitor/message-handler/dispatch.tsTest plan
🤖 Generated with Claude Code
Greptile Summary
This PR adds sticky thread routing for Slack, allowing follow-up messages in threads where the bot has already replied to bypass the
@mentionrequirement. The implementation uses an in-memory tracker (StickyThreadTracker) with 24-hour TTL and 10K max entries, gated by a newstickyRoutingboolean config option (defaults totrue).StickyThreadTrackerinsrc/slack/monitor/sticky-threads.tswithrecord()/isActive()lifecycle and automatic TTL-based pruningimplicitMentionlogic inprepare.tsto check sticky thread status alongside existingparent_user_idcheckdispatch.tsafter successful bot reply, excluding DMsreplyToModeoverride fromprepare.tsthrough todispatch.tsviaPreparedSlackMessage, fixing a latent issue where dispatch used the globalctx.replyToModeinstead of the resolved per-chat-type modechannels.slack.thread.stickyRoutingto schema, types, help text, and labelsConfidence Score: 4/5
src/slack/monitor/message-handler/prepare.ts(implicit mention logic expansion) andsrc/slack/monitor/message-handler/dispatch.ts(replyToMode source change from ctx to prepared).Last reviewed commit: bba3cf1
(2/5) Greptile learns from your feedback when you react with thumbs up/down!