Skip to content

BUG: openclaw agent --session-id silently ignored when --agent is specified #60614

Description

@foreverxdord

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

openclaw agent --session-id <uuid> is silently ignored when --agent <id> is specified. The CLI always routes to the agent's main session, regardless of --session-id or --to values. This makes it impossible to route CLI-sent messages to non-main sessions (e.g., group chat sessions created via webhook).

Steps to reproduce

  1. Configure an agent (e.g. myagent) in openclaw.json
  2. Create a group chat session via channel webhook (session key: agent:myagent:feishu:group:oc_xxx, session ID: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee)
  3. Run: openclaw agent --agent myagent --session-id aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee --message 'test' --deliver
  4. Observe: message appears in agent:myagent:main session, not the targeted group session

Expected behavior

Per docs at https://docs.openclaw.ai/tools/agent-send:

--session-id <id>: Use an explicit session id to reuse an existing session

--session-id should override --agent's default main session routing and deliver the message to the specified session.

Actual behavior

Flags Actual Session Key Expected
--agent myagent agent:myagent:main correct
--agent myagent --session-id <uuid> agent:myagent:main should use session-id
--agent myagent --to 'chat:oc_xxx' agent:myagent:main should derive from --to
--session-id <uuid> (no --agent) agent:main:main wrong agent config

OpenClaw version

2026.3.31

Operating system

macOS 26.2 (ARM64)

Install method

npm global

Model

glm-5-turbo (zai)

Provider / routing chain

zai -> glm-5-turbo

Additional provider/model setup details

Reproducible with any model/provider. The routing logic is independent of the LLM backend.

Logs, screenshots, and evidence

Gateway log confirms all CLI-routed messages go to the agent's main session:

2026-04-04T08:39:48.846+08:00 [feishu] feishu[default]: dispatching to agent (session=agent:alice:main)

--json output from --session-id (without --agent) confirms it falls back to the default main agent:

{
  "sessionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "sessionKey": "agent:main:main",
  "workspaceDir": "/home/user/.openclaw/workspace-main"
}

Impact and severity

Medium. Blocks programmatic routing to non-main sessions via CLI. Workaround available (route to main session only).

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