fix(claw): allow ten-minute chat tasks

This commit is contained in:
134 2026-08-07 12:12:11 +08:00
parent 7708b66e8d
commit f1b769490a
4 changed files with 24 additions and 9 deletions

View File

@ -2225,7 +2225,7 @@ export function AdminSettingsClient() {
enabled: false,
baseUrl: DEFAULT_OPENCLAW_CHAT_BASE_URL,
token: "",
timeoutMs: 180_000,
timeoutMs: 600_000,
});
const [openClawChatTokenConfigured, setOpenClawChatTokenConfigured] =
useState(false);
@ -2518,8 +2518,8 @@ export function AdminSettingsClient() {
String(raw.baseUrl || "").trim() || DEFAULT_OPENCLAW_CHAT_BASE_URL,
token: "",
timeoutMs: Math.min(
300_000,
Math.max(5_000, Math.round(Number(raw.timeoutMs) || 180_000))
600_000,
Math.max(5_000, Math.round(Number(raw.timeoutMs) || 600_000))
),
});
setOpenClawChatTokenConfigured(
@ -4372,8 +4372,8 @@ export function AdminSettingsClient() {
openClawChatConfig.baseUrl.trim() || DEFAULT_OPENCLAW_CHAT_BASE_URL,
token: openClawChatConfig.token.trim(),
timeoutMs: Math.min(
300_000,
Math.max(5_000, Math.round(Number(openClawChatConfig.timeoutMs) || 180_000))
600_000,
Math.max(5_000, Math.round(Number(openClawChatConfig.timeoutMs) || 600_000))
),
};
@ -12694,11 +12694,11 @@ export function AdminSettingsClient() {
<Input
id="openClawChatTimeoutMs"
min={5000}
max={300000}
max={600000}
onChange={(event) =>
setOpenClawChatConfig((prev) => ({
...prev,
timeoutMs: Number(event.target.value) || 180000,
timeoutMs: Number(event.target.value) || 600000,
}))
}
type="number"

View File

@ -20,9 +20,9 @@ export type AdminOpenClawChatConfig = Omit<OpenClawChatConfig, "token"> & {
tokenPreview: string;
};
const DEFAULT_TIMEOUT_MS = 180_000;
const DEFAULT_TIMEOUT_MS = 600_000;
const MIN_TIMEOUT_MS = 5_000;
const MAX_TIMEOUT_MS = 300_000;
const MAX_TIMEOUT_MS = 600_000;
function readRecord(value: unknown): Record<string, unknown> {
return value && typeof value === "object" && !Array.isArray(value)

View File

@ -16,6 +16,7 @@ export default defineConfig({
/routes\/clawd-request-lifecycle\.test\.ts/,
/routes\/canvas-skill-tag-order\.test\.ts/,
/routes\/openclaw-client-errors\.test\.ts/,
/routes\/openclaw-config\.test\.ts/,
/routes\/openclaw-durable-task-state\.test\.ts/,
/routes\/openclaw-request-state\.test\.ts/,
/routes\/openclaw-video-attachments\.test\.ts/,

View File

@ -0,0 +1,14 @@
import { expect, test } from "@playwright/test";
import { normalizeOpenClawChatConfig } from "@/lib/openclaw-chat/config";
test.describe("OpenClaw chat timeout config", () => {
test("defaults long-running tasks to ten minutes", () => {
expect(normalizeOpenClawChatConfig({}).timeoutMs).toBe(600_000);
});
test("caps configured timeouts at ten minutes", () => {
expect(
normalizeOpenClawChatConfig({ timeoutMs: 900_000 }).timeoutMs
).toBe(600_000);
});
});