fix(routes): persist openai-codex provider unconditionally on stale-session repair (Opus stage-303 follow-up)

Opus advisor on stage-303 (#1738 verification Q4) flagged that the
catalog-coverage branch produces a redundant repair-write per chat-start
when the active Codex default is itself slash-prefixed: the repair sets
`provider_context = None`, the next chat-start hits the same branch
because `requested_provider is None` again, and the repair fires repeatedly.

In practice Codex `default_model` is always a bare `gpt-...` ID from the
Codex catalog, so this is theoretical. But once we've decided this session
belongs to Codex, we should persist that decision. Drop the conditional
catalog-coverage check and unconditionally attach `raw_active_provider`
("openai-codex") on this repair path. The shape is now stable across
resolutions.

Absorb-in-release per Opus stage-303 verdict — small, defensive, ≤10 LOC.
This commit is contained in:
nesquena-hermes
2026-05-06 15:18:34 +00:00
parent bccb1a06d6
commit ec403fa3cf
+7 -6
View File
@@ -948,12 +948,13 @@ def _resolve_compatible_session_model_state(
and requested_provider is None
and default_model
):
provider_context = (
raw_active_provider
if _should_attach_codex_provider_context(default_model, raw_active_provider, catalog)
else None
)
return default_model, provider_context, True
# Persist provider_context = "openai-codex" unconditionally on this
# repair path so the resolved shape is stable across resolutions
# (Opus stage-303 SHOULD-FIX: avoid redundant repair-writes per
# chat-start when the catalog-coverage check fails — e.g. if a
# future Codex default is itself slash-prefixed). Once we've
# decided the session belongs to Codex, persist that decision.
return default_model, raw_active_provider, True
# Also normalize when the model is from a known provider but the active provider
# is an unlisted one (e.g. ollama-cloud) — active_provider is "" in that case