#9756: fix(feishu): prevent message redelivery during long AI generation
channel: feishu
stale
Cluster:
Feishu Enhancements and Fixes
## Summary
- Don't await `processFeishuMessage` in the event handler so SDK sends ack immediately
- Prevents Feishu from redelivering messages when AI generation takes >15s
## Root Cause
The Lark SDK's `WSClient.handleEventData` waits for `eventDispatcher.invoke()` to complete before sending ack to server. When AI generation takes longer than Feishu's timeout (~15s), the server assumes failure and redelivers the same message.
## Test plan
- [x] Send a message to Feishu bot that triggers long AI generation
- [x] Verify message is only processed once (no duplicate logs)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR changes Feishu’s WebSocket event handling so `processFeishuMessage()` is fired-and-forgotten (with a `.catch`) rather than awaited, allowing the Lark SDK to send its ACK immediately and avoid Feishu/Lark message redelivery when AI generation takes longer than the provider timeout.
It also broadens Feishu message handling by adding support for rich-text `post` messages (extracting plaintext from structured content), ensures sender metadata is forcibly appended in DM bodies for auth-sensitive channels, improves browser extension relay server lifecycle (persisting server state across hot reloads, de-duping concurrent initialization, and stopping relays during control-service shutdown), and adds regression tests around session-history slicing and inbound sender-meta formatting.
<h3>Confidence Score: 3/5</h3>
- This PR is reasonably safe to merge once the Feishu `post` media-handling bug is fixed.
- Core change (not awaiting Feishu handler) is straightforward, but the new `post` message type currently flows into the media-download path, which is a concrete behavior bug. The extension-relay concurrency change looks directionally correct but should be double-checked under failure/retry scenarios. Automated tests were not run in this environment (pnpm unavailable), so confidence is reduced.
- src/feishu/message.ts; src/browser/extension-relay.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#22675: feishu: move message dedup to just before dispatch
by zijiegeng · 2026-02-21
80.1%
#21576: fix(feishu): stop ghost messages from corrupting active conversatio...
by xuanyue202 · 2026-02-20
77.3%
#19793: feat(feishu): reply-in-thread, parallel group sessions, and fire-an...
by yinsn · 2026-02-18
76.6%
#13211: feat(feishu): skip reply-to in DM conversations
by Vincentwei1021 · 2026-02-10
76.6%
#17863: Fix Feishu card button callback parameters dropped (missing handler)
by Clawborn · 2026-02-16
76.5%
#19027: fix(feishu): keep chunked messages in topic/thread context
by qiangu · 2026-02-17
76.3%
#21484: fix(feishu): scope message deduplication by accountId to support mu...
by guanyu-zhang · 2026-02-20
75.0%
#16337: feat(feishu): sync community plugin updates from clawdbot-feishu v0...
by graydawnc · 2026-02-14
74.4%
#13761: fix(feishu): silently degrade when contact permission is missing
by echoVic · 2026-02-11
74.3%
#10675: feat(feishu): add audio message support and fix file upload
by YumoeZhung · 2026-02-06
73.6%