antigravity 0.1.8: a manifest read that times out no longer pins 2.9.1 for six hours (#1057)
The User-Agent's version comes from Antigravity's update manifest. A read that failed (5s timeout, often hit on a cold plugin host) left the 2.9.1 default in place for the full six hours. Google lists and serves Gemini 4 only to newer releases, so under 2.9.1 the Argon and Carbon models fell out of the list and a request for them got 404. - The default is the manifest's version today, 2.31.2. - The read waits 15s, and one that fails is tried again after a minute. - A version that changes drops the model lists read under the old one, so the newer list arrives at once, not up to ten minutes later. magpie puts delisted picks back when the list has them again. Run on a separate test Mac (Bun 1.4.2, temp HOME): - bun test packages/antigravity: 99 pass, 0 fail (4 new in version.test.mjs). - bun scripts/check.mjs antigravity: ok. - The manifest answered "version: 2.31.2" today. Broken by hand, each red then restored: - no retry after a failed read: 1 fail. - no list drop on a new version: 1 fail. Not tried: a real Antigravity account. The reporter's own test of 2.9.1 vs 2.31.2 on one token is what shows the version gates Gemini 4. Reported-by: floodsource
This commit is contained in:
@@ -73,7 +73,10 @@ wrapped in the app's envelope (`{model, project, userAgent: "antigravity",
|
||||
requestType: "agent", requestId, request}`):
|
||||
|
||||
- The User-Agent is `antigravity/hub/<version> <os>/<arch>`. The version is
|
||||
read from the app's update manifest every 6 hours.
|
||||
read from the app's update manifest every 6 hours. Google lists Gemini 4
|
||||
only to new enough releases, so a manifest that can't be read is asked
|
||||
again after a minute, and the model list is read again when the version
|
||||
changes.
|
||||
- The session id is a number made from the host's session header when named,
|
||||
else the conversation's first real user prompt (skipping injected
|
||||
`AGENTS.md` and environment preambles), so unrelated conversations that
|
||||
|
||||
@@ -53,13 +53,18 @@ const BASE = DAILY + "/v1beta"
|
||||
const NPM = "@ai-sdk/google"
|
||||
|
||||
const VERSION_URL = "https://antigravity-hub-auto-updater-974169037036.us-central1.run.app/manifest/latest-arm64-mac.yml"
|
||||
const DEFAULT_VERSION = "2.9.1"
|
||||
// the manifest's version on 2026-11-12; Google serves Gemini 4 only to
|
||||
// releases about this new (2.9.1 got no Gemini 4, #1057)
|
||||
const DEFAULT_VERSION = "2.31.2"
|
||||
|
||||
const SIGN_IN_TIMEOUT = 10 * 60 * 1000
|
||||
const MODELS_TTL = 10 * 60 * 1000
|
||||
const TIERS_TTL = 60 * 60 * 1000
|
||||
const TIER_REFUSED_FOR = 24 * 60 * 60 * 1000
|
||||
const VERSION_TTL = 6 * 60 * 60 * 1000
|
||||
// a manifest that couldn't be read is asked again this soon, not in six hours
|
||||
const VERSION_RETRY = 60 * 1000
|
||||
const VERSION_TIMEOUT = 15 * 1000
|
||||
|
||||
// the header magpie names a request's effort in
|
||||
const EFFORT = "x-magpie-effort"
|
||||
@@ -107,25 +112,34 @@ const platform = () => `${GOOS[process.platform] ?? process.platform}/${GOARCH[p
|
||||
const ver = { v: "", at: 0, pending: null }
|
||||
|
||||
// version is the Antigravity release the requests say they come from,
|
||||
// read from the app's own update manifest every six hours
|
||||
// read from the app's own update manifest every six hours. Google lists
|
||||
// and serves some models (Gemini 4) only to new enough releases, so a
|
||||
// manifest that can't be read keeps the default for a minute only, and a
|
||||
// version that changes drops the model lists read under the old one.
|
||||
async function version() {
|
||||
if (ver.v && Date.now() - ver.at < VERSION_TTL) return ver.v
|
||||
if (ver.pending) return ver.pending
|
||||
ver.at = Date.now()
|
||||
if (!ver.v) ver.v = DEFAULT_VERSION
|
||||
ver.pending = (async () => {
|
||||
let read = ""
|
||||
try {
|
||||
const res = await fetch(VERSION_URL, { headers: { "User-Agent": "electron-builder" }, signal: AbortSignal.timeout(5000) })
|
||||
const res = await fetch(VERSION_URL, { headers: { "User-Agent": "electron-builder" }, signal: AbortSignal.timeout(VERSION_TIMEOUT) })
|
||||
if (res.ok) {
|
||||
const text = (await res.text()).slice(0, 64 << 10)
|
||||
for (const line of text.split(/\r?\n/)) {
|
||||
if (!line.startsWith("version:")) continue
|
||||
const v = line.slice(8).trim().replace(/^['"]+|['"]+$/g, "")
|
||||
if (v && /^[0-9.]+$/.test(v)) ver.v = v
|
||||
if (v && /^[0-9.]+$/.test(v)) read = v
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
if (!read) ver.at = Date.now() - VERSION_TTL + VERSION_RETRY
|
||||
else if (read !== ver.v) {
|
||||
ver.v = read
|
||||
lists.clear()
|
||||
}
|
||||
ver.pending = null
|
||||
return ver.v
|
||||
})()
|
||||
@@ -1911,4 +1925,8 @@ export const _internal = {
|
||||
lists,
|
||||
refused,
|
||||
ver,
|
||||
version,
|
||||
VERSION_TTL,
|
||||
VERSION_RETRY,
|
||||
DEFAULT_VERSION,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-antigravity-auth",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"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",
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// The version the requests name is read from the update manifest (#1057).
|
||||
import { afterEach, beforeEach, expect, test } from "bun:test"
|
||||
import { _internal } from "./index.mjs"
|
||||
import { real } from "./fake.mjs"
|
||||
|
||||
const { ver, version, lists, VERSION_TTL, VERSION_RETRY, DEFAULT_VERSION } = _internal
|
||||
|
||||
beforeEach(() => {
|
||||
ver.v = ""
|
||||
ver.at = 0
|
||||
ver.pending = null
|
||||
lists.clear()
|
||||
})
|
||||
afterEach(() => (globalThis.fetch = real))
|
||||
|
||||
const manifest = (v) => async () => new Response(`version: ${v}\nfiles: []\n`, { status: 200 })
|
||||
const down = async () => { throw new TypeError("fetch failed") }
|
||||
|
||||
test("a manifest that can't be read is asked again after a minute, not six hours", async () => {
|
||||
let asked = 0
|
||||
globalThis.fetch = async (...a) => { asked++; return down(...a) }
|
||||
expect(await version()).toBe(DEFAULT_VERSION)
|
||||
expect(asked).toBe(1)
|
||||
expect(await version()).toBe(DEFAULT_VERSION)
|
||||
expect(asked).toBe(1)
|
||||
ver.at -= VERSION_RETRY + 1
|
||||
globalThis.fetch = async (...a) => { asked++; return manifest("2.40.0")(...a) }
|
||||
expect(await version()).toBe("2.40.0")
|
||||
expect(asked).toBe(2)
|
||||
ver.at -= VERSION_RETRY + 1
|
||||
expect(await version()).toBe("2.40.0")
|
||||
expect(asked).toBe(2)
|
||||
})
|
||||
|
||||
test("a read manifest holds for six hours", async () => {
|
||||
let asked = 0
|
||||
globalThis.fetch = async (...a) => { asked++; return manifest("2.40.0")(...a) }
|
||||
await version()
|
||||
ver.at -= VERSION_TTL - 1000
|
||||
await version()
|
||||
expect(asked).toBe(1)
|
||||
})
|
||||
|
||||
test("a new version drops the model lists read under the old one", async () => {
|
||||
globalThis.fetch = down
|
||||
await version()
|
||||
lists.set("rt", { at: Date.now(), infos: [], project: "p" })
|
||||
ver.at -= VERSION_RETRY + 1
|
||||
globalThis.fetch = manifest(DEFAULT_VERSION)
|
||||
await version()
|
||||
expect(lists.size).toBe(1)
|
||||
ver.at -= VERSION_TTL + 1
|
||||
globalThis.fetch = manifest("2.40.0")
|
||||
await version()
|
||||
expect(lists.size).toBe(0)
|
||||
})
|
||||
|
||||
test("the default is a release Google serves Gemini 4 to", () => {
|
||||
const [a, b] = DEFAULT_VERSION.split(".").map(Number)
|
||||
expect(a > 2 || (a === 2 && b >= 20)).toBe(true)
|
||||
})
|
||||
Reference in New Issue
Block a user