Skip to content

[Bug]: Dashboard/webchat overwrites Telegram session deliveryContext, breaking subagent delivery #47745

@neosan8

Description

@neosan8

Bug type

Regression (worked before, now fails)

Summary

When a Telegram session is viewed or interacted with from the dashboard/webchat, the session's deliveryContext.channel and lastChannel are overwritten from telegram to webchat. Subsequent subagent completion events are then delivered to webchat instead of Telegram, silently dropping messages for the Telegram user.

Steps to reproduce

  1. Start a Telegram DM session with the bot (creates session agent:main:telegram:direct:<userId>)
  2. From the dashboard/webchat, view or send a message to the same session
  3. Spawn a subagent from the Telegram session (e.g. via a task that triggers sessions_spawn)
  4. Wait for the subagent to complete and announce its result
  5. Observe: the completion message appears on the dashboard/webchat, NOT on Telegram

Expected behavior

Subagent completion messages should be delivered to the session's original/primary channel (Telegram), regardless of whether the session was viewed from another channel (dashboard/webchat). Admin/monitoring access should not mutate the delivery route.

Actual behavior

After viewing the Telegram session from the dashboard, sessions_list shows:

agent:main:telegram:direct:432587867
  deliveryContext.channel: "webchat"  ← should be "telegram"
  lastChannel: "webchat"             ← should be "telegram"

Subagent completions are silently delivered to the dashboard instead of Telegram. The Telegram user receives nothing. Running /reset from Telegram restores correct delivery.

OpenClaw version

2026.3.14 (git main @ 59bcac4)

Operating system

macOS 26.2 (arm64)

Install method

pnpm dev (git clone)

Model

openai-codex/gpt-5.4 (default), anthropic/claude-opus-4-6 (webchat session)

Provider / routing chain

openclaw → openai-codex (Telegram session), openclaw → anthropic (webchat session)

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: All users who use Telegram (or any external channel) + dashboard simultaneously
Severity: High — subagent results silently lost for the channel user
Frequency: 100% reproducible when dashboard views a Telegram session
Consequence: Messages delivered to wrong channel; user thinks bot is unresponsive

Additional information

Workaround: Running /reset from Telegram restores correct deliveryContext.

Suggested fix: Separate originChannel (immutable, set at session creation) from lastChannel (mutable, tracks most recent interaction). Subagent delivery should use originChannel, not lastChannel. Admin/monitoring access from dashboard should not mutate the delivery route.

This likely affects all external channels (Telegram, Slack, Signal, etc.) when viewed from the dashboard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    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