feat(discord): add multibot-mentions mode for allow_user_messages#464
Merged
thepagent merged 1 commit intoopenabdev:mainfrom Apr 19, 2026
Merged
Conversation
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
ec38117 to
df56295
Compare
thepagent
approved these changes
Apr 19, 2026
Collaborator
thepagent
left a comment
There was a problem hiding this comment.
LGTM — clean feature, well-designed middle ground between involved and mentions.
One nit: the PR description says "No caching of other_bot_present" but the code correctly caches it in multibot_threads. The code is right (bot posting is irreversible), the description just needs updating to match.
Everything else checks out:
- Config deserialization with
-/_normalization ✅ - Positive-only cache with TTL + eviction ✅
Involvedmode: no regression (bot_owns_thread still short-circuits) ✅MultibotMentions+ bot_owns_thread: correctly fetches to check for other bots ✅- Detection uses
m.author.bot(any bot, not just trusted) ✅ - Docs updated ✅
a901950 to
7bcea5f
Compare
Add a third mode for allow_user_messages that behaves like 'involved' in single-bot threads but falls back to 'mentions' when other bots have also posted in the thread. This prevents all bots from responding to every message in multi-bot threads while keeping natural conversation flow in single-bot threads. - Add MultibotMentions variant to AllowUsers enum - Refactor bot_participated_in_thread to return (involved, other_bot_present) - Add multibot-mentions gating logic in message handler - Update docs/discord.md with new mode and recommended usage Closes openabdev#463
7bcea5f to
502b517
Compare
thepagent
approved these changes
Apr 19, 2026
chaodu-agent
added a commit
to chaodu-agent/openab
that referenced
this pull request
Apr 19, 2026
Instead of fetching thread history to detect other bots on every unmentioned message, detect multi-bot threads eagerly from msg.author: when a bot message arrives in a thread, cache multibot_threads immediately — zero API calls needed. This eliminates per-message fetches in MultibotMentions mode for single-bot threads (which would never find other bots but fetched every time to check). - Add early detection before gating: msg.author.bot → cache multibot - Simplify bot_participated_in_thread: cached_involved → return immediately with cached_multibot, no MultibotMentions special-casing Builds on openabdev#464
This was referenced Apr 19, 2026
brettchien
added a commit
to brettchien/openab
that referenced
this pull request
Apr 19, 2026
The openab binary added the `MultibotMentions` variant to `AllowUsers` in openabdev#464, but the Helm chart's validation block was not updated. Any user who follows docs/discord.md § Multi-Bot Setup and sets `allowUserMessages: "multibot-mentions"` is blocked by a template fail before the pod ever starts. Fix: - Add `"multibot-mentions"` to the `has ... (list ...)` check for both Discord and Slack in `charts/openab/templates/configmap.yaml`. - Update the trailing documentation comment describing the mode. - Document the new option (and its semantics) in `charts/openab/values.yaml`. - Add helm-unittest cases covering renders + invalid-value rejection for `allowUserMessages` (the test file previously only covered `allowBotMessages`). Verified: $ helm template openab ./charts/openab \ --set agents.kiro.discord.allowUserMessages=multibot-mentions \ ... | grep allow_user_messages allow_user_messages = "multibot-mentions" $ helm unittest charts/openab Charts: 1 passed, 1 total Test Suites: 2 passed, 2 total Tests: 18 passed, 18 total Fixes openabdev#471 Refs openabdev#464 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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
Closes #463
Add a third mode for
allow_user_messagesthat combines the best ofinvolvedandmentions:@mentionneeded (same asinvolved)@mentionso only the addressed bot responds (same asmentions)Changes
src/config.rsMultibotMentionsvariant toAllowUsersenum"multibot-mentions"or"multibot_mentions"in config deserializationsrc/discord.rsbot_participated_in_thread()to return(involved, other_bot_present)tuplem.author.bot && m.author.id != bot_idto detect other botsInvolvedmode with a cache hit, skips the fetch entirely (no regression)multibot_threadspositive-only cache (same pattern asparticipated_threads)return (true, true), zero API callMultibotMentionsbranch in the gating logic:@mention)src/main.rsmultibot_threadscache in Handler constructiondocs/discord.mdmultibot-mentionsto theallow_user_messagesconfig tableDesign decisions
Positive-only caching for
other_bot_present: Like participation, a thread becoming multi-bot is irreversible — bot messages don't disappear. So we use the same positive-only cache pattern: once detected, cached for the session TTL. This avoids per-message API calls in active multi-bot threads.Detection uses
m.author.bot: Checks any bot author, not justtrusted_bot_ids. This is intentional — even untrusted bots in a thread indicate a multi-bot scenario where@mentiongating is desirable.First message in new thread: No other bot messages exist yet → behaves as
involved. Correct, since it is not yet a multi-bot thread.