Skip to content

Commit 419f165

Browse files
committed
fix(memory-lancedb): resolve the per-agent memorySearch gate via resolveAgentConfig
1 parent 035dc31 commit 419f165

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎extensions/memory-lancedb/index.ts‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Buffer } from "node:buffer";
1010
import { randomUUID } from "node:crypto";
1111
import type * as LanceDB from "@lancedb/lancedb";
1212
import type { AgentToolResult } from "openclaw/plugin-sdk/agent-core";
13+
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-runtime";
1314
import {
1415
optionalFiniteNumberSchema,
1516
optionalPositiveIntegerSchema,
@@ -25,7 +26,6 @@ import {
2526
} from "openclaw/plugin-sdk/number-runtime";
2627
import { readFiniteNumberParam, readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";
2728
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
28-
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
2929
import { ensureGlobalUndiciEnvProxyDispatcher } from "openclaw/plugin-sdk/runtime-env";
3030
import {
3131
asOptionalRecord as asRecord,
@@ -1432,24 +1432,15 @@ export default definePluginEntry({
14321432
// Mirrors core resolveMemorySearchConfig gating: the per-agent entry wins
14331433
// over agents.defaults, and unset means enabled. Without this gate, shared
14341434
// LanceDB memories leak into agents that disabled memory search (#103590).
1435+
// Per-agent resolution goes through the canonical resolveAgentConfig so id
1436+
// normalization/default-agent policy cannot drift from core.
14351437
const agentMemorySearchEnabled = (agentId: string | undefined): boolean => {
14361438
const runtimeCfg = api.runtime.config?.current?.() as OpenClawConfig | undefined;
14371439
if (!runtimeCfg) {
14381440
return true;
14391441
}
1440-
// Normalize both sides: configured ids like "XiaoHuo" or ids with stray
1441-
// whitespace must still hit their per-agent override, not the default.
1442-
const normalizedAgentId = agentId ? normalizeAgentId(agentId) : undefined;
1443-
const agentEntry = normalizedAgentId
1444-
? runtimeCfg.agents?.list?.find(
1445-
(entry) => normalizeAgentId(entry.id ?? "") === normalizedAgentId,
1446-
)
1447-
: undefined;
1448-
return (
1449-
agentEntry?.memorySearch?.enabled ??
1450-
runtimeCfg.agents?.defaults?.memorySearch?.enabled ??
1451-
true
1452-
);
1442+
const overrides = agentId ? resolveAgentConfig(runtimeCfg, agentId)?.memorySearch : undefined;
1443+
return overrides?.enabled ?? runtimeCfg.agents?.defaults?.memorySearch?.enabled ?? true;
14531444
};
14541445
const resolveCurrentHookConfig = () => {
14551446
const runtimePluginConfig = resolveLivePluginConfigObject(

0 commit comments

Comments
 (0)