fix: copy SearchConfig before mutating .limit to prevent shared-state clobber#1594
fix: copy SearchConfig before mutating .limit to prevent shared-state clobber#1594totto wants to merge 1 commit into
Conversation
…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 <noreply@anthropic.com>
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: example@example.com or I have read the CLA Document and I hereby sign the CLA behalf of my company, e-mail: example@example.com Signature is valid for 6 months. This bot will be retriggered when the Contributor License Agreement comment has been provided. Posted by the CLA Assistant Lite bot. |
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: totto@exoreaction.com |
What
search_recall()assigned one of the module-levelSearchConfigconstants directly to a local variable and then mutated.limiton it:Why it matters
This is a concurrency hazard. Every concurrent call to
search_recall()races to setlimiton the same shared object. One request can silently cap another request's result count to whatever was set most recently.Even in a single-threaded context, the module-level constant is permanently modified after the first call — subsequent calls that rely on the default
limitwill get the last caller's value instead.Fix
Call
.model_copy(deep=True)before mutation so each invocation works on its own independent copy: