feat(slack): add ignoreOtherMentions channel config#53467
Conversation
Greptile SummaryThis PR adds an Key changes:
The only gap is test coverage: the Discord counterpart has dedicated unit tests for this path ( Confidence Score: 5/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/slack/src/monitor/message-handler/prepare.ts
Line: 472-497
Comment:
**No test coverage for `ignoreOtherMentions`**
The Discord counterpart (`extensions/discord/src/monitor/message-handler.preflight.test.ts`) has dedicated test cases for this feature (e.g. `"drops guild messages that mention another user when ignoreOtherMentions=true"`, `"does not drop @everyone messages when ignoreOtherMentions=true"`), but no equivalent tests were added for the Slack implementation.
Consider adding cases in `prepare.test.ts` or a sibling file covering at least:
- A channel message with `<@U456>` and `ignoreOtherMentions: true` → expect `null`
- A channel message with `<@UBOT> <@U456>` (bot explicitly mentioned) and `ignoreOtherMentions: true` → expect non-null
- A DM with `<@U456>` and `ignoreOtherMentions: true` → expect non-null (DMs are excluded by the `isRoom` guard)
- A channel message with no user mentions and `ignoreOtherMentions: true` → expect non-null
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat(slack): add ignoreOtherMentions cha..." | Re-trigger Greptile Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bc878f821
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4ecaa5b to
42c72fa
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42c72fa87e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
42c72fa to
8aacf0b
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aacf0b0ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d28b0c2cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The 3 failing checks ( Errors are |
de5481e to
0337e5d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0337e5d7a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
0337e5d to
f2c0875
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2c0875146
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c082e1f to
2e37d7f
Compare
|
Rebased on latest upstream/main and regenerated baseline artifacts ( The two remaining CI failures are pre-existing on upstream/main — unrelated to this PR:
Both reproduce locally on a clean checkout of |
5c23a9c to
0ad297d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ad297d28f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
715d740 to
0fa84e3
Compare
Cherry-pick from upstream PR openclaw#53467 (0fa84e3). Mirrors Discord ignoreOtherMentions for Slack channels — drops messages that mention another user but not the bot, even in bot-participated threads. Regenerated config baseline and bundled metadata.
0fa84e3 to
5ec9e3e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Rebased onto latest
All Slack-related checks (channels, contracts, boundary tests) pass. |
5ec9e3e to
183a3e1
Compare
|
Addressed ClawSweeper review findings: [P2] Native bot-id certainty — fixed. [P2] MPIM scope alignment — fixed. [P3] CHANGELOG entry — intentionally kept. |
Mirrors the existing Discord `ignoreOtherMentions` option for Slack channels. When set on a channel entry, drop channel/group/MPIM messages that mention another user or subteam but not this bot — the inverse of `requireMention`. Useful in busy channels where the bot would otherwise reply to side conversations. Implementation lives in `prepareSlackMessage` right after the `allowBots: "mentions"` bot-drop gate and before the `shouldRequireMention` non-mention drop, so it integrates with the new `messageIngress` ingress pipeline. The gate is conditional on `canDetectMention` (botUserId resolvable via `auth.test` or explicit mention regexes configured) to avoid false drops when we have no reliable way to tell bot vs non-bot mentions apart. Slack implicit mentions (thread participation) are intentionally NOT respected here — they fire for every message in a bot-participated thread, so honoring them would defeat the feature in any active thread. The gate matches on `wasMentioned` (explicit) and `hasAnyMention`, with the existing `shouldBypassMention` override (e.g. authorized commands) also respected. Includes config types, zod schema, channel-config resolution, prepare-message implementation, full test coverage in `prepare.test.ts`, regenerated channel + docs baselines, and Slack docs entry.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f03fe0716
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Thread participation is broad on Slack; only an explicit bot mention escapes this gate. | ||
| // Native bot identity distinguishes bot pings from other Slack mentions. | ||
| const ignoreOtherMentions = channelConfig?.ignoreOtherMentions ?? false; | ||
| if (isRoom && ignoreOtherMentions && Boolean(ctx.botUserId) && hasAnyMention && !wasMentioned) { |
There was a problem hiding this comment.
Apply other-mention filtering to relay activations
In Slack relay mode this condition never fires for routed events because relay-source marks every forwarded event as wasMentioned: true (extensions/slack/src/monitor/relay-source.ts:243-245), including channel_default routes. With channels.slack.mode="relay" and ignoreOtherMentions enabled, a forwarded channel message like <@U456> hey reaches this gate with hasAnyMention=true but wasMentioned=true, so the new filter is bypassed and the bot still handles coworker mentions; base this check on actual bot-mention evidence rather than the relay activation flag.
Useful? React with 👍 / 👎.
|
Merged via squash.
|

What Problem This Solves
In busy Slack rooms where
requireMentionis disabled, OpenClaw can respond to messages explicitly directed at another user or user group. This adds an opt-in per-channel filter for #89625 without changing default behavior.Why This Change Was Made
channels.slack.channels.<id>.ignoreOtherMentions, matching the existing Discord configuration concept.User Impact
The new option defaults to
false. When enabled for a Slack channel or private channel, messages that mention another user or user group but not the bot are stored as pending context and are not handled. Bot-directed messages, ordinary unmentioned messages, DMs, and group DMs keep their existing behavior.Evidence
node scripts/run-vitest.mjs extensions/slack/src/monitor/message-handler/prepare.test.ts— 100 tests passed.tbx_01kwqracphtj8m49be5xmhpyxy— broad changed gate passed in 10m16s: core/extension production and test types, lint, import cycles, state/storage guards, config guards, and changed-surface checks.Closes #89625.