Skip to content

refactor(memory-wiki): reuse canonical plugin normalization - #119449

Merged
steipete merged 1 commit into
mainfrom
codex/loc-0804-memory-plugins-luem8u
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-0804-memory-plugins-luem8u

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Memory Wiki plugin repeated its own record, optional-string, finite-number, timestamp, and deduplicated-string normalization across ChatGPT imports, persisted import-run recovery state, markdown/frontmatter parsing, import insights, and overview results. Duplicated normalization increased maintenance cost and the risk that these related workflows would drift.

Why This Change Was Made

Reuse the existing canonical public Plugin SDK normalization helpers at the plugin owner boundary and remove redundant local wrappers and repeated normalization work. The change removes 94 production lines (+85/-179 across five files) while preserving ChatGPT export selection, malformed-frontmatter rejection, metadata handling, persisted import-run recovery, rollback ordering, and privacy behavior. It does not change any SQLite schema, vault contract, plugin SDK contract, config/default surface, security boundary, or secret handling.

User Impact

No intended user-visible behavior change: Memory Wiki imports, recovered or rolled-back imports, markdown claims/person cards, insights, and wiki overviews keep their existing outputs and persistence behavior. Operators get the same behavior from less duplicated, consistently normalized plugin code.

Evidence

  • Focused existing Memory Wiki suites passed: 6 files, 53 tests (markdown 32, chatgpt-import 13, mutation-coordinator 4, import-insights 2, import-runs 1, and wiki-overview 1). This includes real SQLite crash/reopen recovery, rollback/retry coordination, and persisting 32 recovery slots before safely handling a 33rd target.
  • The complete, unchanged pnpm check:changed gate passed on the same isolated trusted Blacksmith Testbox, including production and test extension typechecks, formatting, zero-warning lint, Plugin SDK API/boundary checks, dead-export scans, the database-first storage guard, sidecar checks, and zero runtime import cycles.
  • Exact required independent autoreview passed: autoreview --mode local --engine codex --model gpt-5.6-sol --thinking xhigh.
  • Remote execution: https://github.com/openclaw/openclaw/actions/runs/30970848741

Exact-head Memory Wiki import and rollback proof

The actual production importChatGptConversations and rollbackChatGptImportRun owners were executed against a synthetic ChatGPT export, an isolated temporary vault, and a real isolated plugin-state SQLite database at the unchanged reviewed commit. No real user data, operator vault, credentials, or external service was used.

$ git rev-parse HEAD
5c0d479114065e50e0b2257901747bdc09428232
$ pnpm test extensions/memory-wiki/src/wiki-notes-read-retry.test.ts extensions/memory-wiki/src/chatgpt-import.test.ts --reporter=verbose
✓ memory-wiki existing-page read retry > preserves chatgpt conversation notes after a transient existing-page read failure 78ms
✓ memory-wiki existing-page read retry > preserves chatgpt conversation notes containing replacement-pattern dollar sequences 67ms
✓ memory-wiki existing-page read retry > leaves a ChatGPT page unchanged after a persistent existing-page read failure 68ms
✓ ChatGPT import rollback recovery > returns a completed rollback without initializing or mutating the vault 144ms
✓ ChatGPT import rollback recovery > persists the moving phase before vault initialization 146ms
✓ ChatGPT import rollback recovery > reconciles a crash after rename across a real SQLite reopen 261ms
✓ ChatGPT import rollback recovery > persists 32 recovery slots before retrying and preserving the 33rd target 359ms
✓ ChatGPT import rollback recovery > queues the whole rollback behind an active vault mutation 118ms
✓ ChatGPT import rollback recovery > preserves trailing spaces on an updated page before restoring its snapshot 95ms
✓ ChatGPT import rollback recovery > does not touch targets again after the persisted process-restart fence 176ms
✓ ChatGPT import rollback recovery > rejects a symlinked recovery directory without touching external files 56ms
Test Files  2 passed (2)
     Tests  23 passed (23)
  Duration  6.88s

The actual import owner read synthetic conversations.json, wrote an isolated temporary wiki page, and reimported it; the actual rollback owner exercised real SQLite crash/reopen recovery, persisted rollback phases and fences, 33 recovery targets, and symlink safety. Blacksmith run 30972120517 exited 0. This fulfills the requested after-fix import/rollback artifact; a fresh bot review is intentionally not requested because the reviewed commit is unchanged and root policy explicitly requires no re-review round trip for a body-only evidence update.

@steipete
steipete marked this pull request as ready for review August 5, 2026 03:14
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 11:20 PM ET / August 5, 2026, 03:20 UTC.

ClawSweeper review

What this changes

The PR replaces duplicated Memory Wiki record, string, number, and list normalization with existing public Plugin SDK helpers.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep open for normal maintainer review. The refactor is source-equivalent and uses the intended public Plugin SDK boundary, but the external-PR proof gate still needs an after-fix real behavior artifact.

Priority: P3
Reviewed head: 5c0d479114065e50e0b2257901747bdc09428232

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is clean and contract-equivalent, but real behavior proof is still required before merge.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused tests and CI, but it contains no inspectable after-fix real Memory Wiki run or redacted runtime artifact. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused tests and CI, but it contains no inspectable after-fix real Memory Wiki run or redacted runtime artifact. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Public plugin boundary: The helpers used by the PR were already exported from the public Plugin SDK subpath at its base, so this does not add or change an SDK contract.
Equivalent normalization contracts: Canonical record, optional-string, finite-number, and unique trimmed-list helpers have the same acceptance and rejection semantics as the removed local code.
Recovery and parsing behavior retained: The PR retains the required import-run fields, malformed-frontmatter rejection, and first-seen recovery-path deduplication while replacing only the local helper implementations.
Findings None None.
Security None None.

How this fits together

Memory Wiki parses ChatGPT exports and Markdown frontmatter, normalizes untrusted values at the plugin boundary, then persists import recovery state and produces wiki summaries. The refactor centralizes that normalization in the public Plugin SDK without changing the import or recovery flows.

flowchart LR
A[ChatGPT export and Markdown] --> B[Memory Wiki parsing]
B --> C[Plugin SDK normalization]
C --> D[Import recovery state]
C --> E[Wiki insights and overview]
D --> F[Rollback and recovery]
E --> F
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused tests and CI, but it contains no inspectable after-fix real Memory Wiki run or redacted runtime artifact. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The PR body provides test and CI claims but no inspectable after-fix real behavior artifact; that remains a merge gate for this external production-code PR.
  • Complete next step (P2) - No mechanical repair is indicated; a maintainer should review the added real-behavior artifact on the exact head before merge.
Agent review details

Security

None.

PR surface

Source -94. Total -94 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 5 85 179 -94
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 85 179 -94

Review metrics

Metric Value Why it matters
Production vs test LOC production -94, tests 0 The net deletion is justified by eliminating duplicated plugin-boundary normalization without expanding behavior or configuration.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-wiki/src/chatgpt-import.ts, unknown-data-model-change: extensions/memory-wiki/src/import-runs-state.ts, unknown-data-model-change: extensions/memory-wiki/src/markdown.ts, vector/embedding metadata: extensions/memory-wiki/src/chatgpt-import.ts, vector/embedding metadata: extensions/memory-wiki/src/import-insights.ts, vector/embedding metadata: extensions/memory-wiki/src/import-runs-state.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared SDK normalization path, add a redacted real Memory Wiki import or rollback run showing unchanged output, then complete exact-head maintainer review.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the shared SDK normalization path, add a redacted real Memory Wiki import or rollback run showing unchanged output, then complete exact-head maintainer review.

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

Not applicable: this PR refactors an existing implementation rather than reporting a user-visible failure; source comparison establishes the intended behavior boundary.

Is this the best way to solve the issue?

Yes. Reusing already-public canonical Plugin SDK normalization is the narrowest maintainable solution, and direct contract comparison shows it preserves the removed local semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a8caab5c3d3c.

Labels

Label changes:

  • add P3: This is a low-risk internal cleanup with no intended user-visible behavior change.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and CI, but it contains no inspectable after-fix real Memory Wiki run or redacted runtime artifact. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a low-risk internal cleanup with no intended user-visible behavior change.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and CI, but it contains no inspectable after-fix real Memory Wiki run or redacted runtime artifact. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • steipete: Introduced the SQLite-backed import-run architecture and has substantial history across the affected Memory Wiki paths. (role: import-run storage and Memory Wiki contributor; confidence: high; commits: 7a3d24e70c9d, 5c0d47911406; files: extensions/memory-wiki/src/import-runs-state.ts, extensions/memory-wiki/src/chatgpt-import.ts)
  • Yuval Dinodia: Authored the recent user-edit-preserving rollback repair that exercises the persistence invariant touched by this refactor. (role: rollback-recovery contributor; confidence: high; commits: 623a01592803; files: extensions/memory-wiki/src/chatgpt-import.ts, extensions/memory-wiki/src/chatgpt-import.test.ts)
  • Vincent Koc: Introduced the current public normalization facade and is the recent blame owner for the canonical helper surface. (role: Plugin SDK normalization contributor; confidence: high; commits: 6293b54250fc; files: src/plugin-sdk/string-coerce-runtime.ts, packages/normalization-core/src/record-coerce.ts)

Rank-up moves

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

  • Post a redacted terminal, log, or recording artifact from an after-fix Memory Wiki import or rollback run; update the PR body to trigger a fresh review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 2b003f1 into main Aug 5, 2026
157 of 166 checks passed
@steipete
steipete deleted the codex/loc-0804-memory-plugins-luem8u branch August 5, 2026 03:56
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: memory-wiki maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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.

1 participant