Skip to content

fix(slack): add message deduplication for Socket Mode retransmissions#364

Closed
leighstillard wants to merge 1 commit intochenhg5:mainfrom
leighstillard:fix/slack-message-dedup
Closed

fix(slack): add message deduplication for Socket Mode retransmissions#364
leighstillard wants to merge 1 commit intochenhg5:mainfrom
leighstillard:fix/slack-message-dedup

Conversation

@leighstillard
Copy link
Copy Markdown
Contributor

@leighstillard leighstillard commented Mar 29, 2026

Summary

  • Adds core.MessageDedup to the Slack platform adapter, matching the pattern used by every other platform (Feishu, DingTalk, QQ, QQBot, WeCom)
  • Deduplicates both AppMentionEvent and MessageEvent using ev.TimeStamp as the unique message ID
  • Prevents duplicate processing when Slack Socket Mode retransmits events after reconnects or delayed TCP acks

Problem

Slack Socket Mode retransmits events when acknowledgment is delayed or after connection drops/reconnects. Without dedup, the same message is processed multiple times:

09:44:18 msg received (msg_id=1774777453.010829)  ← processed
09:44:32 msg received (msg_id=1774777453.010829)  ← queued as duplicate
09:46:11 msg received (msg_id=1774777453.010829)  ← queued as duplicate

This causes "message queued for busy session" spam and can trigger duplicate bot responses after the current turn completes.

Test plan

  • go build ./... passes
  • go test ./core/ passes (614 tests)
  • Manual: verify duplicate messages no longer appear during long agent turns
  • Manual: verify normal message flow is unaffected

🤖 Generated with Claude Code

…issions

Slack Socket Mode retransmits events when ack is delayed or after
reconnects. Without dedup, the same message gets processed multiple
times, causing "message queued for busy session" spam and duplicate
bot responses.

Every other platform (Feishu, DingTalk, QQ, QQBot, WeCom) already
uses core.MessageDedup — Slack was the only one missing it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@chenhg5 chenhg5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good fix following the established pattern.

Review notes:

  • ✅ CI passes
  • Matches dedup pattern used by other platforms (Feishu, DingTalk, QQ, WeCom)
  • Uses ev.TimeStamp as unique message ID
  • Prevents duplicate processing from Socket Mode retransmissions

Approved for merge.

@leighstillard
Copy link
Copy Markdown
Contributor Author

Final checks have been done, ready for merge

@leighstillard
Copy link
Copy Markdown
Contributor Author

Merged locally into feature/thread-affinity-router — dedup fix now included in #533

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants