Skip to content

Bug: Feishu channel does not handle text slash commands (/compact, /new, /stop) #79409

@jooey

Description

@jooey

Bug: Feishu channel does not handle text slash commands (/compact, /new, /stop, etc.)

Environment

  • OpenClaw: 2026.5.7 (eeef486)
  • @openclaw/feishu plugin: 2026.5.7
  • Channel: Feishu (websocket mode)
  • OS: macOS 26.4.1 (arm64), node 25.5.0

Description

Text slash commands like /compact, /new, /stop are not executed when received through the Feishu channel. The messages are dispatched directly to the agent as plain text without passing through the slash command handler.

The same /compact command works correctly via webchat/TUI.

Steps to Reproduce

  1. Set up Feishu channel with dmPolicy: "open" and multiple accounts
  2. Send /compact as a DM message to any Feishu bot agent
  3. Observe Gateway logs

Expected Behavior

Gateway should intercept /compact and execute the compaction, as it does on webchat.

Actual Behavior

Gateway logs show the message is dispatched directly to the agent:

[feishu] feishu[nova]: received message from ou_xxx in oc_xxx (p2p)
[feishu] feishu[nova]: Feishu[nova] DM from ou_xxx: /compact
[feishu] feishu[nova]: dispatching to agent (session=agent:nova:main)
[feishu] feishu[nova]: dispatch complete (queuedFinal=false, replies=0)

No command handling occurs. The agent receives /compact as plain text and may ignore it or reply with a confused response.

On webchat/TUI, the same command produces:

[agent:nested] session=agent:nova:main run=xxx channel=webchat **已执行 `/compact`**

Code Investigation

I traced the message flow through the minified source:

  1. Feishu plugin (@openclaw/feishu/dist/monitor.account-*.js):

    • Sets CommandBody: agentFacingContent (which is ctx.content, the raw message text /compact)
    • Passes it via textForCommands: ctxPayload.CommandBody to core.channel.turn.run()
    • Does not set CommandSource in the context payload
  2. Core dispatch (dispatch-*.js):

    • ctx.CommandSource is undefined for feishu messages
  3. Core reply handler (get-reply-*.js):

    • shouldHandleTextCommands() from commands-text-routing-*.js is called with commandSource: undefined
    • This function returns true when cfg.commands?.text !== false (which is our case, default is true)
    • So allowTextCommands = true and the slash command path should be entered
    • resolveSlashCommandName() correctly detects /compact from the text

However, despite all this appearing correct, the command is never actually handled. The agent receives the raw /compact text instead of the command being intercepted.

Possible Root Cause

The issue may be in how core.channel.turn.run() processes the inbound message from the feishu adapter before reaching get-reply. The CommandBody is being set correctly by the plugin, but somewhere in the turn pipeline, the message is dispatched to the agent without first checking for slash commands.

Alternatively, there may be a session routing or early-return in the dispatch layer that skips command handling for plugin channel messages.

Config

{
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true,
    "ownerDisplay": "raw",
    "ownerAllowFrom": ["feishu:ou_xxx"]
  },
  "channels": {
    "feishu": {
      "enabled": true,
      "connectionMode": "websocket",
      "dmPolicy": "open",
      "groupPolicy": "open"
    }
  }
}

Workaround

Use webchat/TUI to send /compact to the target agent session. This works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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