Skip to content

memory-wiki lint: wikilink extractor still not markdown-aware — fenced code false positives (reopening #70986) #97945

Description

@Durambar

Summary

openclaw wiki lint still produces large numbers of false-positive Broken wikilink target warnings from [[...]] patterns inside fenced code blocks and inline code spans. This was reported and validated in #70986, which was closed by the stale bot without the fix being merged.

Tested on: OpenClaw 2026.x, macOS 15.5.0 (arm64)

Relation to #70986

Issue #70986 fully describes the root cause and proposed fix. A contributor (one-box-u) validated the fix in a live vault, dropping lint warnings from 70 → 4. The issue was closed by openclaw-barnacle on 2026-06-13 due to inactivity, not because it was resolved. This report confirms the bug is still present in the current release.

Evidence

Vault: isolated mode, Obsidian render mode, ~420 compiled pages.

Before fix: 2,626 lint warnings including ~1,697 Broken wikilink target.

Samples of false positives from fenced Scala/bash code blocks:

Broken wikilink target `mongoComponent = mongoComponent, collectionName = "users"...`
Broken wikilink target `"$name" == "Alice"`.
Broken wikilink target `$count -gt 5`.
Broken wikilink target `-z "$str"`.
Broken wikilink target `val userId: String, request: Request[A]`.
Broken wikilink target `request`.

These all originate from Scala type generics (Future[Option[User]]) and bash test syntax ([[ "$x" == "y" ]]) inside fenced code blocks — not real wikilinks.

Root cause (verified in current bundle)

/opt/homebrew/lib/node_modules/openclaw/dist/cli-XK7iPloG.js, line 356:

function extractWikiLinks(markdown, sourceRelativePath) {
  const searchable = markdown.replace(RELATED_BLOCK_PATTERN$1, "");
  // OBSIDIAN_LINK_PATTERN runs against full markdown including fenced code blocks

Fenced code blocks and inline code spans are not stripped before the wikilink regex runs.

Validated fix (from #70986, one-box-u)

Strip fenced code blocks (and inline code) from searchable before running the regex:

const searchable = markdown
  .replace(/(^|\n)(`{3,})[^\n]*\n[\s\S]*?\n\2(?=\n|$)/g, "\n")  // fenced blocks
  .replace(/`[^`]+`/g, "``")                                       // inline code
  .replace(RELATED_BLOCK_PATTERN$1, "");

Applied locally to the dist bundle: warnings dropped from 2,626 → 2,563, with all bash/Scala code-block false positives eliminated. Remaining warnings are genuine Class 2 resolver issues (title vs slug mismatch) also described in #70986.

Request

Please reopen or re-land the fix from #70986. The markdown-awareness fix is straightforward, validated, and ready. The stale-close was premature — the bug is still live and actively causing noise in real vaults.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions