Skip to content

fix: SenderName/WasMentioned missing in DMWork adapter inbound context #142

@yujiawei

Description

@yujiawei

Problem

DMWork adapter only sets SenderId: message.from_uid in finalizeInboundContext. The AI has no idea who is talking — it only sees a raw UID.

Missing OpenClaw SDK fields

  • SenderName — display name
  • SenderUsername — username fallback
  • WasMentioned — framework can't gate elevated/exec permissions properly

Root cause

WuKongIM RECV binary protocol only pushes from_uid, no sender name. The adapter had uidToNameMap available from group member cache but never used it to populate these fields.

Additional issues found

  1. Reply from_name and MultipleForward users[].name data was received but not cached
  2. Group members not preloaded on startup (empty uidToNameMap until first group message)
  3. cleanupStaleCaches bug: _uidToNameMaps.delete(groupId) on flat uid→name map
  4. DM cross-space users unresolvable (different uid prefix per space)

Fix

PR #141 addresses all issues above.

Remaining gap

Pure DM users (never appeared in any group) need backend /v1/bot/user/info API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions