From df7d7ae0a5086ccbaaa4b9d95591f37d5264e2cf Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 15 Nov 2026 07:21:05 +0800 Subject: [PATCH] antigravity 0.1.18: a variant at xhigh is asked at xhigh (#1169) feikeer27 asked gemini-4-hydrogen at xhigh. sentID picked the gemini-4-hydrogen-xhigh variant, but shape() set the inner thinkingConfig.thinkingLevel to "high": its level chain had no xhigh case and fell through to high, a rule from Gemini 3, which took nothing above high. Google lists LOW, MEDIUM, HIGH and XHIGH for Gemini 4 Hydrogen (magpie 15500d437). A variant whose own level is xhigh is now asked at "xhigh", lowercase like every other level this plugin sends. A model with no xhigh variant stays at high, so an xhigh asked of gemini-3.7-flash or gemini-4-hydrogen-high still goes at high. complete() also read a thinkingLevel from the body only in lowercase. Gemini's own clients write "XHIGH"/"LOW", so with no X-Magpie-Effort header the level was dropped. It is lowercased first now. Run: bun test packages/antigravity on mote (temp HOME): 133 pass, 0 fail; bun scripts/check.mjs antigravity ok. Broken by hand: both changes reverted, 3 of the new tests red (the two hydrogen-xhigh shape cases and the capitals request test). Not tried: a real gemini-4-hydrogen-xhigh request. No account here is served Gemini 4, so Code Assist taking "xhigh" is from Google's model page, not a reply; the reporter is asked to confirm. --- packages/antigravity/index.mjs | 7 ++++++- packages/antigravity/package.json | 2 +- packages/antigravity/requests.test.mjs | 9 +++++++++ packages/antigravity/shape.test.mjs | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/antigravity/index.mjs b/packages/antigravity/index.mjs index b6e0b18..12767d6 100644 --- a/packages/antigravity/index.mjs +++ b/packages/antigravity/index.mjs @@ -1226,6 +1226,10 @@ function shape(req, sent, at, effort) { else if (e === "minimal" && at) level = "minimal" else if ((e === "none" || e === "minimal") && !draws(m)) level = "low" else if (e === "medium" && (m.includes("flash") || g > 3)) level = "medium" + // a variant at xhigh (Gemini 4 Hydrogen) is asked at xhigh, which + // Google lists for it (LOW, MEDIUM, HIGH, XHIGH); a model with no + // such variant stays at high (#1169) + if (at === "xhigh") level = "xhigh" tc.thinkingLevel = level } else delete tc.thinkingLevel } else if (typeof tc.thinkingLevel === "string") { @@ -1539,7 +1543,8 @@ async function complete(s, url, init, magpie) { let effort = headerOf(init?.headers, EFFORT).toLowerCase() // a variant's level, where OpenCode asked for one const tl = raw.generationConfig?.thinkingConfig?.thinkingLevel - if (!effort && typeof tl === "string" && LEVELS.includes(tl)) effort = tl + // Gemini's own clients write it in capitals ("XHIGH") + if (!effort && typeof tl === "string" && LEVELS.includes(tl.toLowerCase())) effort = tl.toLowerCase() let l try { l = await modelInfo(s) diff --git a/packages/antigravity/package.json b/packages/antigravity/package.json index 1a4bfcb..70562b4 100644 --- a/packages/antigravity/package.json +++ b/packages/antigravity/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-antigravity-auth", - "version": "0.1.17", + "version": "0.1.18", "description": "Sign in to Antigravity with a Google account from OpenCode or magpie: Gemini, and the Claude and GPT-OSS models Google hosts for it", "type": "module", "main": "./opencode.mjs", diff --git a/packages/antigravity/requests.test.mjs b/packages/antigravity/requests.test.mjs index 3f990bd..f4df78d 100644 --- a/packages/antigravity/requests.test.mjs +++ b/packages/antigravity/requests.test.mjs @@ -58,6 +58,15 @@ test("OpenCode's variant names the level", async () => { expect(seen.find((s) => s.name === "streamGenerateContent").json.model).toBe("gemini-3.7-flash-low") }) +test("a level in capitals, as Gemini's own clients write it, names the level too (#1169)", async () => { + const seen = fake({ fetchAvailableModels: models, streamGenerateContent: () => sse({ candidates: [] }) }) + const f = await loaderFetch(auth()) + await f(URL_("gemini-3.7-flash"), { method: "POST", body: ask("hi", { generationConfig: { thinkingConfig: { includeThoughts: true, thinkingLevel: "LOW" } } }) }) + const sent = seen.find((s) => s.name === "streamGenerateContent").json + expect(sent.model).toBe("gemini-3.7-flash-low") + expect(sent.request.generationConfig.thinkingConfig).toEqual({ includeThoughts: true, thinkingLevel: "low" }) +}) + test("a Request input is read", async () => { const seen = fake({ fetchAvailableModels: models, streamGenerateContent: () => sse({ candidates: [] }) }) const f = await loaderFetch(auth()) diff --git a/packages/antigravity/shape.test.mjs b/packages/antigravity/shape.test.mjs index 0d350a1..631719f 100644 --- a/packages/antigravity/shape.test.mjs +++ b/packages/antigravity/shape.test.mjs @@ -59,6 +59,10 @@ test.each([ ["gemini-3.7-flash-low", "low", "low", "low"], ["gemini-3.7-flash-medium", "medium", "medium", "medium"], ["gemini-3.7-flash-high", "high", "xhigh", "high"], + // a variant at xhigh thinks at xhigh, asked or by default (#1169) + ["gemini-4-hydrogen-xhigh", "xhigh", "xhigh", "xhigh"], + ["gemini-4-hydrogen-xhigh", "xhigh", "", "xhigh"], + ["gemini-4-hydrogen-high", "high", "xhigh", "high"], ["gemini-3.1-pro-high", "high", "medium", "high"], ["gemini-3-flash", "", "medium", "medium"], ["gemini-pro-agent", "", "medium", "high"],