Skip to content

QMD memory_search silently returns empty in Discord guild channels (default scope denies chatType 'channel') #10191

@Skipper-Assistant-1968

Description

@Skipper-Assistant-1968

Bug Description

memory_search returns empty results with no errors or warnings when called from a Discord guild/server channel. Works fine in DMs.

Root Cause

The default QMD scope configuration in reply-DpTyb3Hh.js is:

const DEFAULT_QMD_SCOPE = {
  default: "deny",
  rules: [{
    action: "allow",
    match: { chatType: "direct" }
  }]
};

Discord server channels resolve to chatType: "channel" (via deriveChatTypeFromKey), which does not match the "direct" rule. The default "deny" kicks in and the search returns [] immediately — with no log warning or error.

Impact

Anyone running OpenClaw with QMD memory backend in a Discord guild channel (which is probably most Discord users) will see memory_search return zero results. The silent failure makes this extremely difficult to debug — there is no indication that the search was blocked by scope rather than finding no matches.

We spent several hours investigating CUDA backends, Bun segfaults, timeouts, and environment variable propagation before discovering the actual cause was this one-line scope default.

Steps to Reproduce

  1. Configure memory.backend: "qmd" (no custom scope config)
  2. Use OpenClaw from a Discord guild/server channel (not a DM)
  3. Call memory_search with any query
  4. Results: always [], no errors logged

Fix (User Workaround)

Add explicit scope rules to openclaw.json:

"memory": {
  "backend": "qmd",
  "qmd": {
    "scope": {
      "default": "deny",
      "rules": [
        { "action": "allow", "match": { "chatType": "direct" } },
        { "action": "allow", "match": { "chatType": "channel" } }
      ]
    }
  }
}

Suggestions

  1. Log a warning when scope denies a search — something like qmd search denied by scope (chatType=channel, session=...) would have saved hours of debugging
  2. Consider changing the default — if the security concern is group chats with strangers, "channel" (guild channels) could be allowed by default since they are typically controlled spaces, while "group" (group DMs) could remain denied
  3. Document this behavior — the QMD scope defaults are not mentioned in the docs at https://docs.openclaw.ai/concepts/memory

Environment

  • OpenClaw: 2026.2.3-1
  • QMD: latest (via bun)
  • Channel: Discord guild channel
  • OS: Ubuntu 24.04.3 LTS

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