Repository navigation
fix(memory): restore member snapshots from the 0.7.0 pre-release layout - #16253
Conversation
0.7.0-insider.1 to .5 wrote member snapshot manifests and pending-restore journals that name the owner as owner_member (an alias), and a memory.db with no member_database row. Old backups were refused, and a restore staged before the upgrade could be neither activated nor cancelled. The alias is read back through the store upgrade's attribution, and the old database is checked against its own stamps. A pre-identity copy is completed in its stage and given a current-layout manifest before live memory is touched: at staging for an old snapshot, and at activation, before the live tree moves aside, for a restore the old build staged. That one is completed on a fresh copy of its stage that an atomic journal rewrite switches to, so a completion that fails or is interrupted leaves the old stage matching its own manifest: live memory stays in place and the restore can be retried or cancelled. Only a tree the old build itself activated is completed in place. Both legacy database helpers use the FTS5-capable driver, and cancelling over an unreadable live database is a clean refusal. The memory-skills-hooks spec records the decisions.
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Alias is the only ownership proof for legacy bundles — confirm an alias rebound to a different member since 0.7.0 cannot pass [DESIGN-REVIEWED] 9601344 Description read[DESCRIPTION-READ] fd7a8feec806764d72c7d2c44b4a41caaee75aae2cd50e074ba2a99b4fe18a7a That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the manifest/journal shape the tests fabricate against a real 0.7.0-insider backup zip — the author checked only "against those tags." Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: let a member memory snapshot or pending restore written by 0.7.0-insider.1–.5 be restored, activated or cancelled after upgrading — a FIX (the new tests fail on base, and the pre-identity layout is already pinned in-repo by #12103's store upgrade).
[FIRST-PRINCIPLES-REVIEWED] 9601344 Description read[DESCRIPTION-READ] 59056d0f9c0caed882ee3dc46b369d0ab405d040d16d67462fad8ca204cd2b28 That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Companion PR for the same 0.7.0 pre-release range (member task records and schedules): #16269. The two PRs share no code and can merge in either order. |
Problem / Motivation
Goal: A crew member's memory snapshot or pending restore from 0.7.0-insider.1 to .5 can still be restored or cancelled after the upgrade.
Those pre-release builds wrote member snapshot manifests and pending-restore journals that name the owner as
owner_member, the member's alias. They also wrote amemory.dbwith nomember_databaserow. Today's build refuses all of it. An old backup cannot be restored, and a restore the old build staged before the upgrade can be neither activated nor cancelled. The next gateway start reports it as an ownership mismatch, and it stays that way.Why it matters
A member snapshot is the operator's recovery point for that member's memory. Anyone who backed up a member on a 0.7.0 pre-release loses that recovery point on upgrade. Anyone who requested a restore just before upgrading is left with a pending restore they cannot finish or withdraw.
Not a goal
lessons.jsonlandmemory/history/<date>.mdintomemory.db. They are carried into the restored tree but not read, as the spec records.fix/memory-v2-upgrade-compat), and the two share no code.What changed (motivation → approach → change)
The old files carry enough to identify the owner. The alias resolves through the attribution that the start-of-process store upgrade (#12103) already made. In
member_memory_backup.py, a pre-identity manifest or journal belongs to the member only when the store record'sowner_memberis that alias and the member under that alias is bound to the store and carriesowner_member_id. Its legacy file names are accepted only inside a manifest of that layout. Its database must pass the integrity check, carry this store'sstore_namestamp, and name no other store or member.The copy is completed before live memory is touched, so a failure never leaves the live tree replaced by an unfinished one. An old snapshot is completed in its stage and staged in the current layout. A restore the old build staged is completed on a fresh copy of its stage. An atomic journal rewrite then switches to that copy, so a failure or crash before the switch leaves the old stage matching its own checksums, and the next start retries. Only a tree the old build itself activated is completed in place.
In
memory_stores.py, the store upgrade's directory completion becomescomplete_legacy_member_directory, shared with restore. Both legacy SQLite helpers now use_sqlite_compat, the FTS5-capable driver. Cancelling over an unreadable live database is now aValueErrorthat keeps the journal.Backwards compatibility
Compatible: every manifest and journal main accepts takes the same path. Only the pre-identity layout, which main refuses, is newly read.
Removes nothing: no file, key, row or public function is removed.
migrate_legacy_member_storescalls the extracted helper with the same steps in the same order.Tests
test/test_member_memory_backup_legacy.pybuilds the pre-identity layout directly:Manual verification
N/A: the tests build the manifest, journal and database shapes of 0.7.0-insider.1 to .5 (checked against those tags) and run the real staging, activation and cancel paths.
Related Issues
Follow-up to #12103, which upgraded pre-identity member stores.
Pattern harvest
Not generalizable: this is a one-time reader for one pre-release layout, keyed on that layout's
owner_memberfield.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)memory-skills-hooksspec