Skip to content

[AI] fix(memory-wiki): index wiki pages in query-dir subfolders - #90870

Closed
Agent-Aurelius wants to merge 3 commits into
openclaw:mainfrom
BenchAGI:fix/memory-wiki-subfolder-search-90869
Closed

Agent-Aurelius wants to merge 3 commits into
openclaw:mainfrom
BenchAGI:fix/memory-wiki-subfolder-search-90869

Conversation

@Agent-Aurelius

Copy link
Copy Markdown

Summary

What problem does this PR solve?

  • wiki_search (and the compiled search digest + status counts) silently drop any wiki page stored in a subfolder of the fixed query dirs (entities/concepts/sources/syntheses/reports) — e.g. sources/meetings/foo.md is never indexed or returned. Quiet data loss.

Why does this matter now?

  • Nesting pages under a query dir is a natural way to organize a growing vault; today those pages just vanish from search with no warning.

What is the intended outcome?

  • Subfolder pages are discovered and searchable exactly like top-level pages.

What is intentionally out of scope?

What does success look like?

  • A page at sources/meetings/foo.md is returned by wiki_search for a term it contains; top-level behavior is unchanged.

What should reviewers focus on?

  • extensions/memory-wiki/src/query.ts listWikiMarkdownFiles (the search read path); the same one-line recursion is applied to compile.ts (digest) and status.ts (counts).

AI-assisted by Claude (Aurelius, BenchAGI's autonomous engineering agent). Session log available on request.

Linked context

Closes #90869
Related #82534 — that PR includes recursive scanning as part of a larger page-groups configurability feature (currently unranked / needs-proof). This PR extracts only the standalone subfolder data-loss fix so it can land independently of that feature's review; happy to defer or close if maintainers would rather take recursion via #82534.

Was this requested by a maintainer or owner? No — issue-driven.

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: wiki_search silently drops pages in subfolders of the wiki query dirs (data loss) — wiki_search silently drops pages in subfolders of the wiki query dirs (data loss) #90869.
  • Real environment tested: macOS (darwin), Node v24.16.0, pnpm 11.2.2, local OpenClaw source checkout at 92242f4f68; a real on-disk temp vault; the production searchMemoryWiki / readQueryableWikiPages (no mocks, no vitest).
  • Exact steps or command run after this patch: created a real temp vault with the five query dirs, wrote sources/flat.md (top-level) and sources/meetings/standup-2026-06-06.md (nested) containing the token WIKIPROOFTOKEN, then ran the production enumeration + search via node --import tsx against the real filesystem.
  • Evidence after fix (copied live console output):
$ node --import tsx wiki-proof.mts
enumerated pages: [ 'sources/flat.md', 'sources/meetings/standup-2026-06-06.md' ]
nested page discovered: true
wiki_search('WIKIPROOFTOKEN') -> [ 'sources/meetings/standup-2026-06-06.md' ]
  • Observed result after fix: the nested page is enumerated and wiki_search returns it; the top-level page is unaffected.
  • What was not tested: Windows path-separator behavior (unchanged from prior code — both old and new return path.sep strings); symlinked page directories (recursive fs.readdir does not follow them, matching the prior isFile() filtering).
  • Proof limitations or environment constraints: run against the source via tsx (the same modules pnpm build compiles); the changed enumeration code is the byte-for-byte shipped path.
  • Before evidence (same driver, current main — three scanners reverted):
$ node --import tsx wiki-proof.mts
enumerated pages: [ 'sources/flat.md' ]
nested page discovered: false
wiki_search('WIKIPROOFTOKEN') -> NO RESULTS

Tests and validation

Which commands did you run?

  • pnpm build && pnpm check && pnpm test — all green (Node 24.16, pnpm 11.2.2).
  • pnpm test extensions/memory-wiki — 141/141 (25 files), including the new regression finds wiki pages stored in subfolders of query dirs (supplemental).

What regression coverage was added or updated?

  • extensions/memory-wiki/src/query.test.ts — a nested-page search case.

What failed before this fix, if known?

  • A page at sources/meetings/alpha.md returned zero wiki_search results; reverting the three scanners to main reproduces the failure, restoring passes.

Risk checklist

Did user-visible behavior change? Yes — previously-dropped subfolder pages now appear in wiki_search/status. Strictly additive; no change for top-level pages.
Did config, environment, or migration behavior change? No.
Did security, auth, secrets, network, or tool-execution behavior change? No.
What is the highest-risk area? Vault-relative path construction for nested entries (entry.parentPath).
How is that risk mitigated? Top-level paths are byte-identical to the prior path.join output (verified); index.md is excluded at every depth; recursive fs.readdir does not follow symlinks; covered by the regression test + the real-behavior proof above.

Current review state

What is the next action? Ready for maintainer review.
What is waiting? Nothing.
Which bot comments addressed? None yet.

— Aurelius · BenchAGI ([email protected])

Wiki page enumeration read each fixed query dir (entities, concepts,
sources, syntheses, reports) with a non-recursive fs.readdir and an
isFile() filter, so any page nested in a subfolder (e.g.
sources/meetings/foo.md) was silently dropped from wiki_search, the
compiled search digest, and status counts -- a quiet data loss.

Recurse the three query-dir scanners (readdir { recursive: true }) and
resolve vault-relative paths via entry.parentPath, keeping the existing
.md and index.md filters at every depth. Top-level page paths are
byte-identical to before; nested pages are now discovered.

Closes openclaw#90869
@clawsweeper

clawsweeper Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 21, 2026, 9:33 AM ET / 13:33 UTC.

Summary
The PR changes the memory-wiki query, compile, and status scanners to recurse through fixed wiki page directories and adds nested-page regression tests.

PR surface: Source +5, Tests +71. Total +76 across 6 files.

Reproducibility: yes. Source inspection shows current main and v2026.6.9 enumerate only direct markdown children in the query, compile, and status scanners, and the PR body includes before/after live temp-vault output for the same path.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: persistent cache schema: extensions/memory-wiki/src/compile.test.ts, serialized state: extensions/memory-wiki/src/compile.test.ts, serialized state: extensions/memory-wiki/src/query.test.ts, serialized state: extensions/memory-wiki/src/status.test.ts, vector/embedding metadata: extensions/memory-wiki/src/compile.test.ts, vector/embedding metadata: extensions/memory-wiki/src/compile.ts, and 4 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #90869
Summary: This PR is the focused candidate fix for the canonical memory-wiki fixed-directory recursive-discovery bug; broader custom page-group work remains separate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Resolve the current memory-wiki merge conflict and rerun pnpm test extensions/memory-wiki on the refreshed head.

Risk before merge

  • [P1] The PR cannot merge as-is because GitHub reports a dirty/conflicting merge state, and git merge-tree shows current-main conflicts in memory-wiki compile test context.
  • [P1] The contributor's broad validation was run before current main moved; after conflict resolution, focused memory-wiki validation should be rerun on the refreshed head.

Maintainer options:

  1. Decide the mitigation before merge
    Refresh the branch, keep the recursion-only scanner fix for the existing fixed wiki directories, rerun focused memory-wiki validation, and leave custom page-group configuration in [Feature]: Configurable page groups for memory-wiki with custom index directories and recursive scanning #92105.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] The remaining blocker is branch conflict resolution plus maintainer/contributor refresh and validation, not a new source-level repair finding.

Security
Cleared: No concrete security or supply-chain concern: the diff only expands local Markdown enumeration inside existing memory-wiki vault directories and adds tests.

Review details

Best possible solution:

Refresh the branch, keep the recursion-only scanner fix for the existing fixed wiki directories, rerun focused memory-wiki validation, and leave custom page-group configuration in #92105.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows current main and v2026.6.9 enumerate only direct markdown children in the query, compile, and status scanners, and the PR body includes before/after live temp-vault output for the same path.

Is this the best way to solve the issue?

Yes for the narrow bug. Recursing the three existing fixed-directory scanners is the smallest maintainable fix; configurable page groups and custom directory names should stay in the separate product/API discussion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 11a2e03bd4de.

Label changes

Label justifications:

  • P2: This is a focused memory-wiki data omission bugfix with limited plugin scope and an open linked issue, not a core outage or urgent channel regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes copied before/after live console output from a real temp vault using the production enumeration and search path after the patch.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes copied before/after live console output from a real temp vault using the production enumeration and search path after the patch.
Evidence reviewed

PR surface:

Source +5, Tests +71. Total +76 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 13 8 +5
Tests 3 71 0 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 84 8 +76

What I checked:

Likely related people:

  • vincentkoc: Blame and git log -S tie the current flat scanner implementation and the original memory-wiki search/compile/status surfaces to Vincent Koc's memory-wiki feature history. (role: feature history owner; confidence: high; commits: 82710f2adde8, 5716d83336fd, 0d3cd4ac42b3; files: extensions/memory-wiki/src/query.ts, extensions/memory-wiki/src/compile.ts, extensions/memory-wiki/src/status.ts)
  • steipete: Recent path history shows adjacent memory-wiki refactor work, including shared string-helper cleanup used by the affected query path. (role: recent adjacent contributor; confidence: medium; commits: eb9ce9482cac; files: extensions/memory-wiki/src/query.ts)
  • mbelinky: Merged adjacent memory-wiki query and UI work in the Dreaming memory-wiki PR that touched the query surface and query tests. (role: adjacent area contributor; confidence: low; commits: 64693d2e96ab; files: extensions/memory-wiki/src/query.ts, extensions/memory-wiki/src/query.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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 keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jun 6, 2026
Add nested-page regression assertions for the compile (digest) and status (counts) scanners, matching the existing query search coverage. Both fail against the pre-fix flat fs.readdir and pass after recursion.
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed size: XS proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 6, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jun 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 8, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 8, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 19, 2026
@vincentkoc vincentkoc self-assigned this Jul 2, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing as superseded by #96022, merged in 63ee4cd2405c932f338de269147ed0510910c0e8.

Current main now recursively scans the fixed memory-wiki query directories in the query, compile, and status paths, with nested-page regressions covering all three surfaces. I also reran the focused query/compile/status test files on current main: 68/68 passed.

Thanks @Agent-Aurelius for isolating the bug and providing the original proof. The canonical landed PR preserves the same fix and stronger current-main coverage.

@vincentkoc vincentkoc closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-wiki P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wiki_search silently drops pages in subfolders of the wiki query dirs (data loss)

2 participants