fix(gateway): set explicit chat timeouts for mesh gateway calls

This commit is contained in:
ranausmanai
2026-02-16 21:55:20 +05:00
committed by Peter Steinberger
parent 16e59b26a6
commit c529e6005a

View File

@@ -21,6 +21,10 @@ type ParsedMeshCommand =
const meshPlanCache = new Map<string, CachedMeshPlan>();
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,