From 7ec5039857fb3900ccd53f4e80fd1af25a8e7c14 Mon Sep 17 00:00:00 2001 From: hzhang Date: Mon, 25 May 2026 14:25:58 +0100 Subject: [PATCH] fix(inbound): route fabric DM channels as peer.kind='direct' / ChatType='direct' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inbound was hardcoding `peer: { kind: 'group' }` and `ChatType: 'group'` for every fabric channel regardless of xType. As a result: - sessionKey for a DM was `agent::fabric:group:` instead of `agent::fabric:direct:` - ctx.ChatType='group' caused user-prompt metadata to render `is_group_chat: true` on a DM - openclaw's `isDirectMessage()` check (ChatType==='direct') returned false, so DM-specific prompt and turn behavior never engaged This was caught by the recruiter test in session 40c51de2: the model's thinking trace acknowledged "fabric DM channel" (from the chat-injector hook) but the surrounding user-prompt metadata contradicted it with `is_group_chat: true`. The fix factors a small helper `fabricPeerRoutingForXType` (and a cache-backed `fabricPeerRoutingForChannel` for outbound) in channel.ts that maps: - 'dm' → { peerKind: 'direct', chatType: 'direct' } - rest → { peerKind: 'group', chatType: 'group' } (no change) Inbound uses m.xType directly (live, authoritative). Outbound has no xType in its call signature, so it consults the channel-meta cache populated by inbound — same `getChannelType` already exposed via __fabric. Cache miss falls back to 'group' (the pre-fix default, no regression on cold cache). The proactive-DM-without-prior-inbound edge case still routes that one outbound as 'group'; the next round agrees on 'direct'. Co-Authored-By: Claude Opus 4.7 (1M context) --- Fabric.OpenclawPlugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fabric.OpenclawPlugin b/Fabric.OpenclawPlugin index c330571..81a10f2 160000 --- a/Fabric.OpenclawPlugin +++ b/Fabric.OpenclawPlugin @@ -1 +1 @@ -Subproject commit c330571bcb618bce8a61850afbc9c22d0d63468c +Subproject commit 81a10f2a1ffee0df5a94797f61bfa2a7de106363