From ab7e52b9fb95663f395175b05e972296e6ac5db7 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 23 Feb 2026 20:18:27 +0000 Subject: [PATCH] Fix healthcheck to verify PID and add DM-only conversational mode - 6a: Change healthcheck in Dockerfile and docker-compose.yml to verify the PID file exists and the process is alive (kill -0) instead of testing SQLite connectivity, which only proves the DB file exists - 6b: In DMs, skip !commands so MeshMonitor or other bots handle them. MeshAI only responds conversationally in DMs (no bang commands) Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 4 ++-- docker-compose.yml | 2 +- meshai/router.py | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48f99f9..673221d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,9 +74,9 @@ VOLUME ["/data"] # Expose ttyd web config port EXPOSE 7682 -# Health check +# Health check - verify bot process is alive via PID file HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ - CMD python -c "import sqlite3; sqlite3.connect('/data/conversations.db').execute('SELECT 1')" || exit 1 + CMD test -f /tmp/meshai.pid && kill -0 $(cat /tmp/meshai.pid) 2>/dev/null || exit 1 # Entrypoint handles config and ttyd ENTRYPOINT ["/app/docker-entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index d8ab725..58da129 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,7 +53,7 @@ services: memory: 64M healthcheck: - test: ["CMD", "python", "-c", "import sqlite3; sqlite3.connect('/data/conversations.db').execute('SELECT 1')"] + test: ["CMD-SHELL", "test -f /tmp/meshai.pid && kill -0 $(cat /tmp/meshai.pid) 2>/dev/null || exit 1"] interval: 30s timeout: 10s retries: 3 diff --git a/meshai/router.py b/meshai/router.py index ce6239f..a208e97 100644 --- a/meshai/router.py +++ b/meshai/router.py @@ -80,12 +80,11 @@ class MessageRouter: if message.sender_id == self.connector.my_node_id: return False - # Check if DM + # Check if DM — conversational mode only, skip !commands + # (let MeshMonitor or other bots handle bang commands in DMs) if message.is_dm: - # In DMs, let commands through to dispatcher but skip !commands - # that should be handled by other bots (like MeshMonitor) if self.dispatcher.is_command(message.text): - return True + return False return self.config.bot.respond_to_dms # Check channel filtering