Refresh Codex OAuth model defaults

Stop seeding stale Codex OAuth model metadata so connected accounts use the upstream /models response instead of the retired gpt-5.2-codex default.

Use gpt-5.5 as the Codex proxy fallback model, omit the fake legacy client version when Codex CLI is unavailable, and remove the stale Copilot fallback entry.

Add focused OAuth regressions for the current default model, upstream model-list behavior, and Copilot fallback ordering.
This commit is contained in:
Alessandro 2026-07-02 16:08:52 +02:00
parent 50f80d57dc
commit 446031429d
5 changed files with 58 additions and 10 deletions

View file

@ -35,7 +35,7 @@ except ImportError:
AUTH_FILENAME = "auth.json"
ACCESS_EXPIRY_MARGIN = timedelta(minutes=5)
REFRESH_INTERVAL = timedelta(minutes=55)
FALLBACK_CODEX_VERSION = "0.124.0"
DEFAULT_CODEX_MODEL = "gpt-5.5"
OAUTH_ERROR_KEYS = ("error_description", "error")
DEVICE_CODE_TIMEOUT_SECONDS = 15 * 60
WINDOWS_LOCK_RETRY_SECONDS = 0.05
@ -590,9 +590,11 @@ def fetch_models() -> list[str]:
if configured:
return configured
client_version = resolve_codex_version()
params = {"client_version": client_version} if client_version else None
response = request_codex(
"/models",
params={"client_version": resolve_codex_version()},
params=params,
)
if not response.ok:
raise RuntimeError(upstream_error_message(response, "Failed to load Codex models."))
@ -772,7 +774,7 @@ def chat_messages_to_response_body(body: dict[str, Any]) -> dict[str, Any]:
)
response_body: dict[str, Any] = {
"model": body.get("model") or "gpt-5.2",
"model": body.get("model") or DEFAULT_CODEX_MODEL,
"input": response_input,
"instructions": "\n\n".join(instructions),
"store": False,
@ -980,7 +982,7 @@ def resolve_codex_version() -> str:
return version
except Exception:
pass
return FALLBACK_CODEX_VERSION
return ""
def resolve_auth_file_candidates() -> list[Path]:

View file

@ -20,7 +20,7 @@ from plugins._oauth.helpers.state import (
)
CODEX_DEFAULT_MODELS = ["gpt-5.2-codex", "gpt-5.2"]
CODEX_DEFAULT_MODEL = "gpt-5.5"
CODEX_FALLBACK_CONFIG = {
"enabled": True,
"models": [],
@ -35,7 +35,7 @@ class CodexOAuthProvider:
def metadata(self) -> OAuthProviderMetadata:
cfg = _codex_config()
models = cfg["models"] or CODEX_DEFAULT_MODELS
models = list(cfg["models"])
return OAuthProviderMetadata(
provider_id=CODEX_PROVIDER_ID,
display_name="Codex/ChatGPT",
@ -43,7 +43,7 @@ class CodexOAuthProvider:
model_provider_id=CODEX_PROVIDER_ID,
icon="openai",
auth_flow="device_code",
default_model=models[0] if models else "gpt-5.2-codex",
default_model=models[0] if models else CODEX_DEFAULT_MODEL,
default_models=models,
proxy_base_path=cfg["proxy_base_path"],
callback_path=cfg["callback_path"],

View file

@ -35,7 +35,6 @@ COPILOT_HEADERS = {
"Copilot-Integration-Id": "vscode-chat",
}
CURATED_MODELS = [
"gpt-5.2-codex",
"gpt-5.2",
"claude-sonnet-4.5",
"claude-opus-4.5",
@ -203,7 +202,7 @@ class GitHubCopilotOAuthProvider:
model_provider_id=GITHUB_COPILOT_PROVIDER_ID,
icon="github",
auth_flow="device_code",
default_model="gpt-5.2-codex",
default_model=CURATED_MODELS[0],
default_models=list(CURATED_MODELS),
proxy_base_path="/oauth/github-copilot",
supports_enterprise_domain=True,