fix(memory-wiki): tolerate YAML parse errors in wiki frontmatter#96130
fix(memory-wiki): tolerate YAML parse errors in wiki frontmatter#96130hanZeng-08 wants to merge 1 commit into
Conversation
A single wiki page with malformed YAML frontmatter (e.g. markdown bold syntax containing colons inside list items) caused wiki_apply and wiki_lint to fail entirely via YAMLParseError. parseWikiMarkdown now wraps YAML.parse in try-catch: when parsing fails, it returns an empty frontmatter while preserving the body. This prevents one bad file from crashing the entire vault compilation. Fixes openclaw#96125
Fix rationaleProblemA single wiki page with malformed YAML frontmatter (e.g., Why this approachOption A: fix the YAML content — rejected. The content is user-authored markdown; we can't control what users put in frontmatter. Requiring users to avoid colons inside bold text is unrealistic. Option B: change Option C: wrap
Trade-offA page with invalid YAML frontmatter loses its metadata (title, sourceIds, claims, etc.) and falls back to body-only rendering. This is acceptable because:
Safety
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed June 23, 2026, 8:40 PM ET / 00:40 UTC. Summary PR surface: Source +4, Tests +12. Total +16 across 2 files. Reproducibility: yes. Source inspection shows malformed frontmatter reaches Review metrics: none identified. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows malformed frontmatter reaches Is this the best way to solve the issue? No. The PR fixes the crash in one path, but the best fix is to catch malformed frontmatter only while summarizing unrelated vault pages and keep direct edit-target parsing strict. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cd7e3df1eac9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +4, Tests +12. Total +16 across 2 files. View PR surface stats
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
|
|
The canonical fix for #96125 has now landed via #97177 in commit This candidate remains correctly closed: catching in the shared parser could erase malformed target metadata, while the landed version isolates vault scans and keeps every Markdown writer fail-closed. |
Fixes #96125
What Problem This Solves
Fixes an issue where a single wiki page with malformed YAML frontmatter causes
wiki_applyandwiki_lintto fail entirely, even though the file was already written successfully. ThecompileMemoryWikiVaultstep throwsYAMLParseError("Unexpected scalar at node end") when parsing frontmatter containing markdown bold syntax with colons (e.g.,- **MEMORY.md 第 235 行**:"..."). This creates a single-point-of-failure: one bad file breaks the entire vault.Why This Change Was Made
parseWikiMarkdown(extensions/memory-wiki/src/markdown.ts:176) calledYAML.parsewithout any error handling. When a list item in frontmatter contains markdown bold + colon (which YAML interprets as an invalid key-value structure), the parser throws and the error propagates up throughtoWikiPageSummary→readPageSummaries→compileMemoryWikiVault→wiki_apply/wiki_lint.The fix wraps
YAML.parsein a try-catch: when parsing fails, return an emptyfrontmatterbut preserve thebody. This prevents one bad file from crashing the entire vault compilation, while allowing the page to still be processed (albeit without frontmatter metadata).User Impact
Users with wiki pages containing complex markdown in frontmatter (like bold + colon combinations) will no longer see
wiki_apply/wiki_lintcrash. The affected page will be processed without its frontmatter metadata, but the rest of the vault compiles normally. Previously, the entire operation would fail with a cryptic YAML parse error.Evidence
Environment: Linux, Node v22.23.0, pnpm v11.2.2, worktree SHA 2af0604
Before fix (reproduction with
yamlpackage):After fix (new regression test on new code):
$ pnpm test extensions/memory-wiki/src/markdown.test.ts Test Files 1 passed (1) Tests 8 passed (8)Lint/format clean:
$ npx oxlint@latest extensions/memory-wiki/src/markdown.ts extensions/memory-wiki/src/markdown.test.ts Found 0 warnings and 0 errors. $ pnpm format extensions/memory-wiki/src/markdown.ts extensions/memory-wiki/src/markdown.test.ts Finished in 13ms on 2 files using 1 threads.