Skip to content

Commit eb6e7fa

Browse files
t3dotggclaude
andauthored
fix(models): new models also surface the CLI update that supports them (pingdotgg#33515)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 2da1b74 commit eb6e7fa

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,9 +1574,9 @@ it.layer(
15741574
["codex_second-package", "1.0.0"],
15751575
]),
15761576
);
1577-
const readCachedVersion = (key: string) =>
1577+
const readCachedVersion = (key: string, latest = "2.0.0") =>
15781578
ProviderLatestVersions.ProviderLatestVersions.use((latestVersions) =>
1579-
latestVersions.cached(key, Effect.succeed("2.0.0")),
1579+
latestVersions.cached(key, Effect.succeed(latest)),
15801580
);
15811581

15821582
yield* Effect.gen(function* () {
@@ -1615,13 +1615,16 @@ it.layer(
16151615
const probesBefore = yield* Ref.get(second.probes);
16161616
yield* registry.refreshModelCatalog;
16171617
assert.strictEqual(yield* Ref.get(second.probes), probesBefore);
1618+
assert.strictEqual(yield* readCachedVersion("codex_second-package", "3.0.0"), "2.0.0");
16181619
yield* Ref.set(manifest, {
16191620
...ModelManifest.BUNDLED_MODEL_MANIFEST,
16201621
updatedAt: "2999-01-01T00:00:00Z",
16211622
});
16221623
yield* registry.refreshModelCatalog;
16231624
yield* registry.refreshModelCatalog;
16241625
assert.strictEqual(yield* Ref.get(second.probes), probesBefore + 1);
1626+
// A changed manifest also rechecks latest CLI versions.
1627+
assert.strictEqual(yield* readCachedVersion("codex_second-package", "3.0.0"), "3.0.0");
16251628
}).pipe(
16261629
Effect.provide(
16271630
ProviderRegistry.layer.pipe(

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class ProviderRegistry extends Context.Service<
9494

9595
/**
9696
* For an opened model picker: refetch a model manifest older than a few
97-
* minutes, and probe providers only when it has models they have not seen.
97+
* minutes. When it changed, recheck latest CLI versions and probe providers.
9898
*/
9999
readonly refreshModelCatalog: Effect.Effect<void>;
100100

@@ -1088,6 +1088,8 @@ export const layer = Layer.effect(
10881088
// The first pass can be one that started before the fetch, so allow one more.
10891089
for (let pass = 0; pass < 2; pass++) {
10901090
if ((yield* Ref.get(probedManifestUpdatedAt)) === updatedAt) return;
1091+
// A new model usually ships with the CLI release that supports it.
1092+
yield* latestVersions.invalidateAll;
10911093
yield* refreshAll();
10921094
}
10931095
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ function layerFailingLatestLookupAfterFirst() {
272272
return yield* lookup;
273273
}),
274274
invalidate: () => Effect.void,
275+
invalidateAll: Effect.void,
275276
});
276277
}
277278

‎packages/provider-core/src/server/ProviderLatestVersions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class ProviderLatestVersions extends Context.Service<
2626
options?: { readonly fresh?: boolean },
2727
) => Effect.Effect<string | null, E, R>;
2828
readonly invalidate: (key: string) => Effect.Effect<void>;
29+
readonly invalidateAll: Effect.Effect<void>;
2930
}
3031
>()("@t3tools/provider-core/server/ProviderLatestVersions") {}
3132

@@ -84,6 +85,7 @@ export const make = Effect.fn("ProviderLatestVersions.make")(function* (
8485
return next;
8586
});
8687
}),
88+
invalidateAll: Ref.set(entries, new Map()),
8789
});
8890
});
8991

0 commit comments

Comments
 (0)