Skip to content

Commit b91ce46

Browse files
fix(server): a machine model change rescans every folder catalog
A folder whose catalog matched the old machine catalog may define a model the machine catalog just dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 958a273 commit b91ce46

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ it.layer(
478478
})),
479479
[
480480
{ cwd: "/project", models: [machineModel, projectModel], modelsPending: true },
481-
{ cwd: "/plain", models: undefined, modelsPending: undefined },
481+
// Its folder may define a model the machine catalog just dropped.
482+
{ cwd: "/plain", models: undefined, modelsPending: true },
482483
],
483484
);
484485
});

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,13 @@ export const mergeProviderSnapshot = (
280280
const savedAccount = carrySavedAntigravityAccount(previousProvider, nextProvider);
281281
const { message: _uncheckedMessage, ...nextWithoutMessage } = nextProvider;
282282
const models = mergeProviderModels(nextProvider, previousProvider.models, nextProvider.models);
283-
// A folder's own catalog was read against the old machine catalog, so it rescans.
283+
// Folder catalogs were compared with the old machine catalog, so every folder rescans.
284284
const previousWorkspaceSnapshots = Equal.equals(models, previousProvider.models)
285285
? previousProvider.workspaceSnapshots
286-
: previousProvider.workspaceSnapshots?.map((snapshot) =>
287-
snapshot.models === undefined ? snapshot : { ...snapshot, modelsPending: true },
288-
);
286+
: previousProvider.workspaceSnapshots?.map((snapshot) => ({
287+
...snapshot,
288+
modelsPending: true,
289+
}));
289290
return {
290291
...(savedAccount?.status === "ready" ? nextWithoutMessage : nextProvider),
291292
...savedAccount,

0 commit comments

Comments
 (0)