feat(feishu): persistent message deduplication to prevent duplicate replies#22604
feat(feishu): persistent message deduplication to prevent duplicate replies#22604Amateur0x1 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
a68cb59 to
1642228
Compare
1642228 to
ebbb525
Compare
ebbb525 to
bd3ba37
Compare
bd3ba37 to
394e1b3
Compare
6c46b07 to
1539976
Compare
extensions/feishu/src/dedup.ts
Outdated
| // First check memory cache (fast path) | ||
| if (processedMessageIds.has(cacheKey)) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
redundant memory cache layer: dedup.ts maintains its own processedMessageIds cache, but tryRecordMessagePersistent also maintains memoryCache inside dedup-store.ts
the first check here will miss if the message was added during a previous run (only in disk), then tryRecordMessagePersistent will correctly find it in the persistent store and return false, but then line 35 adds it to processedMessageIds anyway. this works correctly but stores the same data twice in memory
consider removing processedMessageIds from dedup.ts and relying solely on the memoryCache inside dedup-store.ts, or document why both layers are needed
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/dedup.ts
Line: 22-25
Comment:
redundant memory cache layer: `dedup.ts` maintains its own `processedMessageIds` cache, but `tryRecordMessagePersistent` also maintains `memoryCache` inside `dedup-store.ts`
the first check here will miss if the message was added during a previous run (only in disk), then `tryRecordMessagePersistent` will correctly find it in the persistent store and return `false`, but then line 35 adds it to `processedMessageIds` anyway. this works correctly but stores the same data twice in memory
consider removing `processedMessageIds` from `dedup.ts` and relying solely on the `memoryCache` inside `dedup-store.ts`, or document why both layers are needed
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.…eplies
- Add dedup-store.ts for filesystem-based message deduplication
- Extend dedup TTL from 30min to 24h for better reliability
- Survive OpenClaw restarts and WebSocket reconnects
- Use memory cache + disk storage for performance
Fixes duplicate message processing when Feishu redelivers messages
or WebSocket reconnects during one-on-one conversations.
1539976 to
1b18ba4
Compare
Closes #23369
Problem
Feishu may redeliver the same message multiple times, especially during:
In one-on-one chat mode, this causes duplicate replies to the same message. The existing in-memory dedup map is lost on restart, so duplicates slip through.
Solution
Implement persistent message deduplication with a dual-layer strategy:
Key Design Decisions
Changes
Testing
Fixes duplicate message processing in Feishu DM conversations.