From 2dacaff6a472ae1afb993c6c911a81c425e39ac2 Mon Sep 17 00:00:00 2001 From: The-AarushiSingh <175547726+The-AarushiSingh@users.noreply.github.com> Date: Mon, 5 Oct 2026 18:26:47 +0530 Subject: [PATCH 1/5] fix(cloudflare): fetch tunnel connections from dedicated endpoint after API removal --- apps/sim/tools/cloudflare/get_tunnel.ts | 28 +++++++++++++++++++---- apps/sim/tools/cloudflare/list_tunnels.ts | 7 +++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/apps/sim/tools/cloudflare/get_tunnel.ts b/apps/sim/tools/cloudflare/get_tunnel.ts index cf0faf957f0..609e3aaa0b1 100644 --- a/apps/sim/tools/cloudflare/get_tunnel.ts +++ b/apps/sim/tools/cloudflare/get_tunnel.ts @@ -6,7 +6,7 @@ export const getTunnelTool: ToolConfig cloudflareHeaders(params.apiKey), }, - transformResponse: async (response: Response) => { + transformResponse: async (response: Response, params?: CloudflareGetTunnelParams) => { const data = await response.json() if (!data.success) { @@ -63,6 +63,25 @@ export const getTunnelTool: ToolConfig connector.conns ?? [] + ) + } + } catch { + connections = null + } + } + return { success: true, output: { @@ -78,7 +97,7 @@ export const getTunnelTool: ToolConfig Date: Mon, 5 Oct 2026 18:37:25 +0530 Subject: [PATCH 2/5] fix(cloudflare): pass abort signal to tunnel connections fetch --- apps/sim/tools/cloudflare/get_tunnel.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/sim/tools/cloudflare/get_tunnel.ts b/apps/sim/tools/cloudflare/get_tunnel.ts index 609e3aaa0b1..5a44b124f9c 100644 --- a/apps/sim/tools/cloudflare/get_tunnel.ts +++ b/apps/sim/tools/cloudflare/get_tunnel.ts @@ -37,7 +37,11 @@ export const getTunnelTool: ToolConfig cloudflareHeaders(params.apiKey), }, - transformResponse: async (response: Response, params?: CloudflareGetTunnelParams) => { + transformResponse: async ( + response: Response, + params?: CloudflareGetTunnelParams, + context?: { signal?: AbortSignal } + ) => { const data = await response.json() if (!data.success) { @@ -70,6 +74,7 @@ export const getTunnelTool: ToolConfig Date: Mon, 5 Oct 2026 19:01:16 +0530 Subject: [PATCH 3/5] fix(cloudflare): surface connections lookup failures and preserve cancellation --- apps/sim/tools/cloudflare/get_tunnel.ts | 56 +++++++++++++++---------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/apps/sim/tools/cloudflare/get_tunnel.ts b/apps/sim/tools/cloudflare/get_tunnel.ts index 5a44b124f9c..acbbf69165c 100644 --- a/apps/sim/tools/cloudflare/get_tunnel.ts +++ b/apps/sim/tools/cloudflare/get_tunnel.ts @@ -44,24 +44,26 @@ export const getTunnelTool: ToolConfig { const data = await response.json() + const emptyOutput = { + id: '', + name: null, + account_tag: null, + config_src: null, + status: null, + tun_type: null, + remote_config: null, + metadata: null, + created_at: null, + deleted_at: null, + conns_active_at: null, + conns_inactive_at: null, + connections: null, + } + if (!data.success) { return { success: false, - output: { - id: '', - name: null, - account_tag: null, - config_src: null, - status: null, - tun_type: null, - remote_config: null, - metadata: null, - created_at: null, - deleted_at: null, - conns_active_at: null, - conns_inactive_at: null, - connections: null, - }, + output: emptyOutput, error: cloudflareErrorMessage(data, 'Failed to get tunnel'), } } @@ -77,13 +79,25 @@ export const getTunnelTool: ToolConfig connector.conns ?? [] - ) + if (!connectionsRes.ok || !connectionsData?.success) { + return { + success: false, + output: emptyOutput, + error: cloudflareErrorMessage(connectionsData, 'Failed to get tunnel connections'), + } + } + connections = Array.isArray(connectionsData.result) + ? connectionsData.result.flatMap( + (connector: { conns?: unknown[] }) => connector.conns ?? [] + ) + : [] + } catch (error) { + if (context?.signal?.aborted || (error as Error)?.name === 'AbortError') throw error + return { + success: false, + output: emptyOutput, + error: 'Failed to get tunnel connections', } - } catch { - connections = null } } From 146c389befed34f9ac7afa87bcecac572dbfca08 Mon Sep 17 00:00:00 2001 From: The-AarushiSingh <175547726+The-AarushiSingh@users.noreply.github.com> Date: Mon, 5 Oct 2026 19:07:28 +0530 Subject: [PATCH 4/5] style(cloudflare): fix list_tunnels description indentation --- apps/sim/tools/cloudflare/list_tunnels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sim/tools/cloudflare/list_tunnels.ts b/apps/sim/tools/cloudflare/list_tunnels.ts index 7f4407cca59..5a18da407e1 100644 --- a/apps/sim/tools/cloudflare/list_tunnels.ts +++ b/apps/sim/tools/cloudflare/list_tunnels.ts @@ -18,7 +18,7 @@ export const listTunnelsTool: ToolConfig< id: 'cloudflare_list_tunnels', name: 'Cloudflare List Tunnels', description: - 'Lists the Cloudflare Tunnels (cloudflared) in an account, with their health status. Connections are no longer included on list responses (Cloudflare API change 2026-10-05); use cloudflare_get_tunnel for a tunnel’s connections. Requires an API token with Account Cloudflare Tunnel Read.', + 'Lists the Cloudflare Tunnels (cloudflared) in an account, with their health status. Connections are no longer included on list responses (Cloudflare API change 2026-10-05); use cloudflare_get_tunnel for a tunnel’s connections. Requires an API token with Account Cloudflare Tunnel Read.', version: '1.0.0', params: { From 0c726fc564106e79dc30f08fcf2308702e76ef6e Mon Sep 17 00:00:00 2001 From: The-AarushiSingh <175547726+The-AarushiSingh@users.noreply.github.com> Date: Mon, 5 Oct 2026 19:18:07 +0530 Subject: [PATCH 5/5] chore(cloudflare): annotate raw fetch to Cloudflare connections endpoint --- apps/sim/tools/cloudflare/get_tunnel.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sim/tools/cloudflare/get_tunnel.ts b/apps/sim/tools/cloudflare/get_tunnel.ts index acbbf69165c..4ab3386064e 100644 --- a/apps/sim/tools/cloudflare/get_tunnel.ts +++ b/apps/sim/tools/cloudflare/get_tunnel.ts @@ -73,6 +73,7 @@ export const getTunnelTool: ToolConfig