Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
refactor(discovery): replace the retired term "served set"
Jack Rudenkoad1fcf6ab829
diff --git a/ai-docs/architecture/README.md b/ai-docs/architecture/README.mdindex 8b142114..221a8a09 100644--- a/ai-docs/architecture/README.md+++ b/ai-docs/architecture/README.md@@ -20,7 +20,7 @@ three earlier write-ups this material cites were lost.| [`routing.md`](routing.md) | The `provider@model` syntax, the full provider-prefix table, local models, where a bare name's chain comes from now that there is NO built-in rules table, the fallback hop and its three empty states, `ModelCatalogResolver` vendor-prefix resolution, the DERIVED picker provider list, and why subscription pricing is decided by billing rather than by `modelDiscovery` | change `routeBare`, `route-candidates.ts`, a `nativeModelPatterns` claim, `defaultProvider`, the picker, a catalog resolver, or `SUBSCRIPTION_PROVIDERS` || [`providers/devin.md`](providers/devin.md) | The only binary wire in the pipeline — Connect envelopes carrying protobuf, live uid resolution, errors that ride an HTTP 200, and the three wire facts that cost real money to get wrong | touch `providers/devin/`, the codec, or `dv@` model resolution || [`providers/grok-subscription.md`](providers/grok-subscription.md) | `gk@` on a SuperGrok / X Premium+ plan: RFC 8628 device flow, exact-scope matching, 6-hour token refresh with write-back, three mandatory client headers | touch `gk@`, `claudish login grok`, or its OAuth refresh |-| [`providers/antigravity.md`](providers/antigravity.md) | Gemini on an Antigravity subscription: the shared `agy` keychain token, runtime client-secret extraction, live served-set discovery | touch `ag@`, `auth/antigravity-*`, or the keychain token |+| [`providers/antigravity.md`](providers/antigravity.md) | Gemini on an Antigravity subscription: the shared `agy` keychain token, runtime client-secret extraction, live discovery of the account's dynamic models catalog | touch `ag@`, `auth/antigravity-*`, or the keychain token || [`providers/qwen-alibaba.md`](providers/qwen-alibaba.md) | One service, two consoles, three isolated key+host products and account-discovery caveats | touch `qcode@`/`qtoken@`/`qpay@`, or assume anything about Alibaba's credentials || [`custom-endpoints.md`](custom-endpoints.md) | User-defined `customEndpoints`: schema, `${VAR}` expansion, and `authScheme: "none"` for endpoints that take NO credential | change `customEndpoints`, `config-schema.ts`, or `authScheme` handling || [`predefined-endpoints.md`](predefined-endpoints.md) | The 25-vendor bundled catalog: credential-gated activation, the single registration seam, evidence tiers (all `probe`, none `live`), and the no-model-data rule | add a vendor to `providers/predefined-catalog.ts`, or change endpoint registration |diff --git a/ai-docs/architecture/network-recovery.md b/ai-docs/architecture/network-recovery.mdindex 5ac05565..a4ccf975 100644--- a/ai-docs/architecture/network-recovery.md+++ b/ai-docs/architecture/network-recovery.md@@ -724,8 +724,8 @@ that claim was true and the feature was not, because a budget nothing enforces obudget.The re-issue goes through that **same ternary**. Six transports implement `enqueueRequest`, and what-they implement is not decoration: a bounded 429 loop with `Retry-After`, a served-set model-fallback-chain, and the local concurrency gate that stops `[email protected]:3` running four inferences at once.+they implement is not decoration: a bounded 429 loop with `Retry-After`, a model-fallback chain+drawn from the dynamic models catalog, and the local concurrency gate that stops `[email protected]:3` running four inferences at once.Skipping it would make the attempt that finally *connects* behave differently from the one thatfailed — and at the moment a network returns, N woken waiters would stampede unqueued into aprovider that has just come back.diff --git a/ai-docs/architecture/providers/antigravity.md b/ai-docs/architecture/providers/antigravity.mdindex d28f109d..0fe253a0 100644--- a/ai-docs/architecture/providers/antigravity.md+++ b/ai-docs/architecture/providers/antigravity.md@@ -15,7 +15,7 @@ Two separate Gemini flows, deliberately split:**Bare `gemini-*` reaches `ag@` through a NAMESPACE CLAIM, not a routing table.** The hand-written `"gemini-*": ["antigravity", "google", "openrouter"]` chain was deleted with the rest of `default-routing-rules.ts`. `google/antigravity-subscription` sits in the probe map as `client_model_selection_required` and publishes zero `aggregators[]` rows — the catalog cannot say what a seat was given — so the provider declares `nativeModelPatterns: [{ pattern: /^gemini-/i }]` and `route-candidates.ts` turns that into a `dynamic-subscription`-tier candidate, which the tier order puts ahead of the metered `google` hop. The claim deliberately does not win auto-detection (`google` declares the same pattern and is defined earlier in `BUILTIN_PROVIDERS`, and `getNativeModelPatterns()` is first-wins), and it deliberately does NOT cover `/^claude-/i` even though the backend serves Claude ids: a bare Claude name must never reach `route()` at all — `nativeRouteFor()` handles it first.-The Antigravity half of the old `auth/gemini-oauth.ts` was extracted to **`auth/antigravity-user.ts`** (project/tier resolution, `retrieveUserQuota`, live served-set discovery) before that file was deleted — Antigravity depends on it, so deleting wholesale would have taken `ag@` down too. All three calls now share ONE identity (the Antigravity User-Agent). `retrieveUserQuota` used to keep the gemini-cli UA it was written with; measured 2026-08-18 on a real Ultra account, same token and project, only the UA varying — the gemini-cli UA returned 4 quota buckets (the retired free Code Assist served set) and the Antigravity UA returned 24. This backend gates its ANSWER on request identity, not just the tier label it displays.+The Antigravity half of the old `auth/gemini-oauth.ts` was extracted to **`auth/antigravity-user.ts`** (project/tier resolution, `retrieveUserQuota`, live discovery of the account's dynamic models catalog) before that file was deleted — Antigravity depends on it, so deleting wholesale would have taken `ag@` down too. All three calls now share ONE identity (the Antigravity User-Agent). `retrieveUserQuota` used to keep the gemini-cli UA it was written with; measured 2026-08-18 on a real Ultra account, same token and project, only the UA varying — the gemini-cli UA returned 4 quota buckets (the membership of the retired free Code Assist plan) and the Antigravity UA returned 24. This backend gates its ANSWER on request identity, not just the tier label it displays.**Why not just spoof the identity:** the backend has two independent gates. `loadCodeAssist` gates the visible *tier* on request identity (`User-Agent` + `metadata.ideType: ANTIGRAVITY`), but `streamGenerateContent` gates *generation* on the OAuth **client that minted the token** — headers can't fake it (403 PERMISSION_DENIED). So claudish does not spoof; it **reuses the user's own Antigravity token**.@@ -135,4 +135,4 @@ and orders 3.7 > 3.6 > 3.5 > 3.1 > 3 > 2.5.**Model ids — LIVE discovery, no hardcoded map**: the Antigravity backend requires a reasoning-tier suffix (bare `gemini-3.6-flash` → 404), but which variants a subscription serves is **per-account and drifts**, so claudish never hardcodes a model list. `getServedAntigravityModels()` fetches the live set from the backend's own `v1internal:fetchAvailableModels` (body `{project}`) — the served ids are the response `models` keys, plus a backend `defaultAgentModelId` — cached with a TTL. `resolveAntigravityModelId(requested, servedIds, defaultId)` then resolves against that LIVE set: exact match passes through; a bare family (e.g. `gemini-3.6-flash`) resolves to the backend's `defaultAgentModelId` when it's a variant of that family, else to the strongest reasoning tier by a *rank rule* (`high>medium>low>extra-low>tiered` — a rule, like `rankCodeAssistModel`, not pinned ids); anything else passes through to the F1–F7 404 rewrite. The only literals are the tier-rank ordering and endpoint strings — no concrete model ids in source.-**Identity strings**: `User-Agent: antigravity/cli/<ver> (aidev_client; os_type=<platform>; arch=<arch>; auth_method=consumer)` + `metadata: { ideType: "ANTIGRAVITY" }`. The transport keeps all the F1–F7 improvements from the old codeassist path (terminal-error → 400 surfaced inline, served-set-aware 404 rewrite, `rankCodeAssistModel`). Full reverse-engineering write-up: `ai-docs/sessions/antigravity-refactor-20260803-125333-d0791562/architecture.md` (write-up lost — predates the ai-docs tracking fix).+**Identity strings**: `User-Agent: antigravity/cli/<ver> (aidev_client; os_type=<platform>; arch=<arch>; auth_method=consumer)` + `metadata: { ideType: "ANTIGRAVITY" }`. The transport keeps all the F1–F7 improvements from the old codeassist path (terminal-error → 400 surfaced inline, the 404 rewrite that checks the dynamic models catalog, `rankCodeAssistModel`). Full reverse-engineering write-up: `ai-docs/sessions/antigravity-refactor-20260803-125333-d0791562/architecture.md` (write-up lost — predates the ai-docs tracking fix).diff --git a/ai-docs/architecture/providers/devin.md b/ai-docs/architecture/providers/devin.mdindex c5968534..a0499f09 100644--- a/ai-docs/architecture/providers/devin.md+++ b/ai-docs/architecture/providers/devin.md@@ -56,8 +56,8 @@ versus `"devin-cli"` on `GetChatMessage`, `GetCliTeamSettings` lives on `SeatMan`not_found`, quota-worded `resource_exhausted`) goes straight to a **400 rendered inline**. AnUNRECOGNIZED code is terminal on purpose: guessing "retryable" costs 48s of backoff and still hidesthe reason. An **unserved uid comes back as `permission_denied`, not `not_found`** — the transport's- served-set-aware rewrite names it and lists available families, but keeps the upstream text, because- `permission_denied` was also the symptom of the wrong role enum.+ rewrite checks the dynamic models catalog, names the uid and lists available families, but keeps+ the upstream text, because `permission_denied` was also the symptom of the wrong role enum.- **Field 28 usage is float32 LITTLE-endian** at `28→2→4→2`, selected by the STRING key at `28→2→5`.Field 28 is repeated with the groups in unspecified order, so select by key, never by index; anabsent value means zero. LE reads 16185 tokens where BE reads 2.09e-38.diff --git a/ai-docs/architecture/providers/grok-subscription.md b/ai-docs/architecture/providers/grok-subscription.mdindex adc9d713..e74451e0 100644--- a/ai-docs/architecture/providers/grok-subscription.md+++ b/ai-docs/architecture/providers/grok-subscription.md@@ -132,7 +132,7 @@ longer exists.**The dynamic models catalog is discovered, never pinned.** `/v1/models` is genuinelyauthenticated (401 without a token — unlike Alibaba's `coding-intl` discovery endpoint, where a-200 proves nothing) and the served set is account-scoped.+200 proves nothing) and the dynamic models catalog it returns is account-scoped.Note the per-model effort ladders differ — `grok-4.6` offers `xhigh`, `grok-4.5`does not — which is exactly the drifting per-account data that must not be hardcoded.diff --git a/ai-docs/architecture/routing.md b/ai-docs/architecture/routing.mdindex ff330179..0b6420b9 100644--- a/ai-docs/architecture/routing.md+++ b/ai-docs/architecture/routing.md@@ -251,7 +251,7 @@ Name them apart, because they are different KINDS of fact:**A dynamic models catalog is never persisted.** `providers/model-discovery.ts` keeps thelist in an in-memory `Map` for `CACHE_TTL_MS` (five minutes) and writes nothing to disk;-the Antigravity served set is likewise in memory (`auth/antigravity-user.ts`). Every disk+Antigravity's dynamic models catalog is likewise in memory (`auth/antigravity-user.ts`). Every diskwriter holds hosted or credential-free data. A stored per-account list would outlive thekey or seat that earned it and answer with something no longer true.diff --git a/packages/cli/src/auth/antigravity-user.test.ts b/packages/cli/src/auth/antigravity-user.test.tsindex 6c46a868..492d0739 100644--- a/packages/cli/src/auth/antigravity-user.test.ts+++ b/packages/cli/src/auth/antigravity-user.test.ts@@ -61,7 +61,7 @@ describe("getServedAntigravityModels", () => {const result = await getServedAntigravityModels("placeholder-token", "placeholder-project");- // The pre-existing served-set and backend-default contract must survive metadata enrichment.+ // The pre-existing contract for the dynamic models catalog and the backend default must survive metadata enrichment.expect(result.servedIds).toEqual(["claude-sonnet-4-6","gemini-3.1-flash-image",diff --git a/packages/cli/src/auth/antigravity-user.ts b/packages/cli/src/auth/antigravity-user.tsindex 70ca3850..7ba881b4 100644--- a/packages/cli/src/auth/antigravity-user.ts+++ b/packages/cli/src/auth/antigravity-user.ts@@ -60,8 +60,9 @@ function apiBase(): string {}/**- * The served set changes on the daily-quota cadence, not per request, and both- * lookups below are real network calls we don't want on every refreshAuth.+ * The account's dynamic models catalog changes on the daily-quota cadence, not+ * per request, and both lookups below are real network calls we don't want on+ * every refreshAuth.*/const SERVED_MODELS_TTL_MS = 10 * 60 * 1000;@@ -213,11 +214,11 @@ export interface QuotaBucket {* antigravity UA -> 24 buckets: the 3.x families (3.6-flash-*, 3.5-flash-*,* 3.1-pro-*), plus claude-* and gpt-oss-* uids*- * Those 4 are precisely the RETIRED free Code Assist served set. Identifying- * as gemini-cli therefore asked the backend for a product the user is not on,- * and the quota UI rendered "Antigravity Ultra" — a correct tier label from- * `loadCodeAssist`, which always identified correctly — directly above four- * models an Ultra subscriber does not use, all pinned at 0%.+ * Those 4 are precisely the membership of the RETIRED free Code Assist plan.+ * Identifying as gemini-cli therefore asked the backend for a product the user+ * is not on, and the quota UI rendered "Antigravity Ultra" — a correct tier+ * label from `loadCodeAssist`, which always identified correctly — directly+ * above four models an Ultra subscriber does not use, all pinned at 0%.** So this MUST match `loadCodeAssist`'s identity. Both calls hit the same host* and the backend answers each according to who is asking.@@ -257,7 +258,7 @@ interface AntigravityModelRecord {/** The Antigravity `fetchAvailableModels` response (only the fields we read). */interface FetchAvailableModelsResponse {- /** The served set — the KEYS of this dict ARE the served model ids. */+ /** The dynamic models catalog — the KEYS of this dict ARE the served model ids. */models?: Record<string, AntigravityModelRecord>;/** Backend-provided default model id (e.g. "gemini-3.6-flash-high"). */defaultAgentModelId?: string;@@ -294,7 +295,7 @@ export interface AntigravityModelMeta {displayName?: string;}-/** The live served-set + default id for the Antigravity account. */+/** The dynamic models catalog + default id for the Antigravity account. */export interface AntigravityServedModels {servedIds: string[];defaultId: string | null;@@ -334,10 +335,11 @@ let agServedCacheAt = 0;/*** Discover which model ids this account's Antigravity subscription serves — LIVE.*- * `fetchAvailableModels` is the authoritative per-subscription served-set- * endpoint: the KEYS of its `models` dict ARE the served ids (already carrying- * their reasoning-tier suffix, e.g. `gemini-3.6-flash-high`), and- * `defaultAgentModelId` is the backend's own default.+ * `fetchAvailableModels` is the authoritative discovery endpoint for this+ * account's dynamic models catalog: the KEYS of its `models` dict ARE the served+ * ids (already carrying their reasoning-tier suffix, e.g.+ * `gemini-3.6-flash-high`), and `defaultAgentModelId` is the backend's own+ * default.** Degrades to `{ servedIds: [], defaultId: null }` on any error, so the* transport's 404 handling still functions.diff --git a/packages/cli/src/auth/credentials/antigravity-credential.ts b/packages/cli/src/auth/credentials/antigravity-credential.tsindex c620f205..c84de79a 100644--- a/packages/cli/src/auth/credentials/antigravity-credential.ts+++ b/packages/cli/src/auth/credentials/antigravity-credential.ts@@ -82,7 +82,8 @@ export class AntigravityCredentialProvider implements CredentialProvider {async getRequestAuth(ctx: RequestAuthContext): Promise<RequestAuth> {const token = await getValidAntigravityAccessToken();const { projectId, tierId } = await setupAntigravityUser(token);- // Resolve the requested id against the LIVE served set (fetchAvailableModels).+ // Resolve the requested id against the account's dynamic models catalog+ // (fetchAvailableModels).const { servedIds, defaultId } = await getServedAntigravityModels(token, projectId);const servedModel = resolveAntigravityModelId(ctx.model,diff --git a/packages/cli/src/handlers/composed-handler.ts b/packages/cli/src/handlers/composed-handler.tsindex e9b62825..e881bd25 100644--- a/packages/cli/src/handlers/composed-handler.ts+++ b/packages/cli/src/handlers/composed-handler.ts@@ -1352,12 +1352,12 @@ export class ComposedHandler implements ModelHandler {//// The re-issue must go through that SAME ternary. Six transports// implement `enqueueRequest`, and what they implement is not decoration:- // a bounded 429 loop with `Retry-After`, a served-set model-fallback- // chain, and the local concurrency gate that stops `[email protected]:3`- // running four inferences at once. Skipping it would make the attempt- // that finally CONNECTS behave differently from the one that failed —- // and at the moment a network returns, N woken waiters would stampede- // unqueued into a provider that has just come back.+ // a bounded 429 loop with `Retry-After`, a model-fallback chain drawn+ // from the dynamic models catalog, and the local concurrency gate that+ // stops `[email protected]:3` running four inferences at once. Skipping it+ // would make the attempt that finally CONNECTS behave differently from+ // the one that failed — and at the moment a network returns, N woken+ // waiters would stampede unqueued into a provider that has just come back.//// `getRequestInit()` IS CALLED AGAIN, PER ATTEMPT, and that is not a// tidiness preference. A transport may return a ONE-SHOT signal from it —@@ -2178,9 +2178,10 @@ export class ComposedHandler implements ModelHandler {* instead of burning 48s of backoff first. Only the transient class is* retried; only an exhausted retry chain becomes a 503.*- * Terminal messages pass through the transport's served-set-aware rewrite when- * it offers one, which is what turns an opaque backend string into "that uid- * is not served by your subscription; here is what is".+ * Terminal messages pass through the transport's rewrite when it offers one.+ * That rewrite checks the dynamic models catalog, which is what turns an+ * opaque backend string into "that uid is not served by your subscription;+ * here is what is".*/private async settleDevinStreamHead(initial: Response,diff --git a/packages/cli/src/handlers/fallback-handler.ts b/packages/cli/src/handlers/fallback-handler.tsindex 343a0139..7897e040 100644--- a/packages/cli/src/handlers/fallback-handler.ts+++ b/packages/cli/src/handlers/fallback-handler.ts@@ -346,10 +346,11 @@ export function isRetryableError(// Antigravity rejects some SERVED variants at generation time with a// generic "Request contains an invalid argument" — `gemini-3.1-pro-high`- // is in both the account's served set and the catalog (marked the family- // default), yet 400s on every call. Without this, a bare `gemini-3.1-pro-*`- // aborts the whole chain instead of advancing to a provider that works,- // which is strictly worse than the 404 it used to produce.+ // is in both the account's dynamic models catalog and the cloud models+ // catalog (marked the family default), yet 400s on every call. Without+ // this, a bare `gemini-3.1-pro-*` aborts the whole chain instead of+ // advancing to a provider that works, which is strictly worse than the 404+ // it used to produce.//// Deliberately scoped to this provider: "invalid argument" is generic// enough that a blanket rule would mask real payload bugs elsewhere bydiff --git a/packages/cli/src/providers/devin/model-id-resolver.ts b/packages/cli/src/providers/devin/model-id-resolver.tsindex 2a9b1c91..9272a52d 100644--- a/packages/cli/src/providers/devin/model-id-resolver.ts+++ b/packages/cli/src/providers/devin/model-id-resolver.ts@@ -34,8 +34,9 @@ import type { DevinModelConfig } from "./devin-models.js";* Resolve `requested` to a served uid against the dynamic models catalog.** Total by construction: an unrecognised request is returned unchanged so the- * backend can answer for itself, which is what lets the served-set-aware error- * rewrite name what IS served rather than silently substituting a model.+ * backend can answer for itself, which is what lets the error rewrite name what+ * IS served (from the dynamic models catalog) rather than silently substituting+ * a model.*/export function resolveDevinModelUid(requested: string,diff --git a/packages/cli/src/providers/model-resolvers/devin.ts b/packages/cli/src/providers/model-resolvers/devin.tsindex 0ddc24a2..3a12c8b9 100644--- a/packages/cli/src/providers/model-resolvers/devin.ts+++ b/packages/cli/src/providers/model-resolvers/devin.ts@@ -291,8 +291,8 @@ export class DevinModelResolver implements ProviderModelResolver {* 3. **A uid prefix** resolves only while every match sits in ONE group. When* it spans several it is under-specified, not unknown, and falls to rule 4.* 4. **No usable match** passes through unchanged so the backend can answer.- * The served-set-aware error rewrite turns that into a message naming what- * IS served; guessing here would hide it.+ * The error rewrite checks the dynamic models catalog and turns that into a+ * message naming what IS served; guessing here would hide it.*/expand(selection: string, modelsCatalog: ModelsCatalogEntry[], ctx: ExpandContext): string {const requested = selection.trim();@@ -333,7 +333,8 @@ export class DevinModelResolver implements ProviderModelResolver {// picking one would be a ×35-vs-×6 guess dressed up as a resolution, so// it falls through to rule 4 instead. This is rule 3 of the doc comment// applied to a request that is under-specified rather than unknown: the- // backend's served-set error names the candidates, and we do not.+ // backend's error, rewritten against the dynamic models catalog, names the+ // candidates, and we do not.const pool =named.length > 0? nameddiff --git a/packages/cli/src/providers/provider-profiles.ts b/packages/cli/src/providers/provider-profiles.tsindex 6b4f97e9..e94cdf23 100644--- a/packages/cli/src/providers/provider-profiles.ts+++ b/packages/cli/src/providers/provider-profiles.ts@@ -232,13 +232,14 @@ export const devinProfile: ProviderProfile = {* `openaiCodexProfile` builds `CodexAPIFormat` unconditionally and never calls* this function at all.*- * Pick the verification model carefully. /v1/models is a CATALOGUE, not a served- * set: of those six ids, only `gpt-5.3-codex` actually answers 200 on+ * Pick the verification model carefully. /v1/models is a dynamic models catalog,+ * NOT an entitlement: of those six ids, only `gpt-5.3-codex` actually answers 200 on* /v1/responses for the developer's account — the rest return 404 "Model not* found" there, and `gpt-5-codex` is additionally reported DEPRECATED on* /v1/chat/completions. Testing against any of them looks exactly like "the- * routing fix did not work" when the model is simply not being served. Same- * catalogue-vs-served-set trap the Antigravity and Devin providers document.+ * routing fix did not work" when the model is simply not being served. It is the+ * same dynamic-models-catalog-vs-entitlement trap the Antigravity and Devin+ * providers document.** THE CATALOG MAY ONLY WIDEN THIS GATE, NEVER NARROW IT. The name rule stays an* unconditional `||` below for the reason above: the transport routes everydiff --git a/packages/cli/src/providers/transport/antigravity-modelid.test.ts b/packages/cli/src/providers/transport/antigravity-modelid.test.tsindex 36854cf1..85022b1b 100644--- a/packages/cli/src/providers/transport/antigravity-modelid.test.ts+++ b/packages/cli/src/providers/transport/antigravity-modelid.test.ts@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";import { resolveAntigravityModelId } from "./antigravity.js";/**- * resolveAntigravityModelId operates ONLY on the LIVE served set (no hardcoded+ * resolveAntigravityModelId operates ONLY on the account's dynamic models catalog (no hardcoded* model ids). Every case injects its own servedIds + defaultId, so the tests* carry no pinned model list and touch no network.*/@@ -81,7 +81,7 @@ describe("resolveAntigravityModelId", () => {test("passes an unknown family through unchanged (backend 404 → F1–F7 rewrite)", () => {const served = ["gemini-3.6-flash-high", "gemini-2.5-flash"];expect(resolveAntigravityModelId("gemini-9.9-ultra", served, null)).toBe("gemini-9.9-ultra");- // Empty served set (live fetch failed) → also passthrough.+ // Empty dynamic models catalog (fetch failed) → also passthrough.expect(resolveAntigravityModelId("gemini-3.6-flash", [], null)).toBe("gemini-3.6-flash");});diff --git a/packages/cli/src/providers/transport/antigravity.ts b/packages/cli/src/providers/transport/antigravity.tsindex 643133c1..857ea80d 100644--- a/packages/cli/src/providers/transport/antigravity.ts+++ b/packages/cli/src/providers/transport/antigravity.ts@@ -5,8 +5,9 @@* Adapted from the since-removed providers/transport/gemini-codeassist.ts. It keeps ALL of that* transport's hardening — the 429 classification (RATE_LIMIT_EXCEEDED retry /* MODEL_CAPACITY_EXHAUSTED fallback / QUOTA_EXHAUSTED terminal), the live- * served-set discovery, the capacity fallback chain, and the served-set-aware- * 404 rewrite (F1–F7) — and differs only in identity and model handling:+ * discovery of the account's dynamic models catalog, the capacity fallback chain,+ * and the 404 rewrite that checks that catalog (F1–F7) — and differs only in+ * identity and model handling:** - Auth token comes from getValidAntigravityAccessToken() (the shared agy* keychain item, self-refreshed), NOT the gemini-cli login token.@@ -85,7 +86,7 @@ const UNATTRIBUTED_RETRY_DELAY_MS = 1_000;const QUOTA_CHECK_TIMEOUT_MS = 3000;// ----------------------------------------------------------------------------// Model-id resolution (live served set — NO hardcoded model ids)+// Model-id resolution (dynamic models catalog — NO hardcoded model ids)// ---------------------------------------------------------------------------/**@@ -132,8 +133,9 @@ export function rankAntigravityModel(modelId: string): number {/*** Resolve a user-supplied model id to the id the Antigravity backend serves,- * using ONLY the LIVE served set (from fetchAvailableModels). No pinned model- * ids — the served ids and the default come from the account's own subscription.+ * using ONLY the account's dynamic models catalog (from fetchAvailableModels). No+ * pinned model ids — the served ids and the default come from the account's own+ * subscription.** Rules (pure, exported for testing):* 1. Exact hit — `servedIds` contains `requested` → return it.@@ -148,7 +150,8 @@ export function rankAntigravityModel(modelId: string): number {* - if the backend `defaultId` is one of them → return `defaultId`;* - else the strongest reasoning tier by suffix RANK.* 4. Otherwise — return `requested` unchanged and let the backend 404, which- * the served-set-aware 404 rewrite (F1–F7) turns into an actionable error.+ * the 404 rewrite (F1–F7) checks against the dynamic models catalog and+ * turns into an actionable error.** `catalogDefault` is injected rather than looked up inside, so the function* stays pure and testable.@@ -343,9 +346,9 @@ export class AntigravityProviderTransport implements ProviderTransport {constructor(modelName: string) {this.modelName = modelName;- // Resolved against the LIVE served set in refreshAuth(); until then the raw- // name is a safe placeholder (composed-handler always awaits refreshAuth- // before any request).+ // Resolved against the account's dynamic models catalog in refreshAuth();+ // until then the raw name is a safe placeholder (composed-handler always+ // awaits refreshAuth before any request).this.servedModelName = modelName;}@@ -357,7 +360,7 @@ export class AntigravityProviderTransport implements ProviderTransport {* Pick a probe model from this account's own model list (fetchAvailableModels).** The cloud catalog marks Antigravity `client_model_selection_required`: the- * served set is per account, so no hosted pick can be right for everyone.+ * dynamic models catalog is per account, so no hosted pick can be right for everyone.* Without this method Test All had no candidate at all and reported "no probe* model: transport does not support discovery" for a working subscription.*/@@ -441,7 +444,7 @@ export class AntigravityProviderTransport implements ProviderTransport {** `resetAntigravityUserCache()` is not incidental. `setupAntigravityUser()`* memoizes project + tier for the life of the PROCESS with no expiry, and- * `getServedAntigravityModels()` caches the served set for 10 minutes — both+ * `getServedAntigravityModels()` caches the dynamic models catalog for 10 minutes — both* keyed to the identity that was just invalidated. A re-established session* can land on a different project, so keeping them would pin the fresh token* to the dead session's project. (Until now that reset function had no callers@@ -471,11 +474,12 @@ export class AntigravityProviderTransport implements ProviderTransport {** MODEL_CAPACITY_EXHAUSTED is reported as NON-terminal here on purpose, and* that is a deliberate behaviour change. It is terminal for ONE MODEL — which- * is why `enqueueRequest` answers it with the served-set fallback chain rather- * than a retry — but it says nothing about the account. Google has no capacity- * right now; capacity returns on the order of seconds, so retrying is the- * actual remedy rather than theatre, and a bare name whose chain continues- * (antigravity → google → openrouter) gets served instead of hard-failing.+ * is why `enqueueRequest` answers it with a fallback chain drawn from the+ * dynamic models catalog rather than a retry — but it says nothing about the+ * account. Google has no capacity right now; capacity returns on the order of+ * seconds, so retrying is the actual remedy rather than theatre, and a bare+ * name whose chain continues (antigravity → google → openrouter) gets served+ * instead of hard-failing.* Reporting it terminal also handed it the quota message, which is how a* capacity fault ended up telling users to check their billing.*@@ -541,7 +545,7 @@ export class AntigravityProviderTransport implements ProviderTransport {if (response.status !== 429) {// A 404 usually means this model is not served by the tier we are on.- // Only rewrite when the live served set CONFIRMS that.+ // Only rewrite when the account's dynamic models catalog CONFIRMS that.if (response.status === 404) {return this.rewriteModelNotFound(response);}@@ -679,22 +683,23 @@ export class AntigravityProviderTransport implements ProviderTransport {* serves and how to reach the model anyway. Status stays 404 (terminal), so* composed-handler remaps it to a 400 surfaced verbatim.*- * Returns the response UNTOUCHED when the live served set contains the model.+ * Returns the response UNTOUCHED when the account's dynamic models catalog+ * contains the model.*/private rewriteModelNotFound(response: Response, capacityFallbacksExhausted = false): Response {- // The served set is the LIVE fetchAvailableModels result — no hardcoded seed.+ // The dynamic models catalog is the LIVE fetchAvailableModels result — no hardcoded seed.const served = this.servedModels;if (!capacityFallbacksExhausted && served.includes(this.servedModelName)) {log(- `[Antigravity] 404 for ${this.servedModelName}, which IS in the served set — passing through unmodified`+ `[Antigravity] 404 for ${this.servedModelName}, which IS in the dynamic models catalog — passing through unmodified`);return response;}// Drain the original so the connection body isn't left hanging.response.text().catch(() => {});- // Only name the served set when we actually have one (the live fetch may+ // Only name the dynamic models catalog when we actually have one (the live fetch may// have failed); otherwise stay honest about not knowing.const servesClause =served.length > 0 ? `That tier currently serves: ${served.join(", ")}. ` : "";diff --git a/packages/cli/src/providers/transport/devin.ts b/packages/cli/src/providers/transport/devin.tsindex 1d0745b7..62c267a4 100644--- a/packages/cli/src/providers/transport/devin.ts+++ b/packages/cli/src/providers/transport/devin.ts@@ -28,9 +28,9 @@** **3. Errors arrive inside HTTP 200.** The status code alone never signals* failure, which is why ComposedHandler routes `connect-proto` through- * `sniffDevinStreamHead` before returning a Response. The served-set-aware- * rewrite below turns a terminal fault on an unserved uid into an actionable- * message instead of an opaque backend string.+ * `sniffDevinStreamHead` before returning a Response. The rewrite below checks+ * the dynamic models catalog and turns a terminal fault on an unserved uid into+ * an actionable message instead of an opaque backend string.*/import type { DevinRequestPayload } from "../../adapters/devin-api-format.js";@@ -214,8 +214,8 @@ export class DevinProviderTransport implements ProviderTransport {* Rewrite a TERMINAL in-stream error when the dynamic models catalog proves the uid is* not served. Follows Antigravity's `rewriteModelNotFound` doctrine exactly.*- * Only rewrites when the served set is non-empty AND does not contain the- * resolved uid. An empty set means discovery failed, and inventing a diagnosis+ * Only rewrites when the dynamic models catalog is non-empty AND does not contain the+ * resolved uid. An empty catalog means discovery failed, and inventing a diagnosis* on missing data is worse than passing the backend's own message through.** Worth knowing when reading a live failure: an unserved uid comes back asdiff --git a/packages/cli/src/providers/transport/vertex-discovery.ts b/packages/cli/src/providers/transport/vertex-discovery.tsindex e3aac512..d9380713 100644--- a/packages/cli/src/providers/transport/vertex-discovery.ts+++ b/packages/cli/src/providers/transport/vertex-discovery.ts@@ -51,7 +51,7 @@* `us-central1`. Nothing in the listing distinguishes the two: a per-model* `GET …/models/<id>?view=PUBLISHER_MODEL_VIEW_FULL` returns byte-identical* field sets for a servable and an unservable model, and no other endpoint- * reports a per-region served set (`…/endpoints/openapi/models` is 404,+ * reports the project's entitlement per region (`…/endpoints/openapi/models` is 404,* `…/locations/<l>/models` is the empty tuned-model registry).** So the listing narrows the field and `:countTokens` decides it: measured on@@ -184,7 +184,7 @@ function parsePublisherModels(body: unknown): PublisherModel[] {/*** List the publisher models this project can SEE from this location.*- * A catalogue, NOT a served set — the header records the measurement: this+ * A dynamic models catalog, NOT an entitlement — the header records the measurement: this* endpoint offers `gemini-3.x` rows in `us-central1` that 404 when called there.* `discoverVertexProbeModel` narrows it with `:countTokens`; anything else* consuming this must do the same rather than treat the list as availability.diff --git a/packages/cli/src/proxy-server.ts b/packages/cli/src/proxy-server.tsindex 3290cb1e..ae24ef65 100644--- a/packages/cli/src/proxy-server.ts+++ b/packages/cli/src/proxy-server.ts@@ -740,8 +740,9 @@ export async function createProxyServer(//// Safe to run unconditionally: a model the catalog doesn't know — a local// GGUF, a custom endpoint's private id — resolves to null and passes- // through unchanged. Providers that ALSO resolve live (Antigravity's served- // set) are unaffected: they re-resolve an exact id to itself.+ // through unchanged. Providers that ALSO resolve live (against Antigravity's+ // dynamic models catalog) are unaffected: they re-resolve an exact id to+ // itself.//// ONLY for an EXPLICIT `provider@model` spec. The rewrite emits a// `provider@model` string, and for a BARE name `parsedTarget.provider` is thediff --git a/scripts/no-retired-terms.test.ts b/scripts/no-retired-terms.test.tsindex c1d26db1..15315992 100644--- a/scripts/no-retired-terms.test.ts+++ b/scripts/no-retired-terms.test.ts@@ -23,7 +23,7 @@ test("packages and scripts contain no retired terminology", () => {for (const root of [join(repositoryRoot, "packages"), join(repositoryRoot, "scripts")]) {for (const file of filesUnder(root)) {for (const [index, line] of readFileSync(file, "utf-8").split("\n").entries()) {- if (/\broster\b/i.test(line)) {+ if (/\b(roster|served[- ]set)\b/i.test(line)) {findings.push(`${relative(repositoryRoot, file)}:${index + 1}: ${line.trim()}`);}}