Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(openclaw): merge runtime query config updates (#2673)

Evo81a9dd29ec36
diff --git a/examples/openclaw-plugin/query-config.ts b/examples/openclaw-plugin/query-config.ts
index 031d6f6ee..3053e5e42 100644
--- a/examples/openclaw-plugin/query-config.ts
+++ b/examples/openclaw-plugin/query-config.ts
@@ -231,7 +231,13 @@ export class RuntimeQueryConfigStore {
const { params, warnings } = normalizeRuntimeQueryParams(patch);
const key = this.keyForScope(scope, ctx);
const bucket = scope === "claw" ? this.data.claws : this.data.sessions;
- bucket[key] = { params, updatedAt: Date.now(), updatedBy: "command", peerId: ctx.peerId };
+ const previous = bucket[key];
+ bucket[key] = {
+ params: { ...(previous?.params ?? {}), ...params },
+ updatedAt: Date.now(),
+ updatedBy: "command",
+ peerId: ctx.peerId,
+ };
this.data.updatedAt = Date.now();
await this.persist();
return { warnings };
diff --git a/examples/openclaw-plugin/tests/ut/query-config.test.ts b/examples/openclaw-plugin/tests/ut/query-config.test.ts
index 589a7b482..d938485e9 100644
--- a/examples/openclaw-plugin/tests/ut/query-config.test.ts
+++ b/examples/openclaw-plugin/tests/ut/query-config.test.ts
@@ -175,4 +175,19 @@ describe("RuntimeQueryConfigStore", () => {
expect(afterReset.recallLimit).toBe(6);
expect(afterReset.scoreThreshold).toBe(0.15);
});
+
+ it("merges incremental set calls within the same runtime scope", async () => {
+ const cfg = memoryOpenVikingConfigSchema.parse({ recallLimit: 6, recallScoreThreshold: 0.15 });
+ const store = RuntimeQueryConfigStore.createInMemory(cfg);
+ const ctx = { peerId: "assistant-a", sessionId: "s1" };
+
+ await store.set("session", ctx, { recallLimit: 2 });
+ await store.set("session", ctx, { scoreThreshold: 0.4 });
+
+ const effective = await store.getEffective(ctx);
+ expect(effective.recallLimit).toBe(2);
+ expect(effective.scoreThreshold).toBe(0.4);
+ expect(effective.sources.recallLimit).toBe("session");
+ expect(effective.sources.scoreThreshold).toBe("session");
+ });
});