Skip to content

[Bug]: --to flag ignored when using --agent with custom channel, all sessions map to main #41483

Description

@limpicompany-maker

Bug type

Behavior bug (incorrect output/state without crash)

Summary

When calling openclaw agent with --agent and --to flags, the session key always
resolves to agent:chatwoot_agent:main regardless of the --to value.

Steps to reproduce

  1. Run: openclaw agent --agent chatwoot_agent --channel whatsapp --to "cw_111" --message "test" --json
  2. Run: openclaw agent --agent chatwoot_agent --channel whatsapp --to "cw_222" --message "test" --json
  3. Run: openclaw agent --agent chatwoot_agent --channel instagram --to "cw_333" --message "test" --json
  4. Check sessions: cat ~/.openclaw/agents/chatwoot_agent/sessions/sessions.json

Expected behavior

Each unique --to value should create a separate session with a unique sessionKey,
e.g. agent:chatwoot_agent:cw_111 and agent:chatwoot_agent:cw_222

Actual behavior

Both calls share the same session: agent:chatwoot_agent:main
The --to flag is completely ignored for session routing.
Same result with --session-id flag.

OpenClaw version

2026.3.8

Operating system

npm / self-hosted

Install method

No response

Logs, screenshots, and evidence

Impact and severity

Affects all users running openclaw as a multi-user chatbot bridge (e.g. Chatwoot,
WhatsApp gateway). All customer conversations share one session causing context
mixing between different users. Severity: blocks workflow. Frequency: always.
Consequence: wrong responses sent to wrong customers, session history grows
uncontrollably until agent stops responding.
Tested with WhatsApp and Instagram channels via Chatwoot bridge.
Both channels show same behavior - all map to single main session.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions