


























@@ -2031,6 +2031,65 @@ describe("handleFeishuMessage command authorization", () => {
20312031);
20322032});
203320332034+it("uses thread_id as the canonical topic key in Feishu topic groups", async () => {
2035+mockShouldComputeCommandAuthorized.mockReturnValue(false);
2036+2037+const cfg: ClawdbotConfig = {
2038+channels: {
2039+feishu: {
2040+groups: {
2041+"oc-group": {
2042+requireMention: false,
2043+groupSessionScope: "group_topic",
2044+},
2045+},
2046+},
2047+},
2048+} as ClawdbotConfig;
2049+2050+const topicStarter: FeishuMessageEvent = {
2051+sender: { sender_id: { open_id: "ou-topic-user" } },
2052+message: {
2053+message_id: "om_topic_starter_message",
2054+chat_id: "oc-group",
2055+chat_type: "topic_group",
2056+root_id: "omt_topic_1",
2057+message_type: "text",
2058+content: JSON.stringify({ text: "topic starter" }),
2059+},
2060+};
2061+const topicReply: FeishuMessageEvent = {
2062+sender: { sender_id: { open_id: "ou-topic-user" } },
2063+message: {
2064+message_id: "om_topic_reply_message",
2065+chat_id: "oc-group",
2066+chat_type: "topic_group",
2067+root_id: "om_topic_starter_message",
2068+thread_id: "omt_topic_1",
2069+message_type: "text",
2070+content: JSON.stringify({ text: "topic reply" }),
2071+},
2072+};
2073+2074+await dispatchMessage({ cfg, event: topicStarter });
2075+await dispatchMessage({ cfg, event: topicReply });
2076+2077+expect(mockResolveAgentRoute).toHaveBeenNthCalledWith(
2078+1,
2079+expect.objectContaining({
2080+peer: { kind: "group", id: "oc-group:topic:omt_topic_1" },
2081+parentPeer: { kind: "group", id: "oc-group" },
2082+}),
2083+);
2084+expect(mockResolveAgentRoute).toHaveBeenNthCalledWith(
2085+2,
2086+expect.objectContaining({
2087+peer: { kind: "group", id: "oc-group:topic:omt_topic_1" },
2088+parentPeer: { kind: "group", id: "oc-group" },
2089+}),
2090+);
2091+});
2092+20342093it("uses thread_id as topic key when root_id is missing", async () => {
20352094mockShouldComputeCommandAuthorized.mockReturnValue(false);
20362095此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。