Skip to content

Commit ee09409

Browse files
committed
fix(runtime): double default agent timeouts
1 parent 36d6a4b commit ee09409

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

runtime/src/channels/web/handlers/agent.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,11 @@ export async function processChat(
864864
const hasActiveClients = channel.sse.clients.size > 0;
865865
// Keep interactive web turns bounded so stalled sessions still reach a
866866
// terminal state, but do not clamp them too aggressively. A 5 minute cap
867-
// proved too short for legitimate long-running tool workflows, and 15
868-
// minutes has still been a little tight for some real sessions, so allow up
869-
// to 20 minutes here while still respecting any lower global timeout.
867+
// proved too short for legitimate long-running tool workflows, 20 minutes
868+
// has still been too tight for some real sessions, so allow up to 40
869+
// minutes here while still respecting any lower global timeout.
870870
const agentRuntimeConfig = getAgentRuntimeConfig();
871-
const INTERACTIVE_WEB_TIMEOUT_MS = Math.min(agentRuntimeConfig.timeoutMs, 20 * 60 * 1000);
871+
const INTERACTIVE_WEB_TIMEOUT_MS = Math.min(agentRuntimeConfig.timeoutMs, 40 * 60 * 1000);
872872
const timeoutMs = hasActiveClients
873873
? INTERACTIVE_WEB_TIMEOUT_MS
874874
: (agentRuntimeConfig.backgroundTimeoutMs > 0 ? agentRuntimeConfig.backgroundTimeoutMs : agentRuntimeConfig.timeoutMs);

runtime/src/core/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ export const AGENT_RUNTIME_CONFIG = Object.freeze<AgentRuntimeConfig>({
396396
envConfig.PICLAW_AGENT_TIMEOUT ||
397397
process.env.AGENT_TIMEOUT ||
398398
envConfig.AGENT_TIMEOUT ||
399-
"1800000",
399+
"3600000",
400400
10
401401
),
402402
backgroundTimeoutMs: parseInt(

runtime/test/config/config.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,19 @@ test("agent runtime config getter groups foreground and background timeout setti
332332
);
333333
});
334334

335+
test("agent runtime config defaults to a one-hour foreground timeout", async () => {
336+
await withTempWorkspaceEnv(
337+
"piclaw-config-",
338+
{},
339+
async () => {
340+
const cfg = await importFresh<typeof import("../../src/core/config.js")>("../src/core/config.js");
341+
342+
expect(cfg.AGENT_RUNTIME_CONFIG.timeoutMs).toBe(3600000);
343+
expect(cfg.AGENT_RUNTIME_CONFIG.backgroundTimeoutMs).toBe(0);
344+
},
345+
);
346+
});
347+
335348
test("runtime timing config getter groups poll intervals and timezone", async () => {
336349
await withTempWorkspaceEnv(
337350
"piclaw-config-",

0 commit comments

Comments
 (0)