Repository navigation
fix(memory-wiki): reject blank or non-UTF-8 wiki apply --body-file - #168045
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesReject blank or malformed UTF-8 synthesis body files before Memory Wiki changes the vault. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a concrete data-loss path still present on current main, and the reviewed diff has no actionable defects. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe memory-wiki plugin registers the wiki CLI, resolves summary text from arguments or a local file, then passes valid content to the existing vault mutation and compilation owners. flowchart LR
A[Wiki apply synthesis] --> B[Existing body resolver]
C[Body file bytes] --> B
B --> D[UTF-8 and nonblank checks]
D --> E[Actionable CLI error]
D --> F[Existing vault mutation]
F --> G[Synthesis page and compiled indexes]
Technical reviewBest possible solution: Land the existing body-resolver validation with its preservation regression and documented UTF-8 requirement after the normal CI gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source exposes both destructive inputs, and the supplied base/candidate shipped-CLI comparison records their outcomes; this read-only review ran no target code. Is this the best way to solve the issue? This is the smallest complete fix: validate external file bytes in the existing CLI resolver before any mutation, preserve valid input, and reuse the shared error renderer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 99baae10742c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +47, Docs +4. Total +66 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 22, 2026, 4:13 PM ET / 20:13 UTC (Revision 5). |
aef06b0 to
244b78e
Compare
|
Addressed ClawSweeper P2: body-file rejection now prints the specific reason + recovery step via the wiki CLI user-facing parse-exit path (no more generic "The CLI command failed."). Packaged CLI RED/GREEN + vault readback refreshed on this head. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
244b78e to
6730e9e
Compare
6730e9e to
a2dff56
Compare
|
@clawsweeper re-review Lint-only amend on the same single commit: |
|
🦞👀 Re-review progress:
|
a2dff56 to
c30276d
Compare
|
Addressed ClawSweeper P1 (shared plugin CLI failure renderer): removed the local Local check: @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Exact head 334f3b7: 30 focused wiki CLI tests pass; changed-file formatting/lint pass. Built shipped CLI proof in Evidence independently reads actual vault bytes after blank input twice, malformed UTF-8, and valid Unicode updates. A supporting bounded gpt-5-mini smoke through the shipped agent returned CLI_LIVE_OK; the isolated credential was removed afterward. |
|
Landed in 3f962c1. Thanks @nocodet888-arch. wiki apply synthesis no longer wipes or corrupts summaries from bad body files. |
|
Merged—thank you @nocodet888-arch for preventing blank-file and invalid-UTF-8 synthesis data loss. Built CLI proof confirmed exact byte preservation on both refusal paths and successful valid Unicode updates. |
…penclaw#168045) fix(wiki): refuse blank or malformed --body-file input for synthesis `openclaw wiki apply synthesis --body-file` accepted a blank file and wiped the existing summary, and it rewrote malformed (non-UTF-8) bytes as U+FFFD replacement characters for good. Both are now rejected before anything is written, and the existing summary stays unchanged. Evidence: built CLI with a summary created through the CLI. On main a blank body file wiped it and a Latin-1 file was saved with U+FFFD (twice each); with this change both are refused and the vault bytes are unchanged (twice each). Valid UTF-8 (Café, emoji) and an inline body still work. Production +16/-1, CLI docs updated. Thanks @nocodet888-arch. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
wiki apply synthesis --body-filereads input with lossy UTF-8 decoding and accepts whitespace-only files. Applying a blank file can silently erase an existing generated summary; malformed bytes can permanently replace the text with U+FFFD characters.Changes
Validate file bytes with Node's UTF-8 validator before decoding, and reject blank decoded text before mutation. Keep direct
--bodyhandling and valid UTF-8 file updates unchanged. Document the file-body requirement in the CLI reference.Thanks to @nocodet888-arch for the data-loss repair and regression; their commit is retained. The regression now uses the current CLI test helper after integration with main.
Evidence
Built main
759015dc1664d02dcb4f3f9f3c98dfdf43492d5cand candidate independently in isolated Node 24.22.1 Linux Docker. Enabled the shipped memory-wiki plugin, initialized the vault withwiki init, and created the original synthesis throughwiki apply synthesis Good --source-id src.manual --body "Real summary v1". No internal wiki state was seeded.Independent byte reads of the actual vault page show:
CafébytesCafé 🌱 — valid UTF-8 summaryDirect-body seeding succeeds before every case on both arms. The focused wiki CLI suite passes all 30 tests; changed-file formatting and lint pass.
Simplification: one existing body resolver owns both refusals, using Node's byte validator; no new mutation path, state, SDK, or configuration. Whole PR production delta +16/-1; tests +47/-0. Necessary growth covers two distinct data-loss inputs and actionable errors.
Merge danger: reverting the code is a two-way door, but cannot recover text already corrupted by older builds. Blast radius is file-backed synthesis application; valid UTF-8 and direct bodies retain their behavior.