fix(feishu): include parent media context for replies - #13115
Conversation
|
Hi @tangyuanjc — thanks for putting this up. We've been running an 1. LRU-bound
|
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the parent-context behavior; the current main path still loses replied-parent media: plugins/platforms/feishu/adapter.py:3259 fetches only reply text, and :3298-3299 forwards only current-message media.
Problems
- The diff cannot be applied directly: Feishu was moved from
gateway/platforms/feishu.pytoplugins/platforms/feishu/adapter.pyby5600105478ffde29d7566b45421b100eaa29c4ef; GitHub currently reports this PR asdirty. - The added
_message_context_cacheis unbounded. Current reply-text caching is explicitly LRU-bounded atplugins/platforms/feishu/adapter.py:257,4165-4189(e8cacb57d531137dec3109617e807b30ff5187c9). - A port must retain parent mention normalization: current lookup passes
parent.mentionsandself._bot_identity()atplugins/platforms/feishu/adapter.py:4181-4186.
Suggested changes
- Port the context helper and event-media merge into
plugins/platforms/feishu/adapter.py, using its_run_blockingpath. - Use a bounded
OrderedDictcontext cache matching the existing LRU convention. - Add audio/file, cache-hit/eviction, current-media preservation, and text-message-type regression tests.
Automated hermes-sweeper review.
| self._sent_message_id_order: List[str] = [] # LRU order for _sent_message_ids_to_chat | ||
| self._chat_info_cache: Dict[str, Dict[str, Any]] = {} | ||
| self._message_text_cache: Dict[str, Optional[str]] = {} | ||
| self._message_context_cache: Dict[str, tuple[Optional[str], List[str], List[str]]] = {} |
There was a problem hiding this comment.
Please make this a bounded OrderedDict LRU cache. Main deliberately caps the analogous _message_text_cache at 512 entries (e8cacb57d) because long-lived high-throughput adapters otherwise retain every unique parent message indefinitely.
Summary
Tests
Result: 126 passed, 70 warnings (dependency deprecation warnings from lark_oapi/websockets).