fix(models): synthesize antigravity Gemini 3.1 pro high/low models (#22899)

* Models: add antigravity Gemini 3.1 forward-compat

* models: propagate availability to Gemini 3.1 dot IDs

* test(models): format Gemini 3.1 forward-compat test

* test(models): type Gemini 3.1 forward-compat fixtures

* models: add changelog note for antigravity gemini 3.1 forward-compat

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
Phineas1500
2026-02-22 19:11:39 -05:00
committed by GitHub
parent 5c7c37a02a
commit 320b62265d
5 changed files with 236 additions and 2 deletions

View File

@@ -389,6 +389,99 @@ describe("models list/status", () => {
},
);
it.each([
{
name: "high",
configuredModelId: "gemini-3-1-pro-high",
templateId: "gemini-3-pro-high",
templateName: "Gemini 3 Pro High",
expectedKey: "google-antigravity/gemini-3-1-pro-high",
},
{
name: "low",
configuredModelId: "gemini-3-1-pro-low",
templateId: "gemini-3-pro-low",
templateName: "Gemini 3 Pro Low",
expectedKey: "google-antigravity/gemini-3-1-pro-low",
},
] as const)(
"models list resolves antigravity gemini 3.1 $name from gemini 3 template",
async ({ configuredModelId, templateId, templateName, expectedKey }) => {
const payload = await runGoogleAntigravityListCase({
configuredModelId,
templateId,
templateName,
});
expectAntigravityModel(payload, {
key: expectedKey,
available: false,
includesTags: true,
});
},
);
it.each([
{
name: "high",
configuredModelId: "gemini-3-1-pro-high",
templateId: "gemini-3-pro-high",
templateName: "Gemini 3 Pro High",
expectedKey: "google-antigravity/gemini-3-1-pro-high",
},
{
name: "low",
configuredModelId: "gemini-3-1-pro-low",
templateId: "gemini-3-pro-low",
templateName: "Gemini 3 Pro Low",
expectedKey: "google-antigravity/gemini-3-1-pro-low",
},
] as const)(
"models list marks synthesized antigravity gemini 3.1 $name as available when template is available",
async ({ configuredModelId, templateId, templateName, expectedKey }) => {
const payload = await runGoogleAntigravityListCase({
configuredModelId,
templateId,
templateName,
available: true,
});
expectAntigravityModel(payload, {
key: expectedKey,
available: true,
});
},
);
it.each([
{
name: "high",
configuredModelId: "gemini-3.1-pro-high",
templateId: "gemini-3-pro-high",
templateName: "Gemini 3 Pro High",
expectedKey: "google-antigravity/gemini-3.1-pro-high",
},
{
name: "low",
configuredModelId: "gemini-3.1-pro-low",
templateId: "gemini-3-pro-low",
templateName: "Gemini 3 Pro Low",
expectedKey: "google-antigravity/gemini-3.1-pro-low",
},
] as const)(
"models list marks dot-notation antigravity gemini 3.1 $name as available when template is available",
async ({ configuredModelId, templateId, templateName, expectedKey }) => {
const payload = await runGoogleAntigravityListCase({
configuredModelId,
templateId,
templateName,
available: true,
});
expectAntigravityModel(payload, {
key: expectedKey,
available: true,
});
},
);
it("models list prefers registry availability over provider auth heuristics", async () => {
const payload = await runGoogleAntigravityListCase({
configuredModelId: "claude-opus-4-6-thinking",

View File

@@ -8,6 +8,7 @@ import {
resolveEnvApiKey,
} from "../../agents/model-auth.js";
import {
ANTIGRAVITY_GEMINI_31_FORWARD_COMPAT_CANDIDATES,
ANTIGRAVITY_OPUS_46_FORWARD_COMPAT_CANDIDATES,
resolveForwardCompatModel,
} from "../../agents/model-forward-compat.js";
@@ -117,6 +118,9 @@ export async function loadModelRegistry(cfg: OpenClawConfig) {
for (const synthesized of synthesizedForwardCompat) {
if (hasAvailableTemplate(availableKeys, synthesized.templatePrefixes)) {
availableKeys.add(synthesized.key);
for (const aliasKey of synthesized.availabilityAliasKeys) {
availableKeys.add(aliasKey);
}
}
}
} catch (err) {
@@ -137,6 +141,7 @@ export async function loadModelRegistry(cfg: OpenClawConfig) {
type SynthesizedForwardCompat = {
key: string;
templatePrefixes: readonly string[];
availabilityAliasKeys: readonly string[];
};
function appendAntigravityForwardCompatModels(
@@ -145,8 +150,12 @@ function appendAntigravityForwardCompatModels(
): { models: Model<Api>[]; synthesizedForwardCompat: SynthesizedForwardCompat[] } {
const nextModels = [...models];
const synthesizedForwardCompat: SynthesizedForwardCompat[] = [];
const candidates = [
...ANTIGRAVITY_OPUS_46_FORWARD_COMPAT_CANDIDATES,
...ANTIGRAVITY_GEMINI_31_FORWARD_COMPAT_CANDIDATES,
];
for (const candidate of ANTIGRAVITY_OPUS_46_FORWARD_COMPAT_CANDIDATES) {
for (const candidate of candidates) {
const key = modelKey("google-antigravity", candidate.id);
const hasForwardCompat = nextModels.some((model) => modelKey(model.provider, model.id) === key);
if (hasForwardCompat) {
@@ -162,6 +171,9 @@ function appendAntigravityForwardCompatModels(
synthesizedForwardCompat.push({
key,
templatePrefixes: candidate.templatePrefixes,
availabilityAliasKeys: candidate.availabilityAliasIds.map((id) =>
modelKey("google-antigravity", id),
),
});
}