mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-04 16:38:49 +00:00
A top-level channel message that opens a thread fell back to the channel-wide session, because the session key required `raw_thread_ts` — which Slack only sets on messages that already arrived inside a thread. Every new thread therefore began life in one shared channel session and only became thread-scoped from its first reply onward, so unrelated threads saw each other's opening turns. Key off `thread_ts` instead. It is set both for messages arriving inside a thread and for channel messages that `reply_in_thread` opens a thread for. DM roots never get a `thread_ts`, so they keep the default per-chat session and the DM routing from 82c5083 is preserved; with `reply_in_thread` disabled no thread exists and the channel session is still used. This restores the per-thread isolation introduced in #1048. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>