From 326a71352052ceb7dcc84dab5b3224434cf5c86b Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Santana Date: Tue, 10 Feb 2026 07:11:48 -0500 Subject: [PATCH] Onboard: reuse shared fetch timeout helper (#11106) (thanks @MackDing) --- src/commands/onboard-custom.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/commands/onboard-custom.ts b/src/commands/onboard-custom.ts index 58becb842f..ffbe8bcb66 100644 --- a/src/commands/onboard-custom.ts +++ b/src/commands/onboard-custom.ts @@ -4,6 +4,7 @@ import type { RuntimeEnv } from "../runtime.js"; import type { WizardPrompter } from "../wizard/prompts.js"; import { DEFAULT_PROVIDER } from "../agents/defaults.js"; import { buildModelAliasIndex, modelKey } from "../agents/model-selection.js"; +import { fetchWithTimeout } from "../utils/fetch-timeout.js"; import { applyPrimaryModel } from "./model-picker.js"; import { normalizeAlias } from "./models/shared.js"; @@ -133,20 +134,6 @@ function buildAnthropicHeaders(apiKey: string) { return headers; } -async function fetchWithTimeout( - url: string, - init: RequestInit, - timeoutMs: number, -): Promise { - const controller = new AbortController(); - const timeout = setTimeout(() => controller.abort(), timeoutMs); - try { - return await fetch(url, { ...init, signal: controller.signal }); - } finally { - clearTimeout(timeout); - } -} - function formatVerificationError(error: unknown): string { if (!error) { return "unknown error";