fix(server): remove deleted custom models - #5230
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved 8f7bc1a Straightforward bug fix that adds a simple filter to prevent deleted custom models from being retained during model merges. Changes are limited in scope, well-tested, and have clear intent. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Deleting a custom provider model removed it from settings, but stale provider snapshots could add it back to the model picker and persist it again.
Why
The cache hydration and live provider merge paths treated every missing model as provider-discovered inventory. That resilience is useful for non-custom models when a provider returns a partial snapshot, but it also resurrected user-configured models after deletion.
Custom models are configuration, so their absence from current settings must be authoritative. This keeps the existing fallback behavior for provider-discovered models without making custom-model deletion reversible by stale state.
Validation
vp test run apps/server/src/provider/providerStatusCache.test.ts apps/server/src/provider/Layers/ProviderRegistry.test.ts(51 tests passed)vp linton the four changed filesvp format --checkon the four changed filesvp run --filter t3 --fail-if-no-match typecheckChecklist
Note
Remove deleted custom models from provider model retention logic
ProviderRegistry.ts,mergeProviderModelsnow filters out custom models before retaining previously seen models during refresh, so deleted custom models are no longer re-added after a refresh cycle.providerStatusCache.ts,hydrateCachedProvidernow treats current settings as the authority for custom models, skipping cached custom models not present in the fallback provider.Macroscope summarized 8f7bc1a.
Generated with gpt-5.6-sol via the Codex harness in T3 Code.
Note
Low Risk
Scoped to provider model merge/hydration logic with no auth or persistence schema changes; behavior change is intentional for user-configured models only.
Overview
Fixes a bug where custom models removed from settings could reappear in the model picker after a provider refresh or startup cache hydration.
Live refresh merging (
mergeProviderModelsinProviderRegistry.ts) still keeps missing discovered models when a probe returns an empty or partial snapshot, but it no longer carries forward previous models markedisCustom. Successful refreshes that omit a deleted custom model therefore stay deleted.Cache hydration (
providerStatusCache.ts) treats the settings-derived fallback snapshot as authoritative for custom models: cached custom entries are not merged in unless they are already on the fallback list. Stale on-disk cache can still supplement non-custom discovered models.Regression tests cover incomplete/successful Codex refreshes and hydration when cache still lists a removed custom model.
Reviewed by Cursor Bugbot for commit 8f7bc1a. Bugbot is set up for automated code reviews on this repo. Configure here.