Skip to content

bug(discord): @mentioned bot ignored in another bot's thread — multi-bot same-channel #457

@thepagent

Description

@thepagent

Description

When two bots share a Discord channel and a user @mentions both in a single message, only the first bot responds. The second bot sees the message inside the first bot's thread and drops it because allow_user_messages = "involved" rejects messages in threads where the bot hasn't participated.

User: @BotA @BotB HIHI  (main channel)
  │
  ├─► BotA: sees main channel msg → creates thread → responds ✅
  │
  └─► BotB: sees msg inside BotA's thread → "not involved" → drops ❌

Discord converts the original message into a thread parent once BotA creates a thread. By the time BotB processes it, the message is no longer in the main channel — it's in BotA's thread.

Same issue when @mentioning BotB alone in BotA's thread — BotB ignores it because it hasn't participated, even though it's explicitly @mentioned.

Steps to Reproduce

  1. Deploy two bots (e.g. AgentBroker + AgentDealer) in the same Discord channel
  2. Set allow_user_messages = "involved" (default) on both
  3. Send @AgentBroker @AgentDealer HIHI in the main channel
  4. Observe: only AgentBroker responds, AgentDealer silently drops the message

Expected Behavior

If a bot is explicitly @mentioned (is_mentioned = true), it should always process the message regardless of thread ownership or participation status. The is_mentioned check should take priority over the Involved mode's thread participation check.

Suggested fix in discord.rs:

// Current (broken): is_mentioned is only checked at the top level
if !is_mentioned {
    match allow_user_messages {
        AllowUsers::Mentions => return,
        AllowUsers::Involved => {
            // rejects if bot not involved in thread
        }
    }
}

// Fix: always process if explicitly @mentioned
if is_mentioned {
    // proceed — explicit mention overrides thread participation check
} else {
    match allow_user_messages { ... }
}

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdiscord

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions