fix(feishu): preserve sender identity and resolve mentions in merge_forward messages#39001
fix(feishu): preserve sender identity and resolve mentions in merge_forward messages#39001xiaoxinpan wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR enhances the Feishu merge-forward message formatter by prepending each sub-message line with its sender's Issues found:
Confidence Score: 3/5
Last reviewed commit: a3a2ba4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3a2ba4174
ℹ️ 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".
efabb23 to
5f27a4f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f27a4f915
ℹ️ 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".
de9d3c6 to
0ad05ef
Compare
6297723 to
4f91d64
Compare
de16aa0 to
4fbbce1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fbbce1815
ℹ️ 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".
4fbbce1 to
dd72cb5
Compare
|
Rebased onto latest What changed:
All previous review feedback has been incorporated. The remaining bot review comments above are outdated — they reference the old code structure (before upstream extracted |
dd72cb5 to
d0fb87f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0fb87fe01
ℹ️ 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".
7f40ea2 to
7e45868
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. from source and fixture inspection rather than a live Feishu account. Current main fetches merge_forward sub-messages but formats only body text, and the existing test asserts that old transcript shape. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land a completed Feishu plugin-local formatter fix with a changelog entry, real Feishu output proof, and regression coverage for sender prefixes plus mention replacement; no core change is needed. Do we have a high-confidence way to reproduce the issue? Yes, from source and fixture inspection rather than a live Feishu account. Current main fetches merge_forward sub-messages but formats only body text, and the existing test asserts that old transcript shape. Is this the best way to solve the issue? Yes. The Feishu formatter is the narrowest maintainable place to preserve sender and mention identity, but the PR needs the changelog/proof gaps closed before merge. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 121ac44fa8f5. |
…orward messages Prepend each sub-message with its sender open_id and resolve @_user_N mention placeholders back to real names via the mentions array in the Feishu API response. - Sort mentions by key length descending to prevent partial-match collisions (e.g. @_user_1 matching @_user_10) - Normalize mention IDs for both string and object shapes, with union_id fallback - Use callback replacement to avoid $ substitution in display names Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7e45868 to
d353baa
Compare
Summary
When users forward merged chat messages (合并转发) to a Feishu bot, the formatted output currently loses two critical pieces of information:
sender.id(open_id) is available in the API response but discarded during formatting@_user_Nplaceholders in forwarded content, but the API provides amentionsarray on each item that maps these placeholders back to real names and IDsBefore
After
Changes
extensions/feishu/src/bot.ts—parseMergeForwardContent()mentionsto the item type definition (the Feishuim.message.getAPI already returns this field, it was just not declared)[sender.id]to each sub-message line@_user_Nplaceholders using each item'smentionsarray, displaying as@name(open_id)How it works
The Feishu API (
/im/v1/messages/:message_id) returns merge_forward items with this structure:{ "sender": { "id": "ou_aaa111" }, "mentions": [ { "key": "@_user_1", "id": "ou_ccc333", "name": "张三" }, { "key": "@_user_2", "id": "ou_ddd444", "name": "李四" } ], "body": { "content": "..." }, "msg_type": "text" }The
mentionsarray maps each@_user_Nplaceholder back to the real user. This PR uses that mapping to restore the original user references.Test plan
@name(open_id)mentionsfield structure via debug logging against live Feishu API responses🤖 Generated with Claude Code