Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(antigravity): normalize legacy effort models (#3748)

Ahmar Hussain1e4a6de694aa
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index 0c5237f5bd..d5a5dd440e 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -229,6 +229,8 @@ export interface AcpSupport {
model: string | undefined,
env: Record<string, string | undefined>,
): string | undefined;
+ /** Normalize a legacy selection after the live session catalog is known. */
+ normalizeSessionSelection?(turn: SendTurnInput, offeredModels: readonly string[]): SendTurnInput;
/** Per-session settings between session/new (or load) and the first prompt. Some CLIs ignore argv
* and take the model/mode over the wire (droid); a throw fails the turn rather than run another model. */
configureSession?(ctx: {
@@ -1364,8 +1366,14 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
if (support.selectModel) {
const { configId } = support.selectModel;
selectedModel = modelControls.modelOf(session.sessionConfigResult);
- const wanted = cliTurn.model;
const offered = offeredModels(session.sessionConfigResult, configId);
+ const normalized = support.normalizeSessionSelection?.(cliTurn, offered) ?? cliTurn;
+ if (normalized !== cliTurn) {
+ cliTurn = normalized;
+ current.turn = cliTurn;
+ variant = cliTurn.variant;
+ }
+ const wanted = cliTurn.model;
if (support.sessionModelEnv && !session.launchModel && offered.length) accountModels = new Set(offered);
// A pooled process missing a catalog model predates the catalog: fail and respawn, never run another (the catalog holds picker ids; `wanted` may be the resolved wire id, so check both).
staleProcess = Boolean(support.fallbackModel && wanted && !launchedThisTurn && offered.length
diff --git a/server/drivers/antigravity.test.ts b/server/drivers/antigravity.test.ts
index bce4df22d6..871078f323 100644
--- a/server/drivers/antigravity.test.ts
+++ b/server/drivers/antigravity.test.ts
@@ -74,11 +74,17 @@ afterEach(async () => {
describe("official Antigravity catalog", () => {
it("uses current Gemini 3.8 variants as the offline fallback", () => {
expect(STATIC_ANTIGRAVITY_MODELS).toEqual({
- default: "gemini-3.8-flash-high",
+ default: "gemini-3.8-flash",
options: [
- { id: "gemini-3.8-flash-high", label: "Gemini 3.8 Flash (High)" },
- { id: "gemini-3.8-flash-medium", label: "Gemini 3.8 Flash (Medium)" },
- { id: "gemini-3.8-flash-low", label: "Gemini 3.8 Flash (Low)" },
+ {
+ id: "gemini-3.8-flash",
+ label: "Gemini 3.8 Flash",
+ variants: [
+ { id: "low", label: "Low" },
+ { id: "medium", label: "Medium" },
+ { id: "high", label: "High" },
+ ],
+ },
],
});
});
@@ -717,9 +723,10 @@ describe("Antigravity driver over shared ACP", () => {
GEMINI_API_KEY: "must-not-leak",
GOOGLE_API_KEY: "also-must-not-leak",
FAKE_ACP_AUTH_METHOD: "oauth-personal",
- FAKE_ACP_MODELS: "gemini-3.8-flash-high,gemini-3.8-flash-low",
+ FAKE_ACP_MODELS: "gemini-3.8-flash",
FAKE_ACP_VARIANTS: JSON.stringify({
- "gemini-3.8-flash-low": {
+ "gemini-3.8-flash": {
+ id: "thinking_level",
currentValue: "medium",
options: [
{ value: "low", name: "Low" },
@@ -743,8 +750,9 @@ describe("Antigravity driver over shared ACP", () => {
text: "hello",
approvalMode,
resumeCursor: "fake-acp-session",
- model: "gemini-3.8-flash-low",
- variant: "high",
+ // Existing bots can have the pre-variant fallback ID saved. The official
+ // runtime only accepts the base model plus its thinking-level option.
+ model: "gemini-3.8-flash-high",
integrations: {
custom: { docs: { command: "docs-mcp", args: ["serve"], env: { TOKEN: "scoped" } } },
},
@@ -762,9 +770,8 @@ describe("Antigravity driver over shared ACP", () => {
expect(dumpState.env.AGY_ACP_DEFAULT_MODEL).toBeUndefined();
const calls = JSON.parse(readFileSync(`${dump}.config.json`, "utf8"));
expect(calls).toEqual([
- { method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "model", value: "gemini-3.8-flash-low" } },
{ method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "mode", value: approvalMode === "full" ? "yolo" : approvalMode === "edits" ? "auto_edit" : "default" } },
- { method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "effort", value: "high" } },
+ { method: "session/set_config_option", params: { sessionId: "fake-acp-session", configId: "thinking_level", value: "high" } },
]);
const mcp = JSON.parse(readFileSync(`${dump}.mcp.json`, "utf8"));
expect(mcp).toEqual([{ name: "docs", command: "docs-mcp", args: ["serve"], env: [{ name: "TOKEN", value: "scoped" }] }]);
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index 01828dcfcb..e109b02f9b 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -8,6 +8,7 @@ import type {
ProviderDriver,
ProviderInstance,
ProviderSnapshot,
+ SendTurnInput,
} from "../contracts.ts";
import { createAcpDriver, type AcpConfig, type AcpSupport } from "./acp/core.ts";
import {
@@ -27,14 +28,28 @@ import { VERIFICATION_TEMP_KEY, scheduleAntigravityTempSweep } from "./antigravi
import { augmentedPath } from "../env-path.ts";
export const STATIC_ANTIGRAVITY_MODELS: ModelCatalog = {
- default: "gemini-3.8-flash-high",
+ default: "gemini-3.8-flash",
options: [
- { id: "gemini-3.8-flash-high", label: "Gemini 3.8 Flash (High)" },
- { id: "gemini-3.8-flash-medium", label: "Gemini 3.8 Flash (Medium)" },
- { id: "gemini-3.8-flash-low", label: "Gemini 3.8 Flash (Low)" },
+ {
+ id: "gemini-3.8-flash",
+ label: "Gemini 3.8 Flash",
+ variants: [
+ { id: "low", label: "Low" },
+ { id: "medium", label: "Medium" },
+ { id: "high", label: "High" },
+ ],
+ },
],
};
+export function normalizeAntigravityTurn(turn: SendTurnInput, offeredModels: readonly string[]): SendTurnInput {
+ if (turn.variant !== undefined) return turn;
+ const match = turn.model?.match(/^(gemini-3\.8-flash)-(low|medium|high)$/u);
+ return match && offeredModels.includes(match[1]) && !offeredModels.includes(match[0])
+ ? { ...turn, model: match[1], variant: match[2] }
+ : turn;
+}
+
/** Antigravity's session modes: `yolo` for Full, `auto_edit` for auto-accept edits, `default` otherwise (it has no reviewer for Auto). */
export function antigravityPermissionMode(fullAuto: boolean, approvalMode?: ApprovalMode): "yolo" | "auto_edit" | "default" {
if (fullAuto || approvalMode === "full") return "yolo";
@@ -61,6 +76,7 @@ const support: AcpSupport = {
spawnArgs: () => [],
selectModel: { configId: "model" },
modelVariants: true,
+ normalizeSessionSelection: normalizeAntigravityTurn,
// Google's server reads its new-session default from this variable (agy_acp_server 1.4.3
// model_selection.get_default_model_id); a later switch re-fetches the model list (1.3-1.8 s).
sessionModelEnv: "AGY_ACP_DEFAULT_MODEL",