Skip to content

fix(slack): app_mention events silently dropped by dedup cache when message event arrives first #34833

@unboxed-ai

Description

@unboxed-ai

Problem

Slack delivers both message and app_mention events for the same @mention in channels, with no guaranteed delivery order. OpenClaw's dedup cache uses the same channelId:ts key for both event types — whichever arrives first marks the message as seen, and the second is silently dropped.

When message arrives first in a channel with requireMention: true:

  1. message event is dropped by the requireMention check (no mention flag) — but the dedup key is still set
  2. app_mention event arrives with wasMentioned: truesilently deduped

Result

  • ~50% of @mentions in channels are silently ignored
  • Thread context never established (threadTsResolver.resolve never runs)
  • invalid_thread_ts errors on reply → fallback to main channel

Reproduction

This is timing-dependent. In a multi-agent Slack setup where agents @mention each other in channels, approximately half of mentions are dropped. Slack provides no ordering guarantees between message and app_mention (confirmed by Slack team).

Proposed Fix

Exempt app_mention events from the dedup check in message-handler.ts. This is safe because:

  • The downstream debouncer already handles dedup at the flush level via buildKey
  • prepareSlackMessage correctly merges wasMentioned across debounced entries

Related

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