fix(feishu): include replied media context - #27545
Conversation
|
Thanks for the Feishu fix — I verified the bug still exists on current main, and the overall direction is useful. Problems
Suggested changes
Automated hermes-sweeper review. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the Feishu reply-context fix. The underlying bug is still present on current main: plugins/platforms/feishu/adapter.py:3259 fetches only parent text, while MessageEvent receives only the current inbound media at :3298-3299.
Problems
- The new
_message_context_cachein this diff is an unbounded plainDict. It retains downloaded parent-media paths indefinitely. Current main's analogous_message_text_cacheis LRU-bounded atplugins/platforms/feishu/adapter.py:4165-4189; the salvaged context cache should preserve that behavior. - The added test covers a parent image only. The downloader separately handles image keys and generic media references at
plugins/platforms/feishu/adapter.py:3780-3799, so parent file/audio cases need coverage too. - The adapter was relocated to
plugins/platforms/feishu/adapter.pyby5600105478ffde29d7566b45421b100eaa29c4ef, so this needs a targeted salvage port rather than applying the old-path diff directly.
Suggested changes
- Port the helper and media merge to the bundled plugin, use a capped OrderedDict/LRU cache, and test image plus file/audio parent media and eviction behavior.
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. Parent contexts include downloaded media paths, so an unbounded Dict can grow for the lifetime of a busy adapter; current main's analogous reply-text cache promotes hits and evicts past _FEISHU_MESSAGE_TEXT_CACHE_SIZE.
Summary
Test Plan