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: {
cfg: OpenClawConfig;
agentId: string;
purpose?: "default" | "status";
}): Promise<MemoryIndexManager | null> {
const { cfg, agentId } = params;
const settings = resolveMemorySearchConfig(cfg, agentId);
@@ -129,6 +130,7 @@ export class MemoryIndexManager implements MemorySearchManager {
workspaceDir,
settings,
providerResult,
purpose: params.purpose,
});
INDEX_CACHE.set(key, manager);
return manager;
@@ -141,6 +143,7 @@ export class MemoryIndexManager implements MemorySearchManager {
workspaceDir: string;
settings: ResolvedMemorySearchConfig;
providerResult: EmbeddingProviderResult;
purpose?: "default" | "status";
}) {
this.cacheKey = params.cacheKey;
this.cfg = params.cfg;
@@ -175,7 +178,8 @@ export class MemoryIndexManager implements MemorySearchManager {
this.ensureWatcher();
this.ensureSessionListener();
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();
}