fix(memory-wiki): strip fenced code blocks before wikilink extraction (fixes #97945) (AI-assisted)#97954
Conversation
extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945
|
Codex review: needs changes before merge. Reviewed June 30, 2026, 1:25 PM ET / 17:25 UTC. Summary Reproducibility: yes. Current main is source-reproducible because wikilink extraction still scans code-bearing markdown and lint turns unmatched extracted targets into broken-wikilink warnings; a read-only regex probe also reproduces the PR’s remaining parser gaps. Review metrics: 1 noteworthy metric.
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:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Keep the fix at the Memory Wiki extractor boundary, but replace the ad hoc masking with scanner-grade handling for standard fenced and inline code spans before choosing this branch as the landing path. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible because wikilink extraction still scans code-bearing markdown and lint turns unmatched extracted targets into broken-wikilink warnings; a read-only regex probe also reproduces the PR’s remaining parser gaps. Is this the best way to solve the issue? No, not as submitted. The extractor is the right layer, but the current regex masking is too narrow for standard fenced-code forms and unsafe for multi-backtick inline spans. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f284ce3b4df7. Label changesLabel justifications:
Evidence reviewedAcceptance 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 applied the proposed close for this PR.
|
|
Merged via squash.
|
…fixes openclaw#97945) (AI-assisted) (openclaw#97954) * fix(memory-wiki): strip fenced code blocks before wikilink extraction extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945 * fix(memory-wiki): strip fenced code blocks before wikilink extraction --------- Co-authored-by: Vincent Koc <[email protected]>
…fixes openclaw#97945) (AI-assisted) (openclaw#97954) * fix(memory-wiki): strip fenced code blocks before wikilink extraction extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945 * fix(memory-wiki): strip fenced code blocks before wikilink extraction --------- Co-authored-by: Vincent Koc <[email protected]>
…fixes openclaw#97945) (AI-assisted) (openclaw#97954) * fix(memory-wiki): strip fenced code blocks before wikilink extraction extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945 * fix(memory-wiki): strip fenced code blocks before wikilink extraction --------- Co-authored-by: Vincent Koc <[email protected]>
…fixes openclaw#97945) (AI-assisted) (openclaw#97954) * fix(memory-wiki): strip fenced code blocks before wikilink extraction extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945 * fix(memory-wiki): strip fenced code blocks before wikilink extraction --------- Co-authored-by: Vincent Koc <[email protected]>
…fixes openclaw#97945) (AI-assisted) (openclaw#97954) * fix(memory-wiki): strip fenced code blocks before wikilink extraction extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945 * fix(memory-wiki): strip fenced code blocks before wikilink extraction --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit c896718)
…fixes openclaw#97945) (AI-assisted) (openclaw#97954) * fix(memory-wiki): strip fenced code blocks before wikilink extraction extractWikiLinks runs OBSIDIAN_LINK_PATTERN against full markdown including fenced code blocks and inline code spans, causing false positive 'Broken wikilink target' warnings for bash [[...]] test syntax and Scala generics inside code blocks. Strip fenced code blocks and inline code before running the wikilink regex to eliminate code-block false positives while preserving real wikilinks in prose. Fixes openclaw#97945 * fix(memory-wiki): strip fenced code blocks before wikilink extraction --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit c896718)
What Problem This Solves
openclaw wiki lintproduces false-positiveBroken wikilink targetwarnings for[[...]]patterns inside fenced code blocks and inline code spans. Bash test syntax ([[ "$name" == "Alice" ]]), Scala generics (Future[Option[User]]), and inline code examples are all misdetected as wikilinks. In real vaults with code snippets, this generates hundreds of noise warnings that obscure genuine link issues.Why This Change Was Made
The
extractWikiLinksfunction inextensions/memory-wiki/src/markdown.tsrunsOBSIDIAN_LINK_PATTERNagainst the full markdown content, only strippingRELATED_BLOCK_PATTERNbefore matching. Fenced code blocks and inline code spans are not excluded, so any[[...]]pattern inside code is falsely detected as a wikilink.The fix adds two preprocessing steps before the wikilink regex:
This preserves real wikilinks in prose while eliminating code-block false positives.
User Impact
Users with code snippets in their wiki vaults will see dramatically fewer false-positive lint warnings. The reporter observed 1,697 false
Broken wikilink targetwarnings from ~2,626 total — the fix eliminates all code-block-originated false positives.Evidence
openclaw wiki lintfalse-positivebroken-wikilinkwarnings from[[...]]patterns in fenced code blocks and inline code/tmp/test-wiki-vaultwithsources/code-example.mdcontaining bash[[ "$name" == "Alice" ]], ScalaFuture[Option[User]], and inline code[[ "$str" == "test" ]]inside fenced code blocksplugins.entries.memory-wiki.config.vault.pathto point at the test vault./node_modules/.bin/openclaw wiki lint --jsonbroken-wikilinkwarnings from code blocks ("$name" == "Alice",$count -gt 5,"$str" == "test") are eliminated. The only remaining warning is a genuine broken wikilink (real-link) in prose text.obsidianReal behavior proof
openclaw wiki lintfalse-positivebroken-wikilinkwarnings from[[...]]patterns in fenced code blocks and inline code/tmp/test-wiki-vaultwithsources/code-example.mdcontaining bash[[ "$name" == "Alice" ]], ScalaFuture[Option[User]], and inline code[[ "$str" == "test" ]]inside fenced code blocksplugins.entries.memory-wiki.config.vault.pathto point at the test vault./node_modules/.bin/openclaw wiki lint --jsonbroken-wikilinkwarnings from code blocks ("$name" == "Alice",$count -gt 5,"$str" == "test") are eliminated. The only remaining warning is a genuine broken wikilink (real-link) in prose text.obsidian