Repository navigation
fix(memory): skip memory-wiki vault subtree in workspace memory scan (#95657) - #95670
hansraj316 wants to merge 1 commit into
Conversation
…penclaw#95657) A bridge-mode wiki vault placed inside workspace memory/ (the default layout) had its bridge-generated sources/ pages picked up by the recursive memory scan. Both consumers of that scan -- the lancedb embedding indexer and the wiki bridge import -- then re-ingested the wiki's own output, an unbounded self-import loop that bloated the SQLite index. Detect a vault by its .openclaw-wiki marker and skip the whole subtree during the scan, breaking the cycle at its source.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d9a32f48c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (entries.some((entry) => entry.isDirectory() && entry.name === WIKI_VAULT_MARKER)) { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
Skip wiki vaults in the indexer scan too
In the bridge-mode nested vault case, this skip only affects listMemoryHostPublicArtifacts, but the memory-core embedding indexer still discovers files via listMemoryFiles (packages/memory-host-sdk/src/host/internal.ts:139-146) and syncMemoryFiles calls that scanner (extensions/memory-core/src/memory/manager-sync-ops.ts:1789-1793). That walker still descends every directory except .openclaw-repair, so memory/wiki/sources/*.md remains indexed and the SQLite growth loop can continue even though bridge import no longer sees those artifacts. Please share the vault-skip predicate with the indexer scan as well.
Useful? React with 👍 / 👎.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: the merged bridge-side fix now owns the linked self-import loop, and this branch is a partial SDK-only duplicate that would leave the package SQLite indexer scanner unchanged. Canonical path: Keep the merged bridge-side fix as canonical; handle any separate desire to exclude wiki vaults from SQLite memory indexing as a focused scanner-wide follow-up. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Keep the merged bridge-side fix as canonical; handle any separate desire to exclude wiki vaults from SQLite memory indexing as a focused scanner-wide follow-up. Do we have a high-confidence way to reproduce the issue? Yes from source for the scanner split: current main and this PR separate the SDK public-artifact walker from package Is this the best way to solve the issue? No. The merged bridge-side PR is the canonical fix for the self-import loop, while this branch is only a partial SDK scanner change and does not cover the package-level indexer path. Security review: Security review cleared: The diff only changes TypeScript filesystem scanning logic and a colocated unit test; it does not touch dependencies, workflows, secrets, downloads, or package execution surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 96c8338d5bfa. |
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
Fixes #95657. With
memory-wikiinbridgemode and the vault inside the workspacememory/directory (the default layout), the recursive memory scan picked up the wiki's own bridge-generatedsources/*.mdpages as if they were user memory. Both consumers of that scan — the lancedb embedding indexer and the wiki bridge import — then re-ingested the wiki's own output, an unbounded self-import loop. Reporter saw the SQLite index grow to 1.5 GB in ~2 months (82% bridge duplicates), regenerating within hours of manual cleanup.Why This Change Was Made
bridge.indexMemoryRoot: falseonly covers memory-root files, not the wiki vault subtree. Rather than plumb the vault path into the core scanner, the scan now detects a wiki vault generically by its.openclaw-wikimarker directory and skips that whole subtree. This breaks the cycle at its source — wiki sources are never exposed as memory artifacts, so neither the indexer nor the bridge re-ingests them — regardless of where the vault is placed insidememory/.User Impact
No more unbounded SQLite growth or duplicate
bridge-workspace-<id>-*regeneration for bridge-mode wikis nested undermemory/. No config change; the fix is automatic on next index. Purely removes waste — no user data is dropped.Evidence
src/plugin-sdk/memory-host-core.ts:listMarkdownFilesRecursivereturns early on a.openclaw-wikimarker; bothlistMemoryHostPublicArtifacts(indexer) andlistActiveMemoryPublicArtifacts(bridge) funnel through it.src/plugin-sdk/memory-host-core.test.tsasserts a vault nested undermemory/wikiis skipped while sibling real notes are still indexed.pnpm test src/plugin-sdk/memory-host-core.test.ts✅ (5 passed).