diff --git a/src/auto-reply/reply/commands-mesh.ts b/src/auto-reply/reply/commands-mesh.ts index d71ef596b..553807603 100644 --- a/src/auto-reply/reply/commands-mesh.ts +++ b/src/auto-reply/reply/commands-mesh.ts @@ -21,6 +21,10 @@ type ParsedMeshCommand = const meshPlanCache = new Map(); const MAX_CACHED_MESH_PLANS = 200; +const MESH_PLAN_CALL_TIMEOUT_MS = 120_000; +const MESH_RUN_CALL_TIMEOUT_MS = 15 * 60_000; +const MESH_STATUS_CALL_TIMEOUT_MS = 15_000; +const MESH_RETRY_CALL_TIMEOUT_MS = 15 * 60_000; function trimMeshPlanCache() { if (meshPlanCache.size <= MAX_CACHED_MESH_PLANS) { @@ -216,6 +220,7 @@ export const handleMeshCommand: CommandHandler = async (params, allowTextCommand agentId: params.agentId ?? "main", }, ...commonGateway, + timeoutMs: MESH_PLAN_CALL_TIMEOUT_MS, }); putCachedPlan(params, planResp.plan); const sourceLine = planResp.source ? `\nPlanner source: ${planResp.source}` : ""; @@ -252,6 +257,7 @@ export const handleMeshCommand: CommandHandler = async (params, allowTextCommand agentId: params.agentId ?? "main", }, ...commonGateway, + timeoutMs: MESH_PLAN_CALL_TIMEOUT_MS, }); putCachedPlan(params, planResp.plan); runPlan = planResp.plan; @@ -274,6 +280,7 @@ export const handleMeshCommand: CommandHandler = async (params, allowTextCommand plan: runPlan, }, ...commonGateway, + timeoutMs: MESH_RUN_CALL_TIMEOUT_MS, }); return { @@ -300,6 +307,7 @@ export const handleMeshCommand: CommandHandler = async (params, allowTextCommand method: "mesh.status", params: { runId: parsed.runId }, ...commonGateway, + timeoutMs: MESH_STATUS_CALL_TIMEOUT_MS, }); return { shouldContinue: false, @@ -326,6 +334,7 @@ export const handleMeshCommand: CommandHandler = async (params, allowTextCommand ...(parsed.stepIds && parsed.stepIds.length > 0 ? { stepIds: parsed.stepIds } : {}), }, ...commonGateway, + timeoutMs: MESH_RETRY_CALL_TIMEOUT_MS, }); return { shouldContinue: false,