Skip to content

fix: load all plugins for wiki/memory CLI + preserve memory capability during snapshot loads#68041

Open
HongzhuLiu wants to merge 3 commits intoopenclaw:mainfrom
HongzhuLiu:fix/load-plugins-for-wiki-memory-cli
Open

fix: load all plugins for wiki/memory CLI + preserve memory capability during snapshot loads#68041
HongzhuLiu wants to merge 3 commits intoopenclaw:mainfrom
HongzhuLiu:fix/load-plugins-for-wiki-memory-cli

Conversation

@HongzhuLiu
Copy link
Copy Markdown

@HongzhuLiu HongzhuLiu commented Apr 17, 2026

Summary

Two related bugs that caused wiki bridge to persistently show 0 artifacts and delete all imported pages:

  1. CLI plugin loading — Plugin CLI commands like wiki bridge import depend on cross-plugin capabilities (e.g. memory-core must be loaded for artifact enumeration). Without loadPlugins: "always", only the command-owning plugin was loaded.

  2. Gateway capability loss — 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, making listActiveMemoryPublicArtifacts() 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.ts was missing loadPlugins: "always" entries for wiki and memory command paths.

Commit 2: src/plugins/loader.ts saved and restored previousMemory{FlushPlanResolver,PromptBuilder,CorpusSupplements,PromptSupplements,Runtime} but omitted previousMemoryCapability. When restoreMemoryPluginState received no capability field, it set it to undefined, erasing the publicArtifacts registration from memory-core.

Fix

Commit 1: Add loadPlugins: "always" for wiki and memory command paths in the command catalog.

Commit 2: Save getMemoryCapabilityRegistration() before each plugin register call and pass it back via restoreMemoryPluginState({ capability: previousMemoryCapability, ... }) in both the !shouldActivate and error-recovery paths.

Test plan

  • openclaw wiki bridge import loads memory-core and returns 193 artifacts across 2 workspaces
  • openclaw memory promote works correctly with all plugins loaded
  • Gateway runtime: wiki_status shows 193 exported artifacts (was 0 before fix)
  • Wiki bridge sync no longer deletes pages after snapshot plugin loads
  • memory-state.test.ts — 11/11 tests pass
  • All repo checks pass (pnpm check)

🤖 Generated with Claude Code

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>
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS labels Apr 17, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 17, 2026

Greptile Summary

Adds loadPlugins: "always" to the wiki and memory command paths in the CLI command catalog, matching the pattern already used by agent, message, channels, directory, agents, and configure. This fixes a production regression where wiki bridge import would see 0 artifacts because memory-core was not loaded under the default "never" policy.

Confidence Score: 5/5

Safe 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

HongzhuLiu and others added 2 commits April 17, 2026 18:57
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>
@HongzhuLiu HongzhuLiu changed the title fix: load all plugins for wiki and memory CLI commands fix: load all plugins for wiki/memory CLI + preserve memory capability during snapshot loads Apr 17, 2026
@zwj0117
Copy link
Copy Markdown

zwj0117 commented Apr 19, 2026

We hit the exact same bug on OpenClaw v2026.4.15. wiki bridge import always returns 0 artifacts even though our workspace has MEMORY.md and a populated memory/ directory. Confirmed both CLI and gateway RPC (openclaw gateway call wiki.bridge.import) return empty artifact lists.

Root cause matches what this PR fixes: memoryPluginState.capability (which holds publicArtifacts.listArtifacts) is never registered during plugin load, so listActiveMemoryPublicArtifacts returns [].

Current workaround: switching vaultMode to unsafe-local with explicit paths works fine and gives us 118 imported wiki source pages. Looking forward to this landing so we can use bridge mode again.

@prtags
Copy link
Copy Markdown

prtags Bot commented Apr 23, 2026

Related work from PRtags group cheerful-ox-0bzt

Title: Open PR duplicate: memory capability lost across plugin scopes

Number Title
#68041* fix: load all plugins for wiki/memory CLI + preserve memory capability during snapshot loads
#69458 fix(memory): keep active memory capability visible across plugin scopes

* This PR

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

Labels

cli CLI command changes size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants