feat(feishu): prefer thread_id for topic session routing#29788
feat(feishu): prefer thread_id for topic session routing#29788Takhoffman merged 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR enhances Feishu's topic session routing by preferring
Confidence Score: 5/5
Last reviewed commit: cb89f34 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb89f3422d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
e89f024 to
11b87be
Compare
|
PR #29788 - feat(feishu): prefer thread_id for topic session routing (#29788) Merged after verification.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11b87be1bd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Prefer root_id first so both turns stay on the same peer key. | ||
| const topicScope = | ||
| groupSessionScope === "group_topic" || groupSessionScope === "group_topic_sender" | ||
| ? (normalizedRootId ?? normalizedThreadId ?? (replyInThread ? messageId : null)) |
There was a problem hiding this comment.
Align debounced grouping with thread_id topic sessions
With inbound debounce enabled (messages.inbound.debounceMs > 0), this new thread_id-based topic routing can still misroute content because the debounce key is still built from root_id only (extensions/feishu/src/monitor.account.ts:309-311). If two text messages from the same sender arrive quickly in different threads that have no root_id, onFlush merges them and dispatches using the last event’s thread metadata, so the earlier thread’s text is routed into the wrong topic/session. Since this change now routes by thread_id (topicScope fallback), the debounce key should use the same root/thread fallback to avoid cross-thread mixing.
Useful? React with 👍 / 👎.
) thanks @songyaolun Verified: - pnpm test -- extensions/feishu/src/bot.test.ts extensions/feishu/src/reply-dispatcher.test.ts - pnpm build Co-authored-by: songyaolun <26423459+songyaolun@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
) thanks @songyaolun Verified: - pnpm test -- extensions/feishu/src/bot.test.ts extensions/feishu/src/reply-dispatcher.test.ts - pnpm build Co-authored-by: songyaolun <26423459+songyaolun@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
) thanks @songyaolun Verified: - pnpm test -- extensions/feishu/src/bot.test.ts extensions/feishu/src/reply-dispatcher.test.ts - pnpm build Co-authored-by: songyaolun <26423459+songyaolun@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
thread_idoverroot_idfor topic-scoped session routingtopicSessionModelegacy behavior while improving topic isolation accuracyChanges
thread_idfrom inbound events (FeishuMessageEvent/FeishuMessageContext)thread_idfirstthreadReplymode in reply dispatcher to forcereply_in_threadand disable streaming in thread contextsVerification
pnpm --dir /Users/bytedance/Documents/git_repo/openclaw exec vitest run extensions/feishu/src/bot.test.ts extensions/feishu/src/reply-dispatcher.test.tspnpm --dir /Users/bytedance/Documents/git_repo/openclaw exec oxfmt --check extensions/feishu/src/bot.ts extensions/feishu/src/types.ts extensions/feishu/src/reply-dispatcher.ts extensions/feishu/src/config-schema.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/reply-dispatcher.test.tsScreenshots
Closes #29791