Skip to content

[Bug]: Telegram DM session metadata shows channel='webchat' instead of 'telegram' with dmScope per-channel-peer #15527

Description

@ST-ATX

Summary

When dmScope: "per-channel-peer" is enabled, Telegram DM sessions show incorrect metadata with channel: "webchat" instead of "telegram", despite correct routing behavior.

Environment

  • OpenClaw Version: 2026.2.3-1
  • OS: macOS (Darwin 25.2.0, arm64)
  • Node: v25.6.0
  • Channel: Telegram
  • Config: session.dmScope: "per-channel-peer" enabled

Evidence

Session metadata from sessions_list:

{
  "key": "agent:main:telegram:dm:6695119663",
  "displayName": "webchat:g-agent-main-telegram-dm-6695119663",
  "channel": "webchat",
  "deliveryContext": {
    "channel": "telegram",
    "to": "telegram:6695119663"
  },
  "lastChannel": "telegram"
}

Observed:

  • metadata.channel shows "webchat"
  • displayName shows "webchat:g-agent-main-telegram-dm-6695119663"

Expected:

  • metadata.channel should show "telegram"
  • displayName should follow proper Telegram format ✅

Correct:

  • deliveryContext.channel shows "telegram"
  • lastChannel shows "telegram"
  • Session key correctly includes telegram:dm

Steps to Reproduce

  1. Enable secure DM mode: session.dmScope: "per-channel-peer"
  2. Restart gateway
  3. Receive message from Telegram DM
  4. Run sessions_list or check session metadata
  5. Observe channel field shows "webchat" instead of "telegram"

Impact

  • Display confusion: Session appears mislabeled in UI/logs
  • Potential routing issues: Could contribute to session identification errors
  • Debugging difficulty: Makes it harder to track which channel a session belongs to

Actual Behavior

Messages route correctly (deliveryContext is accurate), but session metadata labels the channel incorrectly.

Related Issues

Possibly related to:

Notes

This occurred immediately after enabling dmScope: "per-channel-peer" and restarting the gateway. The session functions correctly (messages deliver properly), but the metadata mislabeling could contribute to confusion in multi-channel scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions