Repository navigation
fix(memory-wiki): filter self-referential artifacts from bridge import to prevent recursive loop (fixes #95657) (AI-assisted) - #95663
Conversation
…t to prevent recursive loop When the wiki vault lives inside the workspace memory/ directory, the memory indexer picks up bridge-generated source files and re-imports them, creating unbounded recursive growth. Filter artifacts whose absolute path starts with the wiki vault's own sources/ directory before passing them to collectBridgeArtifacts. Fixes openclaw#95657
|
Codex review: needs real behavior proof before merge. Reviewed June 22, 2026, 12:41 AM ET / 04:41 UTC. Summary PR surface: Source +6, Tests +62. Total +68 across 2 files. Reproducibility: yes. Source inspection shows current main and v2026.6.9 recursively publish Markdown under Review metrics: none identified. 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: Land one canonical bridge-side self-source filter using the existing artifact-key path contract, with a focused regression test and redacted real bridge-import proof; track broader memory-indexer exclusion only if live DB growth persists. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main and v2026.6.9 recursively publish Markdown under Is this the best way to solve the issue? No as submitted. The bridge importer is the right boundary for the central loop, but the filter should use the existing canonical Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3ff59df960cf. Label changesLabel justifications:
Evidence reviewedPR surface: Source +6, Tests +62. Total +68 across 2 files. View PR surface stats
Acceptance criteria:
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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by upstream fix. The Closing as superseded. |
|
Closing — upstream already handles self-import filtering in |
What Problem This Solves
When
memory-wikiis configured inbridgemode with the vault inside the workspacememory/directory (the default location), the memory indexer recursively scansmemory/wiki/sources/as regular memory files. The bridge import then re-imports those same files as wiki source artifacts, creating a recursive self-referential loop that causes unbounded growth ofmemory/wiki/sources/and the SQLite memory index database.Reported impact: DB grew to 1.5 GB in ~2 months (82% duplicates), 44K chunks vs 13K needed (3.3x overhead), 45 MB duplicate files on disk.
Why This Change Was Made
The bridge import in
syncMemoryWikiBridgeSourcespasses all public memory artifacts tocollectBridgeArtifactswithout checking whether an artifact originates from the wiki vault's ownsources/directory. When the vault path is insidememory/, bridge-generated source pages get indexed as memory artifacts on the next scan, then re-imported as new bridge pages — a classic recursive loop.The fix adds a path-based filter that excludes any artifact whose resolved absolute path starts with the wiki vault's
sources/directory. This is the minimal, surgical change that directly addresses the cycle.User Impact
memory/Evidence
Behavior addressed: Bridge import re-imports artifacts from the wiki vault's own
sources/directory, causing recursive loop and unbounded DB growthEnvironment tested: macOS 26.4.1, Node v22.19, OpenClaw 2026.5.28
Steps run after the patch: Ran
node scripts/run-vitest.mjs run extensions/memory-wiki/src/bridge.test.tsincluding the new regression testfilters out artifacts from the wiki vault sources directory to prevent self-import loopsEvidence after fix:
Observed result after fix: All 12 bridge tests pass. The new test verifies that an artifact whose path is inside the vault's
sources/directory is filtered out (artifactCount=1, only the external artifact imported).What was not tested: Live memory-wiki bridge with real vault on disk — the fix is a path-based filter in
syncMemoryWikiBridgeSources, verified through the production function exercised via test suite.AI-assisted (Hermes Agent)
Real behavior proof
sources/directorynode scripts/run-vitest.mjs run extensions/memory-wiki/src/bridge.test.tswhich includes a new testfilters out artifacts from the wiki vault sources directory to prevent self-import loopssources/directory is filtered out (artifactCount=1, only the external artifact imported).