fix(slack): check thread session participation for implicitMention#25781
Closed
zerone0x wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(slack): check thread session participation for implicitMention#25781zerone0x wants to merge 1 commit intoopenclaw:mainfrom
zerone0x wants to merge 1 commit intoopenclaw:mainfrom
Conversation
When a user @mentions the bot in a channel and the bot replies (starting or joining a thread), subsequent follow-up messages from the user should not require a re-mention. Previously, `implicitMention` was only set when the bot was the `parent_user_id` (i.e. the root-message author). This missed the common case where a user starts a thread and the bot joins it via @mention — because `parent_user_id` is the user who started the thread, not the bot. Fix: also set `implicitMention = true` when the bot has a prior session entry for the thread session key (i.e. it has already replied in this thread). The session key check is a synchronous O(1) JSON read via the existing `readSessionUpdatedAt` helper — no extra Slack API call needed. Implementation details: - Move `storePath` computation earlier in `prepareSlackMessage` so it can be shared between the new `implicitMention` check and the later session-recording code (removes the duplicate `resolveStorePath` call). - Add `botParticipatedInThread` helper flag and include it in the `implicitMention` condition. - Two new unit tests: one verifies the old bot-authored-thread path still works (false when no session exists and bot is not parent_user_id); the other verifies the new path (true when a thread session already exists even if bot is not parent_user_id). Fixes openclaw#25760 Co-Authored-By: Claude <noreply@anthropic.com>
sourman
pushed a commit
to sourman/openclaw
that referenced
this pull request
Feb 27, 2026
…amble Combines: - PR openclaw#25781: Session-based thread participation check for implicit mention - Git stash work: Thread-aware sender preamble Changes: - Add botParticipatedInThread check using readSessionUpdatedAt - Update implicitMention condition to include bot participation - Thread messages: "Slack message detected on thread: {senderName} speaking" - Non-thread messages: "Slack message from {senderName}" This helps the LLM understand multi-human threads and decide when to NO_REPLY when the message is directed at someone else. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 tasks
sourman
added a commit
to sourman/openclaw
that referenced
this pull request
Feb 27, 2026
…amble Combines: - PR openclaw#25781: Session-based thread participation check for implicit mention - Git stash work: Thread-aware sender preamble Changes: - Add botParticipatedInThread check using readSessionUpdatedAt - Update implicitMention condition to include bot participation - Thread messages: "Slack message detected on thread: {senderName} speaking" - Non-thread messages: "Slack message from {senderName}" This helps the LLM understand multi-human threads and decide when to NO_REPLY when the message is directed at someone else. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
@Takhoffman this one too probably |
|
Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
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
requireMention: true, follow-up replies in a thread do not reach the bot unless the user re-mentions it — unless the bot happened to be the root-message author (parent_user_id === botUserId). The very common pattern of user starts thread → bot joins via @mention → user replies without @mention was silently dropped.implicitMentiononly checkedmessage.parent_user_id === ctx.botUserId. This misses threads where a third party started the thread and the bot joined via @mention.implicitMention = truewhen the bot has a prior thread session (i.e. it has already replied in this thread). Uses the existing synchronousreadSessionUpdatedAthelper — no extra Slack API call required. As a bonus,storePath(which was computed twice) is now computed once and shared.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
When
requireMention: trueis configured for a Slack channel:Threads where the bot never replied are unaffected — the mention requirement still applies.
Security Impact (required)
readSessionUpdatedAthelper (JSON file read), not an API call.Repro + Verification
Environment
requireMention: true,thread.inheritParent: true,replyToMode: allSteps
Expected
Bot receives the follow-up reply.
Evidence
prepare.test.tsHuman Verification (required)
isDirectMessageguard). Threads where bot has no session are unaffected.Compatibility / Migration
Failure Recovery (if this breaks)
botParticipatedInThreadaddition insrc/slack/monitor/message-handler/prepare.tsRisks and Mitigations
Greptile Summary
This PR fixes a bug where follow-up thread replies in Slack channels with
requireMention: truewere dropped when users didn't re-mention the bot. The fix extendsimplicitMentionlogic to check if the bot has previously participated in a thread (via session file), not just when the bot authored the root message.Key changes:
storePathcomputation earlier (line 215-219) so it's available for both the new thread participation check and later session operationsbotParticipatedInThreadcheck (line 244-245) usingreadSessionUpdatedAtto detect existing thread sessionsimplicitMentioncondition (line 246-250) to include bot thread participation:(message.parent_user_id === ctx.botUserId || botParticipatedInThread)This is a targeted fix that reuses existing session infrastructure without adding API calls or changing core behavior patterns.
Confidence Score: 5/5
storePathrefactor eliminates redundant computation. ThereadSessionUpdatedAthelper is already used throughout the codebase for similar purposes.Last reviewed commit: ec946d7