From 60f184247208bab7e06bf6cac8b667baef9afbc3 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 7 Mar 2026 09:18:44 -0800 Subject: [PATCH] Agents: pass explicit message tool agent id --- src/agents/tools/message-tool.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/agents/tools/message-tool.ts b/src/agents/tools/message-tool.ts index 96b2702f065..d5a089416e0 100644 --- a/src/agents/tools/message-tool.ts +++ b/src/agents/tools/message-tool.ts @@ -488,6 +488,7 @@ const MessageToolSchema = buildMessageToolSchemaFromActions(AllMessageActions, { type MessageToolOptions = { agentAccountId?: string; agentSessionKey?: string; + agentId?: string; config?: OpenClawConfig; currentChannelId?: string; currentChannelProvider?: string; @@ -775,9 +776,9 @@ export function createMessageTool(options?: MessageToolOptions): AnyAgentTool { gateway, toolContext, sessionKey: options?.agentSessionKey, - agentId: options?.agentSessionKey - ? resolveSessionAgentId({ sessionKey: options.agentSessionKey, config: cfg }) - : undefined, + agentId: + options?.agentId?.trim() || + resolveSessionAgentId({ sessionKey: options?.agentSessionKey, config: cfg }), sandboxRoot: options?.sandboxRoot, abortSignal: signal, });