Gateway: normalize explicit deliver-route boolean

This commit is contained in:
Vincent Koc 2026-03-06 00:58:09 -05:00
parent c3f4250442
commit a6168ce147

View File

@ -906,13 +906,14 @@ export const chatHandlers: GatewayRequestHandlers = {
(isChannelScopedSession || hasLegacyChannelPeerShape)) ||
(isConfiguredMainSessionScope && client?.connect !== undefined && !isFromWebchatClient)),
);
const hasDeliverableRoute =
const hasDeliverableRoute = Boolean(
shouldDeliverExternally &&
canInheritDeliverableRoute &&
routeChannelCandidate &&
routeChannelCandidate !== INTERNAL_MESSAGE_CHANNEL &&
typeof routeToCandidate === "string" &&
routeToCandidate.trim().length > 0;
routeToCandidate.trim().length > 0,
);
const originatingChannel = hasDeliverableRoute
? routeChannelCandidate
: INTERNAL_MESSAGE_CHANNEL;