Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): remove retired Codex models after refresh #9773

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/9773/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

Codex models removed from the CLI's catalog remained in T3's model picker across restarts. The provider registry merged missing discovered models into every refreshed snapshot and persisted them again, so clearing the cache while T3 was running could bring them back.

Fix

Treat successful Codex discovery as the current model inventory. Retain the last discovered models during startup and failed probes, but clear them after sign-out, disable, or uninstall. Current custom models remain available; removed custom models are not restored.

This changes the shared server registry used by web, desktop, and mobile. It does not change proxy configuration or the cache format.

Verification

Before/after evidence uses the actual registry and an isolated on-disk cache seeded with Vega, Joule, Kindle, Ultima, and Solstice alpha models, followed by discovery returning Astra and Vega.

RevisionFocused regression resultPersisted inventory
Base implementation3 failed, 1 passedFour retired alpha models were merged back in
This fix4 passedRetired models disappear and stay absent through a failed refresh and registry restart
  • All 60 tests passed across ProviderRegistry.test.ts, providerStatusCache.test.ts, and CodexProvider.test.ts.
  • Scoped server typecheck, targeted formatting/lint, and git diff --check passed.
  • Covers successful discovery with authenticated and unknown authentication, pending/failed probes, sign-out, disable, uninstall, empty discovery, and custom-model removal.

Screenshots are not applicable to this server-side cache fix. The regression tests verify the model inventory sent to clients and persisted across restarts. The running nightly installation was not changed by this PR.

Model: GPT-6 Astra. Harness: Codex in T3 Code.


Note

Medium Risk Changes shared provider snapshot merge behavior for all Codex instances (web/desktop/mobile model lists and persisted cache), though scope is limited to inventory retention rules aligned with existing Antigravity/OpenCode logic.

Overview Fixes stale Codex models staying in the model picker and on-disk provider status cache after the CLI catalog drops them.

shouldRetainMissingProviderModels now treats Codex like Antigravity and OpenCode: a successful discovery snapshot is authoritative, so retired models are not merged back from cache. Cached models are still kept during startup warnings and failed installed probes, but inventories are cleared when the provider is disabled, signed out, uninstalled, or discovery returns an empty list. Custom models still follow the existing rule—removed customs are not resurrected from the previous snapshot.

Adds a Codex model inventories test block (unit tests on mergeProviderSnapshot plus an integration test through ProviderRegistryLive and writeProviderStatusCache) to lock in removal across refresh, failed refresh, and registry restart.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f393580ae09c960c8df28e317187d365f83b8485. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add tests for retired Codex model removal after refresh in ProviderRegistry

  • Adds Codex-specific provider fixtures for cached, refreshed, pending, and failed snapshots covering both discovered and custom models.
  • Tests model removal after discovery with authenticated and unknown auth states, retention during startup and failed probes, and clearing after sign-out, disable, uninstall, or empty discovery.
  • Adds a persistence test that seeds the provider-status cache, exercises registry loading and refresh, and verifies both in-memory and persisted model inventories.
  • Imports the provider-status-cache writer into existing cache imports to support the new persistence test seeding.
Macroscope summarized f393580.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.7 KiB13.5 KiB−215 B (−1.5%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB+3 B (+0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.7 KiB6.5 KiB−218 B (−3.2%)7.8 KiB✅
      CodexLive turn WebSocket decoded58.5 KiB57.0 KiB−1.5 KiB (−2.6%)66.4 KiB✅
      CodexLive turn messages108−2 (−20.0%)21✅
      ClaudeTotal thread wire13.5 KiB13.8 KiB+218 B (+1.6%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB−3 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.5 KiB6.7 KiB+221 B (+3.3%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.8 KiB59.3 KiB+1.5 KiB (+2.6%)66.4 KiB✅
      ClaudeLive turn messages810+2 (+25.0%)21✅

      Baseline: 163d86a · PR result: f393580 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 113.8 KiB
      • Claude decoded thread snapshot: 114.5 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. Approvability

      Verdict: Approved at f393580

      Macroscope's review found this PR approvable — This narrowly fixes stale Codex model entries by treating successful discovery as authoritative while preserving models during transient startup or probe failures. The production change is isolated and accompanied by coverage for cache persistence, restarts, authentication states, and clearing behavior.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged thisbfef973

    5. juliusmarminge closed this

Sign in to join this conversation.