Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ts/config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ openAI:
# --- Copilot (Copilot SDK chat + Copilot embeddings) -----------------------
# modelProvider: copilot
# copilot:
# defaultModel: gpt-5.6-luna # requires an authenticated `copilot` CLI
# fallbackModels: # first available concrete model is used
# defaultModel: gpt-6-luna # requires an authenticated `copilot` CLI
# fallbackModels: # after the matching GPT-5.6 tier, use the first available model
# - gpt-5.4-mini
# - gpt-5-mini
# - gpt-5.4
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/aiclient/src/copilotModelDefaults.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

export const DEFAULT_COPILOT_MODEL = "gpt-5.6-luna";
export const DEFAULT_COPILOT_MODEL = "gpt-6-luna";

export const DEFAULT_COPILOT_FALLBACK_MODELS: readonly string[] = [
"gpt-5.4-mini",
Expand Down
6 changes: 6 additions & 0 deletions ts/packages/aiclient/src/copilotModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,12 @@ export function selectCopilotModel(
const requestedModel = byId.get(requested);
if (requestedModel !== undefined) return requestedModel;

const previousTier = /^gpt-6-(luna|sol)$/.exec(requested)?.[1];
if (previousTier !== undefined) {
const previousModel = byId.get(`gpt-5.6-${previousTier}`);
if (previousModel !== undefined) return previousModel;
}

for (const fallback of fallbackModels) {
const fallbackModel = byId.get(fallback);
if (fallbackModel !== undefined) return fallbackModel;
Expand Down
14 changes: 7 additions & 7 deletions ts/packages/aiclient/src/providerMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export function usesProviderDefault(canonical: string): boolean {
*/
const COPILOT_MAP: Record<CanonicalName, string> = {
DEFAULT: DEFAULT_COPILOT_MODEL,
GPT_35_TURBO: "gpt-5.6-luna",
GPT_4_O: "gpt-5.6-sol",
GPT_5: "gpt-5.6-sol",
GPT_5_MINI: "gpt-5.6-terra",
GPT_5_NANO: "gpt-5.6-luna",
GPT_5_6_LUNA: "gpt-5.6-luna",
GPT_V: "gpt-5.6-sol",
GPT_35_TURBO: "gpt-6-luna",
GPT_4_O: "gpt-6-sol",
GPT_5: "gpt-6-sol",
GPT_5_MINI: "gpt-6-luna",
GPT_5_NANO: "gpt-6-luna",
GPT_5_6_LUNA: "gpt-6-luna",
GPT_V: "gpt-6-sol",
};

const OLLAMA_MAP: Record<CanonicalName, string> = {
Expand Down
34 changes: 31 additions & 3 deletions ts/packages/aiclient/test/copilotTransport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,39 @@ describe("Copilot session fallback", () => {
describe("selectCopilotModel", () => {
test("uses the requested model when it is available", () => {
const selected = selectCopilotModel(
"gpt-5.6-luna",
"gpt-6-luna",
["gpt-5.4-mini"],
[
makeModel("gpt-5.4-mini"),
makeModel("gpt-5.6-luna"),
makeModel("gpt-6-luna"),
],
);
expect(selected?.id).toBe("gpt-6-luna");
});

test.each(["luna", "sol"])(
"uses GPT-5.6 %s before generic fallbacks when GPT-6 is unavailable",
(tier) => {
const selected = selectCopilotModel(
`gpt-6-${tier}`,
["gpt-5.4-mini"],
[makeModel("gpt-5.4-mini"), makeModel(`gpt-5.6-${tier}`)],
);
expect(selected?.id).toBe(`gpt-5.6-${tier}`);
},
);

test("skips a disabled GPT-5.6 tier fallback", () => {
const selected = selectCopilotModel(
"gpt-6-luna",
["gpt-5.4-mini"],
[makeModel("gpt-5.4-mini"), makeModel("gpt-5.6-luna")],
[
makeModel("gpt-5.6-luna", { policy: "disabled" }),
makeModel("gpt-5.4-mini"),
],
);
expect(selected?.id).toBe("gpt-5.6-luna");
expect(selected?.id).toBe("gpt-5.4-mini");
});

test("uses the first configured concrete fallback", () => {
Expand Down
18 changes: 9 additions & 9 deletions ts/packages/aiclient/test/providerMode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ describe("Copilot provider mode", () => {
});

test.each([
["DEFAULT", "gpt-5.6-luna"],
["GPT_35_TURBO", "gpt-5.6-luna"],
["GPT_4_O", "gpt-5.6-sol"],
["GPT_5", "gpt-5.6-sol"],
["GPT_5_MINI", "gpt-5.6-terra"],
["GPT_5_NANO", "gpt-5.6-luna"],
["GPT_5_6_LUNA", "gpt-5.6-luna"],
["gpt_5_6_luna", "gpt-5.6-luna"],
["GPT_V", "gpt-5.6-sol"],
["DEFAULT", "gpt-6-luna"],
["GPT_35_TURBO", "gpt-6-luna"],
["GPT_4_O", "gpt-6-sol"],
["GPT_5", "gpt-6-sol"],
["GPT_5_MINI", "gpt-6-luna"],
["GPT_5_NANO", "gpt-6-luna"],
["GPT_5_6_LUNA", "gpt-6-luna"],
["gpt_5_6_luna", "gpt-6-luna"],
["GPT_V", "gpt-6-sol"],
])("maps %s to %s", (canonical, expected) => {
expect(resolveTarget("copilot", canonical)).toBe(expected);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ import { openai, resolveTarget } from "@typeagent/aiclient";
import { Session } from "../src/context/session.js";

describe("session translation model", () => {
test("defaults to GPT_5_6_LUNA and resolves to Luna in Copilot mode", async () => {
test("defaults to GPT_5_6_LUNA and resolves to GPT-6 Luna in Copilot mode", async () => {
const session = await Session.create();
const model = session.getConfig().translation.model;
expect(model).toBe(openai.GPT_5_6_LUNA);
expect(resolveTarget("copilot", model)).toBe("gpt-5.6-luna");
expect(resolveTarget("copilot", model)).toBe("gpt-6-luna");
});

test("preserves an explicit model and restores Luna on reset", async () => {
const session = await Session.create({
translation: { model: "GPT_4_O" },
});
expect(session.getConfig().translation.model).toBe("GPT_4_O");
expect(resolveTarget("copilot", "GPT_4_O")).toBe("gpt-5.6-sol");
expect(resolveTarget("copilot", "GPT_4_O")).toBe("gpt-6-sol");

session.updateSettings({ translation: { model: null } });
expect(session.getConfig().translation.model).toBe(openai.GPT_5_6_LUNA);
expect(
resolveTarget("copilot", session.getConfig().translation.model),
).toBe("gpt-6-luna");
});
});
Loading