fix(slack): read thread_id from metadata for in-thread routing#924
Closed
boyleryan wants to merge 1 commit intoNousResearch:mainfrom
Closed
fix(slack): read thread_id from metadata for in-thread routing#924boyleryan wants to merge 1 commit intoNousResearch:mainfrom
boyleryan wants to merge 1 commit intoNousResearch:mainfrom
Conversation
Contributor
|
Superseded by PR #1103 (merged), which addressed the same thread_id/thread_ts key mismatch fix plus additional threading improvements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Slack thread replies — progress messages, typing indicators, session hygiene
warnings, and other auxiliary sends from
_process_message_background()— landin the top-level DM window instead of the conversation thread.
Root Cause
The base adapter and gateway construct thread metadata with a
thread_idkey:gateway/platforms/base.py:691:_thread_metadata = {"thread_id": event.source.thread_id}gateway/run.py:_progress_metadata = {"thread_id": source.thread_id}But
SlackAdapter.send()only checks forthread_ts:gateway/platforms/slack.py:163:metadata.get("thread_ts")The value is correct — it's the original Slack
thread_ts, stored asthread_idin
MessageSourceatslack.py:530. The key name just doesn't match whatsend()looks for.The Telegram adapter already handles this correctly —
telegram.py:218readsmetadata.get("thread_id").Changes
gateway/platforms/slack.py: Accept boththread_tsandthread_idfrommetadata in
send(), preferringthread_tswhen both are present. This alignswith the Telegram adapter's approach of reading the canonical
thread_idkey.tests/gateway/test_slack.py: AddTestSendThreadingclass with 4 tests:thread_id-only metadata,thread_ts-only metadata, both-keys precedence,and
reply_toprecedence over metadata.How to Test
Automated:
pytest tests/gateway/test_slack.py::TestSendThreading -vPlatforms Tested
Related
Known Related Issue (not addressed here)
The Slack media methods (
send_image,send_document,send_video,send_voice,send_image_file) accept**kwargsfrom the base adapter butdon't extract
metadatafor threading. Media sent during threaded conversationsmay land outside the thread. This is a separate issue affecting media method
implementations across adapters and should be addressed in a follow-up.