Skip to content

trusted_bot_ids admission override ineffective in new threads (missing auto-join) #974

@MinCheTsai

Description

@MinCheTsai

Description

Version: 0.8.4

Problem:
trusted_bot_ids admission override is designed to let a trusted bot pull another bot into a new thread via @mention. The application-layer logic exists (src/discord.rs L460–478), but it never fires because Discord Gateway does not deliver MESSAGE_CREATE to Bot B when Bot B is not a thread member.

Human @mentions in the same thread are delivered (Discord auto-adds mentioned users/bots to thread membership), but bot-to-bot mentions do not trigger the same Gateway behavior.

Expected: Bot A (in Bot B's trusted_bot_ids) @mentions Bot B in a new thread → Bot B receives the event and becomes involved.

Actual: Bot B's Gateway receives nothing — no log, no rejection, no event. The message never reaches OpenAB's application layer.

Root cause: OpenAB does not implement thread_create handler or auto-join threads under allowed_channels. Without thread membership, Discord Gateway silently withholds bot-to-bot mention events.

Suggested fix: Add a thread_create (or thread_update) event handler that auto-joins threads whose parent channel is in allowed_channels. This ensures the bot is a thread member and will receive all MESSAGE_CREATE events, allowing the existing trusted_bot_ids logic to work as documented.

Steps to Reproduce

  1. 部署兩個 OAB bot(Bot A、Bot B),版本 0.8.4
  2. Bot B 的 config.toml 設定 trusted_bot_ids = ["<Bot_A_ID>"]
  3. Bot A 和 Bot B 的 allowed_channels 都包含同一個頻道
  4. 在該頻道中,讓 Bot A 建立一個新 thread 並在 thread 內發送包含 <@BOT_B_ID> 的訊息
  5. 觀察 Bot B 的 log(RUST_LOG=openab=debug,serenity=debug)

Expected Behavior

Bot B 收到 MESSAGE_CREATE 事件,trusted bot admission override 觸發,Bot B 回覆並成為 involved。(如 docs/messaging.md Involvement Gate 章節所描述的 trusted bot 行為)

Environment

No response

Screenshots / Logs

Bot B 的 log 完全空白 — 沒有收到任何事件。同一 thread 中人類 @mention Bot B 則能正常觸發。差異僅在於發送者是 bot 還是人類。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions