Skip to content

fix: DM responses appearing in separate threads for AI Assistant apps#689

Merged
bokelley merged 1 commit into
mainfrom
bokelley/dm-thread-response-fix
Jan 10, 2026
Merged

fix: DM responses appearing in separate threads for AI Assistant apps#689
bokelley merged 1 commit into
mainfrom
bokelley/dm-thread-response-fix

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Fix DM responses appearing as separate threads instead of in the same conversation
  • Fix duplicate responses being sent for the same DM message

Problem

Two issues were causing incorrect behavior for Addie's DM responses:

  1. Responses appearing in separate threads: For Slack AI/Assistant apps, every DM is treated as a thread. The code was not passing thread_ts when responding, causing responses to appear as separate notifications/threads instead of in the same conversation.

  2. Duplicate responses: The Assistant framework receives message.im events through a separate pipeline from global middleware, causing both handleDirectMessage and handleUserMessage to fire for the same event, resulting in duplicate responses with different content.

Changes

  • Add thread_ts: event.ts to chat.postMessage in handleDirectMessage to ensure responses appear in the same thread as the user's message
  • Add guard in handleUserMessage to skip DMs without thread_ts (these are handled by handleDirectMessage via middleware)

Test plan

  • Send a DM to Addie through the App Home Chat tab
  • Verify response appears in the same thread as the message (not as a separate notification)
  • Verify only one response is sent (no duplicates)
  • Send a follow-up message in the same conversation and verify response threading works correctly

🤖 Generated with Claude Code

Two issues were causing DM responses to appear incorrectly:

1. For Slack AI/Assistant apps, every DM is treated as a thread. The code
   was not passing thread_ts when responding, causing responses to appear
   as separate notifications/threads instead of in the same conversation.

2. The Assistant framework receives message.im events through a separate
   pipeline from global middleware, causing both handleDirectMessage and
   handleUserMessage to fire for the same event, resulting in duplicate
   responses.

Changes:
- Add thread_ts: event.ts to chat.postMessage in handleDirectMessage
- Add guard in handleUserMessage to skip DMs without thread_ts (handled
  by handleDirectMessage via middleware)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit a703c97 into main Jan 10, 2026
6 checks passed
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