openclaw - ✅(Solved) Fix [Feature]: Support [[reply_to_current]] tag for Slack threaded replies [1 pull requests, 1 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#50031Fetched 2026-04-08 01:00:05
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Enable agents to create threaded replies in Slack using the [[reply_to_current]] reply tag.

Error Message

  1. Manual thread IDs: Require agents to look up and pass thread_ts explicitly - too complex, error-prone, defeats purpose of reply tags

Root Cause

Enable agents to create threaded replies in Slack using the [[reply_to_current]] reply tag.

Fix Action

Fix / Workaround

Severity: Medium - Workarounds exist but degrade UX

PR fix notes

PR #50276: fix(slack): support [[reply_to_current]] thread replies

Description (problem / solution / changelog)

Summary

  • map Slack [[reply_to_current]] to the active thread target (thread_ts) in outbound message-action sends
  • keep behavior scoped to Slack and only when no explicit threadId/replyTo is set
  • align threading test expectation for cross-channel sends to preserve existing cross-context marker behavior

Changes

  • src/infra/outbound/message-action-runner.ts
    • add resolveExplicitReplyToCurrentThreadId(...)
    • when parsed directive has replyToCurrent, resolve Slack thread target via plugin threading helper with effective replyToMode: "all"
  • src/infra/outbound/message-action-runner.threading.test.ts
    • add test for same-channel Slack [[reply_to_current]] mapping to threadId
    • add test for cross-channel Slack send not forcing thread id
    • update cross-channel message assertion to include existing [from C123] decoration

Validation

  • pnpm test -- src/infra/outbound/message-action-runner.threading.test.ts (9/9 pass)
  • pnpm test -- src/infra/outbound/message-action-params.test.ts extensions/slack/src/threading.test.ts extensions/slack/src/threading-tool-context.test.ts extensions/slack/src/action-runtime.test.ts (54 tests pass)

Fixes #50031

Changed files

  • src/infra/outbound/message-action-runner.threading.test.ts (modified, +45/-0)
  • src/infra/outbound/message-action-runner.ts (modified, +66/-0)

Code Example

User (in thread): "logged you into GitHub with google"
Agent: [[reply_to_current]] Perfect! Let me verify...
RAW_BUFFERClick to expand / collapse

Summary

Enable agents to create threaded replies in Slack using the [[reply_to_current]] reply tag.

Problem to solve

Currently, OpenClaw's reply tags work on some platforms (Discord, Telegram) but not on Slack. When an agent uses [[reply_to_current]] in Slack, it either:

  1. Gets stripped without creating a thread reply, OR
  2. Fails silently and posts a top-level message

This breaks conversational context in busy Slack channels where threads are essential for organizing discussions. Users expect agents to maintain thread context just like human users do.

Proposed solution

Implement [[reply_to_current]] support for Slack by:

  1. Detection: When a message starts with [[reply_to_current]], extract it before sending
  2. Thread context: Use the incoming message's thread_ts (or message_id if it's a thread starter) as the thread_ts parameter in the Slack API call
  3. Tag stripping: Remove the tag from the final message text
  4. Fallback: If thread_ts is unavailable, post as top-level message

Expected behavior:

  • Agent receives message in thread → [[reply_to_current]] → reply goes to same thread
  • Agent receives top-level message → [[reply_to_current]] → starts new thread under that message

API mapping: Use Slack's chat.postMessage with thread_ts parameter set to the parent message timestamp.

Alternatives considered

  1. Always thread: Make all bot replies threaded by default - awkward in fast-moving channels, reduces top-level visibility
  2. Prompt engineering: Tell agents to avoid threaded replies - doesn't solve the UX problem, agents should match human threading behavior
  3. Manual thread IDs: Require agents to look up and pass thread_ts explicitly - too complex, error-prone, defeats purpose of reply tags

Impact

Affected: All OpenClaw users with Slack integrations

Severity: Medium - Workarounds exist but degrade UX

Frequency: Every time an agent wants to maintain thread context in Slack

Consequence:

  • Broken conversational flow (replies don't stay in thread)
  • Channel clutter (follow-ups posted at top level)
  • Lost context (users must hunt for related messages)
  • Inconsistent behavior across platforms (works on Discord/Telegram but not Slack)

Evidence/examples

Real-world example: Agent tries to use [[reply_to_current]] in Slack DM thread:

User (in thread): "logged you into GitHub with google"
Agent: [[reply_to_current]] Perfect! Let me verify...

Expected: Reply appears in thread below user's message
Actual: Reply tag stripped, message posted at top level (or fails)

Prior art: Discord and Telegram implementations already support this pattern successfully.

Additional information

Slack API reference: https://api.slack.com/methods/chat.postMessage

  • thread_ts parameter creates threaded reply
  • Value should be parent message's ts or existing thread's thread_ts

Related code: Check how Discord/Telegram reply tag handlers are implemented and adapt for Slack's API.

Edge cases:

  • Bot receives message without thread context → starts new thread
  • User explicitly wants top-level reply → don't use reply tag
  • Multiple reply tags in one message → only honor the first one

extent analysis

Fix Plan

To enable agents to create threaded replies in Slack using the [[reply_to_current]] reply tag, follow these steps:

  1. Detect and extract the reply tag: Before sending a message, check if it starts with [[reply_to_current]]. If it does, extract the tag and store the rest of the message.
  2. Get the thread context: Use the incoming message's thread_ts (or message_id if it's a thread starter) as the thread_ts parameter in the Slack API call.
  3. Strip the tag: Remove the [[reply_to_current]] tag from the final message text.
  4. Post the message: Use the Slack chat.postMessage API with the thread_ts parameter set to the parent message timestamp.

Example Code (Python):

import re
import requests

def handle_reply_tag(message, thread_ts=None):
    # Detect and extract the reply tag
    if message.startswith('[[reply_to_current]]'):
        message = message.replace('[[reply_to_current]]', '', 1)
        # Get the thread context
        if thread_ts:
            # Post the message with thread context
            response = requests.post('https://slack.com/api/chat.postMessage', json={
                'channel': 'your_channel',
                'text': message,
                'thread_ts': thread_ts
            })
            return response.json()
        else:
            # Post the message as a new thread
            response = requests.post('https://slack.com/api/chat.postMessage', json={
                'channel': 'your_channel',
                'text': message
            })
            return response.json()
    else:
        # Post the message without thread context
        response = requests.post('https://slack.com/api/chat.postMessage', json={
            'channel': 'your_channel',
            'text': message
        })
        return response.json()

Verification

To verify that the fix worked, test the following scenarios:

  • Agent receives a message in a thread and uses [[reply_to_current]] to reply. The reply should appear in the same thread.
  • Agent receives a top-level message and uses [[reply_to_current]] to reply. The reply should start a new thread under the original message.
  • Agent receives a message without thread context and uses [[reply_to_current]] to reply. The reply should start a new thread.

Extra Tips

  • Make sure to handle edge cases, such as multiple reply tags in one message or user explicitly wanting a top-level reply.
  • Test the implementation thoroughly to ensure it works as expected in different scenarios.
  • Consider adding logging and error handling to the implementation to track any issues that may arise.

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 - ✅(Solved) Fix [Feature]: Support [[reply_to_current]] tag for Slack threaded replies [1 pull requests, 1 participants]