Explorar o código

tweak: add abort signal timeout to the github copilot model fetch to prevent infinite blocking (#20705)

Aiden Cline hai 5 meses
pai
achega
10ca1ace6b
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      packages/opencode/src/plugin/github-copilot/models.ts

+ 1 - 0
packages/opencode/src/plugin/github-copilot/models.ts

@@ -112,6 +112,7 @@ export namespace CopilotModels {
   ): Promise<Record<string, Model>> {
   ): Promise<Record<string, Model>> {
     const data = await fetch(`${baseURL}/models`, {
     const data = await fetch(`${baseURL}/models`, {
       headers,
       headers,
+      signal: AbortSignal.timeout(5_000),
     }).then(async (res) => {
     }).then(async (res) => {
       if (!res.ok) {
       if (!res.ok) {
         throw new Error(`Failed to fetch models: ${res.status}`)
         throw new Error(`Failed to fetch models: ${res.status}`)