diff --git a/go/internal/api/routes/core.go b/go/internal/api/routes/core.go index 16c1ed6..78ba26d 100644 --- a/go/internal/api/routes/core.go +++ b/go/internal/api/routes/core.go @@ -105,6 +105,7 @@ func (a *API) Commit(w http.ResponseWriter, r *http.Request) { if src == "" && req.Metadata != nil { src = req.Metadata["source"] } + log.Printf("[srcprobe] commit 收到 source=%q(顶层), metadata=%v → 解析后 src=%q", req.Source, req.Metadata, src) // 1. 写入 episode(原始日志,总是写入) epID, err := a.LanceDB.InsertEpisode(req.AgentID, req.Namespace, req.Content, req.Category) diff --git a/go/internal/api/server.go b/go/internal/api/server.go index f3c9ed2..46e5028 100644 --- a/go/internal/api/server.go +++ b/go/internal/api/server.go @@ -209,6 +209,7 @@ func NewServer() http.Handler { Freshness: "fresh", Source: srcOrLLMDistill(input.Source), // 2026-09-26:有笔记出处→"wiki:<路径>";否则沿用 llm_distill(2026-09-07 方案C provenance) } + log.Printf("[srcprobe] 蒸馏落库 episode=%s input.Source=%q → mem.Source=%q", input.EpisodeID, input.Source, mem.Source) if err := ldb.InsertMemory(mem); err != nil { log.Printf("[distill] commit fact failed: %v", err) } diff --git a/go/internal/storage/lancedb_ipc.go b/go/internal/storage/lancedb_ipc.go index d47b8fd..4024b2d 100644 --- a/go/internal/storage/lancedb_ipc.go +++ b/go/internal/storage/lancedb_ipc.go @@ -187,6 +187,9 @@ func (rc *RustLanceDBClient) Search(table string, vector []float32, topK int, na VolatileFlag bool `json:"volatile_flag"` Tier string `json:"tier"` LastRecalledAt string `json:"last_recalled_at"` + // 2026-09-26:出处(笔记路径)—— 此前**解包结构缺该字段** → IPC 主路径 Source 恒空 + // (本地兜底路径有 Source,主路径没有 → recall 永远拿不到出处,链路看似修好实则断在这一环) + Source string `json:"source"` // vector 必须解析:近重复去重(commit near_dup / 蒸馏写入 gate / // admin/dedup 端点)全部依赖 records 携带向量做 cosine 比较。 // 此前缺失该字段 → Vector 恒为空 → 所有 len(Vector)>0 判定失败 → @@ -264,6 +267,7 @@ func (rc *RustLanceDBClient) Search(table string, vector []float32, topK int, na QualityScore: finalQuality, Importance: r.Importance, RecallCount: int(r.RecallCount), VolatileFlag: r.VolatileFlag, Tier: r.Tier, + Source: r.Source, // 2026-09-26:出处透出(缺此行 → recall.source 恒空) Vector: r.Vector, // 去重判据依赖,勿删 }) if len(out) >= topK {