From bbf5c66abd879b4e73cbec340060723ce2b06691 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Tue, 3 Feb 2026 16:40:23 -0800 Subject: [PATCH] address bugbot comments --- .../sim/lib/copilot/tools/client/base-tool.ts | 2 +- apps/sim/lib/core/execution-limits/types.ts | 35 ------------------- apps/sim/lib/mcp/utils.ts | 7 +--- 3 files changed, 2 insertions(+), 42 deletions(-) diff --git a/apps/sim/lib/copilot/tools/client/base-tool.ts b/apps/sim/lib/copilot/tools/client/base-tool.ts index 522dc1d04..8d7d396f9 100644 --- a/apps/sim/lib/copilot/tools/client/base-tool.ts +++ b/apps/sim/lib/copilot/tools/client/base-tool.ts @@ -7,7 +7,7 @@ const baseToolLogger = createLogger('BaseClientTool') const DEFAULT_TOOL_TIMEOUT_MS = 5 * 60 * 1000 -export const WORKFLOW_EXECUTION_TIMEOUT_MS = 5 * 60 * 1000 +export const WORKFLOW_EXECUTION_TIMEOUT_MS = 10 * 60 * 1000 // Client tool call states used by the new runtime export enum ClientToolCallState { diff --git a/apps/sim/lib/core/execution-limits/types.ts b/apps/sim/lib/core/execution-limits/types.ts index e7e69e232..463caebbd 100644 --- a/apps/sim/lib/core/execution-limits/types.ts +++ b/apps/sim/lib/core/execution-limits/types.ts @@ -51,37 +51,13 @@ export function getExecutionTimeout( return EXECUTION_TIMEOUTS[plan || 'free'][type] } -export function getExecutionTimeoutSeconds( - plan: SubscriptionPlan | undefined, - type: 'sync' | 'async' = 'sync' -): number { - return Math.floor(getExecutionTimeout(plan, type) / 1000) -} - export function getMaxExecutionTimeout(): number { return EXECUTION_TIMEOUTS.enterprise.async } export const DEFAULT_EXECUTION_TIMEOUT_MS = EXECUTION_TIMEOUTS.free.sync -export class ExecutionTimeoutError extends Error { - constructor( - public readonly timeoutMs: number, - public readonly plan?: SubscriptionPlan - ) { - const timeoutSeconds = Math.floor(timeoutMs / 1000) - const timeoutMinutes = Math.floor(timeoutSeconds / 60) - const displayTime = - timeoutMinutes > 0 - ? `${timeoutMinutes} minute${timeoutMinutes > 1 ? 's' : ''}` - : `${timeoutSeconds} seconds` - super(`Execution timed out after ${displayTime}`) - this.name = 'ExecutionTimeoutError' - } -} - export function isTimeoutError(error: unknown): boolean { - if (error instanceof ExecutionTimeoutError) return true if (!(error instanceof Error)) return false const name = error.name.toLowerCase() @@ -96,18 +72,7 @@ export function isTimeoutError(error: unknown): boolean { ) } -export function createTimeoutError( - timeoutMs: number, - plan?: SubscriptionPlan -): ExecutionTimeoutError { - return new ExecutionTimeoutError(timeoutMs, plan) -} - export function getTimeoutErrorMessage(error: unknown, timeoutMs?: number): string { - if (error instanceof ExecutionTimeoutError) { - return error.message - } - if (timeoutMs) { const timeoutSeconds = Math.floor(timeoutMs / 1000) const timeoutMinutes = Math.floor(timeoutSeconds / 60) diff --git a/apps/sim/lib/mcp/utils.ts b/apps/sim/lib/mcp/utils.ts index 58bf16c84..3e6af0551 100644 --- a/apps/sim/lib/mcp/utils.ts +++ b/apps/sim/lib/mcp/utils.ts @@ -1,6 +1,5 @@ import { NextResponse } from 'next/server' -import { DEFAULT_EXECUTION_TIMEOUT_MS, getExecutionTimeout } from '@/lib/core/execution-limits' -import type { SubscriptionPlan } from '@/lib/core/rate-limiter/types' +import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits' import type { McpApiResponse } from '@/lib/mcp/types' import { isMcpTool, MCP } from '@/executor/constants' @@ -13,10 +12,6 @@ export const MCP_CONSTANTS = { MAX_CONSECUTIVE_FAILURES: 3, } as const -export function getMcpExecutionTimeout(plan?: SubscriptionPlan): number { - return getExecutionTimeout(plan, 'sync') -} - /** * Core MCP tool parameter keys that are metadata, not user-entered test values. * These should be preserved when cleaning up params during schema updates.