From c33cc3c6626f64f1b880484b90176130b5bc7b9e Mon Sep 17 00:00:00 2001 From: totto Date: Wed, 17 Jun 2026 23:55:57 +0200 Subject: [PATCH] fix: copy SearchConfig before mutating limit to prevent shared-state clobber search_recall() assigned the module-level constant EDGE_HYBRID_SEARCH_RRF (or _NODE_DISTANCE) directly to search_config, then mutated .limit on it. Every concurrent call therefore races to set the same object's limit field, meaning one request can silently cap another request's result count. Fix: call .model_copy(deep=True) before mutation so each invocation works on its own copy, leaving the module-level default untouched. Co-Authored-By: Claude Sonnet 4.6 --- graphiti_core/graphiti.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphiti_core/graphiti.py b/graphiti_core/graphiti.py index 51c3099fa4..9cd6cf7d3c 100644 --- a/graphiti_core/graphiti.py +++ b/graphiti_core/graphiti.py @@ -1568,7 +1568,7 @@ async def search( """ search_config = ( EDGE_HYBRID_SEARCH_RRF if center_node_uuid is None else EDGE_HYBRID_SEARCH_NODE_DISTANCE - ) + ).model_copy(deep=True) search_config.limit = num_results edges = (