File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
packages/opencode/src/provider Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -413,8 +413,21 @@ export namespace Provider {
413413 const mod = await import ( modPath )
414414 if ( options [ "timeout" ] !== undefined ) {
415415 // Only override fetch if user explicitly sets timeout
416- options [ "fetch" ] = async ( input : any , init ?: any ) => {
417- return await fetch ( input , { ...init , timeout : options [ "timeout" ] } )
416+ options [ "fetch" ] = async ( input : any , init ?: BunFetchRequestInit ) => {
417+ const { signal, ...rest } = init ?? { }
418+
419+ const signals : AbortSignal [ ] = [ ]
420+ if ( signal ) signals . push ( signal )
421+ signals . push ( AbortSignal . timeout ( options [ "timeout" ] ) )
422+
423+ const combined = signals . length > 1 ? AbortSignal . any ( signals ) : signals [ 0 ]
424+
425+ return fetch ( input , {
426+ ...rest ,
427+ signal : combined ,
428+ // @ts -ignore see here: https://github.com/oven-sh/bun/issues/16682
429+ timeout : false ,
430+ } )
418431 }
419432 }
420433 const fn = mod [ Object . keys ( mod ) . find ( ( key ) => key . startsWith ( "create" ) ) ! ]
You can’t perform that action at this time.
0 commit comments