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
62 lines
2.0 KiB
JavaScript
62 lines
2.0 KiB
JavaScript
// 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)
|
|
})
|