Skip to content

Slack: empty DM thread_ts hits conversations.replies(ts='') in fetch paths — add conversations.history fallback #138

Description

@patrick-chinchill

Summary

For Slack DM roots the encoded thread_ts is empty (slack:Dxxx:). This is produced by both:

  • the DM message path — _handle_message_event (slack/adapter.py:2409), which is faithful to upstream handleMessageEvent (adapter-slack/src/index.ts:2158), and
  • now the DM block-action path — _handle_block_actions (fix(slack): don't thread block-action responses in DMs (supersedes #133) #137), which is a documented divergence from upstream (see the Known Non-Parity row in docs/UPSTREAM_SYNC.md).

When a handler subsequently fetches that thread (event.thread.refresh(), pagination, fetch_message, open_modal-driven fetches), the Slack fetch paths call conversations.replies(ts=thread_ts) with no empty-thread_ts guard:

  • _fetch_messages_forward / _fetch_messages_backward (slack/adapter.py:4118 / :4134)
  • fetch_message (slack/adapter.py:4164)

With an empty DM thread_ts this sends ts='', which returns no replies / loses the original message context for DM action paths. (Raised by the Codex review on #137.)

Pre-existing + faithful to upstream (not a #137 regression)

This already affects every DM root (DM messages), independent of #137. It is also faithful to upstream: upstream's fetchMessages (index.ts:4178) calls conversations.replies(ts: threadTs) with no empty guard either. So a fix here is a divergence ahead of upstream and is codebase-wide (all DM roots), not specific to block-actions — which is why it's out of scope for #137.

Proposed fix

In the Slack fetch dispatch (fetch_messages, fetch_message), when thread_ts is empty (DM root), route to the channel-history path (fetch_channel_messages / _fetch_channel_messages_*conversations.history) instead of conversations.replies. This covers DM messages and DM block-actions uniformly. Add a regression test for an empty-DM-thread_ts fetch_messages that asserts it does not call conversations.replies(ts="").

Also consider filing the same upstream (vercel/chat) so the empty-DM-thread_ts fetch handling — and the #137 block-action divergence — can be removed on a future sync.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingslack

    Type

    No type

    Fields

    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