← Back to PRs

#13761: fix(feishu): silently degrade when contact permission is missing

by echoVic open 2026-02-11 00:47 View on GitHub →
channel: feishu
## 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