diff --git a/src/cron/isolated-agent.run-timeout-override.test.ts b/src/cron/isolated-agent.run-timeout-override.test.ts index e65d00b10c6..dc05459ccc5 100644 --- a/src/cron/isolated-agent.run-timeout-override.test.ts +++ b/src/cron/isolated-agent.run-timeout-override.test.ts @@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { clearAllBootstrapSnapshots } from "../agents/bootstrap-cache.js"; import { runEmbeddedPiAgent } from "../agents/pi-embedded.js"; import { clearSessionStoreCacheForTest } from "../config/sessions/store.js"; +import type { OpenClawConfig } from "../config/types.openclaw.js"; import { resetAgentRunContextForTest } from "../infra/agent-events.js"; import { createCliDeps, mockAgentPayloads } from "./isolated-agent.delivery.test-helpers.js"; import { runCronIsolatedAgentTurn } from "./isolated-agent.js"; @@ -19,6 +20,25 @@ function lastEmbeddedCall(): { runTimeoutOverrideMs?: number; timeoutMs?: number return calls.at(-1)?.[0] as { runTimeoutOverrideMs?: number; timeoutMs?: number }; } +function makeTimeoutTestCfg( + home: string, + storePath: string, + timeoutSeconds: number, +): OpenClawConfig { + return makeCfg(home, storePath, { + agents: { defaults: { timeoutSeconds } }, + models: { + providers: { + openai: { + baseUrl: "https://api.openai.com/v1", + agentRuntime: { id: "pi" }, + models: [], + }, + }, + }, + }); +} + const envSnapshot = { HOME: process.env.HOME, USERPROFILE: process.env.USERPROFILE, @@ -77,9 +97,7 @@ describe("runCronIsolatedAgentTurn — explicit per-run timeout signal", () => { }); mockAgentPayloads([{ text: "ok" }]); - const cfg = makeCfg(home, storePath, { - agents: { defaults: { timeoutSeconds: 300 } }, - }); + const cfg = makeTimeoutTestCfg(home, storePath, 300); await runCronIsolatedAgentTurn({ cfg, @@ -109,9 +127,7 @@ describe("runCronIsolatedAgentTurn — explicit per-run timeout signal", () => { }); mockAgentPayloads([{ text: "ok" }]); - const cfg = makeCfg(home, storePath, { - agents: { defaults: { timeoutSeconds: 300 } }, - }); + const cfg = makeTimeoutTestCfg(home, storePath, 300); await runCronIsolatedAgentTurn({ cfg, @@ -141,9 +157,7 @@ describe("runCronIsolatedAgentTurn — explicit per-run timeout signal", () => { }); mockAgentPayloads([{ text: "ok" }]); - const cfg = makeCfg(home, storePath, { - agents: { defaults: { timeoutSeconds: 300 } }, - }); + const cfg = makeTimeoutTestCfg(home, storePath, 300); await runCronIsolatedAgentTurn({ cfg,