[BugFix] Scope divergent hybrid cache hits to capable connectors (#50344)

Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai>
Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Yifan Qiao
2026-08-09 15:38:13 -07:00
committed by GitHub
co-authored by OpenAI Codex
parent 83ad767eed
commit d6941300fc
8 changed files with 130 additions and 27 deletions
+8
View File
@@ -363,6 +363,7 @@ class MockKVConfig:
matched_tokens: int = 0
is_async: bool = False
num_defers_before_matching: int = 0
supports_divergent_local_hybrid_hits: bool = False
class MockKVConnectorMetadata(KVConnectorMetadata):
@@ -388,11 +389,18 @@ class MockKVConnector(KVConnectorBase_V1):
num_defers_before_matching=extra_config.get(
"num_defers_before_matching", 0
),
supports_divergent_local_hybrid_hits=extra_config.get(
"supports_divergent_local_hybrid_hits", False
),
)
self._defers_left: defaultdict[str, int] = defaultdict(
lambda: self.config.num_defers_before_matching
)
@property
def supports_divergent_local_hybrid_hits(self) -> bool:
return self.config.supports_divergent_local_hybrid_hits
def get_num_new_matched_tokens(
self,
request: Request,