GeezerVison is showing github.com — fix(antigravity): restore concrete models with ACP 1.4 by pauljones0 · Pull Request #20979 · pingdotgg/t3code
fix(antigravity): restore concrete models with ACP 1.4
#20979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter
Filter by extension
.ts
(9)
All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
fix(antigravity): restore concrete models with ACP 1.4
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
Paul
committed
Oct 17, 2026
commit ea8e441db58e82e69e0794e2f2cc1720f4d922d4
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -25,8 +25,9 @@ import type * as EffectAcpSchema from "effect-acp/compat";
import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
import * as TestProviderHost from "@t3tools/provider-testing/TestProviderHost";
import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";
import { makeAntigravityAcpRuntime } from "../../provider/acp/AntigravityAcpSupport.ts";
import { antigravity140Session } from "../../provider/acp/antigravity140.fixture.ts";
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
import {
Expand Down
Expand Up
@@ -58,6 +59,41 @@ function permissionRequest(
}
describe("AntigravityAdapterV2 flavor", () => {
it.effect("restores an ACP 1.4 concrete model instead of selecting the family", () => {
const selected: string[] = [];
return Effect.gen(function* () {
const runtime = yield* AcpSessionRuntime.AcpSessionRuntime;
const model = yield* flavor.applyModelSelection!({
runtime,
startResult: {
sessionId: antigravity140Session.sessionId,
sessionSetupResult: antigravity140Session,
initializeResult: { protocolVersion: 1 },
modelConfigId: "model",
},
modelSelection: {
instanceId: ProviderInstanceId.make("antigravity-test"),
model: "gemini-3.8-flash-low",
},
});
assert.equal(model, "gemini-3.8-flash-low");
assert.deepEqual(selected, ["gemini-3.8-flash-low"]);
}).pipe(
Effect.provide(
Layer.mock(AcpSessionRuntime.AcpSessionRuntime)({
processContainment: "none",
getConfigOptions: Effect.succeed(antigravity140Session.configOptions),
setModel: () => Effect.die("The model config only accepts a family ID"),
setSessionModel: (model) =>
Effect.sync(() => {
selected.push(model);
return {};
}),
}),
),
);
});
it("keeps a successful subagent launch running until the parent turn becomes idle", () => {
const batch = flavor.extractSubagentUpdate?.({
toolCallId: "trajectory:4",
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -163,11 +163,12 @@ export function makeAntigravityAcpAdapterFlavor(
preferResumeSession: true,
subagentsIdleOnTurnCompletion: true,
...(options.onSessionEvent === undefined ? {} : { onSessionEvent: options.onSessionEvent }),
applyModelSelection: ({ runtime, modelSelection }) =>
applyModelSelection: ({ runtime, modelSelection, startResult }) =>
Effect.gen(function* () {
const defaultModel = yield* options.defaultModel;
return yield* applyAntigravityAcpModelSelection({
runtime,
models: startResult.sessionSetupResult.models,
model:
modelSelection.model === ANTIGRAVITY_DEFAULT_MODEL ? undefined : modelSelection.model,
defaultModel,
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -29,6 +29,7 @@ import {
buildAntigravityModelsFromSession,
makeAntigravityProvider,
} from "./AntigravityProvider.ts";
import { antigravity140Session } from "./acp/antigravity140.fixture.ts";
const decodeSettings = Schema.decodeSync(AntigravitySettings);
const instanceId = ProviderInstanceId.make("antigravity-test");
Expand Down
Expand Up
@@ -179,6 +180,14 @@ const makeHarness = Effect.fn("makeAntigravityProviderHarness")(function* (
});
describe("Antigravity model catalog", () => {
it("keeps ACP 1.4 concrete models and the selected thinking level", () => {
const models = buildAntigravityModelsFromSession(antigravity140Session);
expect(models.map((model) => model.slug)).toEqual(
antigravity140Session.models.availableModels.map((model) => model.modelId),
);
expect(models.find((model) => model.isDefault)?.slug).toBe("gemini-3.8-flash-high");
});
it("keeps the captured personal catalog's IDs, labels, order, and selected default", () => {
const models = buildAntigravityModelsFromSession(sessionSetupResult);
expect(models.map((model) => [model.slug, model.name])).toEqual(
Expand Down
Expand Up
@@ -235,6 +244,29 @@ describe("Antigravity model catalog", () => {
});
it.layer(layerTest)("Antigravity provider snapshots", (it) => {
it.effect("keeps concrete ACP 1.4 models when grouped config options are updated", () =>
Effect.scoped(
Effect.gen(function* () {
const harness = yield* makeHarness();
yield* harness.initialize;
yield* harness.provider.onSessionStarted({
...started,
sessionSetupResult: antigravity140Session,
});
yield* harness.provider.onConfigOptionsUpdated(antigravity140Session.configOptions);
const snapshot = yield* harness.provider.snapshot.getSnapshot;
expect(snapshot.models.map((model) => model.slug)).toEqual(
antigravity140Session.models.availableModels.map((model) => model.modelId),
);
yield* harness.provider.onSessionStarted(started);
yield* harness.provider.onConfigOptionsUpdated([
{ ...modelConfig, options: modelOptions.slice(0, 1) },
]);
expect((yield* harness.provider.snapshot.getSnapshot).models).toHaveLength(1);
}),
),
);
it.effect("does not probe or run helper safety checks while disabled", () =>
Effect.scoped(
Effect.gen(function* () {
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -50,10 +50,15 @@ export function buildAntigravityModelsFromSession(
const config = setup.configOptions?.find(
(option) => option.id === "model" || option.category === "model",
);
const models = setup.configOptions?.some((option) => option.id === "thinking_level")
? setup.models
: undefined;
const currentValue =
config?.type === "select" ? config.currentValue : setup.models?.currentModelId;
const entries =
config?.type === "select"
models?.currentModelId ??
(config?.type === "select" ? config.currentValue : setup.models?.currentModelId);
const entries = models
? models.availableModels.map((model) => ({ value: model.modelId, name: model.name }))
: config?.type === "select"
? config.options.flatMap((entry) => ("value" in entry ? [entry] : entry.options))
: config === undefined
? (setup.models?.availableModels.map((model) => ({
Expand Down
Expand Up
@@ -115,6 +120,7 @@ function isMissingInstallation(error: EffectAcpErrors.AcpError | ProviderSetupEr
interface AntigravityProviderState {
readonly draft: ServerProviderDraft;
readonly authRevision: number;
readonly usesSessionModels: boolean;
}
interface AntigravityProviderOptions {
Expand Down
Expand Up
@@ -159,6 +165,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
const metadata = yield* SubscriptionRef.make<AntigravityProviderState>({
draft: initialDraft,
authRevision: 0,
usesSessionModels: false,
});
// Skills the driver discovered on disk per workspace. Session callbacks
// rewrite the workspace entry with native commands and must keep these, or
Expand Down
Expand Up
@@ -286,6 +293,11 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
const workspace = cwd ? workspaces.find((entry) => entry.cwd === cwd) : undefined;
return {
authRevision: state.authRevision + 1,
usesSessionModels:
started.sessionSetupResult.models != null &&
started.sessionSetupResult.configOptions?.some(
(option) => option.id === "thinking_level",
) === true,
draft: {
...draft,
installed: true,
Expand Down
Expand Up
@@ -326,7 +338,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
) {
const models = buildAntigravityModelsFromSession({ configOptions });
yield* SubscriptionRef.update(metadata, (state) => {
if (state.draft.auth.status !== "authenticated") return state;
if (state.draft.auth.status !== "authenticated" || state.usesSessionModels ) return state;
return { ...state, draft: { ...state.draft, models } };
});
});
Expand Down
Expand Up
@@ -375,6 +387,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
(state) =>
({
authRevision: state.authRevision + 1,
usesSessionModels: false,
draft: {
...state.draft,
auth: { status: "unauthenticated" },
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -13,6 +13,7 @@ import * as EffectAcpErrors from "effect-acp/errors";
import type * as EffectAcpSchema from "effect-acp/compat";
import { resolveAttachmentPath } from "../../attachmentStore.ts";
import { antigravity140Session } from "./antigravity140.fixture.ts";
import {
antigravityPermissionMode,
applyAntigravityAcpModelSelection,
Expand All
@@ -35,17 +36,134 @@ function makeModelRuntime(
failure?: EffectAcpErrors.AcpError,
) {
const selections: string[] = [];
const sessionSelections: string[] = [];
const setModel = Effect.fn("AntigravityAcpSupportTest.setModel")(function* (model: string) {
if (failure) return yield* failure;
selections.push(model);
});
return {
runtime: { getConfigOptions: Effect.succeed(configOptions), setModel },
runtime: {
getConfigOptions: Effect.succeed(configOptions),
setModel,
setSessionModel: (model: string) =>
Effect.gen(function* () {
if (failure) return yield* failure;
sessionSelections.push(model);
return {};
}),
},
selections,
sessionSelections,
};
}
describe("applyAntigravityAcpModelSelection", () => {
it.effect.each(["gemini-3.8-flash-high", "gemini-3.8-flash-low"])(
"restores concrete ACP 1.4 model %s through session/set_model",
(model) =>
Effect.gen(function* () {
const { runtime, selections, sessionSelections } = makeModelRuntime(
antigravity140Session.configOptions,
);
const selected = yield* applyAntigravityAcpModelSelection({
runtime,
models: antigravity140Session.models,
model,
mapError: (cause) => cause,
});
expect(selected).toBe(model);
expect(sessionSelections).toEqual([model]);
expect(selections).toEqual([]);
}),
);
it.effect("resolves the ACP 1.4 default to a concrete model", () =>
Effect.gen(function* () {
const { runtime, sessionSelections } = makeModelRuntime(antigravity140Session.configOptions);
const selected = yield* applyAntigravityAcpModelSelection({
runtime,
models: antigravity140Session.models,
model: ANTIGRAVITY_DEFAULT_MODEL,
defaultModel: "gemini-3.8-flash-medium",
mapError: (cause) => cause,
});
expect(selected).toBe("gemini-3.8-flash-medium");
expect(sessionSelections).toEqual(["gemini-3.8-flash-medium"]);
}),
);
it.effect("keeps the ACP 1.4 current model when the manifest default is unavailable", () =>
Effect.gen(function* () {
const { runtime, selections, sessionSelections } = makeModelRuntime(
antigravity140Session.configOptions,
);
const selected = yield* applyAntigravityAcpModelSelection({
runtime,
models: antigravity140Session.models,
model: undefined,
defaultModel: "gemini-unavailable",
mapError: (cause) => cause,
});
expect(selected).toBe("gemini-3.8-flash-high");
expect(sessionSelections).toEqual([]);
expect(selections).toEqual([]);
}),
);
it.effect("restores the manifest default after an in-session thinking-level change", () =>
Effect.gen(function* () {
const { runtime, sessionSelections } = makeModelRuntime(
antigravity140Session.configOptions.map((option) =>
option.id === "thinking_level" ? { ...option, currentValue: "low" } : option,
),
);
const selected = yield* applyAntigravityAcpModelSelection({
runtime,
models: antigravity140Session.models,
model: ANTIGRAVITY_DEFAULT_MODEL,
defaultModel: "gemini-3.8-flash-high",
mapError: (cause) => cause,
});
expect(selected).toBe("gemini-3.8-flash-high");
expect(sessionSelections).toEqual(["gemini-3.8-flash-high"]);
}),
);
it.effect("keeps the config-option path when an agent has no per-model state", () =>
Effect.gen(function* () {
const { runtime, selections, sessionSelections } = makeModelRuntime(
antigravity140Session.configOptions,
);
const selected = yield* applyAntigravityAcpModelSelection({
runtime,
model: "gemini-3.8-flash",
mapError: (cause) => cause,
});
expect(selected).toBe("gemini-3.8-flash");
expect(selections).toEqual(["gemini-3.8-flash"]);
expect(sessionSelections).toEqual([]);
}),
);
it.effect.each(["gemini-3.8-flash", "gemini-unavailable"])(
"rejects ACP 1.4 model %s when it is not a concrete advertised ID",
(model) =>
Effect.gen(function* () {
const { runtime, selections, sessionSelections } = makeModelRuntime(
antigravity140Session.configOptions,
);
const error = yield* applyAntigravityAcpModelSelection({
runtime,
models: antigravity140Session.models,
model,
mapError: (cause) => cause,
}).pipe(Effect.flip);
expect(error).toMatchObject({ _tag: "AcpRequestError", code: -32602 });
expect(sessionSelections).toEqual([]);
expect(selections).toEqual([]);
}),
);
it.effect("restores the saved model instead of the cold-resume default", () =>
Effect.gen(function* () {
const { runtime, selections } = makeModelRuntime();
Expand Down
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.