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(storage): requeue semantic directory lock conflicts (#5340)
Lusen Dong36ec2f560277
diff --git a/openviking/storage/queuefs/semantic_executor.py b/openviking/storage/queuefs/semantic_executor.pyindex f1675aa8c..12cd9bbce 100644--- a/openviking/storage/queuefs/semantic_executor.py+++ b/openviking/storage/queuefs/semantic_executor.py@@ -692,6 +692,11 @@ class SemanticTreeExecutor:for child_uri in children_dirs:self._schedule_dir(child_uri, dir_uri)return False+ except LockAcquisitionError:+ # A content-write message can be dequeued before the writer releases+ # its exact-path lease. Let SemanticProcessor re-enqueue this+ # recoverable conflict instead of acknowledging unfinished file work.+ raiseexcept Exception as e:logger.error(f"Failed to dispatch directory {dir_uri}: {e}", exc_info=True)self._record_skill_failure(dir_uri, e)diff --git a/tests/storage/test_semantic_executor_stats.py b/tests/storage/test_semantic_executor_stats.pyindex 181cb2c16..ee48eb8d1 100644--- a/tests/storage/test_semantic_executor_stats.py+++ b/tests/storage/test_semantic_executor_stats.py@@ -386,6 +386,34 @@ async def test_busy_parent_snapshot_preserves_changed_file_work(monkeypatch):assert executor.get_stats().total_nodes == 2+async def test_directory_listing_lock_conflict_propagates_for_retry(monkeypatch):+ root_uri = "viking://resources"+ changed = f"{root_uri}/cp-source-test.md"+ fake_fs = _FakeVikingFS({})+ fake_fs.ls = AsyncMock(side_effect=LockAcquisitionError("source write still locked"))+ monkeypatch.setattr(+ "openviking.storage.queuefs.semantic_executor.get_viking_fs", lambda: fake_fs+ )+ _patch_semantic_config(monkeypatch)++ executor = SemanticTreeExecutor(+ processor=_FakeProcessor(),+ context_type="resource",+ max_concurrent_llm=2,+ ctx=RequestContext(user=UserIdentifier("acc1", "user1"), role=Role.USER),+ incremental_update=True,+ target_uri=root_uri,+ recursive=False,+ changes={"added": [changed]},+ generation_trigger="content_write",+ aggregate_directory=False,+ )++ with pytest.raises(LockAcquisitionError, match="source write still locked"):+ await executor.run(root_uri)++@pytest.mark.asyncioasync def test_semantic_executor_shares_node_scheduler_across_roots(monkeypatch):root_a = "viking://resources/root-a"