Repository navigation
fix(memory-wiki): exclude vault's own pages from unsafe-local import - #125160
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 10:18 AM ET / 14:18 UTC. ClawSweeper reviewWhat this changesThis PR prevents unsafe-local Memory Wiki imports from re-ingesting pages inside the active vault and copied generated bridge or unsafe-local source pages. Merge readinessKeep open: fetched current main still sends every discovered unsafe-local file directly into the deduped artifact set, while this PR adds the missing pre-persistence eligibility checks and focused regressions. Recorded filesystem before/after evidence supports the fix; exact-head hosted validation must finish cleanly before merge. Likely related people: Vincent Koc (original unsafe-local work), Peter Steinberger (recent Memory Wiki work), and TurboTheTurtle (analogous bridge repair). Priority: P2 Review scores
Verification
How this fits togetherMemory Wiki’s unsafe-local importer scans operator-configured local paths and turns eligible files into generated vault source pages. The resulting source state is used by later status, compile, and import operations, so eligibility must be decided before sync-state writes. flowchart LR
A[Configured local paths] --> B[Unsafe-local importer]
B --> C[Canonical path and generated-page checks]
C --> D[Eligible source artifacts]
D --> E[Source sync state]
E --> F[Generated vault pages]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +26, Tests +68. Total +94 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the two pre-deduplication eligibility checks in the unsafe-local collector, then merge after exact-head validation is clean so the linked bug can close through the PR. Do we have a high-confidence way to reproduce the issue? Yes: the pre-fix collector’s unconditional deduplication is visible in fetched main, and the PR body records a physical mirror-copy cycle that changes from recursive growth to stable imports after the new filters. Is this the best way to solve the issue? Yes: filtering at the collector before deduplication and source-state persistence is the narrow owner-boundary fix; live-vault containment alone would not exclude copied generated pages at a different canonical path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0a6c013be5f5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
4353fb1 to
f827dc1
Compare
f827dc1 to
467c544
Compare
|
Thanks @rajmp999! Proof: With one legitimate source, copying the generated vault into the configured unsafe-local tree made
Example
|
Prevent unsafe-local scans from importing the active vault or copied generated source pages. Reuse canonical containment and the existing generated-page classifier while keeping legitimate files eligible. Closes openclaw#125139. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #125139
What Problem This Solves
In unsafe-local mode, a backup or mirror of the Memory Wiki vault can sit below a configured scan path. The importer treated each copied generated source page as a new source because the copy had a different canonical path. Repeated import and status runs then created nested
unsafe-local-pages without a bound.Why This Change Was Made
The unsafe-local collector owns source eligibility. It now rejects two forms of self-import before deduplication and persistence:
bridge-orunsafe-local-page whose content matches the existing generated-source wrapper contract.The filename gate limits content parsing to names produced by OpenClaw. A legitimate file with the same prefix remains importable unless it also has the complete generated wrapper. Isolated mode has no local import path. Bridge mode keeps its existing canonical vault containment rule.
User Impact
Unsafe-local import and status runs no longer multiply copied generated vault pages. Legitimate files, including ordinary files named with
bridge-orunsafe-local-prefixes, remain eligible.Evidence
Live filesystem and command-registration proof used the same import, mirror-copy, status, mirror-refresh, and import cycle on both revisions:
1505218b3e42(main)467c544a03a9(fixed)The six retained artifacts in the fixed run are the legitimate source plus five ordinary vault scaffold or log files from the copied tree. Their generated source pages stay at six after the mirror refresh. The recursive generated pages are excluded.
Regression proof:
node scripts/run-vitest.mjs extensions/memory-wiki/src: 39 files and 466 tests passed.Hosted CI owns TypeScript type-check and build validation for this host.
This PR was drafted with AI assistance (Claude). The maintainer repair preserved Raj Muppala's authorship and replaced the stale patch with the current-main implementation and proof.