openclaw - ✅(Solved) Fix feat(slack): Add thread.requireMention option to enforce explicit @mentions inside threads [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49972Fetched 2026-04-08 01:00:39
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
3
Participants
Timeline (top)
referenced ×5cross-referenced ×2closed ×1

Add a configuration option to enforce explicit @mentions within Slack threads, even after the bot has already participated in the thread.

Root Cause

Add a configuration option to enforce explicit @mentions within Slack threads, even after the bot has already participated in the thread.

PR fix notes

PR #58276: feat(slack): add thread.requireExplicitMention config option

Description (problem / solution / changelog)

Summary

When requireMention: true is set for a Slack channel, replying inside a thread where the bot previously participated bypasses mention gating via implicit mention detection. This causes the bot to respond to every thread message even without an explicit @mention.

This PR adds channels.slack.thread.requireExplicitMention (default: false) which, when set to true, suppresses implicit thread mentions so only explicit @bot mentions trigger replies inside threads.

Configuration

{
  "channels": {
    "slack": {
      "requireMention": true,
      "thread": {
        "requireExplicitMention": true
      }
    }
  }
}

Changes

  • src/config/types.slack.ts: Add requireExplicitMention to SlackThreadConfig
  • src/config/zod-schema.providers-core.ts: Add field to SlackThreadSchema
  • extensions/slack/src/monitor/context.ts: Thread the new option through SlackMonitorContext
  • extensions/slack/src/monitor/provider.ts: Read config and pass to context
  • extensions/slack/src/monitor/message-handler/prepare.ts: Gate implicitMention on the new flag
  • extensions/slack/src/config-ui-hints.ts: Add UI hint
  • docs/channels/slack.md: Document the new option
  • Tests: 3 new test cases covering enabled, disabled, and explicit mention scenarios

Behavior

thread.requireExplicitMentionThread reply without @botThread reply with @bot
false (default)Bot responds (implicit mention)Bot responds
trueBot ignoresBot responds

Closes #34389 Closes #49972

Changed files

  • CHANGELOG.md (modified, +3/-0)
  • docs/.generated/config-baseline.sha256 (modified, +4/-4)
  • docs/channels/slack.md (modified, +2/-1)
  • extensions/mattermost/src/config-schema.ts (added, +1/-0)
  • extensions/slack/src/config-ui-hints.ts (modified, +4/-0)
  • extensions/slack/src/monitor/context.test.ts (modified, +1/-0)
  • extensions/slack/src/monitor/context.ts (modified, +3/-0)
  • extensions/slack/src/monitor/message-handler/prepare.test-helpers.ts (modified, +2/-0)
  • extensions/slack/src/monitor/message-handler/prepare.test.ts (modified, +119/-0)
  • extensions/slack/src/monitor/message-handler/prepare.ts (modified, +1/-0)
  • extensions/slack/src/monitor/monitor.test.ts (modified, +1/-0)
  • extensions/slack/src/monitor/provider.ts (modified, +2/-0)
  • src/config/bundled-channel-config-metadata.generated.ts (modified, +10/-0)
  • src/config/types.slack.ts (modified, +8/-0)
  • src/config/zod-schema.providers-core.ts (modified, +1/-0)

Code Example

{
  channels: {
    slack: {
      thread: {
        historyScope: "thread",
        inheritParent: false,
        requireMention: true  // NEW: force explicit @mention even in active threads
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Feature Request

Summary

Add a configuration option to enforce explicit @mentions within Slack threads, even after the bot has already participated in the thread.

Current Behavior

Once an OpenClaw bot participates in a Slack thread (e.g., after being explicitly mentioned), all subsequent messages in that thread are treated as implicit mentions. The bot responds to every message in the thread without requiring a direct @botname.

This is documented behavior:

"Replying to a bot message counts as an implicit mention (when the channel supports reply metadata). This applies to Telegram, WhatsApp, Slack, Discord, and Microsoft Teams."

Desired Behavior

A new configuration option (e.g., thread.requireMention: true) that would require explicit @mentions for the bot to respond, even within an active thread where the bot has previously participated.

Proposed Configuration

{
  channels: {
    slack: {
      thread: {
        historyScope: "thread",
        inheritParent: false,
        requireMention: true  // NEW: force explicit @mention even in active threads
      }
    }
  }
}

Use Case

Teams using Slack threads for discussions where the bot is occasionally consulted (via @mention) but shouldn't respond to every message in the thread. This is a common pattern in busy team channels where the bot is used as an on-demand assistant, not a continuous participant.

Alternatives Considered

  • No config change: Bot responds to all thread messages once it participates (current behavior — too noisy)
  • requireMention: false on the channel: Bot responds to all messages in the channel (too permissive)
  • There is currently no middle ground for thread-level mention enforcement.

Platform Scope

While the implicit thread mention behavior applies to Telegram, WhatsApp, Slack, Discord, and Microsoft Teams, this request is primarily motivated by Slack usage patterns where thread isolation is a key UX consideration.


Reported via Fibek's OpenClaw deployment.

extent analysis

Fix Plan

To implement the thread.requireMention configuration option, follow these steps:

  1. Update configuration parsing:

    • Modify the configuration parser to recognize and validate the requireMention option within the thread object.
    • Ensure the parser defaults to false if the option is not provided.
  2. Modify message handling logic:

    • Check if thread.requireMention is true for the current channel.
    • If true, verify that the message contains an explicit @mention of the bot before responding.
    • Use a regular expression to match the bot's name in the message text.

Example code snippet (in JavaScript):

const botName = 'OpenClawBot';
const requireMention = config.channels.slack.thread.requireMention;

// ...

if (requireMention) {
  const mentionRegex = new RegExp(`@${botName}`, 'i');
  if (!mentionRegex.test(message.text)) {
    // Do not respond if no explicit @mention is found
    return;
  }
}

// Respond to the message if an explicit @mention is found or requireMention is false
  1. Update documentation:
    • Document the new thread.requireMention configuration option.
    • Provide examples of how to use this option in different scenarios.

Verification

To verify that the fix worked:

  • Set thread.requireMention to true in your configuration.
  • Participate in a Slack thread using the bot.
  • Send a message in the thread without mentioning the bot.
  • Verify that the bot does not respond.
  • Send a message in the thread with an explicit @mention of the bot.
  • Verify that the bot responds correctly.

Extra Tips

  • Consider adding a warning or log message when thread.requireMention is enabled, to remind users that explicit @mentions are required for the bot to respond.
  • Review the bot's documentation to ensure that the new configuration option is clearly explained and examples are provided for different use cases.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix feat(slack): Add thread.requireMention option to enforce explicit @mentions inside threads [1 pull requests, 1 participants]