Skip to content
Draft
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
10 changes: 9 additions & 1 deletion src/providers/model-rename-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export interface ModelRename {
* but lose the reasoning picker entirely.
*/
dropReasoningEffortMap?: boolean;
/**
* Keep a saved default whose legacy id carries request semantics that the
* replacement id cannot encode. Other catalog fields are still renamed.
*/
preserveDefaultModel?: boolean;
}

/**
Expand Down Expand Up @@ -77,6 +82,9 @@ export const MODEL_RENAMES: readonly ModelRename[] = [
// The retired Flash tiers were wire ids, so any saved per-model record keyed by one
// may also hold one as a value. 3.7 expresses tiers as thinkingLevel names instead.
dropReasoningEffortMap: true,
// Tier-specific retired ids remain valid routing aliases. Replacing one when it is
// the saved default would discard its encoded tier and make 3.7 default to medium.
preserveDefaultModel: from !== "gemini-3.6-flash",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the tier through OAuth reconciliation

For the normal google-antigravity configuration with authMode: "oauth", this flag is undone during the same startup: startServer runs the rename migration and then reconcileOAuthProviders (src/server/index.ts:494-505), whose stale-default check replaces any default absent from the refreshed preset model list with gemini-3.7-flash (src/oauth/index.ts:935-942). Since the tier-bearing alias is deliberately removed from models, a saved gemini-3.6-flash-high therefore still becomes the medium default before requests are served. Preserve recognized compatibility aliases during OAuth reconciliation (or persist the tier separately), and cover the actual migration-plus-reconciliation sequence rather than testing the projection alone.

AGENTS.md reference: src/AGENTS.md:L24-L26

Useful? React with 👍 / 👎.

})),
];

Expand Down Expand Up @@ -237,7 +245,7 @@ export function projectModelRenames(
row[field] = next;
touched = true;
}
if (prov.defaultModel === rename.from) {
if (prov.defaultModel === rename.from && !rename.preserveDefaultModel) {
prov.defaultModel = rename.to;
touched = true;
}
Expand Down
8 changes: 7 additions & 1 deletion tests/gemini-37-flash-migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ describe("a saved config survives the retirement", () => {

test("migrating a tier id does not duplicate an already-present 3.7 entry", () => {
const { config } = projectModelRenames(configWith(["gemini-3.6-flash-high", "gemini-3.7-flash"]));
expect(config.providers["google-antigravity"]!.selectedModels).toEqual(["gemini-3.7-flash"]);
const prov = config.providers["google-antigravity"]!;
expect(prov.selectedModels).toEqual(["gemini-3.7-flash"]);
expect(prov.defaultModel).toBe("gemini-3.6-flash-high");
expect(resolveAntigravityEffortWireModel(prov.defaultModel!)).toEqual({
wireModelId: "gemini-3.7-flash",
thinkingLevel: "high",
});
});

test("an unrelated selection is left alone", () => {
Expand Down
Loading