openclaw - 💡(How to fix) Fix [Bug]: sessions_send loses deliveryContext, causing replies to go to wrong channel [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#54327Fetched 2026-04-08 01:28:57
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

When using sessions_send to inject a message into another agent's session, the target agent's reply goes to webchat instead of the original feishu channel. The deliveryContext is lost during inter-session messaging.

Root Cause

  • Affected: Users with multi-agent setups using sessions_send for inter-agent communication
  • Severity: High (breaks real-time agent coordination)
  • Frequency: 100% (2/2 attempts)
  • Consequence: Agent replies are lost from Feishu, only visible in browser UI. The key use case of "reminding another agent during task execution" is broken because message tool has higher latency (seconds vs milliseconds for sessions_send).

Fix Action

Fix / Workaround

Temporary workaround: Use message tool to send directly to Feishu group, but this has higher latency and doesn't achieve the goal of "injecting into session context for immediate processing".

Code Example

[agent:nested] session=agent:feishu-agent-3:feishu:group:oc_9268c66fb5c110a7ce045924b8614dfb run=a7a4b0c0-... channel=webchat 收到!诊断已完成...

---

Gateway log excerpt:

[agent:nested] session=agent:feishu-agent-3:feishu:group:oc_9268c66fb5c110a7ce045924b8614dfb run=a7a4b0c0-f6a6-48ad-a46f-357d39ae191b channel=webchat 收到!诊断已完成...

Session history shows the injected message has `provenance.kind: "inter_session"` instead of normal `senderLabel`.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

When using sessions_send to inject a message into another agent's session, the target agent's reply goes to webchat instead of the original feishu channel. The deliveryContext is lost during inter-session messaging.

Steps to reproduce

  1. Configure multiple Feishu group agents (e.g., feishu-agent-2 and feishu-agent-3) with different bindings.
  2. In feishu-agent-2's group, ask it to remind feishu-agent-3 using sessions_send.
  3. Command: sessions_send(sessionKey="agent:feishu-agent-3:feishu:group:oc_xxx", message="reminder content")
  4. feishu-agent-3 receives the message and replies.
  5. Observe: reply appears in webchat (browser UI), NOT in the Feishu group.

Expected behavior

The target agent's reply should be sent to the original Feishu group (preserving the deliveryContext from the session binding). The session has deliveryContext.channel: "feishu" and deliveryContext.to: "chat:oc_xxx", so replies should go there.

Actual behavior

The target agent's reply is sent to webchat channel instead of feishu. Gateway log shows:

[agent:nested] session=agent:feishu-agent-3:feishu:group:oc_9268c66fb5c110a7ce045924b8614dfb run=a7a4b0c0-... channel=webchat 收到!诊断已完成...

Note channel=webchat instead of channel=feishu. The message appears in the browser control UI but NOT in the Feishu group.

OpenClaw version

2026.3.25

Operating system

Windows 11

Install method

npm global

Model

xfyun/astron-code-latest

Provider / routing chain

openclaw -> xfyun

Additional provider/model setup details

Multiple Feishu group agents configured with bindings to different peer.id (group chat IDs). Each agent has its own session with deliveryContext.channel: "feishu" and deliveryContext.to: "chat:oc_xxx".

Logs, screenshots, and evidence

Gateway log excerpt:

[agent:nested] session=agent:feishu-agent-3:feishu:group:oc_9268c66fb5c110a7ce045924b8614dfb run=a7a4b0c0-f6a6-48ad-a46f-357d39ae191b channel=webchat 收到!诊断已完成...

Session history shows the injected message has `provenance.kind: "inter_session"` instead of normal `senderLabel`.

Impact and severity

  • Affected: Users with multi-agent setups using sessions_send for inter-agent communication
  • Severity: High (breaks real-time agent coordination)
  • Frequency: 100% (2/2 attempts)
  • Consequence: Agent replies are lost from Feishu, only visible in browser UI. The key use case of "reminding another agent during task execution" is broken because message tool has higher latency (seconds vs milliseconds for sessions_send).

Additional information

Temporary workaround: Use message tool to send directly to Feishu group, but this has higher latency and doesn't achieve the goal of "injecting into session context for immediate processing".

Root cause hypothesis: When sessions_send injects a message, the message lacks proper deliveryContext. The agent's reply then defaults to webchat instead of the session's original channel.

extent analysis

Fix Plan

To fix the issue, we need to ensure that the deliveryContext is preserved when using sessions_send to inject a message into another agent's session.

Here are the steps:

  • Update the sessions_send function to include the deliveryContext of the target session.
  • Modify the sessions_send function to set the provenance.kind to "inter_session" and include the original deliveryContext.
  • Ensure that the agent's reply is sent to the original channel specified in the deliveryContext.

Example code snippet:

def sessions_send(session_key, message):
    # Get the target session's deliveryContext
    target_session = get_session(session_key)
    delivery_context = target_session.delivery_context
    
    # Create a new message with the preserved deliveryContext
    new_message = {
        "message": message,
        "provenance": {
            "kind": "inter_session"
        },
        "deliveryContext": delivery_context
    }
    
    # Send the new message to the target session
    send_message(new_message, target_session)

In this example, we first retrieve the target session's deliveryContext and then create a new message with the preserved deliveryContext. We then send the new message to the target session.

Verification

To verify that the fix worked, you can test the sessions_send function by injecting a message into another agent's session and checking that the reply is sent to the original Feishu group. You can also check the gateway log to ensure that the channel is set to feishu instead of webchat.

Extra Tips

  • Make sure to update the sessions_send function to handle cases where the target session's deliveryContext is missing or invalid.
  • Consider adding logging or monitoring to track the usage of sessions_send and detect any potential issues.
  • Review the documentation for sessions_send to ensure that it accurately reflects the updated behavior.

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…

FAQ

Expected behavior

The target agent's reply should be sent to the original Feishu group (preserving the deliveryContext from the session binding). The session has deliveryContext.channel: "feishu" and deliveryContext.to: "chat:oc_xxx", so replies should go there.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING