From dd2aac40faecf57c6dba44330d3f477506f191ef Mon Sep 17 00:00:00 2001 From: Chris Herold Date: Tue, 27 Jan 2026 22:51:26 -0800 Subject: [PATCH] fix(gateway): use canonical session key in chat.send Fixes session key mismatch where chat.send used raw key (e.g. "main") but chat.history used canonical key (e.g. "agent:main:main"), causing messages to be written to one session but read from another. Fixes #2493 --- src/gateway/server-methods/chat.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gateway/server-methods/chat.ts b/src/gateway/server-methods/chat.ts index 9010a6f21..dca2c54a9 100644 --- a/src/gateway/server-methods/chat.ts +++ b/src/gateway/server-methods/chat.ts @@ -362,7 +362,7 @@ export const chatHandlers: GatewayRequestHandlers = { return; } } - const { cfg, entry } = loadSessionEntry(p.sessionKey); + const { cfg, entry, canonicalKey } = loadSessionEntry(p.sessionKey); const timeoutMs = resolveAgentTimeoutMs({ cfg, overrideMs: p.timeoutMs, @@ -449,7 +449,7 @@ export const chatHandlers: GatewayRequestHandlers = { BodyForCommands: commandBody, RawBody: parsedMessage, CommandBody: commandBody, - SessionKey: p.sessionKey, + SessionKey: canonicalKey, Provider: INTERNAL_MESSAGE_CHANNEL, Surface: INTERNAL_MESSAGE_CHANNEL, OriginatingChannel: INTERNAL_MESSAGE_CHANNEL,