-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
Description
Slack Thread Metadata Missing in Agent Context
Summary
Agents cannot determine if a Slack message is a reply within a thread because thread metadata (thread_ts and parent_user_id) is not included in the message context passed to agents.
Current Behavior
When a user sends a Slack message that replies to another message in a thread, the agent receives:
[slack message id: 1769970942.286059 channel: C0ACKPWN3Q9]
Expected Behavior
The agent should receive thread context when available:
[slack message id: 1769970942.286059 channel: C0ACKPWN3Q9 thread_ts: 1769970000.123456 parent_user: U026H3AP1]
Root Cause
File: src/slack/monitor/message-handler/prepare.ts
Line: 399
const textWithId = `${rawBody}\n[slack message id: ${message.ts} channel: ${message.channel}]`;OpenClaw internally uses these fields for routing and mention detection (lines 172-173):
const implicitMention = Boolean(!isDirectMessage &&
ctx.botUserId &&
message.thread_ts &&
message.parent_user_id === ctx.botUserId);But the metadata line only includes message.ts and message.channel.
Confirmation: Slack API Provides This Data
The Slack API does include thread_ts and parent_user_id in message events:
From @slack/types/dist/events/message.d.ts:
interface GenericMessageEvent {
user: string;
text?: string;
ts: string;
thread_ts?: string; // ← Available
parent_user_id?: string; // ← Available
channel_type: ChannelTypes;
// ... other fields
}OpenClaw already reads these fields internally, but doesn't expose them to agents.
Impact
- Current: Agents cannot determine conversation context for threaded replies
- With fix: Agents can detect threads and provide context-aware responses
- Breaking change: None (additive metadata only)
Reproduction
- Send a message in a Slack channel
- Reply to that message in a thread
- Check agent context - thread metadata is missing
- Agent has no way to know the message is part of a thread
Example Use Cases Enabled by Fix
- Agent can say "Regarding your original question about X..." when replying in thread
- Agent can fetch thread context to provide better answers
- Agent can distinguish between new topics vs thread continuations
- Tools can be built that operate on thread context
Environment:
- OpenClaw version: 2026.1.30
- Channel: Slack (Socket Mode)
- Reported by: @bennewton999