← Back to PRs

#9662: fix(feishu): include sender ID in direct messages for auth

by cszhouwei open 2026-02-05 14:57 View on GitHub →
channel: feishu stale
## Summary Add `ForceIncludeSenderMeta` flag to `MsgContext` that allows channels to force sender metadata injection even for direct/DM chats. Feishu now sets this flag so AI can access the sender's `open_id` for identity verification in both group and direct messages. Also improved `senderName` resolution to use `open_id` as fallback when `user_id` is unavailable (common due to Feishu permission requirements). ## Problem Feishu direct messages were not passing `SenderId` (open_id) to AI, while group messages were injecting `[from: unknown (ou_xxx)]`. This made it impossible for AI to perform identity verification in DM conversations. ## Changes - `src/auto-reply/templating.ts` - Added `ForceIncludeSenderMeta` field to MsgContext - `src/auto-reply/reply/inbound-sender-meta.ts` - Check the new flag to allow sender meta injection for direct chats - `src/feishu/message.ts` - Set the flag and improved senderName fallback - `src/auto-reply/inbound.test.ts` - Added test cases ## Test plan - [x] Unit tests pass - [x] Type check passes - [ ] Manual test with Feishu DM 🤖 Generated with [Claude Code](https://claude.ai/code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a `ForceIncludeSenderMeta` boolean to `MsgContext` and updates the shared inbound-body formatting to allow appending a `[from: ...]` line even in DMs when that flag is set. Feishu’s inbound message handler now always sets this flag and adjusts sender labeling so the AI can see the sender’s `open_id` in direct messages for identity verification. Tests were extended to cover forced sender-meta injection for `direct`/`dm` chat types. <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but it changes DM formatting semantics and Feishu sender labeling in a way that should be confirmed. - Core change is small and covered by unit tests, but (1) Feishu now uses IDs as `SenderName` fallback, which will surface in user-visible/meta text, and (2) the new force flag intentionally bypasses the DM guard in shared logic, which can affect other channels if misused. - src/feishu/message.ts, src/auto-reply/reply/inbound-sender-meta.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs