@devries-cameron20 / t3code Mirror · read-only / commits / 7f5528154e
Fork 0

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 22, 13:15 UTC

fix(antigravity): served reads stop spinning and duplicate model names are labeled (#26928)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Oct 29, 2026 at 05:07 UTC 7f5528154ebe50269c5a9b3be08e93958dcefda8
6 files changed +85 -13
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts
+10
@@ -896,6 +896,16 @@ describe("AntigravityAdapterV2 subagent reads", () => {
896 : undefined;
897 };
898
899 + const firstEvent = (nativeId: string, status: string) =>
900 + events.findIndex(
901 + (event) =>
902 + event.type === "turn_item.updated" &&
903 + event.turnItem.nativeItemRef?.nativeId === nativeId &&
904 + event.turnItem.status === status,
905 + );
906 + // T3 completes a served read itself instead of leaving it running until the flush.
907 + assert.isAbove(firstEvent("call_served", "completed"), -1);
908 + assert.isBelow(firstEvent("call_served", "completed"), firstEvent("call_native", "failed"));
909 const failed = { status: "failed" as const, output: stepError };
910 assert.deepEqual(read("call_served"), { status: "completed", output: undefined });
911 assert.deepEqual(read("call_retried"), { status: "completed", output: undefined });
apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts
+26 -5
@@ -11,6 +11,7 @@ import * as Effect from "effect/Effect";
11 import * as FileSystem from "effect/FileSystem";
12 import * as Path from "effect/Path";
13 import * as Exit from "effect/Exit";
14 +import * as Semaphore from "effect/Semaphore";
15 import * as Scope from "effect/Scope";
16 import * as EffectAcpErrors from "effect-acp/errors";
17
@@ -131,20 +132,40 @@ export function makeAntigravityAcpAdapterFlavor(
132 .pipe(Effect.provideService(Scope.Scope, scope));
133 // Repair keeps state across updates, so each runtime must have one session-update handler.
134 const reads = makeAntigravityReadRepair();
135 + // Served reads are reported from the read handler, so they take turns with agent updates.
136 + const updates = yield* Semaphore.make(1);
137 + let projectUpdate: Parameters<typeof runtime.handleSessionUpdate>[0] | undefined;
138 return {
139 ...runtime,
140 handleReadTextFile: (handler) =>
141 runtime.handleReadTextFile((request, context) =>
142 handler(request, context).pipe(
139 - Effect.onExit((exit) =>
140 - Effect.sync(() => reads.attempted(request.path, Exit.isSuccess(exit))),
141 - ),
143 + Effect.onExit((exit) => {
144 + const served = reads.attempted(request.path, Exit.isSuccess(exit));
145 + if (served === undefined || projectUpdate === undefined) return Effect.void;
146 + return updates
147 + .withPermit(
148 + projectUpdate({
149 + sessionId: served.sessionId,
150 + update: {
151 + sessionUpdate: "tool_call_update",
152 + toolCallId: served.toolCallId,
153 + status: "completed",
154 + },
155 + }),
156 + )
157 + .pipe(Effect.ignore);
158 + }),
159 ),
160 ),
161 prompt: (payload, promptOptions) =>
162 Effect.sync(reads.reset).pipe(Effect.andThen(runtime.prompt(payload, promptOptions))),
146 - handleSessionUpdate: (handler) =>
147 - runtime.handleSessionUpdate((notification) => handler(reads.repair(notification))),
163 + handleSessionUpdate: (handler) => {
164 + projectUpdate = handler;
165 + return runtime.handleSessionUpdate((notification) =>
166 + updates.withPermit(handler(reads.repair(notification))),
167 + );
168 + },
169 start: () =>
170 runtime
171 .start()
apps/server/src/provider/AntigravityProvider.test.ts
+19
@@ -215,6 +215,25 @@ describe("Antigravity model catalog", () => {
215 );
216 });
217
218 + it("labels models that share a display name with their IDs", () => {
219 + const models = buildAntigravityModelsFromSession({
220 + configOptions: [
221 + {
222 + ...modelConfig,
223 + currentValue: "gemini-3.8-flash",
224 + options: [
225 + { value: "gemini-3.8-flash", name: "Gemini 3.8 Flash" },
226 + { value: "gemini-3.8-flash-preview", name: "Gemini 3.8 Flash" },
227 + ],
228 + },
229 + ],
230 + });
231 + expect(models.map((model) => model.name)).toEqual([
232 + "Gemini 3.8 Flash",
233 + "Gemini 3.8 Flash (gemini-3.8-flash-preview)",
234 + ]);
235 + });
236 +
237 it("offers each model the thinking levels it reported when selected", () => {
238 const thinking = (currentValue: string) =>
239 ({
apps/server/src/provider/AntigravityProvider.ts
+6 -1
@@ -82,15 +82,20 @@ export function buildAntigravityModelsFromSession(
82 : [];
83 const currentThinking = antigravityThinkingConfig(setup.configOptions);
84 const seen = new Set<string>();
85 + // The agent can list two IDs under one name; label the later ones so the picker tells them apart.
86 + const names = new Set<string>();
87 return entries.flatMap((entry): ServerProviderModel[] => {
88 if (!entry.value.trim() || seen.has(entry.value)) return [];
89 seen.add(entry.value);
90 + const baseName = entry.name.trim() ? entry.name : entry.value;
91 + const name = names.has(baseName) ? `${baseName} (${entry.value})` : baseName;
92 + names.add(baseName);
93 const observed =
94 entry.value === currentValue ? (currentThinking ?? null) : thinkingLevels.get(entry.value);
95 return [
96 {
97 slug: entry.value,
93 - name: entry.name.trim() ? entry.name : entry.value,
98 + name,
99 isCustom: false,
100 ...(entry.value === currentValue
101 ? { isDefault: true, aliases: [ANTIGRAVITY_DEFAULT_MODEL] }
apps/server/src/provider/acp/AntigravityProtocol.test.ts
+2 -1
@@ -430,7 +430,7 @@ describe("Antigravity served reads", () => {
430 it("credits a read T3 served before the agent announced it", () => {
431 const reads = makeAntigravityReadRepair();
432 reads.attempted("/repo/a.ts", true);
433 - reads.repair({
433 + const announced = reads.repair({
434 sessionId: "session-1",
435 update: {
436 sessionUpdate: "tool_call",
@@ -441,6 +441,7 @@ describe("Antigravity served reads", () => {
441 locations: [{ path: "/repo/a.ts" }],
442 },
443 });
444 + expect(announced.update).toMatchObject({ status: "completed" });
445 expect(flush(reads, "call_late")).toEqual({
446 sessionUpdate: "tool_call_update",
447 toolCallId: "call_late",
apps/server/src/provider/acp/AntigravityProtocol.ts
+22 -6
@@ -239,7 +239,10 @@ function antigravityClientReadPath(update: {
239 */
240 export function makeAntigravityReadRepair() {
241 type Outcome = "served" | "refused";
242 - const openReads = new Map<string, { readonly path: string; outcome?: Outcome }>();
242 + const openReads = new Map<
243 + string,
244 + { readonly path: string; readonly sessionId: string; outcome?: Outcome }
245 + >();
246 // The agent runs a client tool in a background task, so its request can precede the announcement.
247 const earlyOutcomes: Array<{ readonly path: string; readonly outcome: Outcome }> = [];
248 return {
@@ -248,15 +251,19 @@ export function makeAntigravityReadRepair() {
251 openReads.clear();
252 earlyOutcomes.length = 0;
253 },
251 - /** Each `fs/read_text_file` request answers the oldest open read of its path, in order. */
254 + /**
255 + * Each `fs/read_text_file` request answers the oldest open read of its path, in order.
256 + * Returns the call a served read completes, so T3 can report it without waiting.
257 + */
258 attempted: (path: string, served: boolean) => {
259 const outcome = served ? "served" : "refused";
254 - for (const read of openReads.values()) {
260 + for (const [toolCallId, read] of openReads) {
261 if (read.path !== path || read.outcome !== undefined) continue;
262 read.outcome = outcome;
257 - return;
263 + return served ? { sessionId: read.sessionId, toolCallId } : undefined;
264 }
265 earlyOutcomes.push({ path, outcome });
266 + return undefined;
267 },
268 repair: (
269 notification: EffectAcpSchema.SessionNotification,
@@ -269,10 +276,19 @@ export function makeAntigravityReadRepair() {
276 if (path !== undefined && !openReads.has(update.toolCallId)) {
277 const early = earlyOutcomes.findIndex((entry) => entry.path === path);
278 const outcome = early === -1 ? undefined : earlyOutcomes.splice(early, 1)[0]?.outcome;
272 - openReads.set(update.toolCallId, outcome === undefined ? { path } : { path, outcome });
279 + const sessionId = notification.sessionId;
280 + openReads.set(
281 + update.toolCallId,
282 + outcome === undefined ? { path, sessionId } : { path, sessionId, outcome },
283 + );
284 }
274 - if (update.status !== "completed" && update.status !== "failed") return notification;
285 const read = openReads.get(update.toolCallId);
286 + if (update.status === "pending" || update.status === "in_progress") {
287 + return read?.outcome === "served"
288 + ? { ...notification, update: { ...update, status: "completed" } }
289 + : notification;
290 + }
291 + if (update.status !== "completed" && update.status !== "failed") return notification;
292 openReads.delete(update.toolCallId);
293 if (update.status === "completed" || read?.outcome !== "served") return notification;
294 const { rawOutput: _stepError, ...rest } = update;