fix(agent): add missing ping() to OllamaBackend and OdooClient

Health endpoint called .ping() on both but neither implemented it,
causing ollama/odoo to always show as error and the bot to stay offline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-12 22:51:03 -04:00
parent 103f575f92
commit 5261396ef7
2 changed files with 15 additions and 0 deletions

View File

@@ -62,5 +62,16 @@ class OllamaBackend:
finally:
self._active -= 1
async def ping(self) -> None:
"""Raise if Ollama is unreachable."""
import ollama
client = ollama.AsyncClient(host=self._url)
try:
await asyncio.wait_for(client.list(), timeout=5)
except asyncio.TimeoutError:
raise OllamaUnavailableError('Ollama ping timed out')
except Exception as exc:
raise OllamaUnavailableError(f'Ollama ping failed: {exc}') from exc
@property
def active_count(self): return self._active

View File

@@ -55,6 +55,10 @@ class OdooClient:
self._models = xmlrpc.client.ServerProxy(
f'{self._url}/xmlrpc/2/object', transport=transport, allow_none=True)
async def ping(self) -> None:
"""Raise if Odoo is unreachable."""
await self._xmlrpc_call(self._common, 'version')
async def connect(self):
await self._authenticate()
if self._pg_dsn: