fix(feishu): harden target routing, dedupe, and reply fallback

This commit is contained in:
Peter Steinberger
2026-03-02 03:41:07 +00:00
parent 77ccd35e5e
commit 2a252a14cc
11 changed files with 371 additions and 14 deletions

View File

@@ -1188,6 +1188,38 @@ describe("handleFeishuMessage command authorization", () => {
}),
);
});
it("does not dispatch twice for the same image message_id (concurrent dedupe)", async () => {
mockShouldComputeCommandAuthorized.mockReturnValue(false);
const cfg: ClawdbotConfig = {
channels: {
feishu: {
dmPolicy: "open",
},
},
} as ClawdbotConfig;
const event: FeishuMessageEvent = {
sender: {
sender_id: {
open_id: "ou-image-dedup",
},
},
message: {
message_id: "msg-image-dedup",
chat_id: "oc-dm",
chat_type: "p2p",
message_type: "image",
content: JSON.stringify({
image_key: "img_dedup_payload",
}),
},
};
await Promise.all([dispatchMessage({ cfg, event }), dispatchMessage({ cfg, event })]);
expect(mockDispatchReplyFromConfig).toHaveBeenCalledTimes(1);
});
});
describe("toMessageResourceType", () => {