mirror of
https://fastgit.cc/github.com/openclaw/openclaw
synced 2026-05-01 06:36:23 +08:00
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.
This commit is contained in:
committed by
Peter Steinberger
parent
ab1e091e39
commit
866d1eef0a
@@ -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"],
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user