Skip to content

Feature Request: Feishu DM thread/topic-based session isolation #70512

@cjboy007

Description

@cjboy007

Feature Request

Channel: Feishu (Lark)
Current behavior: All DM messages from the same user route to a single session, regardless of Feishu topic/thread ID.
Requested behavior: Support per-topic session isolation in Feishu DMs, similar to how group topics already get separate sessions.

Problem

When using Feishu DMs, creating a new topic (话题) in the conversation does not create a new session on the gateway side. All messages from the same open_id share one session, regardless of topic_id / thread_id.

This is inconvenient when:

  • Working on multiple independent tasks in the same DM via different topics
  • Want to keep context isolated between different conversations with the same person

Current Code Analysis

In monitor-BFekcwtJ.js, the peer resolution logic:

```javascript
const peerId = isGroup ? groupSession?.peerId ?? ctx.chatId : ctx.senderOpenId;
```

For group chats, groupSessionScope supports `"group_topic"` and `"group_topic_sender"` modes, which create separate sessions per topic. For DMs, peerId is always `ctx.senderOpenId`, ignoring any `topic_id` in the message event.

Comparison with Other Channels

  • Matrix: Has `dm.sessionScope: "per-room"` to isolate each DM room into its own session
  • Telegram: Supports `message_thread_id` in private chats for thread-aware session keys
  • Feishu groups: Already supports `groupSessionScope: "group_topic"` for per-topic sessions

Proposed Solution

Add a Feishu DM-level config option, for example:

```json5
{
channels: {
feishu: {
dm: {
// Session isolation mode for DMs:
// "per-user" (default): all DMs from same user share one session
// "per-topic": each topic/thread in DM gets its own session
sessionScope: "per-topic"
}
}
}
}
```

When `sessionScope: "per-topic"`, the gateway should use `topic_id` (or `root_id`) from Feishu message events to generate separate session keys for different topics within the same DM.

Use Case

Users who use Feishu DMs as a workspace with multiple topics want each topic to have its own isolated agent session, with independent context, models, and configurations — similar to how group topic conversations already work.

Environment

  • OpenClaw version: 2026.4.5
  • Channel: Feishu (WebSocket mode)
  • OS: macOS (arm64)

Thanks for considering this feature! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions