Feishu: skip comment events before bot identity recovery

This commit is contained in:
wangweiming 2026-04-01 12:27:13 +08:00 committed by George Zhang
parent 6d981e17ea
commit 4bbce18e99
No known key found for this signature in database
2 changed files with 19 additions and 0 deletions

View File

@ -308,6 +308,18 @@ describe("resolveDriveCommentEventTurn", () => {
expect(turn).toBeNull();
});
it("skips comment notices when bot open_id is unavailable", async () => {
const synthetic = await resolveDriveCommentSyntheticEvent({
cfg: buildMonitorConfig(),
accountId: "default",
event: makeDriveCommentEvent(),
botOpenId: undefined,
createClient: () => makeOpenApiClient({}) as never,
});
expect(synthetic).toBeNull();
});
});
describe("drive.notice.comment_add_v1 monitor handler", () => {

View File

@ -479,6 +479,13 @@ async function resolveDriveCommentEventCore(params: ResolveDriveCommentEventPara
logger?.(`feishu[${accountId}]: unsupported drive comment notice type ${noticeType}`);
return null;
}
if (!botOpenId) {
logger?.(
`feishu[${accountId}]: skipping drive comment notice because bot open_id is unavailable ` +
`event=${eventId}`,
);
return null;
}
if (senderId === botOpenId) {
logger?.(
`feishu[${accountId}]: ignoring self-authored drive comment notice event=${eventId} sender=${senderId}`,