Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/plugin/config/model-discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ describe("model discovery is forward-only", () => {
expect(buildDiscoveredModels(["gemini-4-argon"])["antigravity-gemini-4-argon"]).toBeDefined();
});

it("groups the Gemini 4 Hydrogen family and keeps xhigh out of the picker", () => {
// The official CLI ships Hydrogen as Low|Medium|High|XHigh. OpenCode's
// ModelThinkingLevel has no `xhigh`, so the tier is still recognized and
// stripped from the family id, but it is not offered as a variant.
expect(isDiscoverableModelId("gemini-4-hydrogen-xhigh")).toBe(true);
expect(isDiscoverableModelId("gemini-4-carbon-high")).toBe(true);

const discovered = buildDiscoveredModels([
"gemini-4-hydrogen-low",
"gemini-4-hydrogen-medium",
"gemini-4-hydrogen-high",
"gemini-4-hydrogen-xhigh",
]);

expect(Object.keys(discovered)).toEqual(["antigravity-gemini-4-hydrogen"]);
expect(Object.keys(discovered["antigravity-gemini-4-hydrogen"]!.variants!).sort()).toEqual([
"high",
"low",
"medium",
]);
});

it("surfaces Claude generations newer than the curated floor", () => {
// Successors of the Claude 4.6 trio that Google removes on 2026-11-02.
expect(isDiscoverableModelId("claude-sonnet-5-5")).toBe(true);
Expand Down
17 changes: 14 additions & 3 deletions src/plugin/config/model-discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ const TIERED_SUFFIX = /-tiered$/i;
* a thinking dial is noise, and the curated catalog already models 3.8 Flash that
* way (`antigravity-gemini-3.8-flash` + `low|medium|high` variants).
*/
const TIER_SUFFIX = /-(low|medium|high|max)$/i;
const TIER_ORDER = ["low", "medium", "high", "max"] as const;
const TIER_SUFFIX = /-(low|medium|high|xhigh|max)$/i;
const TIER_ORDER = ["low", "medium", "high", "xhigh", "max"] as const;
type TierName = (typeof TIER_ORDER)[number];

/** Backend limits measured from `fetchAvailableModels`, keyed by backend id. */
Expand Down Expand Up @@ -169,6 +169,17 @@ const GEMINI_THINKING_VARIANTS: Record<string, ModelVariant> = {
high: { thinkingLevel: "high" },
};

/**
* Tiers the backend encodes in the id but OpenCode's `ModelThinkingLevel` cannot
* express yet. Gemini 4 Hydrogen ships `-xhigh` (the official CLI exposes it as
* `--effort xhigh` and lists Low|Medium|High|XHigh), but the selector type only
* knows low|medium|high. The tier is still recognized and stripped so the
* family groups correctly and nothing is duplicated; it simply is not offered as
* a picker variant until the type grows the level. `#xhigh` still travels through
* the launch-model suffix.
*/
const UNMAPPED_TIERS = new Set<string>(["xhigh"]);

const CLAUDE_THINKING_VARIANTS: Record<string, ModelVariant> = {
low: { thinkingConfig: { thinkingBudget: 8192 } },
medium: { thinkingConfig: { thinkingBudget: 16384 } },
Expand Down Expand Up @@ -273,7 +284,7 @@ export function buildDiscoveredModelDefinition(
: { ...CLAUDE_THINKING_VARIANTS };
} else if (!isGptOss) {
definition.variants = observed
? Object.fromEntries(observed.map((tier) => [tier, { thinkingLevel: tier as "low" | "medium" | "high" }]))
? Object.fromEntries(observed.filter((tier) => !UNMAPPED_TIERS.has(tier)).map((tier) => [tier, { thinkingLevel: tier as "low" | "medium" | "high" }]))
: { ...GEMINI_THINKING_VARIANTS };
}

Expand Down
Loading