feishu: fall back to user_id for inbound sender identity#26703
Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom Feb 28, 2026
Merged
feishu: fall back to user_id for inbound sender identity#26703Takhoffman merged 2 commits intoopenclaw:mainfrom
Takhoffman merged 2 commits intoopenclaw:mainfrom
Conversation
Comment on lines
+485
to
+495
| const senderOpenId = event.sender.sender_id.open_id?.trim(); | ||
| const senderUserId = event.sender.sender_id.user_id?.trim(); | ||
| const senderFallbackId = senderOpenId || senderUserId || ""; | ||
|
|
||
| const ctx: FeishuMessageContext = { | ||
| chatId: event.message.chat_id, | ||
| messageId: event.message.message_id, | ||
| senderId: event.sender.sender_id.user_id || event.sender.sender_id.open_id || "", | ||
| senderOpenId: event.sender.sender_id.open_id || "", | ||
| senderId: senderUserId || senderOpenId || "", | ||
| // Keep the historical field name, but fall back to user_id when open_id is unavailable | ||
| // (common in some mobile app deliveries). | ||
| senderOpenId: senderFallbackId, |
Contributor
There was a problem hiding this comment.
inconsistent fallback priority between senderId and senderOpenId
Lines 492 and 495 have opposite priority orders:
- Line 492:
senderId: senderUserId || senderOpenId || "" - Line 495:
senderOpenId: senderFallbackId(wheresenderFallbackId = senderOpenId || senderUserId)
this means when only user_id is present:
senderId=user_id✓senderOpenId=user_id✓
but when both are present:
senderId=user_id(prioritizes user_id)senderOpenId=open_id(prioritizes open_id)
the comment on line 493-494 says senderOpenId falls back to user_id when open_id is unavailable, but the actual behavior prioritizes open_id when both exist. since the field is named senderOpenId and the historical behavior was to use open_id, this is probably correct, but the inconsistency with senderId could cause subtle bugs in routing/allowlist matching where both fields are checked
Suggested change
| const senderOpenId = event.sender.sender_id.open_id?.trim(); | |
| const senderUserId = event.sender.sender_id.user_id?.trim(); | |
| const senderFallbackId = senderOpenId || senderUserId || ""; | |
| const ctx: FeishuMessageContext = { | |
| chatId: event.message.chat_id, | |
| messageId: event.message.message_id, | |
| senderId: event.sender.sender_id.user_id || event.sender.sender_id.open_id || "", | |
| senderOpenId: event.sender.sender_id.open_id || "", | |
| senderId: senderUserId || senderOpenId || "", | |
| // Keep the historical field name, but fall back to user_id when open_id is unavailable | |
| // (common in some mobile app deliveries). | |
| senderOpenId: senderFallbackId, | |
| const ctx: FeishuMessageContext = { | |
| chatId: event.message.chat_id, | |
| messageId: event.message.message_id, | |
| senderId: senderFallbackId, | |
| // Keep the historical field name, but fall back to user_id when open_id is unavailable | |
| // (common in some mobile app deliveries). | |
| senderOpenId: senderFallbackId, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/bot.ts
Line: 485-495
Comment:
inconsistent fallback priority between `senderId` and `senderOpenId`
Lines 492 and 495 have opposite priority orders:
- Line 492: `senderId: senderUserId || senderOpenId || ""`
- Line 495: `senderOpenId: senderFallbackId` (where `senderFallbackId = senderOpenId || senderUserId`)
this means when only `user_id` is present:
- `senderId` = `user_id` ✓
- `senderOpenId` = `user_id` ✓
but when both are present:
- `senderId` = `user_id` (prioritizes user_id)
- `senderOpenId` = `open_id` (prioritizes open_id)
the comment on line 493-494 says `senderOpenId` falls back to `user_id` when `open_id` is unavailable, but the actual behavior prioritizes `open_id` when both exist. since the field is named `senderOpenId` and the historical behavior was to use `open_id`, this is probably correct, but the inconsistency with `senderId` could cause subtle bugs in routing/allowlist matching where both fields are checked
```suggestion
const ctx: FeishuMessageContext = {
chatId: event.message.chat_id,
messageId: event.message.message_id,
senderId: senderFallbackId,
// Keep the historical field name, but fall back to user_id when open_id is unavailable
// (common in some mobile app deliveries).
senderOpenId: senderFallbackId,
```
How can I resolve this? If you propose a fix, please make it concise.9eb398d to
5ed488d
Compare
Contributor
|
PR #26703 - feishu: fall back to user_id for inbound sender identity (#26703) Merged via squash.
Thanks @NewdlDewdl! |
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 4ae9cbe)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 4ae9cbe)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 4ae9cbe)
vincentkoc
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
vincentkoc
pushed a commit
to rylena/rylen-openclaw
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
newtontech
pushed a commit
to newtontech/openclaw-fork
that referenced
this pull request
Feb 28, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Mar 1, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Mar 1, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit e0b1b48) # Conflicts: # CHANGELOG.md # extensions/feishu/src/bot.ts
zooqueen
added a commit
to hanzoai/bot
that referenced
this pull request
Mar 1, 2026
) thanks @NewdlDewdl Cherry-pick of upstream e0b1b48.
ansh
pushed a commit
to vibecode/openclaw
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
safzanpirani
pushed a commit
to safzanpirani/clawdbot
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
venjiang
pushed a commit
to venjiang/openclaw
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
robertchang-ga
pushed a commit
to robertchang-ga/openclaw
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Mar 2, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit e0b1b48) # Conflicts: # CHANGELOG.md
dorgonman
pushed a commit
to kanohorizonia/openclaw
that referenced
this pull request
Mar 3, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
sachinkundu
pushed a commit
to sachinkundu/openclaw
that referenced
this pull request
Mar 6, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen
added a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
) thanks @NewdlDewdl Cherry-pick of upstream e0b1b48.
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Mateljan1
pushed a commit
to Mateljan1/openclaw
that referenced
this pull request
Mar 7, 2026
) thanks @NewdlDewdl Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: NewdlDewdl <230946873+NewdlDewdl@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sender_id.open_idis missing (common on some mobile deliveries).sender_id.user_idso inbound messages keep a stable sender id for routing, metadata, and dashboard rendering.open_id/user_id/union_id) before calling Feishu contact APIs.user_id.Issue
Validation
pnpm buildpnpm checkpnpm testscripts/quality_gate.sh(build, format:check, tsgo, lint, test)Risk
AI-assisted disclosure
Greptile Summary
Fixes Feishu inbound message handling when
sender_id.open_idis missing by falling back tosender_id.user_id, which prevents message routing failures on some mobile deliveries.parseFeishuMessageEventto useuser_idas fallback for sender identity fieldsresolveFeishuSenderNameto accept genericsenderIdand auto-detect ID type (open_id/user_id/union_id) via prefix matchingresolveSenderLookupIdTypefunction to determine correct Feishu API parameter based on ID prefixuser_id-only caseCritical finding:
senderId(prioritizesuser_id) andsenderOpenId(prioritizesopen_id) in bot.ts:485-495 could cause routing/allowlist mismatches when both IDs are presentConfidence Score: 3/5
user_idfallback for sender identity and adds proper test coverage, but has an inconsistent fallback priority betweensenderIdandsenderOpenIdfields that could cause subtle routing bugs when bothuser_idandopen_idare presentsenderIdvssenderOpenIdis intentional or should use same fallback orderLast reviewed commit: 9eb398d