Skip to content

The open source coding agent.

TypeScript

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

Aiden Cline10ca1ace6be7
diff --git a/packages/opencode/src/plugin/github-copilot/models.ts b/packages/opencode/src/plugin/github-copilot/models.ts
index 6cbb17fe9a8..b6b27d03401 100644
--- a/packages/opencode/src/plugin/github-copilot/models.ts
+++ b/packages/opencode/src/plugin/github-copilot/models.ts
@@ -112,6 +112,7 @@ export namespace CopilotModels {
): Promise<Record<string, Model>> {
const data = await fetch(`${baseURL}/models`, {
headers,
+ signal: AbortSignal.timeout(5_000),
}).then(async (res) => {
if (!res.ok) {
throw new Error(`Failed to fetch models: ${res.status}`)