Skip to content

sessions_send reply routes to webchat instead of origin channel (Feishu) #76104

@hongfangsong

Description

@hongfangsong

Bug Report: sessions_send reply routes to webchat instead of origin channel (Feishu)

Environment

  • OpenClaw version: 2026.4.29
  • Channel: Feishu (websocket mode)
  • Issue occur: When triggering sessions_send from Feishu DM

Description

When a user sends a command (e.g., /compact) via Feishu direct message, and the command is processed via sessions_send, the reply routes to webchat channel instead of feishu.

This means:

  1. User triggers /compact in Feishu DM
  2. sessions_send processes the command
  3. Reply appears in OpenClaw Dashboard (webchat), not in Feishu DM
  4. User in Feishu sees no response

Root Cause Analysis

In openclaw-tools-DuqACH22.js, the sessions_send routing logic uses sourceChannel from params.requesterChannel. However, the session's channel field (= webchat) takes priority over deliveryContext.channel (= feishu) because entry.channel is checked first in the routing chain.

The session key for Feishu DM: agent:main:feishu:direct:ou_xxx

Session data shows:

  • channel: webchat (problem: session.channel != deliveryContext.channel)
  • origin.provider: feishu
  • deliveryContext.channel: feishu (correct but not used)

Expected Behavior

Replies should route back to the origin channel where the message came from (Feishu DM), not to the session's internal channel field (webchat).

Reproduction Steps

  1. Connect OpenClaw with Feishu channel (websocket mode)
  2. Open Feishu DM with the bot
  3. Send any command (e.g., /compact)
  4. Check Dashboard — reply appears there
  5. Check Feishu DM — no reply received

Session Data (for debugging)

Session: agent:main:feishu:direct:ou_117720b5f6ed8e9e6da53a0f4ad25a3a

  • channel: webchat (problem)
  • origin.provider: feishu
  • deliveryContext.channel: feishu
  • deliveryContext.to: user:ou_117720b5f6ed8e9e6da53a0f4ad25a3a

Suggested Fix

In sessions_send routing, deliveryContext.channel should take higher priority than the session's channel field. Either:

  1. Prioritize origin.provider when it differs from session.channel
  2. Force deliveryContext.channel as the fallback when origin provider is set
  3. Add config flag for channel delivery fallback

Workaround

Currently users must trigger commands from the Dashboard to get replies back to Dashboard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    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