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:
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. |
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo Closing this because #9075 has merged. Live snapshot and boot-cache merges now drop custom models that are missing from current settings, which covers the stale server-cache case in this PR. |
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 15d0258.
Generated with gpt-5.6-sol via the Codex harness in T3 Code.
Note
Medium Risk
Changes provider model merge semantics for custom vs discovered models; incorrect filtering could drop legitimate custom models or still resurrect deleted ones, but scope is limited to merge/hydration paths with targeted tests.
Overview
Fixes a bug where custom models removed from settings could reappear in the model picker after a provider refresh or server restart.
Live refresh merging (
mergeProviderSnapshotinProviderRegistry) still backfills missing discovered models when a probe returns a partial or empty list, but it no longer carries forward previous custom (isCustom) entries that are absent from the new snapshot.Startup cache hydration (
hydrateCachedProviderinproviderStatusCache) still layers cached probe metadata and non-custom models onto the settings-derived fallback, but cached custom models are ignored so current settings define the custom model list.Regression tests cover successful vs incomplete refreshes and cache hydration when the on-disk cache still lists a deleted custom model.
Reviewed by Cursor Bugbot for commit 15d0258. Bugbot is set up for automated code reviews on this repo. Configure here.