Repository navigation
fix(providers): drop a removed provider's custom models (#1273) #1293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -615,13 +615,20 @@ export async function handleProviderRoutes(ctx: ManagementContext): Promise<Resp | |
| const { saveConfigPreservingClaudeCode: save } = await import("../../config"); | ||
| if (fallbackDefault) config.defaultProvider = fallbackDefault; | ||
| delete config.providers[name]; | ||
| const { dropProviderCustomModels } = await import("../../providers/provider-id-rewrite"); | ||
| const droppedCustomModels = dropProviderCustomModels(config, name); | ||
| setProviderContextCap(config, name, false); | ||
| save(config); | ||
|
Comment on lines
+618
to
621
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Import the cleanup helper before mutating Line 617 removes the provider from the live configuration. Line 618 then yields on a dynamic import before it removes the provider-owned custom models. A concurrently resuming request can observe a deleted provider with its orphaned custom models still present. Load 🤖 Prompt for AI Agents |
||
| reconcileLiveStateStores(); | ||
| const { clearModelCache: clearCache } = await import("../../codex/model-cache"); | ||
| clearCache(name); | ||
| const catalogRefresh = await convergeCodexCatalog(); | ||
| return jsonResponse({ success: true, ...(fallbackDefault ? { defaultProvider: fallbackDefault } : {}), catalogRefresh }); | ||
| return jsonResponse({ | ||
| success: true, | ||
| ...(fallbackDefault ? { defaultProvider: fallbackDefault } : {}), | ||
| ...(droppedCustomModels > 0 ? { droppedCustomModels } : {}), | ||
| catalogRefresh, | ||
| }); | ||
| } | ||
|
|
||
| if (url.pathname === "/api/provider-context-caps" && req.method === "GET") { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Always return
droppedCustomModels.When a provider has no custom models, both responses omit
droppedCustomModels. Clients cannot distinguish a zero cleanup count from an older server that does not implement this lifecycle cleanup.src/cli/provider.ts#L317-L318: EmitdroppedCustomModels: 0when no rows are removed.src/server/management/provider-routes.ts#L626-L630: EmitdroppedCustomModels: 0in every successful deletion response.Add zero-removal assertions to both integration tests.
As per PR objectives, “Report the number removed via CLI output,
--json.droppedCustomModels, and the API response”.📍 Affects 2 files
src/cli/provider.ts#L317-L318(this comment)src/server/management/provider-routes.ts#L626-L630🤖 Prompt for AI Agents