openclaw - 💡(How to fix) Fix openclaw agent: --session-id ignored when --agent is specified [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#60609Fetched 2026-04-08 02:49:11
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
closed ×1locked ×1

Fix Action

Workaround

Use --agent alice without --session-id/--to. Messages go to alice's main session, which works but prevents routing to specific sessions (e.g., group chats) via CLI.

Code Example

# Test 1: --agent + --session-id → routes to main (should use session-id)
openclaw agent --agent alice --session-id 0876e337-984f-4bf5-b61d-abc8073c30e7 --message 'test' --deliver

# Test 2: --agent + --to → routes to main (should derive session from --to)
openclaw agent --agent alice --to 'chat:oc_5044fa1cf8a911271a036ca065b0f506' --message 'test' --deliver

# Test 3: --session-id without --agent → routes to agent:main:main (wrong agent)
openclaw agent --session-id 0876e337-984f-4bf5-b61d-abc8073c30e7 --message 'test' --deliver
RAW_BUFFERClick to expand / collapse

Bug Description

openclaw agent --session-id <uuid> is ignored when --agent <id> is specified. The CLI always routes to the agent's main session, regardless of --session-id or --to values.

Reproduction

Given an existing session:

  • Session key: agent:alice:feishu:group:oc_5044fa1cf8a911271a036ca065b0f506
  • Session ID: 0876e337-984f-4bf5-b61d-abc8073c30e7

All of the following commands route to agent:alice:main instead of the targeted session:

# Test 1: --agent + --session-id → routes to main (should use session-id)
openclaw agent --agent alice --session-id 0876e337-984f-4bf5-b61d-abc8073c30e7 --message 'test' --deliver

# Test 2: --agent + --to → routes to main (should derive session from --to)
openclaw agent --agent alice --to 'chat:oc_5044fa1cf8a911271a036ca065b0f506' --message 'test' --deliver

# Test 3: --session-id without --agent → routes to agent:main:main (wrong agent)
openclaw agent --session-id 0876e337-984f-4bf5-b61d-abc8073c30e7 --message 'test' --deliver

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

FlagsActual Session Key
--agent aliceagent:alice:main
--agent alice --session-id <uuid>agent:alice:main (session-id ignored)
--agent alice --to 'chat:oc_xxx'agent:alice:main (to ignored)
--session-id <uuid> (no --agent)agent:main:main (wrong agent, no alice config)

Environment

  • OpenClaw version: 2026.3.31 (npm)
  • OS: macOS 26.2 (ARM64)
  • Node: v24.13.1

Workaround

Use --agent alice without --session-id/--to. Messages go to alice's main session, which works but prevents routing to specific sessions (e.g., group chats) via CLI.

extent analysis

TL;DR

The issue can be worked around by omitting the --session-id and --to flags when using --agent, but a proper fix requires resolving the session routing logic.

Guidance

  • Verify that the session ID is correctly formatted and exists in the system.
  • Check the OpenClaw documentation for any updates or known issues related to session routing.
  • Test the --session-id flag without the --agent flag to see if the issue is specific to the combination of these flags.
  • Consider filing an issue with OpenClaw or seeking support from their team, as this appears to be a bug in their software.

Example

No code snippet is provided as the issue seems to be related to the OpenClaw CLI tool rather than custom code.

Notes

The provided workaround allows messages to be sent to the main session of the specified agent but does not resolve the issue of routing to specific sessions.

Recommendation

Apply the workaround of using --agent without --session-id or --to until a fix is available from OpenClaw, as this allows for some functionality while waiting for a proper resolution.

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