Skip to content

[Feature]: Separate external conversations from local agent sessions #108666

Description

@steipete

Summary

Separate exact external conversation addressing from local agent session context, with first-class send and correlated-turn tools.

Problem to solve

OpenClaw sessions identify local model context, but channel users and agents can mistake a session for the remote peer or channel it most recently served. This is especially confusing for direct-message channels where multiple peers share one main session: a session-targeted action can run the local agent again or route through stale delivery context instead of reaching the intended peer.

The current workaround is to use the generic message tool with raw channel targets. That requires the model to retain transport-specific identifiers and makes request/reply correlation manual. A remote reply can also start a second local agent turn even when it belongs to an in-flight tool call.

Proposed solution

  • Maintain an agent-scoped registry that maps stable opaque conversation references to exact channel, account, peer, and thread addresses.
  • Add owner-only tools to list conversations, send directly without running another local agent session, and perform a request/reply turn.
  • Correlate a remote reply to the outbound transport message and return it from the pending tool call without invoking a second model turn.
  • Persist both outbound and inbound sides in the linked local transcript so future context remains coherent.
  • Keep existing session tools and their established local-session/announcement behavior unchanged.

Alternatives considered

  • Reinterpret session identifiers as external addresses. Rejected because one session can legitimately serve multiple direct-message peers, and sessions remain the correct unit for model context.
  • Require the generic message tool for every send. This works for callers that already know raw transport identifiers, but it leaves discovery, ownership, and request/reply correlation to the model.
  • Create one local session per external peer. This couples context policy to transport addressing and would break existing main-session behavior.

Impact

Affected: Agents coordinating through direct-message, channel, and threaded transports.

Severity: High for agent-to-agent coordination because messages can loop into the sender's session or remain pending instead of reaching the intended peer.

Frequency: Every time an agent treats a shared local session as a remote address.

Consequence: Failed handoffs, duplicate model turns, transport-specific prompting, and unreliable automation.

Evidence/examples

A live Reef reproduction showed a paired, healthy peer while repeated outbound attempts were recorded in the sender's local session and no reply was delivered back through Reef. The proposed contract is transport-generic and will be validated with focused registry/correlation tests plus a live two-peer Reef round trip.

Metadata

Metadata

Assignees

Labels

P2Normal backlog priority with limited blast radius.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.enhancementNew feature or requestimpact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.maintainerMaintainer-authored PR

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions