feat(migration): OpenClaw import surface + unblock unified-core Apply
Summary
- Re-enable the disabled
create_memory_for_migrationfactory so the Apply path ofopenhuman.migrate_openclawactually moves data instead of bailing with "memory migration is disabled for the unified namespace memory core." - Add a Settings → Account → "Import from another assistant" panel that wraps the RPC with a preview-then-apply flow — the discoverability surface called out as the #1 gap in #1440.
- Hermes lands as "on the roadmap" with a context link to #1440 (per the acceptance criteria: "do not leave Hermes unmentioned in UX; coming soon is acceptable").
- 13 new tests (6 Rust: 5 pre-existing + 1 new fresh-import integration test; 7 Vitest: panel UX matrix).
- New coverage matrix row
13.5.4 Migration from another assistant (OpenClaw).
Problem
#1440 (raised by @senamakel) flagged three things:
- Discoverability — migration RPC has lived under
src/openhuman/migration/for a while with zero UI surface. - Dry-run vs apply must be obvious — the RPC defaults
dry_runtotrue, which surprises CLI/RPC callers who expect "I clicked Import, my data should move." - Hermes — no in-tree importer; either ship one or honestly track it.
Discovered while smoke-testing the UI: even with the panel wired, Apply was dead at the backend. src/openhuman/memory/store/factories.rs:442 had create_memory_for_migration permanently bail!ed with "memory migration is disabled for the unified namespace memory core" — left over from the unified namespace memory landing. Without unblocking that, the UI would have shipped half-broken: users would discover the migration surface, run Preview, click Apply, and watch it fail with a backend error nobody could action without reading Rust source.
Solution
Three layers, sized to scope:
1. Backend re-enable (src/openhuman/memory/store/factories.rs, src/openhuman/migration/core.rs)
Under the unified namespace memory core there is no separate "migration backend" — the importer just needs a writable Box<dyn Memory> rooted at the active workspace, which is exactly what create_memory(config, workspace_dir) already produces.
create_memory_for_migrationnow delegates tocreate_memory. Old behavior was unconditional bail.- Signature changes from
(&str, &Path)to(&MemoryConfig, &Path)so we can pass the full memory config; the sole caller (target_memory_backend) already has&Configin scope. - The "always errors" regression test in
factories.rsis replaced with a positivecreate_memory_for_migration_returns_writable_memory_on_unified_corethat pins the new contract. - New integration test
migrate_openclaw_apply_imports_markdown_entries_into_target_workspaceexercises the full Apply path against a temp OpenClaw workspace and assertsimported >= 1.
2. Settings panel (app/src/components/settings/panels/MigrationPanel.tsx)
- Vendor
<select>— OpenClaw active, Hermes disabled with an honest "on the roadmap" callout that links to #1440 for context. - Optional source path input (blank → backend auto-resolves
~/.openclaw/workspace). - Preview button hits the RPC with
dry_run=trueand renders the returnedMigrationReport— source/target paths, per-source counts (from_sqlite,from_markdown),imported,skipped_unchanged,renamed_conflicts, warnings. - Apply button — disabled until a successful Preview lands, fires
window.confirmwith the planned counts, then calls the RPC withdry_run=falseand shows the post-apply report. - Inline error surface survives the form so the user can edit + retry without losing context.
- Wired into Settings via a new
migrationroute + sidebar item under the Account section. - English i18n keys under
migration.*andpages.settings.account.migration*. Other locales fall back to English via the existingt()fallback chain.
3. Coverage matrix (docs/TEST-COVERAGE-MATRIX.md)
New row 13.5.4 Migration from another assistant (OpenClaw) — was ❌, now ✅, layer VU+RU.
Why preview-then-apply (not single Import button)?
The instinct is to flip dry_run's default. The downside: the existing RPC contract is load-bearing for any external script that's been calling it with the dry-run default. A safer UX-side fix: keep the RPC contract as-is, but make the UI explicit — Preview = dry_run=true, Apply = dry_run=false + confirm. The user always knows which mode they're in.
Submission Checklist
- [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — 7 new Vitest tests + 1 new Rust integration test + 1 positive Rust factories test (replacing the "always errors" regression).
- [x] Diff coverage ≥ 80% — every visible code path in the new panel is exercised by a test (preview, apply, error, vendor switch, confirm cancel, source path); backend re-enable is exercised by both unit + integration tests.
- [x] Coverage matrix updated — new row
13.5.4indocs/TEST-COVERAGE-MATRIX.md. - [x] All affected feature IDs from the matrix are listed in the PR description under
## Related. - [x] No new external network dependencies introduced — reuses the existing
openhuman.migrate_openclawRPC +create_memoryfactory; no new deps. - [x] Manual smoke checklist — verified end-to-end against a real OpenClaw-shaped workspace (
~/.openclaw/workspacewithMEMORY.md+ 2memory/*.mdfiles): Preview returnsfrom_markdown=3, imported=0; Apply succeeds (no more bail), backup directory created, report renders inline; idempotent re-Apply reportsskipped_unchanged=3. - [x] N/A: Linked issue is not auto-closed by this PR — see
## Related. #1440 covers OpenClaw + Hermes; this PR ships OpenClaw end-to-end and leaves #1440 open for the Hermes companion (per acceptance criterion 2: "do not leave Hermes unmentioned in UX; 'coming soon' is acceptable only with linked tracking issue").
Impact
- Runtime: desktop only. No new IPC commands. No new RPC method. RPC contract for
openhuman.migrate_openclawunchanged (dry_runstill defaults totrueat the handler level — old CLI/RPC callers continue to behave identically). - Performance: Apply now actually does work where it previously failed fast. The work itself is bounded by the OpenClaw source size; backup is one-time before the writes.
- Security: positive — moves migration off the "you have to know the RPC name" surface and onto an explicit confirm flow.
- Migration: backward compatible. Existing memory is backed up before any import runs (the
backup_target_memoryhelper was already in place; only the bail in front of it was the blocker). - Compatibility: cloud-independent. Works in fully-local mode since both halves are local-only.
Related
- Refs: #1440 (intentionally not auto-closed — see below)
- Coverage matrix rows: 13.5.4 Migration from another assistant (OpenClaw)
- Hermes: deliberately left open in #1440 as the linked tracking issue the panel's "on the roadmap" copy points at. Closing #1440 here would orphan the link and silently drop the Hermes ask — keeping it open is the honest read of acceptance criterion 2. If a maintainer would rather split Hermes into its own dedicated tracker, happy to spin one out and reword the panel copy on a follow-up.
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
- Key: N/A — human-authored, GitHub issue only.
- URL: N/A
Commit & Branch
- Branch: N/A
- Commit SHA: N/A
Validation Run
- [x]
pnpm --filter openhuman-app format:check - [x]
pnpm typecheck - [x] Focused tests:
pnpm exec vitest run --config test/vitest.config.ts src/components/settings/panels/__tests__/MigrationPanel.test.tsx— 7 passedpnpm debug rust migrate_openclaw— 6 passed (including the new Apply integration test)pnpm debug rust create_memory_for_migration— 1 passed (positive replacement of the always-errors regression)
- [x] Rust fmt/check (via
cargo check --manifest-path Cargo.toml) — clean. - [x] N/A: Tauri fmt/check (no Tauri shell changes).
Validation Blocked
command:N/Aerror:N/Aimpact:N/A
Behavior Changes
- Intended behavior change: OpenClaw migration is now discoverable from Settings AND the Apply path actually writes data instead of bailing.
- User-visible effect: new "Import from another assistant" item under Settings → Account; Preview shows planned counts, Apply imports markdown + brain.db entries into the workspace memory with a backup created first.
Parity Contract
- Legacy behavior preserved:
openhuman.migrate_openclawRPC contract unchanged (dry_rundefaults totrueat the handler level). CLI / RPC callers continue to behave identically. - Guard/fallback/dispatch parity checks: backup is still created before any write; idempotency check (existing entry with same content →
skipped_unchanged) untouched; rename-on-conflict behavior untouched. Only the bail in front of all that is replaced.
Duplicate / Superseded PR Handling
- Duplicate PR(s): none — verified no open/closed PR references #1440 before claiming.
- Canonical PR: this one.
- Resolution: N/A
Summary by CodeRabbit
-
New Features
- Added a Migration settings panel: choose vendor, optional source path, Preview (dry-run) then Apply (import) after a successful preview; Apply disabled until preview and requires confirmation; shows preview/applied reports, inline errors, and Hermes marked “coming soon” with a tracker link. Registered Migration in Settings navigation.
-
Localization
- Added migration UI translations across many languages.
-
Tests
- Added UI tests covering the preview→apply workflow.
-
Documentation
- Updated test-coverage matrix for migration.
[!NOTE]
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
- [ ] ▶️ Resume reviews
- [ ] 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a65bc236-2cd9-44f2-b6d6-69703d8921d6
📥 Commits
Reviewing files that changed from the base of the PR and between ebb6bda88042596bc6768c03e567d3f24503bf1e and a3505097c4d6c751d81e0e33af9ea2a31d424afe.
📒 Files selected for processing (30)
app/src/components/settings/panels/MigrationPanel.tsxapp/src/components/settings/panels/__tests__/MigrationPanel.test.tsxapp/src/lib/i18n/chunks/ar-1.tsapp/src/lib/i18n/chunks/ar-4.tsapp/src/lib/i18n/chunks/bn-1.tsapp/src/lib/i18n/chunks/bn-4.tsapp/src/lib/i18n/chunks/en-1.tsapp/src/lib/i18n/chunks/en-4.tsapp/src/lib/i18n/chunks/es-1.tsapp/src/lib/i18n/chunks/es-4.tsapp/src/lib/i18n/chunks/fr-1.tsapp/src/lib/i18n/chunks/fr-4.tsapp/src/lib/i18n/chunks/hi-1.tsapp/src/lib/i18n/chunks/hi-4.tsapp/src/lib/i18n/chunks/id-1.tsapp/src/lib/i18n/chunks/id-4.tsapp/src/lib/i18n/chunks/it-1.tsapp/src/lib/i18n/chunks/it-4.tsapp/src/lib/i18n/chunks/pt-1.tsapp/src/lib/i18n/chunks/pt-4.tsapp/src/lib/i18n/chunks/ru-1.tsapp/src/lib/i18n/chunks/ru-4.tsapp/src/lib/i18n/chunks/zh-CN-1.tsapp/src/lib/i18n/chunks/zh-CN-4.tsapp/src/lib/i18n/en.tsapp/src/pages/Settings.tsxdocs/TEST-COVERAGE-MATRIX.mdsrc/openhuman/memory/store/factories.rssrc/openhuman/migration/core.rssrc/openhuman/migration/ops.rs
✅ Files skipped from review due to trivial changes (11)
- app/src/lib/i18n/chunks/en-1.ts
- app/src/lib/i18n/chunks/bn-1.ts
- app/src/lib/i18n/chunks/bn-4.ts
- app/src/lib/i18n/chunks/pt-4.ts
- app/src/lib/i18n/chunks/en-4.ts
- app/src/lib/i18n/chunks/pt-1.ts
- app/src/lib/i18n/chunks/it-1.ts
- app/src/lib/i18n/chunks/es-4.ts
- app/src/lib/i18n/chunks/ar-1.ts
- docs/TEST-COVERAGE-MATRIX.md
- app/src/lib/i18n/chunks/es-1.ts
🚧 Files skipped from review as they are similar to previous changes (18)
- app/src/lib/i18n/chunks/zh-CN-4.ts
- src/openhuman/migration/core.rs
- app/src/lib/i18n/chunks/it-4.ts
- app/src/lib/i18n/chunks/ru-1.ts
- app/src/lib/i18n/chunks/fr-4.ts
- app/src/lib/i18n/chunks/fr-1.ts
- app/src/lib/i18n/chunks/zh-CN-1.ts
- app/src/lib/i18n/chunks/ar-4.ts
- app/src/lib/i18n/chunks/hi-4.ts
- app/src/pages/Settings.tsx
- src/openhuman/memory/store/factories.rs
- app/src/lib/i18n/chunks/id-1.ts
- app/src/lib/i18n/chunks/ru-4.ts
- app/src/components/settings/panels/tests/MigrationPanel.test.tsx
- src/openhuman/migration/ops.rs
- app/src/lib/i18n/chunks/hi-1.ts
- app/src/lib/i18n/en.ts
- app/src/components/settings/panels/MigrationPanel.tsx
📝 Walkthrough
Walkthrough
Adds a MigrationPanel UI for previewing and applying OpenClaw imports, i18n and settings routing, frontend tests, and backend changes to enable writable migration memory and an integration apply test.
Changes
OpenClaw Migration Feature
| Layer / File(s) | Summary |
|---|---|
Migration memory factory and backend infrastructure src/openhuman/memory/store/factories.rs, src/openhuman/migration/core.rs, src/openhuman/migration/ops.rs |
create_memory_for_migration now accepts &MemoryConfig and delegates to create_memory, enabling writable UnifiedMemory for migrations. Caller updated to pass config.memory. Adds integration test verifying non-dry-run apply imports markdown entries. |
MigrationPanel React component implementation app/src/components/settings/panels/MigrationPanel.tsx |
New default-exported MigrationPanel component: vendor dropdown (OpenClaw enabled, Hermes disabled/coming soon), source workspace input, Preview (dry-run) and Apply (confirm-gated) flows, loading/error state handling, and migration report rendering. |
Component tests app/src/components/settings/panels/__tests__/MigrationPanel.test.tsx |
Vitest + React Testing Library suite covering vendor defaults, Hermes callout, Preview RPC (dry_run=true) and rendering, source path trimming, Apply gating/confirmation (dry_run=false), cancel behavior, re-disable on edit, and RPC error rendering. |
Settings routing, i18n and docs app/src/pages/Settings.tsx, app/src/lib/i18n/*, docs/TEST-COVERAGE-MATRIX.md |
Registers /settings/.../migration route rendering MigrationPanel, adds MigrationIcon and account menu item, inserts migration.* translation keys across locales including English account labels, and updates TEST-COVERAGE-MATRIX.md to mark migration covered. |
Sequence Diagram
sequenceDiagram
participant User
participant MigrationPanel
participant TauriRPC
User->>MigrationPanel: Select vendor & enter source path
User->>MigrationPanel: Click Preview
MigrationPanel->>TauriRPC: openhumanMigrateOpenclaw(dry_run=true, source)
TauriRPC-->>MigrationPanel: MigrationReport (preview)
MigrationPanel->>User: Display preview report
User->>MigrationPanel: Click Apply
MigrationPanel->>User: window.confirm()
alt User confirms
MigrationPanel->>TauriRPC: openhumanMigrateOpenclaw(dry_run=false, source)
TauriRPC-->>MigrationPanel: MigrationReport (applied)
MigrationPanel->>User: Display applied report
else User cancels
MigrationPanel->>User: Keep preview report
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related issues
- tinyhumansai/openhuman#1440 — Implements the migration UI and OpenClaw/Hermes handling referenced by this issue.
Possibly related PRs
- tinyhumansai/openhuman#1518 — Related i18n infrastructure and translation usage referenced by the new migration strings.
- tinyhumansai/openhuman#1986 — Prior i18n/catalog changes that align with the new locale chunk updates.
Suggested reviewers
- graycyrus
Poem
🐰 I sniff the codepath, soft and keen,
A preview first—no change unseen,
Then confirm the hop to import true,
From OpenClaw fields into your view,
A rabbit's cheer for migrations new!
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly summarizes the main change: adding a user-facing OpenClaw migration UI panel and unblocking the unified-core memory factory for Apply operations. It is concise, specific, and directly related to the primary changes across both frontend and backend. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add
eslintto devDependencies.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
@obchain Could you add Closes #1440 to the PR description so the issue auto-closes on merge? Happy to spin out a separate Hermes tracker after this lands.