From df9d26eb4335d717077029ae23c7b1b997aedb83 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 28 Apr 2026 18:55:44 -0700 Subject: [PATCH] fix(active-memory): narrow prompt hook timeout --- extensions/active-memory/index.test.ts | 14 ++++++++++++-- extensions/active-memory/index.ts | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/extensions/active-memory/index.test.ts b/extensions/active-memory/index.test.ts index 20bba56ac78..6fc0b9ee10d 100644 --- a/extensions/active-memory/index.test.ts +++ b/extensions/active-memory/index.test.ts @@ -185,9 +185,19 @@ describe("active-memory plugin", () => { it("registers a before_prompt_build hook", () => { expect(api.on).toHaveBeenCalledWith("before_prompt_build", expect.any(Function), { - timeoutMs: 150_000, + timeoutMs: 45_000, }); - expect(hookOptions.before_prompt_build?.timeoutMs).toBe(150_000); + expect(hookOptions.before_prompt_build?.timeoutMs).toBe(45_000); + }); + + it("registers before_prompt_build with the configured recall timeout plus setup grace", () => { + api.pluginConfig = { + agents: ["main"], + timeoutMs: 90_000, + }; + plugin.register(api as unknown as OpenClawPluginApi); + + expect(hookOptions.before_prompt_build?.timeoutMs).toBe(120_000); }); it("runs recall without recording shared auth-profile failures", async () => { diff --git a/extensions/active-memory/index.ts b/extensions/active-memory/index.ts index 7db163dc458..dc3b2f59fab 100644 --- a/extensions/active-memory/index.ts +++ b/extensions/active-memory/index.ts @@ -2431,7 +2431,7 @@ export default definePluginEntry({ }, }); - const beforePromptBuildTimeoutMs = 120_000 + setupGraceTimeoutMs; + const beforePromptBuildTimeoutMs = config.timeoutMs + setupGraceTimeoutMs; api.on( "before_prompt_build", async (event, ctx) => {