openclaw - 💡(How to fix) Fix Feature: Cross-channel session binding (unified session across TUI + Telegram/Discord) [1 participants]

Official PRs (…)
ON THIS PAGE

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#58004Fetched 2026-04-08 01:54:58
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Fix Action

Fix / Workaround

Current Workaround

Code Example

"channelSessionMap": {
  "telegram:7567491118": "main",
  "webchat:gateway-client": "main"
}

---

"sessions": {
  "bindings": [
    {
      "sessionKey": "main",
      "channels": ["telegram:7567491118", "webchat:gateway-client"]
    }
  ]
}
RAW_BUFFERClick to expand / collapse

Problem

Currently each surface (TUI/webchat, Telegram DM, Discord) gets its own session key. Context doesn't carry when switching between them — you have to re-establish state every time you move from mobile Telegram to the local TUI or vice versa.

Proposed Solution

Allow mapping multiple channel/sender identities to a single persistent named session, so a user can switch surfaces mid-conversation without losing thread continuity.

Example config shape:

"channelSessionMap": {
  "telegram:7567491118": "main",
  "webchat:gateway-client": "main"
}

Or alternatively, a top-level sessions.bindings config:

"sessions": {
  "bindings": [
    {
      "sessionKey": "main",
      "channels": ["telegram:7567491118", "webchat:gateway-client"]
    }
  ]
}

Use Case

Power users who run the TUI locally on their workstation while also messaging from mobile Telegram want one continuous conversation thread — not two fragmented sessions that each need context re-established every time they switch devices.

Current Workaround

Shared MEMORY.md + memory/*.md as a continuity layer works for high-level context, but session-level message history, in-progress tasks, and short-term working context are still lost on surface switches.

Notes

  • Session routing by sender identity would be the key primitive needed
  • Should be opt-in and scoped per agent
  • Named sessions via cron (sessionTarget: "session:<id>") already exist — extending this to inbound channel routing would be a natural fit

extent analysis

Fix Plan

To implement the proposed solution, follow these steps:

  • Update the configuration to include a channelSessionMap or sessions.bindings section.
  • Modify the session routing logic to use the configured mappings.

Example Code

// Load the configuration
const config = require('./config.json');

// Function to get the session key for a given channel and sender
function getSessionKey(channel, sender) {
  // Check if channelSessionMap is defined
  if (config.channelSessionMap) {
    const key = `${channel}:${sender}`;
    return config.channelSessionMap[key];
  }
  // Check if sessions.bindings is defined
  else if (config.sessions && config.sessions.bindings) {
    for (const binding of config.sessions.bindings) {
      if (binding.channels.includes(`${channel}:${sender}`)) {
        return binding.sessionKey;
      }
    }
  }
  // Return a default session key if no mapping is found
  return `default-${channel}-${sender}`;
}

// Example usage:
const channel = 'telegram';
const sender = '7567491118';
const sessionKey = getSessionKey(channel, sender);
console.log(`Session key for ${channel}:${sender}: ${sessionKey}`);

Verification

To verify that the fix worked, test the following scenarios:

  • Switching between different surfaces (e.g., from mobile Telegram to local TUI) with the same user identity.
  • Checking that the conversation thread is continuous and context is preserved.
  • Verifying that the session key is correctly mapped and used for each channel and sender.

Extra Tips

  • Make sure to handle cases where the configuration is missing or invalid.
  • Consider adding logging or debugging statements to help diagnose issues with session key mapping.
  • Review the existing code for session routing and modify it accordingly to use the new configuration and getSessionKey function.

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: Cross-channel session binding (unified session across TUI + Telegram/Discord) [1 participants]