Bug Description
Feishu/Lark inbound reply events can carry reply-tree context in root_id. Hermes currently resolves MessageEvent.reply_to_message_id from parent_id or upper_message_id only. If the SDK/event payload has root_id but no parent_id, Hermes does not fetch the replied-to/root message text, so the gateway never injects the [Replying to: ...] context for the agent.
This is separate from the Feishu topic outbound-routing issues tracked in #6969 / #17875: this report is only about inbound reply context (reply_to_message_id / reply_to_text).
Steps to Reproduce
- Receive a Feishu
im.message.receive_v1 event for a reply message where message.root_id is set but message.parent_id and message.upper_message_id are absent.
- Let
FeishuAdapter._process_inbound_message() normalize the event.
- Inspect the resulting
MessageEvent.
Expected Behavior
MessageEvent.reply_to_message_id should use the available reply root id, _fetch_message_text() should fetch the referenced message, and reply_to_text should be populated so the gateway can inject reply context.
Actual Behavior
reply_to_message_id is None, _fetch_message_text() is not called, and the agent receives the user's reply without explicit replied-to context.
Proposed Fix
Treat root_id as a fallback reply target after parent_id and upper_message_id, with regression coverage for root-id-only Feishu reply payloads.
Test Plan
uv run pytest tests/gateway/test_feishu.py -q -o 'addopts='
Bug Description
Feishu/Lark inbound reply events can carry reply-tree context in
root_id. Hermes currently resolvesMessageEvent.reply_to_message_idfromparent_idorupper_message_idonly. If the SDK/event payload hasroot_idbut noparent_id, Hermes does not fetch the replied-to/root message text, so the gateway never injects the[Replying to: ...]context for the agent.This is separate from the Feishu topic outbound-routing issues tracked in #6969 / #17875: this report is only about inbound reply context (
reply_to_message_id/reply_to_text).Steps to Reproduce
im.message.receive_v1event for a reply message wheremessage.root_idis set butmessage.parent_idandmessage.upper_message_idare absent.FeishuAdapter._process_inbound_message()normalize the event.MessageEvent.Expected Behavior
MessageEvent.reply_to_message_idshould use the available reply root id,_fetch_message_text()should fetch the referenced message, andreply_to_textshould be populated so the gateway can inject reply context.Actual Behavior
reply_to_message_idisNone,_fetch_message_text()is not called, and the agent receives the user's reply without explicit replied-to context.Proposed Fix
Treat
root_idas a fallback reply target afterparent_idandupper_message_id, with regression coverage for root-id-only Feishu reply payloads.Test Plan
uv run pytest tests/gateway/test_feishu.py -q -o 'addopts='