f3ff32fd18
Tasks with no progress.lastUpdate were silently skipped in checkAndInterruptStaleTasks, causing them to hang forever when the model hangs before its first tool call. Now falls back to checking startedAt against a configurable messageStalenessTimeoutMs (default: 10 minutes). Closes #1769
14 lines
775 B
TypeScript
14 lines
775 B
TypeScript
import { z } from "zod"
|
|
|
|
export const BackgroundTaskConfigSchema = z.object({
|
|
defaultConcurrency: z.number().min(1).optional(),
|
|
providerConcurrency: z.record(z.string(), z.number().min(0)).optional(),
|
|
modelConcurrency: z.record(z.string(), z.number().min(0)).optional(),
|
|
/** Stale timeout in milliseconds - interrupt tasks with no activity for this duration (default: 180000 = 3 minutes, minimum: 60000 = 1 minute) */
|
|
staleTimeoutMs: z.number().min(60000).optional(),
|
|
/** Timeout for tasks that never received any progress update, falling back to startedAt (default: 600000 = 10 minutes, minimum: 60000 = 1 minute) */
|
|
messageStalenessTimeoutMs: z.number().min(60000).optional(),
|
|
})
|
|
|
|
export type BackgroundTaskConfig = z.infer<typeof BackgroundTaskConfigSchema>
|