Skip to content

Commit 7b2df54

Browse files
StiensWoutclaude
andcommitted
fix(providers): replace a withdrawn managed install with the pin
When the manifest withdraws a version a user already updated to, the installer no longer protects it from downgrade. Its offer falls back to the pinned release, so Update replaces it instead of re-checking a runtime Codex would refuse. The offer is now recomputed on every update check, not only when the hourly lookup runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ae35ea8 commit 7b2df54

5 files changed

Lines changed: 152 additions & 41 deletions

File tree

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

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ interface HarnessOptions {
140140
readonly registry?: unknown;
141141
/** Served by URL instead of the pinned archive. */
142142
readonly archives?: Readonly<Record<string, Uint8Array>>;
143-
readonly manifest?: ModelManifest.ModelManifestData;
143+
readonly manifest?: Effect.Effect<ModelManifest.ModelManifestData>;
144144
}
145145

146146
const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
@@ -198,7 +198,7 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
198198
Effect.provideService(HostProcess.Architecture, arch),
199199
Effect.provideService(HostProcess.Environment, { PATH: options.path ?? "" }),
200200
Effect.provideService(ModelManifest.ModelManifest, {
201-
current: Effect.succeed(options.manifest ?? ModelManifest.BUNDLED_MODEL_MANIFEST),
201+
current: options.manifest ?? Effect.succeed(ModelManifest.BUNDLED_MODEL_MANIFEST),
202202
refresh: Effect.succeed(ModelManifest.BUNDLED_MODEL_MANIFEST),
203203
forceRefresh: Effect.succeed(ModelManifest.BUNDLED_MODEL_MANIFEST),
204204
refreshInBackground: Effect.void,
@@ -292,6 +292,16 @@ const registryListing = (archive = upstreamUrl) => ({
292292
},
293293
],
294294
});
295+
const withdrawnManifest: ModelManifest.ModelManifestData = {
296+
...ModelManifest.BUNDLED_MODEL_MANIFEST,
297+
compatibility: [
298+
{
299+
driver: "antigravity",
300+
t3CodeRange: ">=0.0.42",
301+
ranges: [{ range: ">=1.4.0", status: "broken" }],
302+
},
303+
],
304+
};
295305
const pinnedAsset = Effect.fn("test.pinnedAntigravityAsset")(function* () {
296306
return { ...(yield* releaseAsset()), version: "1.3.0" };
297307
});
@@ -1192,16 +1202,7 @@ it.layer(NodeServices.layer)("Antigravity installation", (it) => {
11921202
{
11931203
name: "withdrawn by the model manifest",
11941204
registry: registryListing(),
1195-
manifest: {
1196-
...ModelManifest.BUNDLED_MODEL_MANIFEST,
1197-
compatibility: [
1198-
{
1199-
driver: "antigravity",
1200-
t3CodeRange: ">=0.0.42",
1201-
ranges: [{ range: ">=1.4.0", status: "broken" as const }],
1202-
},
1203-
],
1204-
},
1205+
manifest: Effect.succeed(withdrawnManifest),
12051206
},
12061207
])("does not offer a registry release $name", ({ registry, manifest }) =>
12071208
Effect.gen(function* () {
@@ -1231,4 +1232,35 @@ it.layer(NodeServices.layer)("Antigravity installation", (it) => {
12311232
expect(h.requests).toEqual([ACP_REGISTRY_URL, ACP_REGISTRY_URL]);
12321233
}),
12331234
);
1235+
1236+
it.effect("returns an install the manifest withdraws to the pinned release", () =>
1237+
Effect.gen(function* () {
1238+
let manifest = ModelManifest.BUNDLED_MODEL_MANIFEST;
1239+
const h = yield* makeHarness({
1240+
asset: yield* pinnedAsset(),
1241+
registry: registryListing(),
1242+
archives: { [upstreamUrl]: upstreamArchive },
1243+
manifest: Effect.sync(() => manifest),
1244+
});
1245+
yield* h.installation.checkForUpdate;
1246+
yield* h.installation.start;
1247+
yield* terminalState(h.installation);
1248+
yield* h.installation.start;
1249+
expect(yield* terminalState(h.installation)).toMatchObject({ installedVersion: "1.4.1" });
1250+
1251+
manifest = withdrawnManifest;
1252+
yield* h.installation.checkForUpdate;
1253+
expect(yield* h.installation.state).toMatchObject({
1254+
installedVersion: "1.4.1",
1255+
version: "1.3.0",
1256+
});
1257+
yield* h.installation.start;
1258+
expect(yield* terminalState(h.installation)).toMatchObject({
1259+
phase: "succeeded",
1260+
installedVersion: "1.3.0",
1261+
version: "1.3.0",
1262+
});
1263+
expect((yield* h.installation.resolve()).version).toBe("1.3.0");
1264+
}),
1265+
);
12341266
});

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

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
256256
return status === "broken" || status === "unsupported";
257257
});
258258

259+
// Forgets what the manifest withdrew after it was seen. A withdrawn install
260+
// is not kept either, so the pin replaces it rather than a re-check.
261+
const keptInstall = Effect.fn("AntigravityInstallation.keptInstall")(function* (
262+
installedVersion: string | null,
263+
) {
264+
if (upstream && (yield* isWithdrawn(upstream.version))) upstream = null;
265+
return installedVersion !== null && !(yield* isWithdrawn(installedVersion))
266+
? installedVersion
267+
: null;
268+
});
269+
259270
const lookupUpstream = Effect.gen(function* () {
260271
const target = resolveAcpRegistryPlatformTarget(platform, arch);
261272
if (!target) return null;
@@ -286,15 +297,21 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
286297
.withPermitsIfAvailable(1)(
287298
Effect.gen(function* () {
288299
const now = yield* Clock.currentTimeMillis;
289-
if (upstreamCheckedAt !== null && now - upstreamCheckedAt < UPDATE_CHECK_INTERVAL_MS) {
290-
return;
300+
if (upstreamCheckedAt === null || now - upstreamCheckedAt >= UPDATE_CHECK_INTERVAL_MS) {
301+
// A failed lookup counts too, and keeps whatever release was offered before.
302+
upstreamCheckedAt = now;
303+
upstream = yield* lookupUpstream.pipe(
304+
Effect.timeout(UPDATE_CHECK_TIMEOUT),
305+
Effect.orElseSucceed(() => upstream),
306+
);
291307
}
292-
// A failed lookup counts too, and keeps whatever release was offered before.
293-
upstreamCheckedAt = now;
294-
upstream = yield* lookupUpstream.pipe(Effect.timeout(UPDATE_CHECK_TIMEOUT));
295308
// A running install already published the release it is installing.
296-
yield* SubscriptionRef.update(state, (current) =>
297-
isRunning(current) ? current : { ...current, ...offer(current.installedVersion) },
309+
yield* SubscriptionRef.updateEffect(state, (current) =>
310+
isRunning(current)
311+
? Effect.succeed(current)
312+
: keptInstall(current.installedVersion).pipe(
313+
Effect.map((kept) => ({ ...current, ...offer(kept) })),
314+
),
298315
);
299316
}),
300317
)
@@ -901,14 +918,13 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
901918
Effect.gen(function* () {
902919
const current = yield* SubscriptionRef.get(state);
903920
if (isRunning(current)) return current;
904-
// The manifest may have withdrawn the cached upstream release since its lookup.
905-
if (upstream && (yield* isWithdrawn(upstream.version))) upstream = null;
921+
const installedVersion = yield* keptInstall(current.installedVersion);
906922
const release = selectManagedRelease<AntigravityRelease>(
907-
current.installedVersion,
923+
installedVersion,
908924
releaseAsset,
909925
upstream,
910926
);
911-
if (!release && current.installedVersion === null) {
927+
if (!release && installedVersion === null) {
912928
return yield* installationError(
913929
"start",
914930
`Google does not publish an Antigravity runtime for ${platform}-${arch}. Use a supported remote environment or a custom executable.`,
@@ -920,7 +936,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
920936
operationId,
921937
phase: release ? "downloading" : "verifying",
922938
downloadedBytes: 0,
923-
...offer(current.installedVersion),
939+
...offer(installedVersion),
924940
installedVersion: current.installedVersion,
925941
canRemove: current.canRemove,
926942
message: release
@@ -1043,9 +1059,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
10431059
if (!(yield* fs.exists(activePath))) return;
10441060
const active = yield* readRecord(activePath, ActiveRelease);
10451061
const installed = yield* completedRelease(active.releaseId);
1062+
const kept = yield* keptInstall(installed.version);
10461063
yield* SubscriptionRef.update(state, (current) => ({
10471064
...current,
1048-
...offer(installed.version),
1065+
...offer(kept),
10491066
installedVersion: installed.version,
10501067
}));
10511068
}).pipe(

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,3 +630,50 @@ it.effect("does not install a cached update the manifest has since withdrawn", (
630630
expect((yield* h.installation.resolve()).version).toBe("0.156.1");
631631
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
632632
);
633+
634+
it.effect("returns a managed install the manifest withdraws to the pinned release", () =>
635+
Effect.gen(function* () {
636+
const crypto = yield* Crypto.Crypto;
637+
const checksum = Hex.encode(
638+
yield* crypto.digest("SHA-256", upstreamArchive).pipe(Effect.orDie),
639+
);
640+
let manifest = ModelManifest.BUNDLED_MODEL_MANIFEST;
641+
const h = yield* makeHarness({
642+
responses: upstreamResponses(checksum),
643+
manifestCurrent: Effect.sync(() => manifest),
644+
});
645+
yield* h.installation.checkForUpdate;
646+
yield* h.installation.start;
647+
yield* terminalState(h.installation);
648+
yield* h.installation.start;
649+
expect(yield* terminalState(h.installation)).toMatchObject({
650+
installedVersion: upstreamVersion,
651+
});
652+
653+
manifest = {
654+
...manifest,
655+
compatibility: [
656+
{
657+
driver: "codex",
658+
t3CodeRange: ">=0.0.42",
659+
ranges: [
660+
{ range: ">=0.160.0", status: "unsupported" },
661+
{ range: ">=0.156.0 <0.160.0", status: "supported" },
662+
],
663+
},
664+
],
665+
};
666+
yield* h.installation.checkForUpdate;
667+
expect(yield* h.installation.state).toMatchObject({
668+
installedVersion: upstreamVersion,
669+
version: "0.156.1",
670+
});
671+
yield* h.installation.start;
672+
expect(yield* terminalState(h.installation)).toMatchObject({
673+
phase: "succeeded",
674+
installedVersion: "0.156.1",
675+
version: "0.156.1",
676+
});
677+
expect((yield* h.installation.resolve()).version).toBe("0.156.1");
678+
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
679+
);

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

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,18 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
301301
)
302302
);
303303
});
304+
const isSupported = (version: string) =>
305+
compatibility(version).pipe(Effect.map((advisory) => advisory?.status === "supported"));
306+
// Forgets what the manifest withdrew after it was seen. Managed resolution
307+
// refuses a withdrawn install, so the pin replaces it rather than a re-check.
308+
const keptInstall = Effect.fn("CodexInstallation.keptInstall")(function* (
309+
installedVersion: string | null,
310+
) {
311+
if (upstream && !(yield* isSupported(upstream.version))) upstream = null;
312+
return installedVersion !== null && (yield* isSupported(installedVersion))
313+
? installedVersion
314+
: null;
315+
});
304316
// npm names the latest stable release; its GitHub release lists the package
305317
// checksums, so an upstream update stays SHA-256 verified.
306318
const lookupUpstream = Effect.gen(function* () {
@@ -310,7 +322,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
310322
.pipe(Effect.flatMap(HttpClientResponse.filterStatusOk));
311323
const { version } = yield* latest.json.pipe(Effect.flatMap(decodeNpmLatest));
312324
// Managed resolution refuses anything else, so offering it would break sessions.
313-
if ((yield* compatibility(version))?.status !== "supported") return null;
325+
if (!(yield* isSupported(version))) return null;
314326
const releaseUrl = `${UPSTREAM_RELEASES_URL}/rust-v${version}`;
315327
const checksums = yield* http
316328
.execute(HttpClientRequest.get(`${releaseUrl}/codex-package_SHA256SUMS`))
@@ -334,15 +346,21 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
334346
.withPermitsIfAvailable(1)(
335347
Effect.gen(function* () {
336348
const now = yield* Clock.currentTimeMillis;
337-
if (upstreamCheckedAt !== null && now - upstreamCheckedAt < UPDATE_CHECK_INTERVAL_MS) {
338-
return;
349+
if (upstreamCheckedAt === null || now - upstreamCheckedAt >= UPDATE_CHECK_INTERVAL_MS) {
350+
// A failed lookup counts too, and keeps whatever release was offered before.
351+
upstreamCheckedAt = now;
352+
upstream = yield* lookupUpstream.pipe(
353+
Effect.timeout(UPDATE_CHECK_TIMEOUT),
354+
Effect.orElseSucceed(() => upstream),
355+
);
339356
}
340-
// A failed lookup counts too, and keeps whatever release was offered before.
341-
upstreamCheckedAt = now;
342-
upstream = yield* lookupUpstream.pipe(Effect.timeout(UPDATE_CHECK_TIMEOUT));
343357
// A running install already published the release it is installing.
344-
yield* SubscriptionRef.update(state, (current) =>
345-
isRunning(current) ? current : { ...current, ...offer(managedVersion(current)) },
358+
yield* SubscriptionRef.updateEffect(state, (current) =>
359+
isRunning(current)
360+
? Effect.succeed(current)
361+
: keptInstall(managedVersion(current)).pipe(
362+
Effect.map((kept) => ({ ...current, ...offer(kept) })),
363+
),
346364
);
347365
}),
348366
)
@@ -689,11 +707,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
689707
const current = yield* SubscriptionRef.get(state);
690708
if (isRunning(current)) return current;
691709
if (yield* reuseLocal()) return yield* SubscriptionRef.get(state);
692-
const installedVersion = managedVersion(current);
693-
// The manifest may have withdrawn the cached upstream release since its lookup.
694-
if (upstream && (yield* compatibility(upstream.version))?.status !== "supported") {
695-
upstream = null;
696-
}
710+
const installedVersion = yield* keptInstall(managedVersion(current));
697711
const release = selectManagedRelease(installedVersion, asset, upstream);
698712
if (!release && installedVersion === null) {
699713
return yield* installationError(
@@ -848,12 +862,13 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
848862
if (!(yield* fs.exists(activePath))) return;
849863
const active = yield* readRecord(activePath, ActiveRelease);
850864
const installed = yield* completedRelease(active.version);
865+
const kept = yield* keptInstall(installed.version);
851866
yield* SubscriptionRef.update(
852867
state,
853868
(current) =>
854869
({
855870
...current,
856-
...offer(installed.version),
871+
...offer(kept),
857872
installedVersion: installed.version,
858873
executablePath: installed.executablePath,
859874
source: "managed",

‎docs/user/install.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ mise through mise. Cursor updates with T3 Code. Homebrew installs compare agains
165165
the version Homebrew offers, which can trail the npm release by a few hours.
166166

167167
The managed runtimes for Antigravity and for Codex connected through ChatGPT
168-
first install the release T3 Code tested. When the provider publishes a newer
169-
one, their setup in **Settings → Providers** offers an update.
168+
first install the release T3 Code tested. When T3 Code finds a newer compatible
169+
release, their setup in **Settings → Providers** offers an update.
170170

171171
Add another provider instance for a separate account or configuration. Each
172172
instance can have its own environment variables, such as API keys or a custom

0 commit comments

Comments
 (0)