Commit Graph
5 Commits
Author SHA1 Message Date
小唯 1060e62066 fix(admin): /memories 与 /memories/export 改用全表扫描(Scan),弃零向量 ANN
病根:两个列表/导出端点一直用『零向量 ANN』冒充『列出全部』——零向量没有方向,
ANN 退化成本存储序前 N 行,再按 ns 客户端过滤 ⇒ 计数完全失真
(实测 export hermes-main 报 1 条,真实 139+;shared 报 0,真实 29)。

修复:
① Rust lancedb_ops: scan_for_forgetting 加 namespace 下推(only_if),limit 作用于过滤后结果集
② Go 接口 LanceDB 新增 Scan(limit, ns):
   - RustLanceDBClient → lancedb_scan RPC
   - SQLiteClient → SELECT ... WHERE is_deleted=0 [AND ns] ORDER BY created_at DESC LIMIT
   - MemLanceClient → 内存 map 过滤 + created_at 倒序
③ 两个端点 ListMemories / ExportMemoriesMD 改用 aa.LanceDB.Scan(limit, ns)
④ 补 mock(zz_commit mockLance / write-buffer fakeLDB)+ 5 条新判据
   (全表 3 / hermes-main 2 / shared 1 / limit 生效 / 不存在 ns 0)
2026-09-21 16:36:41 +08:00
小唯 6e67f3e33f fix(storage): fix all no-op/fake implementations in LanceDB interfaces
- IncrementUseful/IncrementNotUseful now return error and persist via
  rc.Update() (Rust sidecar); all 4 implementations updated
- SoftDeleteBatch now delegates to SoftDelete() for real LanceDB write
- UpdateMemoryContent now persists content + version + version history
- Backup changed from return nil to explicit error (Rust sidecar unsupported)
- IncrementUseful/IncrementNotUseful signatures now include error return;
  all 3 call sites (feedback.go, core.go) check the error
- Test mocks (mockLance, fakeLDB) updated to match new interface

Fixes the 'silent no-op' class of bugs discovered during dedup repair.
2026-09-20 09:53:00 +08:00
小唯 ee50ef0d59 fix(rust): 恢复缺失的 LanceDBStats/stats() 和 helper 函数 (t_3fb41049); storage: 添加软删除累积延迟缓冲 (t_384f785b) 2026-09-14 22:14:52 +08:00
xiaowei e6b1e0417c fix(forgetting): P1 防风暴 - 限长/分桶/抽样下推/decay分批
febc2c9 全表扫描 O(n²) 风暴的根治防护(生产基线 ba44e20+ 之上,不含 febc2c9 扫描代码):

1. mergeSimilar 按 category 分桶 + 单桶 maxMergePerBucket=500 截断
   - 原双层循环全量 O(n²),全表时触发 620% CPU
   - 分桶后 O(Σ桶²) << O(n²),语义不变(原 catI!=catJ continue 等价分桶)
2. scanConflicts 显式 created_at 倒序取最近 500 条
   - 原注释'最近100条'实际全量 O(n·50)
3. checkTimestampSanity 先截断 maxSanitySample=1000 再均匀抽样
   - 原全量拉取仅为 5% 抽样
4. decay 每 tick 限量 maxDecayBatch=2000,按最久未访问优先
5. 存储层输出契约统一 RFC3339 string + 补 category/created_at
   - lancedb_ipc: last_recalled_at 此前直接放 time.Time → server.go .(string)
     断言恒失败 → lastAccessed 永远默认30天前 → 遗忘判定失真(本 bug + 数据
     年龄未到 = 遗忘从不触发的双根因之一)
   - sqlite: 补 category/created_at + LIMIT 100→200(对齐 lancedb 契约)
   - 新增 memoryTimeVal/fmtTimeRFC3339 helper 兼容多类型

测试: go build ./... 全绿;gofmt 仅历史文件遗留(未全文件重排,保持最小 diff)
2026-09-06 00:56:06 +08:00
xiaowei 2a350cf781 fix(distill): max_tokens 800→1200 — Agnes推理token预算不足
Agnes 2.0-flash是推理模型,推理token占大量预算。
800仍不够→JSON截断(parse error: unexpected end of JSON input)。
1200确保推理+正文都够用。
2026-08-20 01:13:06 +08:00