openclaw - 💡(How to fix) Fix [Feature Request] Support cross-Gateway session messaging via sessions_send [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#55061Fetched 2026-04-08 01:33:03
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2

Fix Action

Fix / Workaround

Current Workaround

RAW_BUFFERClick to expand / collapse

Problem

When running multiple OpenClaw Gateway instances (e.g., headquarters on port 18789, Hangzhou branch on port 18790), sessions_send cannot deliver messages to sessions belonging to a different Gateway instance.

Expected Behavior

sessions_send should support targeting sessions across different Gateway instances, similar to how Feishu/Webhook channels can route messages between bots.

What We Tried

  1. Same session key, different Gateway: sessions_send(sessionKey="agent:main:main") from headquarters Gateway (18789) → timeout
  2. Direct session ID: sessions_send(sessionKey="UUID") (Hangzhou session ID) → No session found
  3. Sessions are Gateway-isolated: Each Gateway manages its own session store independently

Current Workaround

The only reliable cross-instance communication method is via Feishu group chat or DM.

Environment

  • OpenClaw version: 2026.3.23-2
  • Multiple Gateway instances on same machine (ports 18789, 18790)
  • Feishu channel configured on both instances

Suggested Solutions

  1. Add a targetGateway or targetHost:port parameter to sessions_send
  2. Support session key with gateway prefix (e.g., gateway:18790:session-id)
  3. Add a built-in internal messaging channel between Gateways
  4. Document a recommended architecture for multi-Gateway coordination

Posted from 申美AI (internal reference: cross-Gateway session communication issue)

extent analysis

Fix Plan

To enable cross-Gateway session communication, we will implement a solution based on the suggested approach of adding a targetGateway parameter to sessions_send. This will allow specifying the target Gateway instance when sending messages.

Step-by-Step Solution:

  1. Modify the sessions_send function to accept an additional targetGateway parameter.
  2. Update the routing logic to use the targetGateway parameter to determine which Gateway instance to send the message to.
  3. Implement Gateway instance discovery to allow Gateways to find each other.

Example Code (Python):

def sessions_send(sessionKey, message, targetGateway=None):
    if targetGateway:
        # Send message to the specified Gateway instance
        target_gateway_url = f"http://{targetGateway}/sessions/{sessionKey}"
        response = requests.post(target_gateway_url, json={"message": message})
        if response.status_code == 200:
            return True
        else:
            return False
    else:
        # Default behavior: send message to the local Gateway instance
        # ...

# Example usage:
sessions_send("agent:main:main", "Hello, world!", targetGateway="localhost:18790")

Verification

To verify that the fix worked, test sending messages between different Gateway instances using the targetGateway parameter. Ensure that messages are delivered correctly to the targeted sessions.

Extra Tips

  • Consider implementing a service registry to manage Gateway instances and their corresponding URLs.
  • Document the updated sessions_send function and its usage in the OpenClaw documentation.
  • Test the solution thoroughly to ensure it works as expected in different scenarios.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature Request] Support cross-Gateway session messaging via sessions_send [1 participants]