fix(server): remove retired Codex models after refresh #9773
main fromrefs/pull/9773/head·merged by juliusmarminge View on GitHubProblem#
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.
| Revision | Focused regression result | Persisted inventory |
|---|---|---|
| Base implementation | 3 failed, 1 passed | Four retired alpha models were merged back in |
| This fix | 4 passed | Retired models disappear and stay absent through a failed refresh and registry restart |
- All 60 tests passed across
ProviderRegistry.test.ts,providerStatusCache.test.ts, andCodexProvider.test.ts. - Scoped server typecheck, targeted formatting/lint, and
git diff --checkpassed. - 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.
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.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
f393580Macroscope'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).juliusmarminge merged thisbfef973
juliusmarminge closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
163d86a· PR result:f393580· Source CI: successScenario 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.