relax task timeouts: stale timeout 3min→20min, session wait 30s→1min

This commit is contained in:
YeonGyu-Kim
2026-03-17 16:27:00 +09:00
parent 90351e442e
commit b788586caf
5 changed files with 36 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import type { BackgroundTask, LaunchInput } from "./types"
export const TASK_TTL_MS = 30 * 60 * 1000
export const TERMINAL_TASK_TTL_MS = 30 * 60 * 1000
export const MIN_STABILITY_TIME_MS = 10 * 1000
export const DEFAULT_STALE_TIMEOUT_MS = 180_000
export const DEFAULT_STALE_TIMEOUT_MS = 1_200_000
export const DEFAULT_MESSAGE_STALENESS_TIMEOUT_MS = 1_800_000
export const DEFAULT_MAX_TOOL_CALLS = 200
export const DEFAULT_CIRCUIT_BREAKER_WINDOW_SIZE = 20

View File

@@ -0,0 +1,17 @@
declare const require: (name: string) => any
const { describe, expect, test } = require("bun:test")
import { DEFAULT_STALE_TIMEOUT_MS } from "./constants"
describe("DEFAULT_STALE_TIMEOUT_MS", () => {
test("uses a 20 minute default", () => {
// #given
const expectedTimeout = 20 * 60 * 1000
// #when
const timeout = DEFAULT_STALE_TIMEOUT_MS
// #then
expect(timeout).toBe(expectedTimeout)
})
})

View File

@@ -3027,10 +3027,10 @@ describe("BackgroundManager.checkAndInterruptStaleTasks", () => {
prompt: "Test",
agent: "test-agent",
status: "running",
startedAt: new Date(Date.now() - 300_000),
startedAt: new Date(Date.now() - 25 * 60 * 1000),
progress: {
toolCalls: 1,
lastUpdate: new Date(Date.now() - 200_000),
lastUpdate: new Date(Date.now() - 21 * 60 * 1000),
},
}

View File

@@ -1,6 +1,6 @@
declare const require: (name: string) => any
const { describe, expect, test } = require("bun:test")
import { __resetTimingConfig, __setTimingConfig, getDefaultSyncPollTimeoutMs } from "./timing"
import { __resetTimingConfig, __setTimingConfig, getDefaultSyncPollTimeoutMs, getTimingConfig } from "./timing"
describe("timing sync poll timeout defaults", () => {
test("default sync timeout is 30 minutes", () => {
@@ -27,3 +27,16 @@ describe("timing sync poll timeout defaults", () => {
__resetTimingConfig()
})
})
describe("WAIT_FOR_SESSION_TIMEOUT_MS default", () => {
test("default wait for session timeout is 1 minute", () => {
// #given
__resetTimingConfig()
// #when
const config = getTimingConfig()
// #then
expect(config.WAIT_FOR_SESSION_TIMEOUT_MS).toBe(60_000)
})
})

View File

@@ -2,7 +2,7 @@ let POLL_INTERVAL_MS = 1000
let MIN_STABILITY_TIME_MS = 10000
let STABILITY_POLLS_REQUIRED = 3
let WAIT_FOR_SESSION_INTERVAL_MS = 100
let WAIT_FOR_SESSION_TIMEOUT_MS = 30000
let WAIT_FOR_SESSION_TIMEOUT_MS = 60000
const DEFAULT_POLL_TIMEOUT_MS = 30 * 60 * 1000
let MAX_POLL_TIME_MS = DEFAULT_POLL_TIMEOUT_MS
let SESSION_CONTINUATION_STABILITY_MS = 5000
@@ -30,7 +30,7 @@ export function __resetTimingConfig(): void {
MIN_STABILITY_TIME_MS = 10000
STABILITY_POLLS_REQUIRED = 3
WAIT_FOR_SESSION_INTERVAL_MS = 100
WAIT_FOR_SESSION_TIMEOUT_MS = 30000
WAIT_FOR_SESSION_TIMEOUT_MS = 60000
MAX_POLL_TIME_MS = DEFAULT_POLL_TIMEOUT_MS
SESSION_CONTINUATION_STABILITY_MS = 5000
}