Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix: handle is_healthy() AttributeError when not initialized (closes #298) (#322)
r266-techc929a8619741
diff --git a/openviking/service/debug_service.py b/openviking/service/debug_service.pyindex eeada55f5..15056429d 100644--- a/openviking/service/debug_service.py+++ b/openviking/service/debug_service.py@@ -73,6 +73,11 @@ class ObserverService:self._vikingdb = vikingdbself._config = config+ @property+ def _dependencies_ready(self) -> bool:+ """Check if both vikingdb and config dependencies are set."""+ return self._vikingdb is not None and self._config is not None+@propertydef queue(self) -> ComponentStatus:"""Get queue status."""@@ -87,6 +92,13 @@ class ObserverService:@propertydef vikingdb(self) -> ComponentStatus:"""Get VikingDB status."""+ if self._vikingdb is None:+ return ComponentStatus(+ name="vikingdb",+ is_healthy=False,+ has_errors=True,+ status="Not initialized",+ )observer = VikingDBObserver(self._vikingdb)return ComponentStatus(name="vikingdb",@@ -98,6 +110,13 @@ class ObserverService:@propertydef vlm(self) -> ComponentStatus:"""Get VLM status."""+ if self._config is None:+ return ComponentStatus(+ name="vlm",+ is_healthy=False,+ has_errors=True,+ status="Not initialized",+ )observer = VLMObserver(self._config.vlm.get_vlm_instance())return ComponentStatus(name="vlm",@@ -143,6 +162,8 @@ class ObserverService:def is_healthy(self) -> bool:"""Quick health check."""+ if not self._dependencies_ready:+ return Falsereturn self.system.is_healthydiff --git a/tests/misc/test_debug_service.py b/tests/misc/test_debug_service.pyindex 61a4611f8..36245e107 100644--- a/tests/misc/test_debug_service.py+++ b/tests/misc/test_debug_service.py@@ -284,6 +284,38 @@ class TestObserverService:status = service.systemassert all(c.is_healthy for name, c in status.components.items() if name != "transaction")+ def test_is_healthy_without_dependencies(self):+ """Test is_healthy returns False (not raises) when dependencies not set."""+ service = ObserverService()+ assert service.is_healthy() is False++ def test_vikingdb_property_without_dependency(self):+ """Test vikingdb property returns unhealthy ComponentStatus when vikingdb is None."""+ service = ObserverService()+ status = service.vikingdb+ assert isinstance(status, ComponentStatus)+ assert status.name == "vikingdb"+ assert status.is_healthy is False+ assert status.has_errors is True+ assert status.status == "Not initialized"++ def test_vlm_property_without_dependency(self):+ """Test vlm property returns unhealthy ComponentStatus when config is None."""+ service = ObserverService()+ status = service.vlm+ assert isinstance(status, ComponentStatus)+ assert status.name == "vlm"+ assert status.is_healthy is False+ assert status.has_errors is True+ assert status.status == "Not initialized"++ def test_system_property_without_dependencies(self):+ """Test system property returns unhealthy SystemStatus when dependencies not set."""+ service = ObserverService()+ status = service.system+ assert isinstance(status, SystemStatus)+ assert status.is_healthy is False+@patch("openviking.service.debug_service.get_queue_manager")@patch("openviking.service.debug_service.QueueObserver")@patch("openviking.service.debug_service.VikingDBObserver")