The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(whatsapp): classify npm install failures as non-retryable fatal errors (#80095)
Christopher136a911065fd
diff --git a/plugins/platforms/whatsapp/adapter.py b/plugins/platforms/whatsapp/adapter.pyindex 56ce666b706..7f16158d4c1 100644--- a/plugins/platforms/whatsapp/adapter.py+++ b/plugins/platforms/whatsapp/adapter.py@@ -600,6 +600,11 @@ class WhatsAppAdapter(WhatsAppBehaviorMixin, BasePlatformAdapter):)if install_result.returncode != 0:print(f"[{self.name}] npm install failed: {install_result.stderr}")+ self._set_fatal_error(+ "whatsapp_npm_install_failed",+ f"WhatsApp bridge npm install failed. Run `cd {bridge_dir} && {_npm_bin} install` manually, then restart `hermes gateway`.",+ retryable=False,+ )return Falseprint(f"[{self.name}] Dependencies installed")if _pkg_hash:@@ -609,6 +614,11 @@ class WhatsAppAdapter(WhatsAppBehaviorMixin, BasePlatformAdapter):pass # Stamp is an optimization; install still succeededexcept Exception as e:print(f"[{self.name}] Failed to install dependencies: {e}")+ self._set_fatal_error(+ "whatsapp_npm_install_failed",+ f"WhatsApp bridge npm install failed ({e}). Run `cd {bridge_dir} && {_npm_bin} install` manually, then restart `hermes gateway`.",+ retryable=False,+ )return False# Ensure session directory existsdiff --git a/tests/gateway/test_whatsapp_connect.py b/tests/gateway/test_whatsapp_connect.pyindex 12ee1e00c22..8ce6687b81f 100644--- a/tests/gateway/test_whatsapp_connect.py+++ b/tests/gateway/test_whatsapp_connect.py@@ -216,6 +216,9 @@ class TestConnectCleanup:result = await adapter.connect()assert result is False+ assert adapter.fatal_error_code == "whatsapp_npm_install_failed"+ assert adapter.fatal_error_retryable is False+ assert "npm install failed" in (adapter.fatal_error_message or "")mock_release.assert_called_once_with("whatsapp-session", str(adapter._session_path))assert adapter._platform_lock_identity is None