Skip to content

Commit 44e0f06

Browse files
author
Xinwei Gao
committed
fix(antigravity): preserve unknown live wire models
1 parent 6ea7b15 commit 44e0f06

3 files changed

Lines changed: 45 additions & 7 deletions

File tree

‎src/providers/antigravity-models.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { isValidModelDiscoveryModelId, MODEL_DISCOVERY_MAX_MODELS } from "./mode
66
// CLI resolves labels against. The ids below separate CCA wire ids, collapsed picker entries,
77
// and hidden compatibility aliases for saved selections. The CCA envelope's `model` field must
88
// receive the wire id (for example "Gemini 3.1 Pro (High)" => gemini-pro-agent), while the
9-
// picker exposes collapsed base models only when CCA returns every known tier; otherwise each
10-
// returned wire id remains visible so an unavailable tier cannot be selected.
9+
// picker exposes collapsed known base models only when CCA returns every known tier; unknown
10+
// returned wire ids remain visible so they stay directly routable.
1111

1212
// ── Wire IDs (what CCA :fetchAvailableModels returns) ──
1313

@@ -80,13 +80,13 @@ function pickerModelIdForDiscoveredWireId(
8080
// require another provider-specific ID mapping.
8181
if (wireId.endsWith("-tiered")) {
8282
const baseId = wireId.slice(0, -"-tiered".length);
83-
if (isValidModelDiscoveryModelId(baseId)) return baseId;
83+
if (isKnownAntigravityPickerModelId(baseId)) return baseId;
8484
}
8585

8686
const effortMatch = /^(.*)-(low|medium|high)$/.exec(wireId);
8787
if (effortMatch) {
8888
const baseId = effortMatch[1]!;
89-
if (isValidModelDiscoveryModelId(baseId)
89+
if (isKnownAntigravityPickerModelId(baseId)
9090
&& ANTIGRAVITY_DISCOVERY_EFFORTS.every(effort => available.has(`${baseId}-${effort}`))) {
9191
return baseId;
9292
}
@@ -172,6 +172,10 @@ export const ANTIGRAVITY_MODELS = [
172172
"gpt-oss-120b-medium",
173173
];
174174

175+
function isKnownAntigravityPickerModelId(value: string): boolean {
176+
return isValidModelDiscoveryModelId(value) && ANTIGRAVITY_MODELS.includes(value);
177+
}
178+
175179
// Context windows from the upstream `:fetchAvailableModels` maxTokens per model.
176180
const ANTIGRAVITY_WIRE_MODEL_CONTEXT_WINDOWS: Record<string, number> = {
177181
"gemini-3.7-flash": 1_048_576,

‎tests/google-antigravity-wire.test.ts‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,20 @@ describe("antigravity CCA envelope", () => {
129129
agentModelSorts: [{ groups: [{ modelIds }] }],
130130
});
131131

132+
expect(parseAntigravityAvailableModels(payload([
133+
"gemini-3.7-flash-low",
134+
"gemini-3.7-flash-medium",
135+
"gemini-3.7-flash-high",
136+
]))?.map(model => model.id)).toEqual(["gemini-3.7-flash"]);
132137
expect(parseAntigravityAvailableModels(payload([
133138
"future-flash-low",
134139
"future-flash-medium",
135140
"future-flash-high",
136-
]))?.map(model => model.id)).toEqual(["future-flash"]);
141+
]))?.map(model => model.id)).toEqual([
142+
"future-flash-low",
143+
"future-flash-medium",
144+
"future-flash-high",
145+
]);
137146
expect(parseAntigravityAvailableModels(payload([
138147
"future-flash-low",
139148
"future-flash-high",
@@ -147,7 +156,14 @@ describe("antigravity CCA envelope", () => {
147156
},
148157
agentModelSorts: [{ groups: [{ modelIds: [] }] }],
149158
tieredModelIds: { flash: ["future-flash-tiered"] },
150-
})?.map(model => model.id)).toEqual(["future-flash"]);
159+
})?.map(model => model.id)).toEqual(["future-flash-tiered"]);
160+
expect(parseAntigravityAvailableModels({
161+
models: {
162+
"gemini-3.7-flash-tiered": { maxTokens: 1_048_576 },
163+
},
164+
agentModelSorts: [{ groups: [{ modelIds: [] }] }],
165+
tieredModelIds: { flash: ["gemini-3.7-flash-tiered"] },
166+
})?.map(model => model.id)).toEqual(["gemini-3.7-flash"]);
151167
expect(parseAntigravityAvailableModels({
152168
models: { "-tiered": { maxTokens: 1_048_576 } },
153169
agentModelSorts: [{ groups: [{ modelIds: ["-tiered"] }] }],
@@ -168,6 +184,15 @@ describe("antigravity CCA envelope", () => {
168184
]);
169185
});
170186

187+
test("keeps unknown discovered tier IDs directly routable", async () => {
188+
for (const modelId of ["future-flash-tiered", "future-flash-low"]) {
189+
const req = await createGoogleAdapter(effortProvider).buildRequest(parsedWithEffort(modelId, "high"));
190+
const env = JSON.parse(req.body);
191+
expect(env.model).toBe(modelId);
192+
expect(env.request.generationConfig?.thinkingConfig).toBeUndefined();
193+
}
194+
});
195+
171196
test("rejects malformed and oversized CCA agent-model lists", () => {
172197
const payload = (modelIds: unknown[]) => ({
173198
models: Object.fromEntries(modelIds.map(id => [String(id), { maxTokens: 1_048_576 }])),

‎tests/google-models-listing.test.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,20 @@ describe("Antigravity live model discovery", () => {
8888
models: {
8989
"gemini-3.1-pro-low": { maxTokens: 1_048_576, supportsImages: true, supportsThinking: true, thinkingBudget: 1000 },
9090
"gemini-3.7-flash-tiered": { maxTokens: 1_048_576, supportsImages: true, supportsThinking: true, thinkingBudget: 10000 },
91+
"future-flash-tiered": { maxTokens: 1_048_576, supportsImages: true, supportsThinking: true, thinkingBudget: 10000 },
92+
"future-flash-low": { maxTokens: 1_048_576, supportsImages: true, supportsThinking: true, thinkingBudget: 10000 },
93+
"future-flash-medium": { maxTokens: 1_048_576, supportsImages: true, supportsThinking: true, thinkingBudget: 10000 },
94+
"future-flash-high": { maxTokens: 1_048_576, supportsImages: true, supportsThinking: true, thinkingBudget: 10000 },
9195
"future-agent-model": { maxTokens: 333_333, supportsImages: false, supportsThinking: true, thinkingBudget: 7777 },
9296
"gemini-3.1-flash-image": { maxTokens: 555_555, supportsImages: true },
9397
"non-agent-command-model": { maxTokens: 222_222 },
9498
"tab-only-model": { maxTokens: 32_768 },
9599
},
96100
agentModelSorts: [{ groups: [{ modelIds: [
97101
"future-agent-model", "gemini-3.1-pro-low",
102+
"future-flash-low", "future-flash-medium", "future-flash-high",
98103
] }] }],
99-
tieredModelIds: { flash: ["gemini-3.7-flash-tiered"] },
104+
tieredModelIds: { flash: ["gemini-3.7-flash-tiered", "future-flash-tiered"] },
100105
imageGenerationModelIds: ["gemini-3.1-flash-image"],
101106
tabModelIds: ["tab-only-model"],
102107
commandModelIds: ["non-agent-command-model"],
@@ -121,6 +126,10 @@ describe("Antigravity live model discovery", () => {
121126
expect(JSON.parse(String(seen[0]?.init?.body))).toEqual({ project: "configured-project" });
122127
expect(live.map(model => model.id).sort()).toEqual([
123128
"future-agent-model",
129+
"future-flash-high",
130+
"future-flash-low",
131+
"future-flash-medium",
132+
"future-flash-tiered",
124133
"gemini-3.1-flash-image",
125134
"gemini-3.1-pro-low",
126135
"gemini-3.7-flash",

0 commit comments

Comments
 (0)