fix(memory-wiki): skip prune when configured path is transiently unavailable (#97523)#97527
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 28, 2026, 12:31 PM ET / 16:31 UTC. Summary PR surface: Source +22, Tests +45. Total +67 across 2 files. Reproducibility: yes. source-backed. The linked issue includes a current-main production-function repro, and current main still drops missing configured paths from Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Track scan availability per configured unsafe-local root and prune only entries for roots that were successfully scanned. Do we have a high-confidence way to reproduce the issue? Yes, source-backed. The linked issue includes a current-main production-function repro, and current main still drops missing configured paths from Is this the best way to solve the issue? No. The PR is a plausible single-path mitigation, but the best fix is path-scoped pruning so mixed configured paths do not still lose pages or retain stale ones incorrectly. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 27c1685f106d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +22, Tests +45. Total +67 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Auto-cleanup: freeing PR slots for higher-quality contributions. Feel free to reopen if still relevant. |
What Problem This Solves
In memory-wiki
vaultMode: "unsafe-local", a transiently unavailable configured source path (undocked external drive, NAS rebooting, cloud-synced folder not mounted yet) causes the next wiki sync to delete every imported page for that path AND destroy the user-authored human-notes block inside each page. The loss is permanent: on the next successful sync the page is recreated empty, with no prior content to restore the notes from.Why This Change Was Made
collectUnsafeLocalArtifactstreats a missing path as "zero artifacts collected" (indistinguishable from "all sources deleted"). The sync function then callspruneImportedSourceEntriesunconditionally, which hard-deletes every state entry whosesyncKeyis not inactiveKeys— wiping all imported pages.The fix adds a guard: when zero artifacts are collected AND at least one configured path's parent directory is inaccessible, skip the prune entirely. This preserves imported pages and user-authored human-notes blocks during transient outages. When the parent directory IS accessible (user intentionally removed source files), pruning proceeds normally.
User Impact
Users with
unsafe-localvault mode on removable/network/cloud-synced storage no longer lose imported pages and hand-written notes when the storage is temporarily unavailable.Evidence
pnpm test:extension memory-wikiwhich exercisessyncMemoryWikiUnsafeLocalSourceswith both transient unavailability (new test) and intentional file deletion (existing test)Real behavior proof
pnpm test:extension memory-wikiwhich exercisessyncMemoryWikiUnsafeLocalSourceswith both transient unavailability (new test) and intentional file deletion (existing test)Observed result after fix: All 187 tests pass including the new transient-unavailability test and the existing prune-on-delete test. The guard correctly distinguishes between "parent directory inaccessible" (skip prune) and "file removed from accessible directory" (proceed with prune).
What was not tested: Live NAS/removable-drive unavailability scenario (requires physical hardware). The test simulates this by removing both the source directory and its parent mount point.
AI-assisted (Hermes Agent)