Repository navigation
fix(memory): forgotten facts survive in consolidation history - #131248
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
refusalsfield 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 head3952df5499f48ec84b130ca03b30597ef33bdc24.The first exact-source Linux proof passed: run 33124783681 reproduced the defect through two actual CLI calls on baseline
0706f629and passed seven CLI calls at9c30a622, 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 Testboxtbx_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 main7838302658d5b2a79660fb36d7e86b54bbfc26e6, distinct from the synchronized and tested candidate commit. Exact-head CI 33125643610 andopenclaw/ci-gatepassed, 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.