refactor: simplify message tool turn tracking to a single boolean flag

This commit is contained in:
Re-bin
2026-02-20 15:55:30 +00:00
parent c8682512c9
commit 132807a3fb
2 changed files with 6 additions and 19 deletions

View File

@@ -383,19 +383,9 @@ class AgentLoop:
tools_used=tools_used if tools_used else None)
self.sessions.save(session)
suppress_final_reply = False
if message_tool := self.tools.get("message"):
if isinstance(message_tool, MessageTool):
sent_targets = set(message_tool.get_turn_sends())
suppress_final_reply = (msg.channel, msg.chat_id) in sent_targets
if suppress_final_reply:
logger.info(
"Skipping final auto-reply because message tool already sent to {}:{} in this turn",
msg.channel,
msg.chat_id,
)
return None
if isinstance(message_tool, MessageTool) and message_tool._sent_in_turn:
return None
return OutboundMessage(
channel=msg.channel,