Milvus, Chroma, and Weaviate providers do not persist vector store metadata to kvstore
System Info
N/A
Information
- The official example scripts
- My own modified scripts
Describe the bug
Bug Description
The register_vector_store method in the Milvus, Chroma, and Weaviate vector IO providers writes vector store metadata only to the in-memory self.cache dict, but not to the kvstore under VECTOR_DBS_PREFIX. After a server restart (which clears the in-memory cache), _get_and_cache_vector_store_index cannot find the store, causing VectorStoreNotFoundError. In horizontally scaled deployments, the store only exists in the cache of the instance that handled the create request, so any request routed to a different instance fails immediately.
This affects vector stores created at runtime via the API (e.g., client.vector_stores.create(...)), which are not listed in the distribution config YAML and therefore not re-registered by register_resources on startup.
Impact
When the Responses API file_search tool attempts to search a vector store after a server restart, the following happens:
query_chunks→_get_and_cache_vector_store_index→ cache miss → kvstore miss →VectorStoreNotFoundError- The exception is caught silently in
openai_search_vector_store(openai_vector_store_mixin.py:1123-1131) and returns empty results - The
file_searchtool call completes withstatus: "completed"but returns zero chunks
The vector store remains visible via the OpenAI API (client.vector_stores.retrieve(...)) because OpenAI metadata is stored separately (in the SQL metadata store or kvstore under OPENAI_VECTOR_STORES_PREFIX). This makes the issue difficult to diagnose — the store appears to exist but search silently returns nothing.
Affected Providers
| Provider | register_vector_store persists to kvstore? |
unregister_vector_store cleans up kvstore? |
|---|---|---|
| pgvector | Yes | Yes |
| qdrant | Yes | Yes |
| faiss | Yes | Yes |
| sqlite_vec | Yes | Yes |
| elasticsearch | Yes | Yes |
| milvus | No | No |
| chroma | No | No |
| weaviate | No | No |
Root Cause
In the affected providers, register_vector_store creates a VectorStoreWithIndex and stores it in self.cache but skips the kvstore write. Compare milvus (broken) vs qdrant (working):
Milvus (src/ogx/providers/remote/vector_io/milvus/milvus.py):
async def register_vector_store(self, vector_store: VectorStore) -> None:
# ... create index ...
self.cache[vector_store.identifier] = index # in-memory onlyQdrant (src/ogx/providers/remote/vector_io/qdrant/qdrant.py):
async def register_vector_store(self, vector_store: VectorStore) -> None:
if self.kvstore is None:
raise RuntimeError("KVStore not initialized...")
key = f"{VECTOR_DBS_PREFIX}{vector_store.identifier}"
await self.kvstore.set(key=key, value=vector_store.model_dump_json()) # persisted
# ... create index ...
self.cache[vector_store.identifier] = indexReproduction
- Start an OGX server with a milvus (or chroma/weaviate) vector IO provider
- Create a vector store via the API:
client.vector_stores.create(...) - Verify it's visible:
client.vector_stores.retrieve(vs.id)→ works - Restart the server
- Verify it's still visible:
client.vector_stores.retrieve(vs.id)→ works (OpenAI metadata survived) - Search the store:
client.vector_stores.search(vs.id, query="test")→ returns empty results - Check server logs for:
Error searching vector store ... error=Vector Store '...' not found
Expected Fix
kvstore persistence is added to register_vector_store and kvstore cleanup to unregister_vector_store in milvus, chroma, and weaviate providers, matching the pattern used by pgvector, qdrant, faiss, sqlite_vec, and elasticsearch.
Error logs
N/A
Expected behavior
Store metadata should survive server restarts in Milvus, Chroma, and Weaviate providers
Source: ogx-ai/ogx