Add thread safety and agent health checks

- IRC socket writes protected by threading.Lock in agent.py
- Overseer runs periodic health check (30s interval)
- Detects dead agent processes, cleans up resources, announces in #agents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 13:41:50 +00:00
parent ff694d12f6
commit 6fc6e89917
2 changed files with 24 additions and 1 deletions

View File

@@ -118,6 +118,7 @@ class IRCClient:
self.nick = nick
self.sock = None
self.buf = ""
self._lock = threading.Lock()
def connect(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -127,7 +128,8 @@ class IRCClient:
self.send(f"USER {self.nick} 0 * :Fireclaw Agent")
def send(self, msg):
self.sock.sendall(f"{msg}\r\n".encode("utf-8"))
with self._lock:
self.sock.sendall(f"{msg}\r\n".encode("utf-8"))
def join(self, channel):
self.send(f"JOIN {channel}")