feat(delegate-task): ⚙️ make sync subagent timeout configurable via syncPollTimeoutMs
Allow users to set `background_task.syncPollTimeoutMs` in config to override the default 10-minute sync subagent timeout. Affects sync task, sync continuation, and unstable agent task paths. Minimum value: 60000ms (1 minute). Co-authored-by: Wine Fox <fox@ling.plus>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types"
|
||||
import type { ExecutorContext, ParentContext, SessionMessage } from "./executor-types"
|
||||
import { getTimingConfig } from "./timing"
|
||||
import { DEFAULT_SYNC_POLL_TIMEOUT_MS, getTimingConfig } from "./timing"
|
||||
import { storeToolMetadata } from "../../features/tool-metadata-store"
|
||||
import { formatDuration } from "./time-formatter"
|
||||
import { formatDetailedError } from "./error-formatting"
|
||||
@@ -17,7 +17,7 @@ export async function executeUnstableAgentTask(
|
||||
systemContent: string | undefined,
|
||||
actualModel: string | undefined
|
||||
): Promise<string> {
|
||||
const { manager, client } = executorCtx
|
||||
const { manager, client, syncPollTimeoutMs } = executorCtx
|
||||
|
||||
try {
|
||||
const task = await manager.launch({
|
||||
@@ -80,7 +80,7 @@ export async function executeUnstableAgentTask(
|
||||
let stablePolls = 0
|
||||
let terminalStatus: { status: string; error?: string } | undefined
|
||||
|
||||
while (Date.now() - pollStart < timingCfg.MAX_POLL_TIME_MS) {
|
||||
while (Date.now() - pollStart < (syncPollTimeoutMs ?? DEFAULT_SYNC_POLL_TIMEOUT_MS)) {
|
||||
if (ctx.abort?.aborted) {
|
||||
return `Task aborted (was running in background mode).\n\nSession ID: ${sessionID}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user