fix: load all plugins for wiki/memory CLI + preserve memory capability during snapshot loads#68041
fix: load all plugins for wiki/memory CLI + preserve memory capability during snapshot loads#68041HongzhuLiu wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Plugin CLI commands like `wiki bridge import` depend on cross-plugin capabilities (memory-core must be loaded for artifact enumeration). Without `loadPlugins: "always"`, only the command-owning plugin was loaded, causing `listActiveMemoryPublicArtifacts()` to return an empty list and bridge sync to delete all wiki pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryAdds Confidence Score: 5/5Safe to merge — minimal, targeted one-file fix that follows the established catalog pattern and addresses a confirmed production data-loss incident. The change is two lines, follows an identical pattern already used by six other commands, and the PR description includes direct verification of the fix (186 artifacts returned after the change vs. 0 before). No logic, tests, or interfaces are modified. No files require special attention. Reviews (1): Last reviewed commit: "fix: load all plugins for wiki and memor..." | Re-trigger Greptile |
Snapshot and error-recovery paths in loadOpenClawPlugins restored all memory plugin state fields except capability. This caused memoryPluginState.capability to be set to undefined whenever a non-activate plugin load occurred, which made listActiveMemoryPublicArtifacts return an empty array and wiki bridge delete all imported pages. Save and restore previousMemoryCapability alongside the other fields so publicArtifacts survives snapshot loads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
We hit the exact same bug on OpenClaw v2026.4.15. Root cause matches what this PR fixes: Current workaround: switching |
|
Related work from PRtags group Title: Open PR duplicate: memory capability lost across plugin scopes
|
Summary
Two related bugs that caused wiki bridge to persistently show 0 artifacts and delete all imported pages:
CLI plugin loading — Plugin CLI commands like
wiki bridge importdepend on cross-plugin capabilities (e.g. memory-core must be loaded for artifact enumeration). WithoutloadPlugins: "always", only the command-owning plugin was loaded.Gateway capability loss — Snapshot and error-recovery paths in
loadOpenClawPluginsrestored all memory plugin state fields exceptcapability. This causedmemoryPluginState.capabilityto be set toundefinedwhenever a non-activate plugin load occurred, makinglistActiveMemoryPublicArtifacts()return an empty array. Wiki bridge then interpreted this as "all artifacts removed" and deleted all previously imported pages.Root Cause
Commit 1:
src/cli/command-catalog.tswas missingloadPlugins: "always"entries forwikiandmemorycommand paths.Commit 2:
src/plugins/loader.tssaved and restoredpreviousMemory{FlushPlanResolver,PromptBuilder,CorpusSupplements,PromptSupplements,Runtime}but omittedpreviousMemoryCapability. WhenrestoreMemoryPluginStatereceived nocapabilityfield, it set it toundefined, erasing thepublicArtifactsregistration from memory-core.Fix
Commit 1: Add
loadPlugins: "always"forwikiandmemorycommand paths in the command catalog.Commit 2: Save
getMemoryCapabilityRegistration()before each plugin register call and pass it back viarestoreMemoryPluginState({ capability: previousMemoryCapability, ... })in both the!shouldActivateand error-recovery paths.Test plan
openclaw wiki bridge importloads memory-core and returns 193 artifacts across 2 workspacesopenclaw memory promoteworks correctly with all plugins loadedwiki_statusshows 193 exported artifacts (was 0 before fix)memory-state.test.ts— 11/11 tests passpnpm check)🤖 Generated with Claude Code