Skip to content

fix(slack): add thread_ts support for Slack message delivery - #14146

Closed
dirtyren wants to merge 1 commit into
NousResearch:mainfrom
dirtyren:fix/slack-thread-delivery
Closed

fix(slack): add thread_ts support for Slack message delivery#14146
dirtyren wants to merge 1 commit into
NousResearch:mainfrom
dirtyren:fix/slack-thread-delivery

Conversation

@dirtyren

Copy link
Copy Markdown
Contributor

Problem

When using send_message or cron job delivery with a Slack target that includes a thread timestamp (e.g. slack:CHANNEL_ID:THREAD_TS), the message fails with a Slack API channel_not_found error.

Root Cause

_parse_target_ref() in send_message_tool.py had no Slack-specific handler. The compound CHANNEL_ID:THREAD_TS string was passed through as a single chat_id to the Slack API, which doesn't recognize it as a valid channel.

Additionally, _send_to_platform() never passed thread_id to _send_slack(), and _send_slack() didn't accept or use it — so thread replies were impossible for Slack, unlike Discord and Telegram which already had this support.

Fix

Four changes in tools/send_message_tool.py:

  1. _SLACK_TARGET_RE regex — Parses Slack channel IDs (prefixes C/D/G/W followed by alphanumeric) with an optional :thread_ts decimal timestamp suffix.

  2. Slack handler in _parse_target_ref() — Splits CHANNEL:THREAD_TS into (chat_id, thread_id) for the Slack platform, placed alongside the existing Feishu and Discord handlers.

  3. thread_id passthrough in _send_to_platform() — The Slack branch now passes thread_id=thread_id to _send_slack(), matching how Discord already works.

  4. thread_ts in _send_slack() payload — The function now accepts thread_id=None and includes "thread_ts" in the Slack API payload when present.

Testing

Verified with cron job delivery to a Slack thread — messages now arrive as thread replies instead of failing with channel_not_found.

Notes

This brings Slack thread support to parity with Discord and Telegram, which already had thread/topic delivery support.

Previously, _parse_target_ref() had no Slack-specific handler, so targets like 'slack:CHANNEL:THREAD_TS' were not parsed correctly — the channel:thread_ts compound string was passed as a single chat_id, causing Slack API 'channel_not_found' errors.

This fix adds:
1. _SLACK_TARGET_RE regex to parse Slack channel IDs (C/D/G/W prefix) with optional thread_ts
2. Slack handler in _parse_target_ref() that splits channel and thread
3. thread_id passthrough in _send_to_platform() for the Slack branch
4. thread_ts parameter in _send_slack() to include in API payload
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/slack Slack app adapter comp/tools Tool registry, model_tools, toolsets labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #9394 and #9395 (Slack thread context issues) and #3424 (threaded Slack delivery for cron).

@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #9394, #9395, #3424.

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

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists platform/slack Slack app adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants