t3code icon indicating copy to clipboard operation
t3code copied to clipboard

fix(server): remove deleted custom models

Open CrovLune opened this issue 4 months ago • 2 comments

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.

  • Treat the current settings-derived provider snapshot as authoritative for custom models during cache hydration.
  • Stop retaining missing custom models during live provider refreshes while preserving previously discovered non-custom models.
  • Add focused regression coverage for startup cache hydration and successful or incomplete provider refreshes.

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)
  • Targeted vp lint on the four changed files
  • Targeted vp format --check on the four changed files
  • vp run --filter t3 --fail-if-no-match typecheck

Checklist

  • [x] This PR is small and focused
  • [x] I explained what changed and why
  • [x] I included before/after screenshots for any UI changes (not applicable: no UI changes)
  • [x] I included a video for animation/interaction changes (not applicable: no animation or interaction changes)

[!NOTE]

Remove deleted custom models from provider model retention logic

  • In ProviderRegistry.ts, mergeProviderModels now filters out custom models before retaining previously seen models during refresh, so deleted custom models are no longer re-added after a refresh cycle.
  • In providerStatusCache.ts, hydrateCachedProvider now treats current settings as the authority for custom models, skipping cached custom models not present in the fallback provider.
  • Behavioral Change: Custom models removed from settings will no longer reappear after a provider refresh or cache hydration.

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 (mergeProviderModels in ProviderRegistry.ts) still keeps missing discovered models when a probe returns an empty or partial snapshot, but it no longer carries forward previous models marked isCustom. 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 8f7bc1a72493c57d30f90669929ce23531510a49. Bugbot is set up for automated code reviews on this repo. Configure here.

CrovLune avatar Aug 02 '26 11:08 CrovLune

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 22e63b48-608e-458f-9493-aa4eb2a1380f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • [ ] 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Aug 02 '26 11:08 coderabbitai[bot]

Approvability

Verdict: 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.

macroscopeapp[bot] avatar Aug 02 '26 12:08 macroscopeapp[bot]

[!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.

t3dotgg avatar Sep 03 '26 10:09 t3dotgg