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:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user