fix: break feedback loop - only write to inbox from send_message tool
Previously the outbound loop wrote every message to inbox, causing the homelab bot to process its own responses as new tasks. Now only explicit claude.ai send_message tool calls write to inbox. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
10f6dbbd19
commit
a7344fa332
2 changed files with 10 additions and 1 deletions
|
|
@ -93,6 +93,16 @@ def send_message(message: str) -> str:
|
|||
"""
|
||||
chat_id = get_group_chat_id()
|
||||
outbound_id = db.queue_outbound(chat_id, message)
|
||||
|
||||
# Write to homelab bot inbox so it processes the task
|
||||
from pathlib import Path
|
||||
inbox_path = Path.home() / "homelab" / "telegram" / "inbox"
|
||||
try:
|
||||
with open(inbox_path, "a") as f:
|
||||
f.write(f"[MCP Bridge Task from claude.ai] {message}\nAcknowledge this task and begin working on it. Respond in the group chat.\n")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return json.dumps({"sent": True, "id": outbound_id})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -276,7 +276,6 @@ class BridgeBot:
|
|||
for msg in pending:
|
||||
try:
|
||||
await self.send_to_group(msg["content"], msg["attribution"])
|
||||
await self._write_to_homelab_inbox(msg["content"], msg["attribution"])
|
||||
self.db.mark_outbound_sent(msg["id"])
|
||||
logger.info(f"Sent outbound message {msg['id']}")
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue