Skip to content

Commit ae35ea8

Browse files
StiensWoutclaude
andcommitted
fix(providers): recheck a cached upstream release before installing it
The manifest can withdraw an upstream release after it was looked up. Starting an update now rechecks it, so Codex never activates a version managed resolution would refuse, and Antigravity never installs one marked broken or unsupported. The installer falls back to what it would offer without that release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b811228 commit ae35ea8

3 files changed

Lines changed: 61 additions & 11 deletions

File tree

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

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,20 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
242242
message: null,
243243
});
244244

245+
// The model manifest can withdraw a bad upstream release without a T3 Code release.
246+
const isWithdrawn = Effect.fn("AntigravityInstallation.isWithdrawn")(function* (version: string) {
247+
const manifest = yield* manifestService.current;
248+
const status = (
249+
resolveProviderCompatibility(manifest.compatibility, DRIVER, version) ??
250+
resolveProviderCompatibility(
251+
ModelManifest.BUNDLED_MODEL_MANIFEST.compatibility,
252+
DRIVER,
253+
version,
254+
)
255+
)?.status;
256+
return status === "broken" || status === "unsupported";
257+
});
258+
245259
const lookupUpstream = Effect.gen(function* () {
246260
const target = resolveAcpRegistryPlatformTarget(platform, arch);
247261
if (!target) return null;
@@ -263,17 +277,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
263277
if (!/^\d+\.\d+\.\d+$/u.test(agent.version) || !url?.startsWith(UPSTREAM_DOWNLOAD_PREFIX)) {
264278
return null;
265279
}
266-
// The model manifest can withdraw a bad upstream release without a T3 Code release.
267-
const manifest = yield* manifestService.current;
268-
const status = (
269-
resolveProviderCompatibility(manifest.compatibility, DRIVER, agent.version) ??
270-
resolveProviderCompatibility(
271-
ModelManifest.BUNDLED_MODEL_MANIFEST.compatibility,
272-
DRIVER,
273-
agent.version,
274-
)
275-
)?.status;
276-
if (status === "broken" || status === "unsupported") return null;
280+
if (yield* isWithdrawn(agent.version)) return null;
277281
return { version: agent.version, url } satisfies AntigravityUpstreamRelease;
278282
});
279283

@@ -897,6 +901,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
897901
Effect.gen(function* () {
898902
const current = yield* SubscriptionRef.get(state);
899903
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;
900906
const release = selectManagedRelease<AntigravityRelease>(
901907
current.installedVersion,
902908
releaseAsset,

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,3 +590,43 @@ it.effect("keeps the managed install when an update fails its published checksum
590590
expect((yield* h.installation.resolve()).version).toBe("0.156.1");
591591
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
592592
);
593+
594+
it.effect("does not install a cached update the manifest has since withdrawn", () =>
595+
Effect.gen(function* () {
596+
const crypto = yield* Crypto.Crypto;
597+
const checksum = Hex.encode(
598+
yield* crypto.digest("SHA-256", upstreamArchive).pipe(Effect.orDie),
599+
);
600+
let manifest = ModelManifest.BUNDLED_MODEL_MANIFEST;
601+
const h = yield* makeHarness({
602+
responses: upstreamResponses(checksum),
603+
manifestCurrent: Effect.sync(() => manifest),
604+
});
605+
yield* h.installation.start;
606+
yield* terminalState(h.installation);
607+
yield* h.installation.checkForUpdate;
608+
expect((yield* h.installation.state).version).toBe(upstreamVersion);
609+
manifest = {
610+
...manifest,
611+
compatibility: [
612+
{
613+
driver: "codex",
614+
t3CodeRange: ">=0.0.42",
615+
ranges: [
616+
{ range: ">=0.160.0", status: "unsupported" },
617+
{ range: ">=0.156.0 <0.160.0", status: "supported" },
618+
],
619+
},
620+
],
621+
};
622+
const downloads = h.downloads();
623+
yield* h.installation.start;
624+
expect(yield* terminalState(h.installation)).toMatchObject({
625+
phase: "succeeded",
626+
installedVersion: "0.156.1",
627+
version: "0.156.1",
628+
});
629+
expect(h.downloads()).toBe(downloads);
630+
expect((yield* h.installation.resolve()).version).toBe("0.156.1");
631+
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
632+
);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
690690
if (isRunning(current)) return current;
691691
if (yield* reuseLocal()) return yield* SubscriptionRef.get(state);
692692
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+
}
693697
const release = selectManagedRelease(installedVersion, asset, upstream);
694698
if (!release && installedVersion === null) {
695699
return yield* installationError(

0 commit comments

Comments
 (0)