#13761: fix(feishu): silently degrade when contact permission is missing
channel: feishu
Cluster:
Feishu Messaging Fixes
## Problem
The Feishu plugin currently dispatches a permission error notification to the agent whenever `contact:contact.base:readonly` is missing. This prompts the agent to ask the user to grant the permission — but this permission is overly broad (reads the entire org directory) for the simple need of resolving a sender's display name.
## Changes
- **`resolveFeishuSenderName()`**: On permission error, silently log and fall back to using `open_id` as display name instead of returning a `permissionError`
- **Removed** the `permissionErrorForAgent` tracking and the entire permission error dispatch block in `handleFeishuMessage()` — no more `[System: The bot encountered a Feishu API permission error...]` messages
- **Removed** unused `permissionErrorNotifiedAt` cache and `PERMISSION_ERROR_COOLDOWN_MS` constant
- **Removed** `permissionError` field from `SenderNameResult` type
## Behavior After This Change
- If `contact:contact.base:readonly` is granted: works exactly as before (resolves display names)
- If not granted: silently uses `open_id` as the sender name, logs a one-line debug message, no user-facing error
## Why
`contact:contact.base:readonly` grants read access to the entire organization's contact directory. Many admins consider this too sensitive for a chatbot that just needs to know who sent a message. The bot should work fully without this permission.
Closes #13751
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Removes intrusive permission error notifications when `contact:contact.base:readonly` is missing, replacing them with silent fallback to `open_id` for sender display names. The bot will continue functioning normally without this permission—it just won't resolve friendly display names in group chats.
**Key changes:**
- Removed permission error notification system (cache, cooldown, dispatch logic)
- `resolveFeishuSenderName()` now silently logs permission errors instead of returning them
- Removed 60+ lines of code that created system messages prompting users to grant permissions
- Existing fallback at line 757 (`ctx.senderName ?? ctx.senderOpenId`) ensures graceful degradation
The implementation is clean and follows the intended design: when the permission is unavailable, the bot uses `open_id` values as speaker labels rather than interrupting the conversation with error messages.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no risk
- The changes are straightforward deletions of error notification code with clean fallback behavior already in place. The existing code at extensions/feishu/src/bot.ts:757 (`const speaker = ctx.senderName ?? ctx.senderOpenId;`) handles the fallback gracefully, and all removed code was solely for notifying about the permission error—not for core functionality. No behavioral regression or edge cases identified.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10309: fix: use group ID for peer.id in Feishu group messages
by ParsifalC · 2026-02-06
78.1%
#13211: feat(feishu): skip reply-to in DM conversations
by Vincentwei1021 · 2026-02-10
77.4%
#22675: feishu: move message dedup to just before dispatch
by zijiegeng · 2026-02-21
76.4%
#10513: feat(feishu): add quota optimization flags
by BigUncle · 2026-02-06
75.3%
#14037: docs: improved permission configuration instructions
by LHB6540 · 2026-02-11
74.8%
#8175: fix: suppress raw API errors for non-owners
by Rakshi2609 · 2026-02-03
74.8%
#22957: fix(feishu): download media from quoted messages in group chats (#2...
by echoVic · 2026-02-21
74.6%
#9253: Fix: Feishu chat ID mismatch causing session context confusion
by vishaltandale00 · 2026-02-05
74.5%
#9756: fix(feishu): prevent message redelivery during long AI generation
by cszhouwei · 2026-02-05
74.3%
#14674: feat(feishu): add feishu_chat tool for chat info/member queries
by liuweifly · 2026-02-12
74.3%