Skip to content

fix(wecom): aibot image decryption fails + group @mention not stripped #11447

@leonxia1010

Description

@leonxia1010

Bug 1: Image decryption fails with Incorrect padding

WeCom aibot (智能机器人) delivers the image aeskey as a 64-char hex string, but _decrypt_file_bytes at gateway/platforms/wecom.py:997 blindly calls base64.b64decode(aes_key), which throws binascii.Error: Incorrect padding. The agent never sees the image attachment.

[Wecom] Failed to decrypt image from https://ww-aibot-img-...cos.ap-guangzhou.myqcloud.com/...: Incorrect padding

Fix: try bytes.fromhex() first (len==64), fall back to base64 for callback-app keys.

Bug 2: Slash commands don't work in group chats

WeCom group messages arrive with a plain-text @<DisplayName> prefix but no structured mention field (unlike feishu/discord). So /reset, /sethome etc. never match because the text starts with @BotName /reset.

Fix: add optional bot_display_name config / WECOM_BOT_DISPLAY_NAME env, strip the prefix in _extract_text().

Environment

  • hermes v2026.4.8
  • WeCom aibot (智能机器人) via websocket callback
  • macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/wecomWeCom / WeChat Work adaptertype/bugSomething isn't working

    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