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(reindex): stop chunking memory vectors (#3077)
Qin Haojief0cfd0980335
diff --git a/openviking/service/reindex_executor.py b/openviking/service/reindex_executor.pyindex 34835f6f6..7ac6f560d 100644--- a/openviking/service/reindex_executor.py+++ b/openviking/service/reindex_executor.py@@ -1143,23 +1143,6 @@ class ReindexExecutor:counters.failed_records += 1counters.warnings.append(f"Failed to reindex {file_uri} vector: {exc}")continue- for chunk_uri, chunk_text in self._chunk_memory_body(file_uri, body):- counters.scanned_records += 1- try:- await self._upsert_context(- uri=chunk_uri,- parent_uri=file_uri,- abstract=detail_abstract,- vector_text=chunk_text,- is_leaf=True,- context_type=ContextType.MEMORY.value,- level=ContextLevel.DETAIL,- ctx=ctx,- )- counters.rebuilt_records += 1- except Exception as exc:- counters.failed_records += 1- counters.warnings.append(f"Failed to reindex {chunk_uri} vector: {exc}")continuetry:@@ -1427,28 +1410,6 @@ class ReindexExecutor:except Exception:return ""- def _chunk_memory_body(self, uri: str, body: str) -> Iterable[tuple[str, str]]:- semantic = get_openviking_config().semantic- chunk_chars = semantic.memory_chunk_chars- overlap = semantic.memory_chunk_overlap- if len(body) <= chunk_chars:- return []-- chunks: list[str] = []- start = 0- while start < len(body):- end = start + chunk_chars- if end < len(body):- boundary = body.rfind("\n\n", start, end)- if boundary > start + chunk_chars // 2:- end = boundary + 2- chunks.append(body[start:end].strip())- start = end - overlap- if start >= len(body):- break-- return [(f"{uri}#chunk_{idx:04d}", chunk) for idx, chunk in enumerate(chunks) if chunk]-def _best_non_empty(self, *values: str) -> str:for value in values:if value:diff --git a/tests/server/test_admin_rebuild_api.py b/tests/server/test_admin_rebuild_api.pyindex dfb133449..8ad228b9a 100644--- a/tests/server/test_admin_rebuild_api.py+++ b/tests/server/test_admin_rebuild_api.py@@ -987,7 +987,6 @@ async def test_reindex_memory_l2_falls_back_to_body_when_abstract_missing(monkeymonkeypatch.setattr(ReindexExecutor, "_safe_read_text", fake_safe_read_text)monkeypatch.setattr(ReindexExecutor, "_fetch_existing_record", fake_fetch_existing_record)monkeypatch.setattr(ReindexExecutor, "_best_file_summary", fake_best_file_summary)- monkeypatch.setattr(ReindexExecutor, "_chunk_memory_body", lambda self, uri, body: [])monkeypatch.setattr(ReindexExecutor, "_upsert_context", fake_upsert_context)service = ReindexExecutor()@@ -1039,7 +1038,6 @@ async def test_reindex_memory_l2_strips_memory_fields_from_abstract(monkeypatch)monkeypatch.setattr(ReindexExecutor, "_safe_read_text", fake_safe_read_text)monkeypatch.setattr(ReindexExecutor, "_fetch_existing_record", fake_fetch_existing_record)monkeypatch.setattr(ReindexExecutor, "_best_file_summary", fake_best_file_summary)- monkeypatch.setattr(ReindexExecutor, "_chunk_memory_body", lambda self, uri, body: [])monkeypatch.setattr(ReindexExecutor, "_upsert_context", fake_upsert_context)service = ReindexExecutor()@@ -1115,7 +1113,6 @@ async def test_reindex_memory_vectors_walks_deep_subtree(monkeypatch):monkeypatch.setattr(ReindexExecutor, "_safe_read_text", fake_safe_read_text)monkeypatch.setattr(ReindexExecutor, "_fetch_existing_record", fake_fetch_existing_record)monkeypatch.setattr(ReindexExecutor, "_best_file_summary", fake_best_file_summary)- monkeypatch.setattr(ReindexExecutor, "_chunk_memory_body", lambda self, uri, body: [])monkeypatch.setattr(ReindexExecutor, "_upsert_context", fake_upsert_context)service = ReindexExecutor()@@ -1203,7 +1200,6 @@ async def test_reindex_memory_vectors_rebuilds_directory_levels_without_regeneramonkeypatch.setattr(ReindexExecutor, "_safe_read_text", fake_safe_read_text)monkeypatch.setattr(ReindexExecutor, "_fetch_existing_record", fake_fetch_existing_record)monkeypatch.setattr(ReindexExecutor, "_best_file_summary", fake_best_file_summary)- monkeypatch.setattr(ReindexExecutor, "_chunk_memory_body", lambda self, uri, body: [])monkeypatch.setattr(ReindexExecutor, "_upsert_context", fake_upsert_context)service = ReindexExecutor()