Skip to content

Commit 4c52938

Browse files
pauljones0Paul
andauthored
fix(antigravity): keep the runtime version learned from ACP (pingdotgg#20980)
Co-authored-by: Paul <paul@local>
1 parent fbe670c commit 4c52938

2 files changed

Lines changed: 66 additions & 1 deletion

File tree

‎apps/server/src/provider/AntigravityProvider.test.ts‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,68 @@ it.layer(layerTest)("Antigravity provider snapshots", (it) => {
430430
),
431431
);
432432

433+
it.effect("does not guess a version before a custom launcher's first handshake", () =>
434+
Effect.scoped(
435+
Effect.gen(function* () {
436+
const harness = yield* makeHarness();
437+
yield* Deferred.succeed(harness.initialProbe, {
438+
...initializeResult,
439+
agentInfo: { ...initializeResult.agentInfo, version: "unknown" },
440+
});
441+
yield* harness.initialUpdate;
442+
expect((yield* harness.provider.snapshot.getSnapshot).version).toBeNull();
443+
}),
444+
),
445+
);
446+
447+
it.effect("accepts a known version from a later installation probe", () =>
448+
Effect.scoped(
449+
Effect.gen(function* () {
450+
const harness = yield* makeHarness();
451+
yield* harness.initialize;
452+
yield* harness.provider.onSessionStarted({
453+
...started,
454+
initializeResult: {
455+
...initializeResult,
456+
agentInfo: { ...initializeResult.agentInfo, version: "1.3.0" },
457+
},
458+
});
459+
yield* Ref.set(
460+
harness.probe,
461+
Effect.succeed({
462+
...initializeResult,
463+
agentInfo: { ...initializeResult.agentInfo, version: "1.4.0" },
464+
}),
465+
);
466+
expect((yield* harness.provider.snapshot.refresh).version).toBe("1.4.0");
467+
}),
468+
),
469+
);
470+
471+
it.effect("does not replace a handshake version with an unknown custom-launcher probe", () =>
472+
Effect.scoped(
473+
Effect.gen(function* () {
474+
const harness = yield* makeHarness();
475+
yield* harness.initialize;
476+
yield* harness.provider.onSessionStarted({
477+
...started,
478+
initializeResult: {
479+
...initializeResult,
480+
agentInfo: { ...initializeResult.agentInfo, version: "1.4.0" },
481+
},
482+
});
483+
yield* Ref.set(
484+
harness.probe,
485+
Effect.succeed({
486+
...initializeResult,
487+
agentInfo: { ...initializeResult.agentInfo, version: "unknown" },
488+
}),
489+
);
490+
expect((yield* harness.provider.snapshot.refresh).version).toBe("1.4.0");
491+
}),
492+
),
493+
);
494+
433495
it.effect("replaces one account's catalog instead of combining accounts", () =>
434496
Effect.scoped(
435497
Effect.gen(function* () {

‎apps/server/src/provider/AntigravityProvider.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
177177
);
178178
const initialized =
179179
Result.isSuccess(result) && Option.isSome(result.success) ? result.success.value : undefined;
180+
const version = initialized?.agentInfo?.version;
180181
const failure = Result.isFailure(result) ? result.failure : undefined;
181182
const missingInstallation = failure !== undefined && isMissingInstallation(failure);
182183
const errorMessage =
@@ -210,7 +211,9 @@ export const makeAntigravityProvider = Effect.fn("makeAntigravityProvider")(func
210211
draft: {
211212
...draft,
212213
installed: !missingInstallation,
213-
version: initialized?.agentInfo?.version || draft.version,
214+
// Custom launchers have no static version; their lightweight probe
215+
// must not erase the version learned from a real ACP handshake.
216+
version: version === "unknown" ? draft.version : version || draft.version,
214217
status: errorMessage ? "error" : authenticated ? "ready" : "warning",
215218
checkedAt: updatedAt,
216219
usageLimits: missingInstallation

0 commit comments

Comments
 (0)