fix(plugins): clear memory prompt section on plugin reload
This commit is contained in:
parent
d827603bc9
commit
586326158e
@ -23,7 +23,10 @@ export function buildMemoryPromptSection(params: {
|
||||
return _builder?.(params) ?? [];
|
||||
}
|
||||
|
||||
/** Reset state (for tests). */
|
||||
export function _resetMemoryPromptSection(): void {
|
||||
/** Clear the registered builder (called on plugin reload and in tests). */
|
||||
export function clearMemoryPromptSection(): void {
|
||||
_builder = undefined;
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link clearMemoryPromptSection}. */
|
||||
export const _resetMemoryPromptSection = clearMemoryPromptSection;
|
||||
|
||||
@ -10,6 +10,7 @@ import type { GatewayRequestHandler } from "../gateway/server-methods/types.js";
|
||||
import { openBoundaryFileSync } from "../infra/boundary-file-read.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
import { clearMemoryPromptSection } from "../memory/prompt-section.js";
|
||||
import { inspectBundleMcpRuntimeSupport } from "./bundle-mcp.js";
|
||||
import { clearPluginCommands } from "./commands.js";
|
||||
import {
|
||||
@ -113,6 +114,7 @@ const LAZY_RUNTIME_REFLECTION_KEYS = [
|
||||
export function clearPluginLoaderCache(): void {
|
||||
registryCache.clear();
|
||||
openAllowlistWarningCache.clear();
|
||||
clearMemoryPromptSection();
|
||||
}
|
||||
|
||||
const defaultLogger = () => createSubsystemLogger("plugins");
|
||||
@ -739,11 +741,12 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
|
||||
}
|
||||
}
|
||||
|
||||
// Clear previously registered plugin commands before reloading.
|
||||
// Clear previously registered plugin state before reloading.
|
||||
// Skip for non-activating (snapshot) loads to avoid wiping commands from other plugins.
|
||||
if (shouldActivate) {
|
||||
clearPluginCommands();
|
||||
clearPluginInteractiveHandlers();
|
||||
clearMemoryPromptSection();
|
||||
}
|
||||
|
||||
// Lazy: avoid creating the Jiti loader when all plugins are disabled (common in unit tests).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user