From 866d1eef0a77d376bdfd1a0f688aa545032d22ca Mon Sep 17 00:00:00 2001 From: Bartok Date: Sat, 18 Apr 2026 04:42:56 -0400 Subject: [PATCH] fix(active-memory): raise timeoutMs ceiling from 60s to 120s The normalizePluginConfig clamp hard-coded a 60_000 ms ceiling for config.timeoutMs, silently reducing any configured value above 60 seconds down to 60 000 ms at runtime. This made it impossible for operators to set longer recall budgets even though the docs (docs/pi.md) showed 120_000 as a valid example. Raise the ceiling to 120_000 ms so values between 60 001 and 120 000 are honored. Values above 120 000 are still clamped to prevent unbounded blocking. Adds two regression tests: - 90 000 ms is passed through unchanged - 200 000 ms is clamped to 120 000 ms Fixes #68410. --- extensions/active-memory/index.test.ts | 44 ++++++++++++++++++++++++++ extensions/active-memory/index.ts | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/extensions/active-memory/index.test.ts b/extensions/active-memory/index.test.ts index 102adaf6089..9cfa3bd1b9c 100644 --- a/extensions/active-memory/index.test.ts +++ b/extensions/active-memory/index.test.ts @@ -1140,6 +1140,50 @@ describe("active-memory plugin", () => { ).toBe(true); }); + it("honors configured timeoutMs values above the former 60 000 ms ceiling", async () => { + api.pluginConfig = { + agents: ["main"], + timeoutMs: 90_000, + logging: true, + }; + plugin.register(api as unknown as OpenClawPluginApi); + + await hooks.before_prompt_build( + { prompt: "what wings should i order? high timeout", messages: [] }, + { + agentId: "main", + trigger: "user", + sessionKey: "agent:main:high-timeout", + messageProvider: "webchat", + }, + ); + + const passedTimeoutMs = runEmbeddedPiAgent.mock.calls.at(-1)?.[0]?.timeoutMs; + expect(passedTimeoutMs).toBe(90_000); + }); + + it("clamps timeoutMs above the 120 000 ms ceiling to the ceiling", async () => { + api.pluginConfig = { + agents: ["main"], + timeoutMs: 200_000, + logging: true, + }; + plugin.register(api as unknown as OpenClawPluginApi); + + await hooks.before_prompt_build( + { prompt: "what wings should i order? capped timeout", messages: [] }, + { + agentId: "main", + trigger: "user", + sessionKey: "agent:main:capped-timeout", + messageProvider: "webchat", + }, + ); + + const passedTimeoutMs = runEmbeddedPiAgent.mock.calls.at(-1)?.[0]?.timeoutMs; + expect(passedTimeoutMs).toBe(120_000); + }); + it("sanitizes active-memory log fields onto a single line", async () => { api.pluginConfig = { agents: ["main"], diff --git a/extensions/active-memory/index.ts b/extensions/active-memory/index.ts index 09bd8db55b4..c30e11ad19f 100644 --- a/extensions/active-memory/index.ts +++ b/extensions/active-memory/index.ts @@ -633,7 +633,7 @@ function normalizePluginConfig(pluginConfig: unknown): ResolvedActiveRecallPlugi parseOptionalPositiveInt(raw.timeoutMs, DEFAULT_TIMEOUT_MS), DEFAULT_TIMEOUT_MS, 250, - 60_000, + 120_000, ), queryMode: raw.queryMode === "message" || raw.queryMode === "recent" || raw.queryMode === "full"