The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
fix(server): accept Antigravity model IDs with thinking levels when delegating (#39413)
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Simone committed
Nov 20, 2026 at 00:51 UTC
5ee1c2f652edbb488592ec93c3bf0096302803d6
2 files changed
+83
-5
apps/server/src/mcp/OrchestratorMcpService.test.ts
+56
-1
@@ -4361,6 +4361,7 @@ describe("OrchestratorMcpService provider resolution", () => {
4361
() =>
4362
Effect.gen(function* () {
4363
const peerId = ProviderInstanceId.make("codex-subscription-2");
4364
+ const antigravityId = ProviderInstanceId.make("antigravity");
4365
const driver = ProviderDriverKind.make("codex");
4366
const inherited = {
4367
instanceId: codexInstanceId,
@@ -4408,6 +4409,33 @@ describe("OrchestratorMcpService provider resolution", () => {
4409
target: { providerInstanceId: peerId, options: { reasoningEffort: "max" } },
4410
expected: { instanceId: peerId, model: inherited.model, options: override },
4411
},
4412
+ {
4413
+ name: "Antigravity model with a thinking suffix",
4414
+ target: { providerInstanceId: antigravityId, model: "gemini-4-neon-high" },
4415
+ expected: {
4416
+ instanceId: antigravityId,
4417
+ model: "gemini-4-neon",
4418
+ options: [{ id: "thought_level", value: "high" }],
4419
+ },
4420
+ },
4421
+ {
4422
+ name: "explicit Antigravity thinking overrides the suffix",
4423
+ target: {
4424
+ providerInstanceId: antigravityId,
4425
+ model: "gemini-4-neon-high",
4426
+ options: { thought_level: "medium" },
4427
+ },
4428
+ expected: {
4429
+ instanceId: antigravityId,
4430
+ model: "gemini-4-neon",
4431
+ options: [{ id: "thought_level", value: "medium" }],
4432
+ },
4433
+ },
4434
+ {
4435
+ name: "clear Antigravity suffix options",
4436
+ target: { providerInstanceId: antigravityId, model: "gemini-4-neon-high", options: {} },
4437
+ expected: { instanceId: antigravityId, model: "gemini-4-neon", options: [] },
4438
+ },
4439
{
4440
name: "old Ultracode effort level",
4441
target: { model: "ultracode-model", options: { effort: "ultracode" } },
@@ -4495,8 +4523,35 @@ describe("OrchestratorMcpService provider resolution", () => {
4523
],
4524
},
4525
providerSnapshot({ instanceId: peerId, driver, model: inherited.model }),
4526
+ {
4527
+ ...providerSnapshot({
4528
+ instanceId: antigravityId,
4529
+ driver: ProviderDriverKind.make("antigravity"),
4530
+ }),
4531
+ models: [
4532
+ {
4533
+ slug: "gemini-4-neon",
4534
+ name: "Gemini 4 Neon",
4535
+ isCustom: false,
4536
+ capabilities: {
4537
+ optionDescriptors: [
4538
+ {
4539
+ id: "thought_level",
4540
+ role: "reasoning",
4541
+ label: "Thinking",
4542
+ type: "select",
4543
+ options: [
4544
+ { id: "medium", label: "Medium" },
4545
+ { id: "high", label: "High" },
4546
+ ],
4547
+ },
4548
+ ],
4549
+ },
4550
+ },
4551
+ ],
4552
+ },
4553
]),
4499
- adapterRegistryLayer([codexInstanceId, peerId]),
4554
+ adapterRegistryLayer([codexInstanceId, peerId, antigravityId]),
4555
Layer.mock(ProjectService.ProjectService)({ getById: () => Effect.succeedNone }),
4556
Layer.mock(SecretRequests.SecretRequests)({}),
4557
Layer.mock(RemoteDelegation.RemoteDelegation)({}),
apps/server/src/mcp/OrchestratorMcpService.ts
+27
-4
@@ -397,6 +397,23 @@ const advertisedModel = (provider: ServerProvider, model: string) =>
397
candidate.aliases?.some((alias) => alias.toLowerCase() === model.toLowerCase()),
398
);
399
400
+/** Antigravity 1.3 IDs append the thinking level (`gemini-3.8-flash-high`); the agent still accepts them. */
401
+function antigravitySuffixedModel(provider: ServerProvider, model: string) {
402
+ if (provider.driver !== "antigravity" || advertisedModel(provider, model)) return;
403
+ const separator = model.lastIndexOf("-");
404
+ if (separator === -1) return;
405
+ const family = model.slice(0, separator);
406
+ const value = model.slice(separator + 1);
407
+ const thinking = provider.models
408
+ .find((candidate) => candidate.slug === family)
409
+ ?.capabilities?.optionDescriptors?.find(
410
+ (descriptor) => descriptor.type === "select" && descriptor.role === "reasoning",
411
+ );
412
+ if (thinking?.type === "select" && thinking.options.some((choice) => choice.id === value)) {
413
+ return { model: family, thinking: { id: thinking.id, value } };
414
+ }
415
+}
416
+
417
/** A folder's own provider config can add models that only its workspace snapshot lists. */
418
export const withWorkspaceModels = (
419
providers: ReadonlyArray<ServerProvider>,
@@ -1690,7 +1707,10 @@ const make = Effect.gen(function* () {
1707
1708
const inheritedSelection = input.parent.thread.modelSelection;
1709
const requestedModel = input.target?.model;
1710
+ const antigravityTarget =
1711
+ requestedModel === undefined ? undefined : antigravitySuffixedModel(provider, requestedModel);
1712
const model =
1713
+ antigravityTarget?.model ??
1714
requestedModel ??
1715
(instanceId === inheritedSelection.instanceId
1716
? inheritedSelection.model
@@ -1701,7 +1721,7 @@ const make = Effect.gen(function* () {
1721
`Provider ${instanceId} has no model available for inheritance.`,
1722
);
1723
}
1704
- if (requestedModel !== undefined) yield* requireAdvertisedModel(provider, requestedModel);
1724
+ if (requestedModel !== undefined) yield* requireAdvertisedModel(provider, model);
1725
const advertised = advertisedModel(provider, model);
1726
const descriptors = advertised?.capabilities?.optionDescriptors;
1727
const requestedOptions = withLegacyUltracodeEffort(descriptors, input.target?.options);
@@ -1725,14 +1745,17 @@ const make = Effect.gen(function* () {
1745
descriptors,
1746
)
1747
: undefined;
1728
- if (requestedOptions !== undefined) {
1748
+ if (requestedOptions !== undefined || antigravityTarget !== undefined) {
1749
const selections = new Map(
1730
- (requestedOptions.length === 0 ? [] : (options ?? [])).map((selection) => [
1750
+ (requestedOptions?.length === 0 ? [] : (options ?? [])).map((selection) => [
1751
selection.id,
1752
selection,
1753
]),
1754
);
1735
- for (const selection of requestedOptions) {
1755
+ if (antigravityTarget !== undefined && requestedOptions?.length !== 0) {
1756
+ selections.set(antigravityTarget.thinking.id, antigravityTarget.thinking);
1757
+ }
1758
+ for (const selection of requestedOptions ?? []) {
1759
selections.set(selection.id, selection);
1760
}
1761
options = [...selections.values()];