Files
multica/server
Bohan Jiang 07a0a4272d fix(lark): scope group recent_context to the Lark topic (MUL-5224) (#5882)
Feishu 话题 sessions are isolated per topic (#5061), but the group
recent_context prefetch read the whole chat: a @-mention inside topic B
could pull topic A's messages into B's prompt and persist them into B's
turn (#5835). Fix the leak at the fetch:

- ListChatMessages sends container_id_type=thread&container_id=<thread_id>
  when a topic id is present; the thread container rejects end_time, so the
  window is anchored to the trigger time client-side instead.
- Parse thread_id off the REST item and fail-close on it: a topic fetch
  keeps only exact thread_id matches, dropping any missing/mismatched item
  so a sibling topic can never leak even if the API returns one.
- A topic fetch failure degrades to the readable note and NEVER falls back
  to a chat-wide fetch (that would re-open the leak); a very busy topic may
  get empty context, which is the safe trade.
- Exclude the Bot's own interactive-card replies from the window (they
  flatten to a zero-signal [interactive card] placeholder).
- Non-topic group @-mentions keep the chat-level, end_time-anchored path
  unchanged.

Closes #5835

Co-authored-by: Bohan-J <bohan@devv.ai>
Co-authored-by: multica-agent <github@multica.ai>
2026-07-24 15:38:13 +08:00
..