


























@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
33import { clearAllBootstrapSnapshots } from "../agents/bootstrap-cache.js";
44import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
55import { clearSessionStoreCacheForTest } from "../config/sessions/store.js";
6+import type { OpenClawConfig } from "../config/types.openclaw.js";
67import { resetAgentRunContextForTest } from "../infra/agent-events.js";
78import { createCliDeps, mockAgentPayloads } from "./isolated-agent.delivery.test-helpers.js";
89import { runCronIsolatedAgentTurn } from "./isolated-agent.js";
@@ -19,6 +20,25 @@ function lastEmbeddedCall(): { runTimeoutOverrideMs?: number; timeoutMs?: number
1920return calls.at(-1)?.[0] as { runTimeoutOverrideMs?: number; timeoutMs?: number };
2021}
212223+function makeTimeoutTestCfg(
24+home: string,
25+storePath: string,
26+timeoutSeconds: number,
27+): OpenClawConfig {
28+return makeCfg(home, storePath, {
29+agents: { defaults: { timeoutSeconds } },
30+models: {
31+providers: {
32+openai: {
33+baseUrl: "https://api.openai.com/v1",
34+agentRuntime: { id: "pi" },
35+models: [],
36+},
37+},
38+},
39+});
40+}
41+2242const envSnapshot = {
2343HOME: process.env.HOME,
2444USERPROFILE: process.env.USERPROFILE,
@@ -77,9 +97,7 @@ describe("runCronIsolatedAgentTurn — explicit per-run timeout signal", () => {
7797});
7898mockAgentPayloads([{ text: "ok" }]);
799980-const cfg = makeCfg(home, storePath, {
81-agents: { defaults: { timeoutSeconds: 300 } },
82-});
100+const cfg = makeTimeoutTestCfg(home, storePath, 300);
8310184102await runCronIsolatedAgentTurn({
85103 cfg,
@@ -109,9 +127,7 @@ describe("runCronIsolatedAgentTurn — explicit per-run timeout signal", () => {
109127});
110128mockAgentPayloads([{ text: "ok" }]);
111129112-const cfg = makeCfg(home, storePath, {
113-agents: { defaults: { timeoutSeconds: 300 } },
114-});
130+const cfg = makeTimeoutTestCfg(home, storePath, 300);
115131116132await runCronIsolatedAgentTurn({
117133 cfg,
@@ -141,9 +157,7 @@ describe("runCronIsolatedAgentTurn — explicit per-run timeout signal", () => {
141157});
142158mockAgentPayloads([{ text: "ok" }]);
143159144-const cfg = makeCfg(home, storePath, {
145-agents: { defaults: { timeoutSeconds: 300 } },
146-});
160+const cfg = makeTimeoutTestCfg(home, storePath, 300);
147161148162await runCronIsolatedAgentTurn({
149163 cfg,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。