Treat explicit provider model catalogs as authoritative (#49135)

## Why

Providers with `model_catalog_url` could advertise bundled models absent from their catalog or reuse stale models after a failed refresh. Model metadata could also match by prefix or namespaced suffix instead of the provider's exact model ID.

## What changed

- Suppress bundled model fallback and merging for explicit provider catalogs, including when discovery is disabled.
- Require unique, non-empty catalog slugs and match metadata by exact model ID.
- Serialize explicit catalog refreshes and invalidate in-memory and persisted catalog entries after fetch failures, preventing stale cache reuse.
- Report a clear configuration error when startup has no available model, while allowing an explicitly configured `model`.

## Testing

Add regression coverage for exact model matching, hidden catalog entries, cache invalidation across restart and recovery, invalid slugs, and empty-catalog startup with and without an explicit model. Update app-server model-list expectations and verify the TUI configuration error.

GitOrigin-RevId: ac323a94178e3c48df8d4a159a86fdbac20b03a2
This commit is contained in:
andrewgu-oai
2026-09-29 02:33:55 +00:00
committed by copyberry
parent a9118edae8
commit 458f7046a5
10 changed files with 409 additions and 97 deletions
+5
View File
@@ -659,6 +659,11 @@ impl Session {
config.http_client_factory(),
)
.await;
if model.trim().is_empty() {
return Err(CodexErr::InvalidRequest(
"No models are available. Set `model` explicitly or check your model catalog configuration.".to_string(),
));
}
let trusted_guardian_reviewer = crate::guardian::is_basic_session_source(&session_source)
&& !matches!(conversation_history, InitialHistory::Resumed(_));
if config