Skip to content

Commit 0068cce

Browse files
authored
fix: ensure copilot model list filters out disabled models (#23176)
1 parent 89e8994 commit 0068cce

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

packages/opencode/src/plugin/github-copilot/copilot.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Hooks, PluginInput } from "@opencode-ai/plugin"
22
import type { Model } from "@opencode-ai/sdk/v2"
3-
import { Installation } from "@/installation"
43
import { InstallationVersion } from "@/installation/version"
54
import { iife } from "@/util/iife"
65
import { Log } from "../../util"

packages/opencode/src/plugin/github-copilot/models.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ export const schema = z.object({
1010
// every version looks like: `{model.id}-YYYY-MM-DD`
1111
version: z.string(),
1212
supported_endpoints: z.array(z.string()).optional(),
13+
policy: z
14+
.object({
15+
state: z.string().optional(),
16+
})
17+
.optional(),
1318
capabilities: z.object({
1419
family: z.string(),
1520
limits: z.object({
@@ -122,7 +127,9 @@ export async function get(
122127
})
123128

124129
const result = { ...existing }
125-
const remote = new Map(data.data.filter((m) => m.model_picker_enabled).map((m) => [m.id, m] as const))
130+
const remote = new Map(
131+
data.data.filter((m) => m.model_picker_enabled && m.policy?.state !== "disabled").map((m) => [m.id, m] as const),
132+
)
126133

127134
// prune existing models whose api.id isn't in the endpoint response
128135
for (const [key, model] of Object.entries(result)) {

0 commit comments

Comments
 (0)