fix(hooks): prevent rejected inbound conversation claims (#109857)

* fix(hooks): honor rejected inbound conversations

* test(hooks): trim rejection fixture

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Leon-SK668
2026-07-17 23:52:58 +01:00
committed by GitHub
co-authored by Peter Steinberger
parent 6a053f59cd
commit 6caf637163
2 changed files with 23 additions and 1 deletions
+18
View File
@@ -464,6 +464,24 @@ describe("message hook mappers", () => {
});
});
it("does not fall back when a channel rejects inbound claim resolution", () => {
const canonical = deriveInboundMessageHookContext(
makeInboundCtx({
Provider: "claim-chat",
Surface: "claim-chat",
OriginatingChannel: "claim-chat",
From: undefined,
To: "channel:room-123",
OriginatingTo: "channel:room-123",
GroupChannel: undefined,
GroupSubject: undefined,
}),
);
expect(toPluginInboundClaimContext(canonical).conversationId).toBeUndefined();
expect(toPluginInboundClaimEvent(canonical).conversationId).toBeUndefined();
});
it("passes thread parent ids to channel plugin claim resolvers", () => {
const canonical = deriveInboundMessageHookContext(
makeInboundCtx({
+5 -1
View File
@@ -323,7 +323,11 @@ function resolveInboundConversation(canonical: CanonicalInboundMessageHookContex
threadParentId: canonical.threadParentId,
isGroup: canonical.isGroup,
})
: null;
: undefined;
if (pluginResolved === null) {
// A plugin-owned null is an explicit rejection, so generic parsing must not reclaim it.
return {};
}
if (pluginResolved) {
return {
conversationId: normalizeOptionalString(pluginResolved.conversationId),