fix: merge base snapshot models during enrichment to prevent catalog shrinkage
When enrichCursorSnapshot runs background capability discovery via list_available_models, it may return fewer models than the initial snapshot (which could have been built from session config fallback). Previously, enrichment replaced all models with only the discovered set, dropping models that were in the original snapshot but not in the list_available_models response. Now we merge: discovered models take precedence (with richer capability info), but models from the base snapshot that aren't in the discovered set are preserved.
This commit is contained in:
1 file changed
+6
-1
@@ -1216,11 +1216,16 @@ export const enrichCursorSnapshot = (input: {
|
||||
if (discoveredModels.length === 0) {
|
||||
return Effect.void;
|
||||
}
|
||||
const discoveredSlugs = new Set(discoveredModels.map((m) => m.slug));
|
||||
const mergedModels = [
|
||||
...discoveredModels,
|
||||
...baseSnapshot.models.filter((m) => !discoveredSlugs.has(m.slug)),
|
||||
];
|
||||
return publishSnapshot(
|
||||
stampIdentity({
|
||||
...baseSnapshot,
|
||||
models: providerModelsFromSettings(
|
||||
discoveredModels,
|
||||
mergedModels,
|
||||
PROVIDER,
|
||||
settings.customModels,
|
||||
EMPTY_CAPABILITIES,
|
||||
|
||||
Reference in new issue
Block a user