fix: fail-closed shared-session reply routing (#24571) (thanks @brandonwise)

This commit is contained in:
Peter Steinberger
2026-02-25 01:41:04 +00:00
parent e28803503d
commit 885452f5c1
8 changed files with 180 additions and 14 deletions

View File

@@ -487,6 +487,16 @@ export const agentHandlers: GatewayRequestHandlers = {
typeof request.threadId === "string" && request.threadId.trim()
? request.threadId.trim()
: undefined;
const turnSourceChannel =
typeof request.channel === "string" && request.channel.trim()
? request.channel.trim()
: undefined;
const turnSourceTo =
typeof request.to === "string" && request.to.trim() ? request.to.trim() : undefined;
const turnSourceAccountId =
typeof request.accountId === "string" && request.accountId.trim()
? request.accountId.trim()
: undefined;
const deliveryPlan = resolveAgentDeliveryPlan({
sessionEntry,
requestedChannel: request.replyChannel ?? request.channel,
@@ -494,6 +504,10 @@ export const agentHandlers: GatewayRequestHandlers = {
explicitThreadId,
accountId: request.replyAccountId ?? request.accountId,
wantsDelivery,
turnSourceChannel,
turnSourceTo,
turnSourceAccountId,
turnSourceThreadId: explicitThreadId,
});
let resolvedChannel = deliveryPlan.resolvedChannel;