Skip to content

fix(recall): 遗忘继任者不再让被取代的旧值回潮(#532 存储层半边) - #681

Open
modusensus wants to merge 4 commits into
mainfrom
fix/532-forget-stale-facts
Open

modusensus wants to merge 4 commits into
mainfrom
fix/532-forget-stale-facts

Conversation

@modusensus

Copy link
Copy Markdown
Member

Refs #532(只修存储层半边;§3 的 B/C 仍需 LLM 判断进写路径,未包含在本 PR)。

背景

#532 主楼:更正两个事实、只忘一个,保留的那个答回更正前的旧值。docs/FORGET.md 的定案把根因拆成三段接缝,其中第二、三段的交互有一个确定性缺陷:#650 给 supersededIds() 加的守卫把「继任者归档、遗忘、删除」统一当成「继任者退场」,于是继任者一旦被遗忘,被它取代的旧行就重新回到注入面——而 memory_forget 的语义恰恰是「我不要再记得这个内容」,让用户明确抛弃的旧答案借继任者的退场回潮。

改了什么

  • 遗忘 ≠ 版本失效:supersededIds() 只要求继任者 archived = 0,去掉 forgotten = 0。旧行仍留在 suppressed 集合里、注入面不选它,但显式搜索照旧读得到(fuseRecall 只降权 0.5,不是沉默的不可逆失效)。
  • 归档维持 feat(recall): 取代链检索降权 + 矛盾感知(#641 beta 第三阶段续) #650 原语义:继任者被归档 → 旧行恢复可见(归档是整理面退场、可恢复、且常是合并落点)。回归锁防止这条修正顺手改掉它。
  • memory_forget 回执报连带面:新增只读 store.supersedeContext(id)({ supersededBy, predecessors })经 service 透传;抑制一行时若它取代过 N 条更早的记忆,回执明写「它们保持隐藏(显式搜索仍可达)、不应被当成当前值」。恢复与无链行不渲染那句话。
  • 工具层对缺 supersedeContext 的旧装配/测试替身降级为「无链信息」——回执增强不否决遗忘本身。

验证

  • 全量 npm test:0 fail(合并最新 main 后重跑)。
  • check-sync:124 文件一致。
  • 新增回归 7 条:遗忘继任者旧行保持抑制且不入注入面 / 显式搜索仍可达 / 恢复继任者后仍抑制 / 归档继任者按 feat(recall): 取代链检索降权 + 矛盾感知(#641 beta 第三阶段续) #650 恢复 / 回执报连带面且恢复时不报 / supersedeContext 空行返回 null 与计数 / 旧装配缺方法时回执降级且遗忘照常完成。
  • 变异自证 5 例全部变红(加回 forgotten = 0 / 去掉 archived = 0 / 回执计数恒 0 / 恢复也报连带面 / 删工具层 typeof 守卫)。
  • 已过 euthyna 变更面审计:0 TRUE POSITIVE。被删的 forgotten = 0 来自修复提交 66a88c5be1,按红线以最高风险审过:它不是鉴权/边界校验,改动有原始现象支撑、有回归锁与文档。

明确没修的部分(别读成闭环)

  • 没有取代链的库(dream/sleep 未运行或 conflictLedgerMode 关着)里,memory_forget 依旧行粒度,docs/FORGET.md §4 合成轨迹的「旧值幸存」断言依旧成立。
  • 物理删除继任者后链自然失效(supersededIds 是 INNER JOIN),旧值仍会回潮;该边界已写进注释与文档 §5,是否改口径待定。
  • 写侧自动识别「同主题改值」需要 LLM 判断进热路径,按 R2/R3 暂停等排期。

Copilot AI lite review requested due to automatic review settings November 12, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d07260a and 56da870.

Files selected for processing: 9

  • dsh-mneme/CHANGELOG.md
  • dsh-mneme/docs/FORGET.md
  • dsh-mneme/lib/service.js
  • dsh-mneme/lib/store.js
  • dsh-mneme/lib/tools.js
  • dsh-mneme/src/service.js
  • dsh-mneme/src/store.js
  • dsh-mneme/src/tools.js
  • dsh-mneme/test/forget-supersede-chain.test.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI lite review requested due to automatic review settings November 13, 2026 02:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

2 participants