Skip to content

Your lightweight open-source personal agent.

fix: also check channel match before inheriting default message_id

WormWddc9fc4fd286
diff --git a/nanobot/agent/tools/message.py b/nanobot/agent/tools/message.py
index efbadca10..3ac813248 100644
--- a/nanobot/agent/tools/message.py
+++ b/nanobot/agent/tools/message.py
@@ -86,12 +86,14 @@ class MessageTool(Tool):
) -> str:
channel = channel or self._default_channel
chat_id = chat_id or self._default_chat_id
- # Only use default message_id if chat_id matches the default context.
- # If targeting a different chat, don't reply to the original message.
- if chat_id == self._default_chat_id:
+ # Only inherit default message_id when targeting the same channel+chat.
+ # Cross-chat sends must not carry the original message_id, because
+ # some channels (e.g. Feishu) use it to determine the target
+ # conversation via their Reply API, which would route the message
+ # to the wrong chat entirely.
+ if channel == self._default_channel and chat_id == self._default_chat_id:
message_id = message_id or self._default_message_id
else:
- # Targeting a different chat - don't use default message_id
message_id = None
if not channel or not chat_id: