fix(copilot): honor advertised model endpoints (#34958)

This commit is contained in:
Aiden Cline 2026-07-02 10:23:57 -05:00 committed by GitHub
commit 373cd08b98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 131 additions and 20 deletions

View file

@ -157,6 +157,42 @@ describe("GithubCopilotPlugin", () => {
}),
)
it.effect("uses advertised Copilot endpoint metadata before model ID fallbacks", () =>
Effect.gen(function* () {
const plugin = yield* PluginV2.Service
const aisdk = yield* AISDK.Service
const calls: string[] = []
yield* addPlugin()
yield* aisdk.runLanguage({
model: ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("github-copilot"), ModelV2.ID.make("mai-code-1-flash-picker")),
api: {
id: ModelV2.ID.make("mai-code-1-flash-picker"),
type: "aisdk",
package: "test-provider",
settings: { endpoint: "responses" },
},
}),
sdk: fakeSelectorSdk(calls),
options: { endpoint: "responses" },
})
yield* aisdk.runLanguage({
model: ModelV2.Info.make({
...ModelV2.Info.empty(ProviderV2.ID.make("github-copilot"), ModelV2.ID.make("gpt-5")),
api: {
id: ModelV2.ID.make("gpt-5"),
type: "aisdk",
package: "test-provider",
settings: { endpoint: "chat" },
},
}),
sdk: fakeSelectorSdk(calls),
options: { endpoint: "chat" },
})
expect(calls).toEqual(["responses:mai-code-1-flash-picker", "chat:gpt-5"])
}),
)
it.effect("uses the API model ID when selecting responses or chat", () =>
Effect.gen(function* () {
const plugin = yield* PluginV2.Service