From 3ac160cac6bc5b34c91a46ac6a1dc3c53b9ba574 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Fri, 12 Jun 2026 11:22:43 +0100 Subject: [PATCH 1/2] fix(vector_io): propagate search errors instead of returning empty results The catch-all exception handler in openai_search_vector_store was silently swallowing backend errors and returning an empty result set with HTTP 200. This made it impossible for clients to distinguish between "no matching documents" and "the search failed", masking bugs like the milvus-lite 3.0 chunk_content KeyError. Closes #6092 Co-Authored-By: Claude Opus 4.6 Signed-off-by: Derek Higgins --- .../utils/memory/openai_vector_store_mixin.py | 10 ++----- .../vector_io/test_vector_io_stores_config.py | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/ogx/providers/utils/memory/openai_vector_store_mixin.py b/src/ogx/providers/utils/memory/openai_vector_store_mixin.py index e68130a339..f6d10c5307 100644 --- a/src/ogx/providers/utils/memory/openai_vector_store_mixin.py +++ b/src/ogx/providers/utils/memory/openai_vector_store_mixin.py @@ -1121,14 +1121,8 @@ async def openai_search_vector_store( ) except Exception as e: - # Log the error and return empty results - logger.error("Error searching vector store", vector_store_id=vector_store_id, error=str(e)) - return VectorStoreSearchResponsePage( - search_query=request.query if isinstance(request.query, list) else [request.query], - data=[], - has_more=False, - next_page=None, - ) + logger.error("Failed to search vector store", vector_store_id=vector_store_id, error=str(e)) + raise def _build_reranker_params( self, diff --git a/tests/unit/providers/vector_io/test_vector_io_stores_config.py b/tests/unit/providers/vector_io/test_vector_io_stores_config.py index c39b24840d..b09ddd1298 100644 --- a/tests/unit/providers/vector_io/test_vector_io_stores_config.py +++ b/tests/unit/providers/vector_io/test_vector_io_stores_config.py @@ -213,6 +213,32 @@ async def mock_query_chunks(*args, **kwargs): assert result.search_query == ["test query"] # Original query preserved +async def test_search_vector_store_propagates_backend_errors(vector_io_adapter): + """Test that exceptions from the vector store backend propagate to the caller.""" + vector_store_id = "test_store_error" + vector_io_adapter.openai_vector_stores[vector_store_id] = { + "id": vector_store_id, + "name": "Test Store", + "description": "", + "vector_store_id": "test_db", + "embedding_model": "test/embedding", + } + + async def mock_query_chunks(*args, **kwargs): + raise KeyError("chunk_content") + + vector_io_adapter.query_chunks = mock_query_chunks + + from ogx_api import OpenAISearchVectorStoreRequest + + request = OpenAISearchVectorStoreRequest(query="test query", max_num_results=5) + with pytest.raises(KeyError, match="chunk_content"): + await vector_io_adapter.openai_search_vector_store( + vector_store_id=vector_store_id, + request=request, + ) + + async def test_create_gin_index_executes_correct_sql(): from ogx.providers.remote.vector_io.pgvector.config import PGVectorHNSWVectorIndex from ogx.providers.remote.vector_io.pgvector.pgvector import PGVectorIndex From 7f8c77247607e43517d6317b37b06419ae178c77 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Fri, 12 Jun 2026 11:29:48 +0100 Subject: [PATCH 2/2] fix(test): use correct typed filter format in test_openai_vector_store_with_chunks The test was passing a plain dict filter without a 'type' field, which was silently failing due to the catch-all exception handler returning empty results. The assertion loop never ran, so it appeared to pass. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Derek Higgins --- tests/integration/vector_io/test_openai_vector_stores.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/vector_io/test_openai_vector_stores.py b/tests/integration/vector_io/test_openai_vector_stores.py index ec7d5071e0..a13489080a 100644 --- a/tests/integration/vector_io/test_openai_vector_stores.py +++ b/tests/integration/vector_io/test_openai_vector_stores.py @@ -3585,7 +3585,7 @@ def test_openai_vector_store_with_chunks( filtered_search = compat_client.vector_stores.search( vector_store_id=vector_store.id, query="artificial intelligence", - filters={"topic": "ai"}, + filters={"type": "eq", "key": "topic", "value": "ai"}, max_num_results=5, )