Skip to content

fix(memory-wiki): preserve human notes on OKF concept re-import - #175707

Merged
steipete merged 13 commits into
openclaw:mainfrom
YangManBOBO:fix/memory-wiki-preserve-okf-notes
Oct 21, 2026
Merged

steipete merged 13 commits into
openclaw:mainfrom
YangManBOBO:fix/memory-wiki-preserve-okf-notes

Conversation

@YangManBOBO

@YangManBOBO YangManBOBO commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #175700

Original contributor: @YangManBOBO. The contributor commits remain in this branch, with verified co-author credit in the maintainer rewrite.

What Problem This Solves

Fixes: Re-importing an OKF bundle silently deletes marked handwritten Notes from imported concept pages, even when the bundle is unchanged.

User Impact

OKF concept pages now include the standard ## Notes slot. Re-import preserves the exact block between <!-- openclaw:human:start --> and <!-- openclaw:human:end --> while refreshing producer content. Existing-page read failures stop the rewrite.

Only the marked human block is protected. Text outside it remains producer-owned and can be replaced. Legacy OKF pages without a marked block regenerate with an empty Notes slot; there is no migration refusal or whole-body preservation. Unpaired markers use the shared Notes helper's existing error and recovery instruction.

Why This Change Was Made

The OKF writer previously compared and wrote newly rendered content without preserving Notes, and converted page-read failures into empty content. It now uses the shared Notes-preservation and strict UTF-8/read-retry owners before comparison and writing.

The maintainer rewrite removes the separate OKF extractor. A small producer-Markdown mode in the shared helper excludes frontmatter and fenced marker examples, while source-sync and ChatGPT defaults stay unchanged. A small renderer closes an unterminated producer fence before adding the local slot. Existing paired Notes beneath an old open fence remain visible to the shared marker rules; closed producer examples stay excluded. Apply and ChatGPT import reuse the shared marker constants.

Evidence

Current head: b145c30e975d2cdee01c772f7318399974bc2758. Exact-head CI passed: 24 successful jobs, no failures. The combined CI/security gate also passed.

PR CI is the test gate under maintainer policy. Local tests, typechecks, live Gateway proof, and remote test leases were intentionally skipped; no contributor code was executed locally.

  • Changed-file oxlint with the core TypeScript config passed; oxfmt checked all nine changed files; git diff --check passed.
  • ClawSweeper reviewed this exact head and reported no code findings. Its remaining live/upgrade/local red-green proof requests are intentionally skipped under the maintainer policy above.
  • Fresh Codex autoreview: scoped clean, with no actionable P0–P2 findings. Static review only; no project code or tests were executed.
  • CI covers the importer, shared Markdown owner, existing Notes read/retry suite, and affected consumers. The focused regressions are preserves marked Notes through unchanged and changed re-imports, adds an empty Notes slot when re-importing unmarked legacy content, rejects an unpaired producer-page marker, preserves legacy Notes under an open producer fence, does not preserve a legacy producer's closed Notes example, and leaves OKF concept pages unchanged after a persistent existing-page read failure.
  • The preservation regression adds a marked note on main's slot-free output, so it is designed to fail on main's lost content rather than missing fixture setup. It also checks exact CRLF/Unicode/dollar bytes, copied markers, producer refresh, and open producer fences. These tests are committed for CI; no local red/green run is claimed.

Diff versus integrated main: production +72/-26 (net +46), tests +113/-0, docs +7/-0. This reduces the prior PR's net production growth from 98 to 46 lines and its test additions from 271 to 113. Remaining production growth supports the distinct producer layout and safe slot rendering without changing sibling parsing behavior.

Closes openclaw#175700

OKF bundle re-import fully regenerated concept pages and dropped any human
## Notes block, unlike source sync and ChatGPT import. The rendered page now
carries a Notes slot and writeOkfConceptPage preserves the existing human
block via preserveHumanNotesBlock, matching the documented 'notes preserved
across regeneration' invariant.

Regression test: import, add a handwritten note, re-import, assert note
survives. Fails on main, passes with this change.
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Preserve marked handwritten Notes when OKF concept pages are regenerated.

Example: Import customers.md, add “Keep café 🦞 and $& exactly.” between the human markers, then re-import.

  • Before: The regenerated concept page deletes the handwritten note.
  • After: The marked note survives while updated producer content replaces the generated content.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has no identified correctness blocker, but current-implementation behavior and persisted-vault compatibility remain unproven under the applicable proof gate.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Re-importing an unchanged or updated OKF bundle silently deletes marked handwritten Notes.
Reason: The documented preservation contract is broken on main, and the maintainer explicitly approved the focused marked-block-only repair.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this PR repairs a current-main data-loss path, has maintainer support, and introduces no concrete code defect found in this review.

Priority: P0
Reviewed head: b145c30e975d2cdee01c772f7318399974bc2758

Before merge

  • Add real behavior proof - Earlier CLI and released-install claims name bd9eebb, before the shared-parser rewrite and revised legacy-page behavior. The current body and maintainer request explicitly skip live proof in favor of CI; that records the maintainer's test choice but does not supply the real-behavior evidence required for this external PR. Provide redacted output from openclaw wiki okf import exercising unchanged and changed re-imports, exact marked-Notes retention, legacy Notes beneath an open producer fence, and malformed-marker rejection followed by recovery; redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: The rewritten importer lacks shipped-CLI confirmation, latest-stable vault-transition evidence, and a demonstrated base-red/head-green regression run.
Agent review details

How this fits together

The Memory Wiki plugin imports OKF Markdown bundles into vault concept pages, then compiles indexes and searchable knowledge.

flowchart LR
  A[OKF bundle] --> B[CLI import]
  B --> C[Concept renderer]
  D[Existing vault page] --> E[Shared Notes preservation]
  C --> E
  E --> F[Guarded page writer]
  F --> G[Wiki compiler]
Loading

Technical review

Best possible solution:

Retain the focused plugin-local repair using the existing Notes parser, strict reader, and guarded writer.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes import-edit-reimport data loss: marked Notes make the page differ, then the writer replaces it with slot-free generated content; no target code was executed during this review.

Is this the best way to solve the issue?

The patch fixes the replacement boundary with existing owners, preserves sibling parsing defaults, and handles the producer-specific code-fence layout without retaining a separate extractor.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6a649d256b79.

Provenance checked

  • OKF concept replacement changes intended behavior with a stated reason (4cf4e54: The original OKF importer generated concept pages from producer content; later refactors retained its full replacement behavior.)
  • Canonical Notes preservation and damaged markers keeps the original intent (fix(memory-wiki): preserve human notes block on source re-ingest #95614: Preserve the complete human block verbatim, including copied markers; subsequent damaged-marker protection prevents destructive rewrites.)
  • Markdown code masking keeps the original intent (refactor(extensions): deslop memory-wiki, active-memory, acpx and agentsapi #159262: Keep literal links inside Markdown code examples unchanged; the new producer-only mode preserves default masking behavior for existing link consumers.)
  • Shared marker constants keeps the original intent (5716d83: Synthesis and imported-source renderers use the same human-marker strings; importing their canonical constants retains their output.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6d8f0a1 adds extensions/memory-wiki/src/markdown.ts:540 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6d8f0a13655c; files: extensions/memory-wiki/src/markdown.ts)
  • Vincent Koc: Raw commit 4cf4e54 adds extensions/memory-wiki/src/okf.ts:466 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4cf4e5417938; files: extensions/memory-wiki/src/okf.ts)
  • Yuval Dinodia: Raw commit 0ec12df adds extensions/memory-wiki/src/markdown.ts:490 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ec12df24512; files: extensions/memory-wiki/src/markdown.ts)

PR surface

Source +46, Tests +113, Docs +7. Total +166 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 72 26 +46
Tests 3 113 0 +113
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 192 26 +166

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +72/-26; tests +113/-0 Growth supports producer-aware marker handling, safe Notes-slot rendering, and distinct preservation/read-failure regressions without a parallel preservation owner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #175700
Summary: This PR is the open repair candidate for the canonical Notes-loss issue; the merged UTF-8 fix addresses a separate input-decoding failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P0: The repaired current-main behavior silently destroys handwritten user content during an ordinary repeat import.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide shipped-CLI evidence for the shared-parser implementation.
  • Demonstrate a v2026.10.5 vault transition with marked and unmarked concept pages, page identities, and settings intact.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-17T19:23:09.070Z sha 564926b :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-17T19:32:28.095Z sha 564926b :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-18T00:03:07.865Z sha f8f1a57 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T08:43:40.170Z sha ad26061 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T09:18:11.055Z sha ad26061 :: needs real behavior proof before merge. :: [P1] Reject a missing local Notes closing marker before rewriting
  • reviewed 2026-10-20T10:24:16.632Z sha bd9eebb :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T21:21:17.637Z sha bd9eebb :: needs maintainer review before merge. :: none
  • reviewed 2026-10-21T05:59:27.570Z sha 3d6bc6e :: needs real behavior proof before merge. :: none

Reviewed October 21, 2026, 2:15 AM ET / 06:15 UTC (Revision 12).

Closes openclaw#175700

Scope human-Notes preservation to the local Notes slot instead of reusing
preserveHumanNotesBlock: OKF producer Markdown is unrestricted, so a legacy
page with an unmarked producer Notes section must not throw, and literal
producer marker examples must not widen the preserved range. Rendered pages
now carry a Notes slot; the writer preserves the slot at the end of the page.

Regression tests cover the marked-note round trip, the legacy producer
Notes page, and a producer body containing a literal human marker.
@YangManBOBO

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@YangManBOBO

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 20, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Released-install compatibility proof update (exact bd9eebb53ccc9c1a9c375c01b7c3448936313da0): the published body now records actual released 2026.10.5 → installed canonical candidate using the same prefix/home/config/state/vault, package byte identities, preserved Notes/legacy pages, missing-marker rejection/recovery, and the explicit Doctor normalization delta. This is manual package replacement plus Doctor, not an automatic-updater or model-authentication claim. The earlier acquisition-policy claim is corrected. No source, 69-test replay, commit or CI rerun; please assess this completed compatibility evidence.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 20, 2026
steipete and others added 3 commits October 20, 2026 22:22
Preserve the marked human block before comparing or replacing OKF pages,
and propagate existing-page read failures through the shared read owner.
Keep marker-free legacy pages importable and document that unmarked text
is producer-owned. Replace the separate OKF extractor with the shared
Markdown helper and retain focused importer/read-failure regressions.

Fixes openclaw#175700

Co-authored-by: YangManBOBO <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

Maintainer rewrite on the contributor branch: OKF uses the shared marked-Notes preservation owner and strict existing-page read owner. The separate extractor and redundant test scaffolding are removed; contributor ancestry and credit remain.

The contract is marked-block-only: outside text is producer-owned; marker-free legacy pages regenerate with an empty Notes slot. The body records that limitation, focused regressions, lint and fresh review. PR CI is the test gate per maintainer policy; live proof was intentionally skipped.

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed size: M labels Oct 21, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

Current head: b145c30e975d2cdee01c772f7318399974bc2758.

The follow-up preserves complete legacy Notes beneath an unclosed producer fence through the shared Markdown owner. It uses the existing parser, retains the marked-block-only contract, and adds small LF/CRLF and closed-example regressions. Fresh independent Codex review is clean through P2; changed-file lint and formatting pass.

The prior review reported no code findings. Its shipped-CLI, latest-stable transition, and local red/green proof requests are intentionally skipped under the maintainer's explicit proof policy: PR CI is the test gate. The earlier head passed CI; the new head requires its own CI result. The body records the final implementation and this proof boundary.

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-wiki P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: memory-wiki OKF re-import silently erases human notes on concept pages

3 participants