The open source coding agent.
TypeScript
tweak: default to disabling fetch timeout in provider options
Aiden Cline51bba6e6343e
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.tsindex 2ffe9357c70..37e8e766344 100644--- a/packages/opencode/src/provider/provider.ts+++ b/packages/opencode/src/provider/provider.ts@@ -516,26 +516,29 @@ export namespace Provider {const modPath =provider.id === "google-vertex-anthropic" ? `${installedPath}/dist/anthropic/index.mjs` : installedPathconst mod = await import(modPath)- if (options["timeout"] !== undefined && options["timeout"] !== null) {++ const customFetch = options["fetch"]++ options["fetch"] = async (input: any, init?: BunFetchRequestInit) => {// Preserve custom fetch if it exists, wrap it with timeout logic- const customFetch = options["fetch"]- options["fetch"] = async (input: any, init?: BunFetchRequestInit) => {- const { signal, ...rest } = init ?? {}+ const fetchFn = customFetch ?? fetch+ const opts = init ?? {}+ if (options["timeout"] !== undefined && options["timeout"] !== null) {const signals: AbortSignal[] = []- if (signal) signals.push(signal)+ if (opts.signal) signals.push(opts.signal)if (options["timeout"] !== false) signals.push(AbortSignal.timeout(options["timeout"]))const combined = signals.length > 1 ? AbortSignal.any(signals) : signals[0]- const fetchFn = customFetch ?? fetch- return fetchFn(input, {- ...rest,- signal: combined,- // @ts-ignore see here: https://github.com/oven-sh/bun/issues/16682- timeout: false,- })+ opts.signal = combined}++ return fetchFn(input, {+ ...opts,+ // @ts-ignore see here: https://github.com/oven-sh/bun/issues/16682+ timeout: false,+ })}const fn = mod[Object.keys(mod).find((key) => key.startsWith("create"))!]const loaded = fn({