fix (memory/builtin): keep status dirty state stable across invocations

This commit is contained in:
Vignesh Natarajan
2026-02-14 18:48:34 -08:00
parent cf04208cb9
commit 7addb519da

View File

@@ -101,6 +101,7 @@ export class MemoryIndexManager implements MemorySearchManager {
static async get(params: { static async get(params: {
cfg: OpenClawConfig; cfg: OpenClawConfig;
agentId: string; agentId: string;
purpose?: "default" | "status";
}): Promise<MemoryIndexManager | null> { }): Promise<MemoryIndexManager | null> {
const { cfg, agentId } = params; const { cfg, agentId } = params;
const settings = resolveMemorySearchConfig(cfg, agentId); const settings = resolveMemorySearchConfig(cfg, agentId);
@@ -129,6 +130,7 @@ export class MemoryIndexManager implements MemorySearchManager {
workspaceDir, workspaceDir,
settings, settings,
providerResult, providerResult,
purpose: params.purpose,
}); });
INDEX_CACHE.set(key, manager); INDEX_CACHE.set(key, manager);
return manager; return manager;
@@ -141,6 +143,7 @@ export class MemoryIndexManager implements MemorySearchManager {
workspaceDir: string; workspaceDir: string;
settings: ResolvedMemorySearchConfig; settings: ResolvedMemorySearchConfig;
providerResult: EmbeddingProviderResult; providerResult: EmbeddingProviderResult;
purpose?: "default" | "status";
}) { }) {
this.cacheKey = params.cacheKey; this.cacheKey = params.cacheKey;
this.cfg = params.cfg; this.cfg = params.cfg;
@@ -175,7 +178,8 @@ export class MemoryIndexManager implements MemorySearchManager {
this.ensureWatcher(); this.ensureWatcher();
this.ensureSessionListener(); this.ensureSessionListener();
this.ensureIntervalSync(); this.ensureIntervalSync();
this.dirty = this.sources.has("memory"); const statusOnly = params.purpose === "status";
this.dirty = this.sources.has("memory") && (statusOnly ? !meta : true);
this.batch = this.resolveBatchConfig(); this.batch = this.resolveBatchConfig();
} }