Auto-reply: avoid eager bundled route fallback

This commit is contained in:
Gustavo Madeira Santana
2026-04-17 03:32:26 -04:00
parent 54e4e16844
commit 3ea1bf4232
2 changed files with 8 additions and 13 deletions

View File

@@ -16,15 +16,9 @@ const mocks = vi.hoisted(() => ({
deliverOutboundPayloads: vi.fn(),
}));
vi.mock("../../infra/outbound/deliver-runtime.js", async () => {
const actual = await vi.importActual<typeof import("../../infra/outbound/deliver-runtime.js")>(
"../../infra/outbound/deliver-runtime.js",
);
return {
...actual,
deliverOutboundPayloads: mocks.deliverOutboundPayloads,
};
});
vi.mock("../../infra/outbound/deliver-runtime.js", () => ({
deliverOutboundPayloads: mocks.deliverOutboundPayloads,
}));
const { routeReply } = await import("./route-reply.js");

View File

@@ -93,10 +93,11 @@ export async function routeReply(params: RouteReplyParams): Promise<RouteReplyRe
const normalizedChannel = normalizeMessageChannel(channel);
const channelId =
normalizeChannelId(channel) ?? normalizeOptionalLowercaseString(channel) ?? null;
const loadedPlugin = channelId ? getLoadedChannelPlugin(channelId) : undefined;
const bundledPlugin = channelId ? getBundledChannelPlugin(channelId) : undefined;
const messaging = loadedPlugin?.messaging ?? bundledPlugin?.messaging;
const threading = loadedPlugin?.threading ?? bundledPlugin?.threading;
const plugin = channelId
? (getLoadedChannelPlugin(channelId) ?? getBundledChannelPlugin(channelId))
: undefined;
const messaging = plugin?.messaging;
const threading = plugin?.threading;
const resolvedAgentId = params.sessionKey
? resolveSessionAgentId({
sessionKey: params.sessionKey,