Skip to content

Update Readme - #4

Merged
taranjeet merged 1 commit into
mainfrom
update-readme-2
Jun 20, 2023
Merged

taranjeet merged 1 commit into
mainfrom
update-readme-2

Conversation

@taranjeet

Copy link
Copy Markdown
Member

No description provided.

@taranjeet
taranjeet merged commit 7a47126 into main Jun 20, 2023
@taranjeet
taranjeet deleted the update-readme-2 branch June 20, 2023 11:59
soumil-rathi pushed a commit that referenced this pull request Apr 16, 2026
…hon)

Bugs found and fixed during end-to-end QA testing of the v3 OSS pipeline
across both the TypeScript and Python SDKs. All changes are OSS-side
only; platform client untouched.

## TypeScript fixes (mem0-ts/)

### 1. Entity extractor trailing punctuation (utils/entity_extraction.ts)
End-of-sentence proper nouns retained their trailing period ("Paris."
vs "Paris"), causing cross-batch entity dedup to fail silently —
embeddings of "Paris." and "Paris" don't hit the 0.95 similarity
threshold. Fix: strip trailing sentence punctuation (. , ; ! ?) in
the existing cleanup pass.

### 2. Undefined filter values leak into vector stores (memory/index.ts)
PR #4843's validateAndTrimEntityId refactor spread agent_id: undefined
and run_id: undefined into every getAll/search filter dict. Qdrant
rejected the malformed match (400), pgvector bound NULL (0 rows),
Redis emitted literal "undefined" in TAG filters. Fix: strip
undefined values via Object.fromEntries filter at both call sites.

### 3. Redis TAG filter values unescaped (vector_stores/redis.ts)
Every UUID contains hyphens, which RediSearch interprets as minus
operators. @user_id:{legacy-abc} parses as "legacy AND NOT abc" —
zero matches. Fix: escapeRedisTagValue helper backslash-escapes all
RediSearch TAG special characters.

### 4. Entity cleanup on delete/update/deleteAll (memory/index.ts)
delete(), update(), and deleteAll() never touched the _entities
collection — linkedMemoryIds accumulated stale ids on every mutation.
Search entity-boost then surfaced deleted or rewritten memories. Fix:
new _removeMemoryFromEntityStore and _linkEntitiesForMemory helpers,
wired into deleteMemory and updateMemory. deleteAll gets coverage for
free (loops deleteMemory).

### 5. textLemmatized missing on infer:false path (memory/index.ts)
createMemory() (used by infer:false) set data and hash but never
called lemmatizeForBm25(). Memories added with infer:false had
degraded BM25 — keyword search fell back to raw data. Fix: one-line
addition of textLemmatized to createMemory payload.

## Python fix (mem0/)

### 6. Entity cleanup on delete/update/deleteAll (memory/main.py)
Same bug as TS #4 — _delete_memory and _update_memory never touched
the entity store. Fix: _remove_memory_from_entity_store and
_link_entities_for_memory helpers (sync + async), wired into both
Memory and AsyncMemory. delete_all covered transitively.

## Verification

All changes verified via scratch QA probes against live vector stores:

TS probes (in-memory SQLite, Qdrant, pgvector, Redis):
- Entity cross-batch dedup: Paris entity merges linkedMemoryIds
- Entity boost at search: +67% score delta with vs without entities
- Delete cleanup: stale id removed, ghost entities deleted
- Update cleanup: old entity unlinked, new entity created
- deleteAll: entity store fully cleared
- Legacy data compat: all 4 stores pass (seed v1 record, v3 read/write)
- BM25 contributes real signal on in-memory store
- infer:false: 0 LLM calls, textLemmatized populated, entities skipped
- No-graph: clean separation, legacy config silently ignored

Python probes (Qdrant server):
- Delete/update/deleteAll entity cleanup: all 3 scenarios pass

TS build: clean (552 unit tests pass)
Python tests: 25 + 35 + 173 pass (2 pre-existing failures unrelated)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
oyaah pushed a commit to oyaah/mem0 that referenced this pull request Jun 7, 2026
…hon)

Bugs found and fixed during end-to-end QA testing of the v3 OSS pipeline
across both the TypeScript and Python SDKs. All changes are OSS-side
only; platform client untouched.

## TypeScript fixes (mem0-ts/)

### 1. Entity extractor trailing punctuation (utils/entity_extraction.ts)
End-of-sentence proper nouns retained their trailing period ("Paris."
vs "Paris"), causing cross-batch entity dedup to fail silently —
embeddings of "Paris." and "Paris" don't hit the 0.95 similarity
threshold. Fix: strip trailing sentence punctuation (. , ; ! ?) in
the existing cleanup pass.

### 2. Undefined filter values leak into vector stores (memory/index.ts)
PR mem0ai#4843's validateAndTrimEntityId refactor spread agent_id: undefined
and run_id: undefined into every getAll/search filter dict. Qdrant
rejected the malformed match (400), pgvector bound NULL (0 rows),
Redis emitted literal "undefined" in TAG filters. Fix: strip
undefined values via Object.fromEntries filter at both call sites.

### 3. Redis TAG filter values unescaped (vector_stores/redis.ts)
Every UUID contains hyphens, which RediSearch interprets as minus
operators. @user_id:{legacy-abc} parses as "legacy AND NOT abc" —
zero matches. Fix: escapeRedisTagValue helper backslash-escapes all
RediSearch TAG special characters.

### 4. Entity cleanup on delete/update/deleteAll (memory/index.ts)
delete(), update(), and deleteAll() never touched the _entities
collection — linkedMemoryIds accumulated stale ids on every mutation.
Search entity-boost then surfaced deleted or rewritten memories. Fix:
new _removeMemoryFromEntityStore and _linkEntitiesForMemory helpers,
wired into deleteMemory and updateMemory. deleteAll gets coverage for
free (loops deleteMemory).

### 5. textLemmatized missing on infer:false path (memory/index.ts)
createMemory() (used by infer:false) set data and hash but never
called lemmatizeForBm25(). Memories added with infer:false had
degraded BM25 — keyword search fell back to raw data. Fix: one-line
addition of textLemmatized to createMemory payload.

## Python fix (mem0/)

### 6. Entity cleanup on delete/update/deleteAll (memory/main.py)
Same bug as TS mem0ai#4 — _delete_memory and _update_memory never touched
the entity store. Fix: _remove_memory_from_entity_store and
_link_entities_for_memory helpers (sync + async), wired into both
Memory and AsyncMemory. delete_all covered transitively.

## Verification

All changes verified via scratch QA probes against live vector stores:

TS probes (in-memory SQLite, Qdrant, pgvector, Redis):
- Entity cross-batch dedup: Paris entity merges linkedMemoryIds
- Entity boost at search: +67% score delta with vs without entities
- Delete cleanup: stale id removed, ghost entities deleted
- Update cleanup: old entity unlinked, new entity created
- deleteAll: entity store fully cleared
- Legacy data compat: all 4 stores pass (seed v1 record, v3 read/write)
- BM25 contributes real signal on in-memory store
- infer:false: 0 LLM calls, textLemmatized populated, entities skipped
- No-graph: clean separation, legacy config silently ignored

Python probes (Qdrant server):
- Delete/update/deleteAll entity cleanup: all 3 scenarios pass

TS build: clean (552 unit tests pass)
Python tests: 25 + 35 + 173 pass (2 pre-existing failures unrelated)
cornyum added a commit to cornyum/mem0 that referenced this pull request Aug 16, 2026
内核 review(3 critical / 7 major / 4 minor):
- mem0ai#1 孤儿清扫改为单文档删除 + 宽限期 + 删前水位复核——不再整条
  删除 entry 的已发布版本历史,且不会击中在途发布
- mem0ai#2 _state_flip 每轮 CAS 重读 head:并发 revise 后的 retire/reactivate
  翻转最新状态,不再用陈旧快照回退已发布版本
- mem0ai#3 并发 revise 冲突后重算版本号:确定性 version _id 不再覆盖已发布
  不可变版本(expand 证据链保持有效)
- mem0ai#4 对账校验改为存在且匹配:陈旧 head 从已发布 version 重建;
  事件 state_after 由水位事件推导(不再被陈旧 head 污染)
- mem0ai#5 恢复路径用 version 文档的实际 scope_revision(claim 记录的是预测值)
- mem0ai#6 已发布但 dedup 未落盘的 claim 补 ACTIVE 而非释放(防重复创建)
- mem0ai#7 _get_doc 区分 404 与瞬时故障(防误判触发 claim 接管)
- mem0ai#8 claim 接管围栏:最终 ACTIVE 写入前校验归属;reactivate 尊重 TTL
- mem0ai#9 EmbeddingReconciler 条件向量写入(entry_version_id 围栏,
  防 revise 竞态把旧向量盖章 ready)
- mem0ai#10 purge 物理删除纳入派生重试 + 对账补齐(purged 水位触发清理)
- mem0ai#11 SQL 兜底要求全部通道失败均为 UNAVAILABLE/TIMEOUT/THROTTLED
  (单个 400/401 类失败一票否决,防止配置错误被静默降级)
- mem0ai#12 写者确定性失败时释放自己的 prepared claim(重试立即收敛)
- mem0ai#14 alias 守卫改为别名级(防 v2 切换后双索引绑定)

新增 7 项并发/恢复回归测试(stale-head 翻转、双修订版本链、孤儿宽限、
陈旧 head 重建、条件向量、活 claim 补齐、兜底一票否决)
修复 FakeES NotFoundError 构造缺 body(此前被全捕获掩盖)
E2E 复验: ONLY_VDB 36/36;全套件 820 通过
cornyum added a commit to cornyum/mem0 that referenced this pull request Aug 16, 2026
…1 minor)

- mem0ai#1(CRITICAL) 迁移 backfill 改 search_after 分页扫描——不再静默截断
  1000 行上限(防永久数据丢失)
- mem0ai#2 迁移对账改为强断言:五索引 refresh + track_total_hits 计数,
  scope/head/version/active-dedup 数量不一致即 ok=false
- mem0ai#3 HYBRID 下 ES 探针非阻塞——ES 故障 → degraded(SQL FTS 继续服务,
  §10 表格语义),ONLY_VDB 保持 not_ready
- mem0ai#4 /configure 构建成功后才提交 _current_config(防幻影配置)
- mem0ai#5 legacy get_all 过期过滤改为日期比较(未来过期日不再隐藏记忆)
- mem0ai#6 metadata/expiration-only revise 不再被 noop 吞掉;支持清除过期
  (clear_expires_at 语义贯通 adapter→service→write)
- mem0ai#7 legacy /search 元数据过滤改为真过滤(不再伪造命中 metadata)
- mem0ai#8 vector_store shim 补全 serialize 契约(expiration_date/categories)
  + after_id 键集分页(/export 超 500 行不再截断)
- mem0ai#9 MCP 中间件仅凭证解析在错误作用域内(传输/工具错误不再伪装 401)
- mem0ai#10 挂载式 /mcp 同样套 McpAuthMiddleware(宿主收养 lifespan 时不再
  暴露无鉴权服务级 API)
- mem0ai#11 custom_instructions/分类体系/legacy prompt 真正贯通到抽取 LLM
- mem0ai#12 /configure 拓扑拒绝 → 400(不再 500)
- mem0ai#13 EntryNotActiveError(409) 替代裸 ContextError(500)
- mem0ai#14 legacy add 的 updated 收敛映射为 event=UPDATE
- mem0ai#15 content_hash/expires_at 补入 head/recall 输出(hash 不再恒 null)
- mem0ai#16 MCP expand 空范围防护 + 单条目工具暴露完整 scope 字段
- mem0ai#17 /metrics 加鉴权(admin/内网语义 §7.6.2)
- mem0ai#18 Sunset 头改为 RFC 8594 日期
- mem0ai#19 overrides 读失败跳过持久化(不再清空已存配置)
- mem0ai#20 backfill 单行容错+失败清单、CAS 单次取 scope、消除 O(n²) 辅助
- mem0ai#21 legacy delete_all 循环分页(不再 5000 静默截断)
- mem0ai#22 admin migrate 改后台任务 + job 轮询端点

新增 5 项 legacy 契约回归测试;全套件 825 通过;ONLY_VDB e2e 复验 36/36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant