Skip to content

fix(slackbot): dedupe Slack messages by message identity#16

Merged
samuelclay merged 2 commits into
mainfrom
slackbot/dedup-message-identity
Jun 24, 2026
Merged

fix(slackbot): dedupe Slack messages by message identity#16
samuelclay merged 2 commits into
mainfrom
slackbot/dedup-message-identity

Conversation

@samuelclay

Copy link
Copy Markdown
Collaborator

What

Slack can deliver the same user message as both an app_mention and a message event, each with a distinct event_id. Deduping on event_id alone let both through, producing duplicate DM workflow handoffs and duplicate workflow runs.

Change

  • slackDedupKeys() now emits a message-identity key (message:team:channel:ts) ahead of the event-ID key for message / app_mention callbacks. Non-message events (e.g. app_home_opened) keep event-ID-only dedup.
  • EventDeduper.checkAndRememberAll() rejects a batch if any key is still live, collapsing a double-delivery into a single handoff.
  • Webhook handler switched from slackDedupKeyslackDedupKeys + checkAndRememberAll.

Tests

  • New dedup.test.ts cases: batch rejection when any key is live; message-identity precedence over event ID.
  • index.test.ts: an app_mention + message pair for the same thread now produces exactly one DM root post and one workflow run; the second delivery returns { ok: true, duplicate: true }.

All 9 slackbot dedup/index tests pass.

FORK.md updated per fork policy.

🤖 Generated with Claude Code

samuelclay and others added 2 commits June 24, 2026 13:51
…ent ID

Slack can deliver the same user message as both an app_mention and a
message event with distinct event IDs. Deduping on event ID alone let
both through, producing duplicate DM handoffs and workflow runs.

slackDedupKeys now emits a message-identity key (team:channel:ts) ahead
of the event-ID key for message/app_mention callbacks, and
EventDeduper.checkAndRememberAll rejects a batch if any key is still
live, collapsing the duplicate delivery into one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@samuelclay samuelclay merged commit 76d6f6b into main Jun 24, 2026
7 checks passed
@samuelclay samuelclay deleted the slackbot/dedup-message-identity branch June 24, 2026 18:00
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.

1 participant