Skip to content

[Feishu] Multi-bot routing issues: DMs, group @mentions, and missing emoji reactions #8692

@crane-is-bot

Description

@crane-is-bot

Summary

When running multiple Feishu bots (accounts) under a single OpenClaw instance, messages are incorrectly routed to the default agent instead of the agent bound to each specific account. Additionally, the official @openclaw/feishu plugin does not support emoji reactions.

Environment

  • OpenClaw version: 2026.2.2-3
  • Plugin: @openclaw/feishu v2026.2.2
  • Connection mode: WebSocket
  • Configuration: Two Feishu accounts (defaultagent1, account2agent2)

Issues

1. DM routing ignores bindings (all DMs go to default agent)

Expected: When a user DMs the "account2" Feishu bot, messages should route to agent2.

Actual: All DM messages route to agent:main:main regardless of which bot received them.

Root cause: In pi-embedded-helpers, the resolveSessionKey function hardcodes DEFAULT_AGENT_ID when building the canonical session key:

const canonical = buildAgentMainSessionKey({
    agentId: DEFAULT_AGENT_ID,  // ← hardcoded, ignores bindings
    mainKey: normalizeMainKey(mainKey)
});

The function does not use ctx.AccountId to look up the correct agent from bindings configuration.

Config for reference:

{
  "bindings": [
    { "agentId": "agent1", "match": { "channel": "feishu", "accountId": "default" } },
    { "agentId": "agent2", "match": { "channel": "feishu", "accountId": "account2" } }
  ],
  "channels": {
    "feishu": {
      "accounts": {
        "default": { "name": "Agent1", "appId": "cli_xxx" },
        "account2": { "name": "Agent2", "appId": "cli_yyy" }
      }
    }
  }
}

2. Group @mention routing does not check which bot was mentioned

Expected: When a user @mentions "Agent2" in a group, only agent2 should respond.

Actual: All bots receive the group message via their WebSocket connections. The first one to respond wins (usually the default agent).

Root cause: In processFeishuMessage (plugin-sdk), the mention check only verifies that some mention exists, not that the current bot was mentioned:

const mentions = message.mentions ?? payload.mentions ?? [];
const wasMentioned = mentions.length > 0;  // ← only checks if ANY mention exists

Fix needed: Should check if the current bot's open_id is in the mentions array:

const wasMentioned = mentions.some(m => m.id.open_id === currentBotOpenId);

3. Emoji reactions not supported

Expected: Ability to react to messages with emojis (like Discord/Telegram channels).

Actual: The plugin explicitly declares reactions: false in capabilities:

capabilities: {
    reactions: false,
    // ...
}

This is a feature gap compared to other channel plugins. Feishu API supports reactions via POST /im/v1/messages/:message_id/reactions.

Suggested Fixes

  1. DM routing: Modify resolveSessionKey (or the layer calling it) to look up the correct agentId from bindings based on ctx.AccountId and ctx.OriginatingChannel.

  2. Group @mention routing: Pass the current bot's open_id to processFeishuMessage and filter mentions to check if the bot itself was mentioned.

  3. Reactions: Implement reaction support in the Feishu plugin, or document it as a known limitation.

Questions

  • Are these known issues or expected behavior?
  • Would PRs for fixes 1 and 2 be welcome?
  • Is there a workaround for multi-bot setups in the meantime?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions