fix(memory-wiki): wiki_apply errors when another page has bad frontmatter#96177
fix(memory-wiki): wiki_apply errors when another page has bad frontmatter#96177ZacharyYW wants to merge 1 commit into
Conversation
…tter wiki_apply and wiki_lint recompile the whole vault after their own write, which parses every page's frontmatter. One page with unparsable YAML (e.g. a sourceIds list item containing an inline colon) threw out of the scan and failed the entire operation, even though the requested write or lint had already succeeded. toWikiPageSummary now degrades a page with bad frontmatter to an empty frontmatter instead of throwing, recording the parse failure on the summary. Lint surfaces it as an invalid-frontmatter issue on that page instead of crashing the whole vault scan. Callers that parse one specific page they're about to mutate still throw as before. Closes openclaw#96125
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close this PR as superseded: it targets a valid memory-wiki bug, but #97177 now carries the same summary/lint-scoped fix with stronger control coverage, sufficient real proof, and a clean mergeable state. Canonical path: Land #97177 as the single proof-backed fix for the canonical memory-wiki frontmatter bug, then close #96125 after it merges. So I’m closing this here and keeping the remaining discussion on #97177 and #96125. Review detailsBest possible solution: Land #97177 as the single proof-backed fix for the canonical memory-wiki frontmatter bug, then close #96125 after it merges. 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 for this branch as the landing path. The fix shape is reasonable, but #97177 is the better canonical route because it implements the same boundary with extra control/body-preservation coverage and sufficient proof. Security review: Security review cleared: No concrete security or supply-chain concern was found; the diff only changes memory-wiki parsing, lint reporting, and colocated tests. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 3811001d2783. |
|
ClawSweeper applied the proposed close for this PR.
|
|
The canonical fix has now landed via #97177 in commit This PR remains correctly closed as superseded. The landed version uses a closed scan result so invalid pages cannot contaminate indexes, digests, counts, or query results, and it keeps all Markdown write targets strict and byte-preserving. |
Closes: #96125
What Problem This Solves
Fixes an issue where
wiki_applyandwiki_lintwould report a YAML parse error and look like they failed, even though the requested write or lint had already completed. The error actually came from a completely unrelated page elsewhere in the vault whose frontmatter happened to contain YAML that couldn't be parsed (in the reported case, asourceIdslist item with an inline:inside bold markdown text, which YAML tried to read as a nested key-value pair).Why This Change Was Made
Both tools call
compileMemoryWikiVault()after their own work to refresh vault-wide indexes, and that recompile reads and parses every page's frontmatter.toWikiPageSummary()had no error handling around the YAML parse, so one bad page anywhere in the vault threw and aborted the whole scan. The fix makestoWikiPageSummary()catch a frontmatter parse failure for the page it's currently summarizing, fall back to empty frontmatter for that one page, and record the failure on the summary instead of letting it propagate.wiki_lintnow turns that into a normalinvalid-frontmatterissue on the offending page instead of crashing. Call sites that parse one specific page they're about to edit (e.g.applyCreateSynthesisMutation) are untouched and still throw, since silently treating an edit target's broken frontmatter as empty risks losing that page's existing metadata on write.User Impact
wiki_applyandwiki_lintno longer fail because of an unrelated page somewhere else in the vault. A page with broken frontmatter now shows up as a clear, actionableinvalid-frontmatterlint finding pointing at that specific file, instead of taking down every wiki operation until someone manually finds and fixes it.Evidence
New regression tests reproducing the reported scenario (a
sourceIdsentry with an inline colon inside bold text):both clean.