Skip to content

fix(memory): forgotten facts survive in consolidation history - #131248

Merged
steipete merged 2 commits into
mainfrom
codex/why-simplify-memory-diary-20260827
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/why-simplify-memory-diary-20260827

Conversation

@steipete

@steipete steipete commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #131179

What Problem This Solves

Fixes an issue where users forgetting a source session could still find its old and replacement facts in generated dream-diary consolidation history. Rotating the retained memory backups could also discard the provenance needed to identify diary-only copies. Historical quoted session references could cause the scrubber to remove an unrelated following diary row.

Why This Change Was Made

Consolidation now derives its bounded history excerpts directly from the validated operations and attaches the replacement entry's existing unioned lineage. The ordinary memory scrubber can then remove those excerpts without reconstructing attribution from a textual diff. The existing provenance collector retains keys referenced by either supported diary filename, as it already does for live entries, backups, and indexed snapshots.

Historical excerpts without reliable attribution remain untouched and are reported through the existing refusals field for manual review. Exact source quotations and explicit session references remain eligible for deletion; list-row boundaries prevent a selected reference from consuming its unrelated peer. This builds on the already merged #131179 without duplicating its backup/index work. There is no new SQLite schema or configuration surface.

User Impact

Forgetting a session removes newly generated consolidation excerpts, including superseded facts, while preserving unrelated diary content. Preview and apply report recognizable untraceable historical highlights instead of claiming complete deletion. Diary provenance remains for as long as the corresponding excerpts remain; long histories can therefore retain growing origin sets.

Evidence

The pre-fix regressions reproduce retained merged/superseded diary facts and deletion of an unrelated following historical row. The final owner/sibling matrix passes 104 tests across five files. A fresh isolated Codex autoreview reports no findings at its P0-only threshold; independent owner review found no remaining actionable issue.

Production LOC: +49/−51, net −2. Tests: +229/−162, net +67. Docs: +16/−4. The generic textual-diff highlight path is removed in favor of the validated consolidation operations.

The patch was ported onto main 0706f629c3b550f285d70767f9b869fa7ae5bb4c; all 34,391 tracked blobs and modes match the frozen candidate manifest at head 3952df5499f48ec84b130ca03b30597ef33bdc24.

The first exact-source Linux proof passed: run 33124783681 reproduced the defect through two actual CLI calls on baseline 0706f629 and passed seven CLI calls at 9c30a622, including both diary filename cases, backup rotation, cold repeat, and the human warning. No live model or channel is claimed; canonical owners seed isolated synthetic state using a fixed valid consolidation response. The lease is stopped.

CI then caught two file-size limits, a regex spelling issue, and redundant test-string concatenation. The follow-up reuses one retained-ingestion calculation for both counts and persistence, removes duplicated test setup without dropping any cases or assertions, and fixes the spelling issues. All 104 tests and fresh P0 autoreview passed again. Final exact-commit CLI proof also passed at 3952df5499f48ec84b130ca03b30597ef33bdc24: run 33125682225, Blacksmith Testbox tbx_01m12r59yqxvx6kg12sxm1ssbx. Its own frozen install/build and all seven CLI calls passed. All 34,391 source blobs/modes matched before and after; the lease is stopped/completed. Workflow dispatch used main 7838302658d5b2a79660fb36d7e86b54bbfc26e6, distinct from the synchronized and tested candidate commit. Exact-head CI 33125643610 and openclaw/ci-gate passed, with no pending or failed checks. Local typed lint encountered pre-existing stale shared dependency declarations before linting this patch; no worktree dependency reconciliation was attempted.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete steipete self-assigned this Aug 27, 2026
@steipete
steipete merged commit 0fdae63 into main Aug 27, 2026
173 checks passed
@steipete
steipete deleted the codex/why-simplify-memory-diary-20260827 branch August 27, 2026 23:28
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…aw#131248)

* fix(memory): forgotten facts survive in consolidation history

* refactor(memory): share purge planning and consolidation fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant