fix: remove session-key channel hint fallback for inter-session turns

This commit is contained in:
Rai Butera 2026-03-12 18:20:34 +00:00
parent 75ed865796
commit 42284cc2da
2 changed files with 5 additions and 6 deletions

View File

@ -28,14 +28,17 @@ describe("INTER_SESSION_CHANNEL sentinel routing", () => {
expect(result).toBe("discord");
});
it("falls back to session-key channel hint when no persisted channel is set", () => {
it("returns undefined when persisted channel is absent and only session-key hint exists (no channel synthesis)", () => {
// Inter-session turns must not synthesise a channel from the session key alone.
// Without a persisted external channel, returning a channel-only route would leave
// lastTo undefined and risk misdelivery via the channel defaultTo fallback.
expect(
resolveLastChannelRaw({
originatingChannelRaw: INTER_SESSION_CHANNEL,
persistedLastChannel: undefined,
sessionKey: "agent:navi:discord:direct:channel:123",
}),
).toBe("discord");
).toBeUndefined();
});
it("returns undefined when no external route can be determined", () => {

View File

@ -99,10 +99,6 @@ export function resolveLastChannelRaw(params: {
if (isExternalRoutingChannel(persistedChannel)) {
return persistedChannel;
}
const sessionKeyChannelHint = resolveSessionKeyChannelHint(params.sessionKey);
if (isExternalRoutingChannel(sessionKeyChannelHint)) {
return sessionKeyChannelHint;
}
return undefined;
}