Memory: harden lancedb dreaming config parsing

This commit is contained in:
Mariano Belinky
2026-04-09 20:07:41 +02:00
parent 037d146d36
commit 0fac3d38ca
3 changed files with 23 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ Docs: https://docs.openclaw.ai
- Matrix/runtime: resolve the verification/bootstrap runtime from a distinct packaged Matrix entry so global npm installs stop failing on crypto bootstrap with missing-module or recursive runtime alias errors. (#59249) Thanks @gumadeiras.
- Matrix/streaming: preserve ordered block flushes before tool, message, and agent boundaries, add explicit `channels.matrix.blockStreaming` opt-in so Matrix `streaming: "off"` stays final-only by default, and move MiniMax plain-text final handling into the MiniMax provider runtime instead of the shared core heuristic. (#59266) thanks @gumadeiras
- Gateway/agents: fix stale run-context TTL cleanup so the new maintenance sweep compiles and resets orphaned run sequence state correctly. (#52731) thanks @artwalker
- Memory/lancedb: accept `dreaming` config when `memory-lancedb` owns the memory slot so Dreaming surfaces can read slot-owner settings without schema rejection. (#63874) Thanks @mbelinky.
## 2026.4.9

View File

@@ -50,4 +50,15 @@ describe("memory-lancedb config", () => {
});
}).toThrow("memory config has unknown keys: unexpected");
});
it("rejects non-object dreaming values in runtime parsing", () => {
expect(() => {
memoryConfigSchema.parse({
embedding: {
apiKey: "sk-test",
},
dreaming: true,
});
}).toThrow("dreaming config must be an object");
});
});

View File

@@ -10,7 +10,7 @@ export type MemoryConfig = {
baseUrl?: string;
dimensions?: number;
};
dreaming?: unknown;
dreaming?: Record<string, unknown>;
dbPath?: string;
autoCapture?: boolean;
autoRecall?: boolean;
@@ -119,6 +119,15 @@ export const memoryConfigSchema = {
throw new Error("captureMaxChars must be between 100 and 10000");
}
const dreaming =
typeof cfg.dreaming === "undefined"
? undefined
: cfg.dreaming && typeof cfg.dreaming === "object" && !Array.isArray(cfg.dreaming)
? (cfg.dreaming as Record<string, unknown>)
: (() => {
throw new Error("dreaming config must be an object");
})();
return {
embedding: {
provider: "openai",
@@ -128,7 +137,7 @@ export const memoryConfigSchema = {
typeof embedding.baseUrl === "string" ? resolveEnvVars(embedding.baseUrl) : undefined,
dimensions: typeof embedding.dimensions === "number" ? embedding.dimensions : undefined,
},
dreaming: cfg.dreaming,
dreaming,
dbPath: typeof cfg.dbPath === "string" ? cfg.dbPath : DEFAULT_DB_PATH,
autoCapture: cfg.autoCapture === true,
autoRecall: cfg.autoRecall !== false,