Problem
When using Feishu topic groups (话题群), sub-agents spawned via sessions_spawn send their results as new messages in the group instead of replying within the original topic thread. This breaks the conversation context for users.
Root Cause
The Feishu channel plugin does not propagate topic thread context (rootId) through the OpenClaw pipeline. Specifically:
1. threads: false in channel capabilities (extensions/feishu/src/channel.ts:54)
The plugin declares it does not support threads, which causes the core to skip thread-aware routing.
2. No MessageThreadId in inbound context (extensions/feishu/src/bot.ts:813-835)
The plugin correctly parses rootId from Feishu events (line 489: rootId: event.message.root_id || undefined), but never passes it as MessageThreadId when constructing the inbound context payload:
const ctxPayload = core.channel.reply.finalizeInboundContext({
Body: combinedBody,
// ... other fields ...
// Missing: MessageThreadId: ctx.rootId,
});
3. No threadId in outbound (extensions/feishu/src/outbound.ts)
The outbound adapter does not accept or pass threadId to sendMessageFeishu. When replies need to be routed back, there is no mechanism to target a specific topic thread.
4. No topic-aware session routing (src/infra/outbound/outbound-session.ts:826-871)
resolveFeishuSession does not consider threadId when building session keys, so all topics in the same group share a single session — mixing conversation contexts.
5. sendMessageFeishu lacks topic thread support (extensions/feishu/src/send.ts)
The send function uses im.message.create without any topic thread parameter. Feishu's API does not use reply_in_thread but topic threads are identified by the root_id in the conversation.
Impact on Sub-Agents
The sessions_spawn tool captures requesterOrigin.threadId at spawn time (see sessions-spawn-threadid.test.ts). However, since the Feishu plugin never provides threadId, requesterOrigin.threadId is always undefined. When runSubagentAnnounceFlow sends the result back, it has no topic context and the message appears outside the original thread.
Expected Behavior
- When a user sends a message in a Feishu topic thread, the bot should reply in the same topic thread
- Sub-agent results should be announced back in the original topic thread
- Different topic threads should have isolated session contexts
Proposed Fix
- Set
threads: true in Feishu channel capabilities
- Pass
ctx.rootId as MessageThreadId in the inbound context
- Add threadId support to
sendMessageFeishu (using root_id parameter or the Feishu reply-in-thread API)
- Update
resolveFeishuSession to include topic threadId in session keys (similar to Telegram's topic handling)
- Update
feishuOutbound adapter to accept and forward threadId
Environment
- OpenClaw: latest main branch
- Feishu plugin:
@openclaw/feishu v2026.2.6
- Feishu SDK:
@larksuiteoapi/node-sdk ^1.56.1
Related Code
extensions/feishu/src/bot.ts — inbound message handling
extensions/feishu/src/send.ts — message sending
extensions/feishu/src/outbound.ts — outbound adapter
extensions/feishu/src/channel.ts — capability declaration
src/agents/tools/sessions-spawn-tool.ts — sub-agent spawn
src/agents/subagent-announce.ts — sub-agent result announcement
src/infra/outbound/outbound-session.ts — session routing
Problem
When using Feishu topic groups (话题群), sub-agents spawned via
sessions_spawnsend their results as new messages in the group instead of replying within the original topic thread. This breaks the conversation context for users.Root Cause
The Feishu channel plugin does not propagate topic thread context (
rootId) through the OpenClaw pipeline. Specifically:1.
threads: falsein channel capabilities (extensions/feishu/src/channel.ts:54)The plugin declares it does not support threads, which causes the core to skip thread-aware routing.
2. No
MessageThreadIdin inbound context (extensions/feishu/src/bot.ts:813-835)The plugin correctly parses
rootIdfrom Feishu events (line 489:rootId: event.message.root_id || undefined), but never passes it asMessageThreadIdwhen constructing the inbound context payload:3. No threadId in outbound (
extensions/feishu/src/outbound.ts)The outbound adapter does not accept or pass
threadIdtosendMessageFeishu. When replies need to be routed back, there is no mechanism to target a specific topic thread.4. No topic-aware session routing (
src/infra/outbound/outbound-session.ts:826-871)resolveFeishuSessiondoes not consider threadId when building session keys, so all topics in the same group share a single session — mixing conversation contexts.5.
sendMessageFeishulacks topic thread support (extensions/feishu/src/send.ts)The send function uses
im.message.createwithout any topic thread parameter. Feishu's API does not usereply_in_threadbut topic threads are identified by theroot_idin the conversation.Impact on Sub-Agents
The
sessions_spawntool capturesrequesterOrigin.threadIdat spawn time (seesessions-spawn-threadid.test.ts). However, since the Feishu plugin never providesthreadId,requesterOrigin.threadIdis alwaysundefined. WhenrunSubagentAnnounceFlowsends the result back, it has no topic context and the message appears outside the original thread.Expected Behavior
Proposed Fix
threads: truein Feishu channel capabilitiesctx.rootIdasMessageThreadIdin the inbound contextsendMessageFeishu(usingroot_idparameter or the Feishu reply-in-thread API)resolveFeishuSessionto include topic threadId in session keys (similar to Telegram's topic handling)feishuOutboundadapter to accept and forwardthreadIdEnvironment
@openclaw/feishuv2026.2.6@larksuiteoapi/node-sdk^1.56.1Related Code
extensions/feishu/src/bot.ts— inbound message handlingextensions/feishu/src/send.ts— message sendingextensions/feishu/src/outbound.ts— outbound adapterextensions/feishu/src/channel.ts— capability declarationsrc/agents/tools/sessions-spawn-tool.ts— sub-agent spawnsrc/agents/subagent-announce.ts— sub-agent result announcementsrc/infra/outbound/outbound-session.ts— session routing