Skip to content

fix(memory-wiki): ignore structural markers in query text - #128105

Merged
vincentkoc merged 1 commit into
mainfrom
fix/memory-wiki-query-markers-128017
Aug 23, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/memory-wiki-query-markers-128017

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • build one canonical searchable body for memory-wiki queries
  • remove frontmatter, generated Related blocks, and standalone structural marker lines from both scoring and snippets
  • preserve managed-block content and inline marker prose

Fixes #128017

Reported by @mrdcn.

Testing

  • red repro: node scripts/run-vitest.mjs extensions/memory-wiki/src/query.test.ts failed because the snippet was <!-- openclaw:human:start -->
  • exact-head focused: query, OKF, and CLI tests (90/90 passed)
  • full memory-wiki source suite: 450/450 passed
  • prior Blacksmith Testbox focused: 58/58 passed
  • changed gate: all checks through dead-export scan passed; local extension typecheck was blocked by unrelated stale shared dependency errors in extensions/acpx and extensions/cua-computer
  • autoreview: clean, no P0/P1 findings
  • production LOC: +10/-4 (net +6); tests: +163/-0

Punchcard-Session: crisp-timber-harbor-p1

@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc vincentkoc self-assigned this Aug 23, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 23, 2026 04:14
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 12:50 AM ET / 04:50 UTC.

ClawSweeper review

What this changes

The memory-wiki plugin stops standalone structural HTML comments from affecting search matches, rankings, and displayed excerpts.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The focused repair is correct: it removes standalone internal markers from the shared body representation used for matching and snippets. This maintainer-owned PR remains open for normal exact-head CI resolution.

Priority: P2
Reviewed head: 436bb92d26f7646e839b740af2159fd84889a4a5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with strong regression coverage; required CI is the remaining merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: this is a repository MEMBER PR; its body nevertheless records a pre-fix focused failure and passing exact-head regression coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: this is a repository MEMBER PR; its body nevertheless records a pre-fix focused failure and passing exact-head regression coverage.
Evidence reviewed 5 items Current-main failure mechanism: Current main strips only frontmatter and generated related blocks before choosing snippets and scoring raw text, leaving standalone structural comments eligible.
Canonical repair and regression coverage: The PR centralizes frontmatter, related-block, and standalone-marker exclusion for both snippet selection and raw-body scoring; focused cases cover marker-only pages, metadata matches, ranking, managed content, and inline prose.
Product entry points: The affected result snippet is rendered by the wiki_search agent tool and returned through the CLI and read-scoped Gateway method.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128105-bVIwT7/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
pnpm openclaw --help
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 70.26 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.5s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 9.8s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 3114ms (slowest: built plugin control-plane loads 2133ms)

OpenClaw 2026.8.1 (436bb92) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw

How this fits together

Memory-wiki reads Markdown vault pages, scores them against a query, and returns snippets to the agent tool, CLI, and Gateway API. The changed normalization sits between page text and those result fields so internal formatting comments do not become search content.

flowchart LR
  A[Markdown wiki pages] --> B[Page metadata and body]
  B --> C[Search candidate scoring]
  C --> D[Remove standalone structural markers]
  D --> E[Ranked results and snippets]
  E --> F[Agent wiki search tool]
  E --> G[CLI and Gateway API]
Loading

Before merge

  • Resolve merge risk (P1) - Two exact-head required checks are currently failing; resolve or rerun them before merge, including confirmation that the reported stale extension dependency failures are unrelated to this two-file change.
Agent review details

Security

None.

PR surface

Source +5, Tests +162. Total +167 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 4 +5
Tests 1 162 0 +162
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 171 4 +167

Review metrics

Metric Value Why it matters
Production versus regression-test LOC production +5 (9 added, 4 removed); tests +162 The five net production lines create one shared body transformation for both affected search paths; added tests cover visible selection and ranking behavior.

Stored data model

Persistent data-model change detected: serialized state: extensions/memory-wiki/src/query.test.ts, unknown-data-model-change: extensions/memory-wiki/src/query.test.ts, unknown-data-model-change: extensions/memory-wiki/src/query.ts, vector/embedding metadata: extensions/memory-wiki/src/query.test.ts, vector/embedding metadata: extensions/memory-wiki/src/query.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared line-anchored normalization and merge once the exact PR head has green required checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the shared line-anchored normalization and merge once the exact PR head has green required checks.

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

Yes—source-reproducible: current main leaves standalone structural comments in both the snippet candidate pool and raw-body scoring, matching the linked report's mechanism.

Is this the best way to solve the issue?

Yes—the shared normalization is the narrowest maintainable fix because both affected paths consume the same page-body representation while metadata, managed content, and inline marker prose remain intact.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 663f4e796d30.

Labels

Label changes:

  • add P2: This is a bounded search-result quality bug that degrades agent-facing excerpts but does not cause data loss, an outage, or a security-boundary failure.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: this is a repository MEMBER PR; its body nevertheless records a pre-fix focused failure and passing exact-head regression coverage.

Label justifications:

  • P2: This is a bounded search-result quality bug that degrades agent-facing excerpts but does not cause data loss, an outage, or a security-boundary failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: this is a repository MEMBER PR; its body nevertheless records a pre-fix focused failure and passing exact-head regression coverage.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Feature history contains multiple memory-wiki repairs and refactors, with the largest sampled contribution count for the query surface. (role: long-running memory-wiki contributor; confidence: high; commits: b1c9f022ec32, 8b0735e89f22, 35e0bc22ead2; files: extensions/memory-wiki/src/query.ts, extensions/memory-wiki/src/query.test.ts)
  • vincentkoc: File history reports repeated contributions on the query files in addition to this focused repair. (role: recurrent query-surface contributor; confidence: medium; commits: 436bb92d26f7; files: extensions/memory-wiki/src/query.ts, extensions/memory-wiki/src/query.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore or rerun the exact-head required checks, recording the unrelated extension dependency failures if they persist.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-23T04:07:37.779Z sha 436bb92 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Aug 23, 2026
@vincentkoc
vincentkoc force-pushed the fix/memory-wiki-query-markers-128017 branch from 436bb92 to fd91301 Compare August 23, 2026 05:14
@vincentkoc
vincentkoc merged commit f5553a8 into main Aug 23, 2026
102 of 104 checks passed
@vincentkoc
vincentkoc deleted the fix/memory-wiki-query-markers-128017 branch August 23, 2026 05:26
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-wiki maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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.

[Bug]: wiki_search snippets can return bare HTML marker comments instead of content

1 participant