openclaw - 💡(How to fix) Fix Slack thread replies should optionally route to parent channel session [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#50984Fetched 2026-04-08 01:05:56
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Participants
Timeline (top)
cross-referenced ×2commented ×1

Root Cause

While diagnosing this exact issue in a team channel, the discussion itself created threads which created separate sessions — perfectly demonstrating the problem. Behavioral rules ("don't use replyTo") have been tried and don't hold because the architecture makes it too easy to accidentally trigger.

Fix Action

Fix / Workaround

replyToMode: off prevents the gateway from auto-threading, but when an agent uses [[reply_to:...]] tags or passes replyTo in the message tool, it threads directly via the Slack API. The local patch (allowTagsWhenOff: false, ref #5470) blocks tags but not explicit replyTo tool calls.

RAW_BUFFERClick to expand / collapse

Problem

When a Slack message is posted in a thread (has thread_ts), the gateway creates a separate session with key baseKey:thread:{threadTs}. This means:

  • Every thread reply spins up an independent context window
  • Multiple agents replying in the same thread each get separate sessions
  • Token usage multiplies (duplicate context per agent per thread)
  • Agents lose shared awareness of the channel conversation

This is hardcoded in routing/session-key.js:resolveThreadSessionKeys().

Why replyToMode: off doesn't prevent it

replyToMode: off prevents the gateway from auto-threading, but when an agent uses [[reply_to:...]] tags or passes replyTo in the message tool, it threads directly via the Slack API. The local patch (allowTagsWhenOff: false, ref #5470) blocks tags but not explicit replyTo tool calls.

Current config levers (insufficient)

  • channels.slack.thread.inheritParent (default false) — sets a parentSessionKey but does NOT prevent the separate session creation
  • channels.slack.thread.historyScope (default "thread") — controls history visibility, not session routing

Proposed Solution

A new config option: channels.slack.thread.sessionMode with two modes:

"parent" (proposed default)

Thread replies route to the parent channel session. No new session is created. One conversation, one context, one token budget. This is the correct behavior for ~90% of use cases (brainstorming, discussions, retros, Q&A).

"thread" (current behavior, opt-in)

Thread replies create separate sessions as they do today. Useful for explicitly parallel work (e.g., 20 feedback items each needing independent context).

Implementation notes

  • Discord already handles this differently — thread messages don't necessarily create separate sessions in the same way
  • The opt-in for "thread" mode could also be per-message (a flag in the message tool like separateSession: true) rather than global config, allowing agents to choose at runtime
  • A "thread" mode request could also be channel-level config for channels where parallel threading is the norm

Real-world impact

While diagnosing this exact issue in a team channel, the discussion itself created threads which created separate sessions — perfectly demonstrating the problem. Behavioral rules ("don't use replyTo") have been tried and don't hold because the architecture makes it too easy to accidentally trigger.

Environment

  • Clawdbot v2026.1.24
  • Slack channel plugin
  • Multi-agent setup (4 agents sharing channels)

extent analysis

Fix Plan

To address the issue of separate sessions being created for thread replies, we will introduce a new config option channels.slack.thread.sessionMode. The proposed default mode is "parent", where thread replies route to the parent channel session.

Step-by-Step Solution:

  1. Add new config option: Introduce channels.slack.thread.sessionMode with two modes: "parent" and "thread".
  2. Update session key resolution: Modify routing/session-key.js:resolveThreadSessionKeys() to respect the new config option.
  3. Implement parent session routing: When sessionMode is set to "parent", route thread replies to the parent channel session.

Example Code:

// routing/session-key.js
function resolveThreadSessionKeys(threadTs, config) {
  if (config.channels.slack.thread.sessionMode === 'parent') {
    // Route to parent channel session
    return `baseKey:channel:${config.channelId}`;
  } else {
    // Current behavior: create separate session for thread
    return `baseKey:thread:${threadTs}`;
  }
}

Verification

To verify the fix, test the following scenarios:

  • Thread replies with sessionMode set to "parent" should route to the parent channel session.
  • Thread replies with sessionMode set to "thread" should create separate sessions.

Extra Tips

  • Consider adding a per-message flag separateSession to allow agents to choose the session mode at runtime.
  • Evaluate the need for channel-level config for channels where parallel threading is the norm.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Slack thread replies should optionally route to parent channel session [1 comments, 2 participants]