fix(recall): E4.2 跨ns共享兜底补 ghost-ns 判据 — 修复传不存在的 ns 仍经 shared 补充搜泄漏
t_a243aefa 终审在**生产部署后实测**发现:传 ghost ns 仍返回 1 条 channel=shared 记忆 (mem_1793118290141936234, score=0.5 固定值)。根因 = core.go:724 E4.2「结果数 <3 时 补搜 shared」这一段没有 nsHasRows 判据 —— t_15d82af7 只修了 recall.go 的 namespaces 列表和 FTS 尾通道两处,漏了路由层这第三处。 判据与另两处对齐:storage.NamespaceHasRowsFor(与 recall.go 同一个函数,带 60s TTL 缓存)。 ghost ns ⇒ 不补搜;真实 ns ⇒ 行为逐位不变(回归测试 + go test 两包全绿)。
This commit is contained in:
@@ -722,7 +722,12 @@ func (a *API) Recall(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// E4.2: 跨 agent 知识共享 — recall 结果在 (0, top_k) 时,补充搜索 "shared" namespace
|
||||
if len(results) > 0 && len(results) < 3 && req.Namespace != "shared" && req.Namespace != "" {
|
||||
// t_a243aefa 终审补漏(2026-11-07 部署后实测):ghost ns(全表无该 ns 行)时**不得**补搜 shared。
|
||||
// t_15d82af7 已给 coarse search 的 namespaces 列表和 FTS 尾通道加了同口径判据,唯独漏了本处 ⇒
|
||||
// 传不存在的 ns 仍会经 E4.2 捞出 shared 记忆(实测泄漏 mem_1793118290141936234, channel=shared, score=0.5)。
|
||||
// 现与另两处对齐:nsHasRows=false ⇒ 不补搜。判据函数与 recall.go 同一个(带 60s TTL 缓存)。
|
||||
if len(results) > 0 && len(results) < 3 && req.Namespace != "shared" && req.Namespace != "" &&
|
||||
storage.NamespaceHasRowsFor(a.LanceDB, req.Namespace) {
|
||||
vec, encErr := a.Embedder.EncodeQuery(req.Query)
|
||||
if encErr == nil {
|
||||
var shared []models.MemoryRecord
|
||||
|
||||
Reference in New Issue
Block a user