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(semantic): stop parent refresh at namespace roots (#4232)
LH-kevinacfb3965cbb9
diff --git a/openviking/storage/queuefs/semantic_processor.py b/openviking/storage/queuefs/semantic_processor.pyindex d6748272d..b8110e24e 100644--- a/openviking/storage/queuefs/semantic_processor.py+++ b/openviking/storage/queuefs/semantic_processor.py@@ -255,7 +255,7 @@ class SemanticProcessor(DequeueHandlerBase):parent_uri = parent.uri.rstrip("/")if (not parent_uri- or parent_uri in {"viking://", "viking:"}+ or parent_uri in {"viking://", "viking:", "viking://user", "viking://agent"}or parent_uri == uri.rstrip("/")):returndiff --git a/tests/storage/test_semantic_parent_bubbling.py b/tests/storage/test_semantic_parent_bubbling.pyindex 4550c5be8..9aca6bdcb 100644--- a/tests/storage/test_semantic_parent_bubbling.py+++ b/tests/storage/test_semantic_parent_bubbling.py@@ -66,3 +66,92 @@ async def test_non_recursive_reindex_does_not_bubble_to_parent(monkeypatch):)plan.assert_not_awaited()++ ("uri", "context_type"),+ [+ ("viking://user/alice", "resource"),+ ("viking://agent/skills", "skill"),+ ],+)+async def test_parent_refresh_stops_at_nonsemantic_namespace_root(+ monkeypatch, uri, context_type+):+ plan = AsyncMock(+ side_effect=AssertionError("non-semantic namespace root must not be refreshed")+ )+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_processor.plan_abstract_overview_refresh",+ plan,+ )+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_processor.get_openviking_config",+ lambda: SimpleNamespace(+ semantic=SimpleNamespace(+ overview_sample_limit=32,+ freshness_refresh_ratio=0.10,+ )+ ),+ )+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_processor.get_viking_fs",+ lambda: SimpleNamespace(),+ )++ msg = SemanticMsg(uri=uri, context_type=context_type)+ await SemanticProcessor()._enqueue_parent_refresh(+ msg,+ msg.uri,+ l0_body_changed=True,+ )++ plan.assert_not_awaited()+++ ("uri", "context_type", "expected_parent"),+ [+ ("viking://resources/project", "resource", "viking://resources"),+ ("viking://user/alice/resources", "resource", "viking://user/alice"),+ ("viking://agent/skills/demo", "skill", "viking://agent/skills"),+ ],+)+async def test_parent_refresh_preserves_semantic_roots(+ monkeypatch, uri, context_type, expected_parent+):+ plan = AsyncMock(+ return_value=FreshnessDecision(+ FreshnessAction.NOOP,+ pending_after=0,+ total_entries=1,+ )+ )+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_processor.plan_abstract_overview_refresh",+ plan,+ )+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_processor.get_openviking_config",+ lambda: SimpleNamespace(+ semantic=SimpleNamespace(+ overview_sample_limit=32,+ freshness_refresh_ratio=0.10,+ )+ ),+ )+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_processor.get_viking_fs",+ lambda: SimpleNamespace(),+ )++ msg = SemanticMsg(uri=uri, context_type=context_type)+ await SemanticProcessor()._enqueue_parent_refresh(+ msg,+ msg.uri,+ l0_body_changed=True,+ )++ plan.assert_awaited_once()+ assert plan.await_args.kwargs["dir_uri"] == expected_parent