mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix(memory-wiki): skip bridge pruning when memory-core is not loaded (#71764)
When memory-core plugin is not registered (e.g. CLI context), listActiveMemoryPublicArtifacts returns an empty array. The previous code would then call pruneImportedSourceEntries with an empty activeKeys Set, which removes ALL bridge-imported entries. Now checks getMemoryCapabilityRegistration() instead of relying on artifact count as a proxy, correctly distinguishing between 'plugin not loaded' and 'plugin loaded with no artifacts'. Fixes #68373
This commit is contained in:
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import {
|
||||
getMemoryCapabilityRegistration,
|
||||
listActiveMemoryPublicArtifacts,
|
||||
type MemoryPluginPublicArtifact,
|
||||
} from "openclaw/plugin-sdk/memory-host-core";
|
||||
@@ -248,12 +249,17 @@ export async function syncMemoryWikiBridgeSources(params: {
|
||||
}
|
||||
const workspaceCount = new Set(publicArtifacts.map((artifact) => artifact.workspaceDir)).size;
|
||||
|
||||
const removedCount = await pruneImportedSourceEntries({
|
||||
vaultRoot: params.config.vault.path,
|
||||
group: "bridge",
|
||||
activeKeys,
|
||||
state,
|
||||
});
|
||||
// Skip pruning when memory-core is not loaded (e.g. CLI context) to avoid
|
||||
// removing all bridge-imported entries. See #68373.
|
||||
const memoryCapability = getMemoryCapabilityRegistration();
|
||||
const removedCount = memoryCapability
|
||||
? await pruneImportedSourceEntries({
|
||||
vaultRoot: params.config.vault.path,
|
||||
group: "bridge",
|
||||
activeKeys,
|
||||
state,
|
||||
})
|
||||
: 0;
|
||||
await writeMemoryWikiSourceSyncState(params.config.vault.path, state);
|
||||
const importedCount = results.filter((result) => result.changed && result.created).length;
|
||||
const updatedCount = results.filter((result) => result.changed && !result.created).length;
|
||||
|
||||
@@ -20,6 +20,7 @@ export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
export {
|
||||
buildMemoryPromptSection as buildActiveMemoryPromptSection,
|
||||
listActiveMemoryPublicArtifacts,
|
||||
getMemoryCapabilityRegistration,
|
||||
} from "../plugins/memory-state.js";
|
||||
export { parseAgentSessionKey } from "../routing/session-key.js";
|
||||
export type { OpenClawConfig } from "../config/config.js";
|
||||
|
||||
Reference in New Issue
Block a user