fix: keep refreshable Codex OAuth configured

maintainer edit: Settings reads local Codex token storage to avoid refresh work, so expired access tokens with refresh credentials still need to count as configured until real provider use refreshes them.
This commit is contained in:
chengyongru authored and Xubin Ren committed 2026-06-22 17:14:13 +08:00
1 parent b8abe5542c
commit 1cd5a0e029
2 files changed
+25 -1

No files matched your search

+4 -1
View File
@@ -298,9 +298,12 @@ def _oauth_provider_status(spec: Any) -> dict[str, Any]:
token_filename=OPENAI_CODEX_PROVIDER.token_filename,
).load()
expires_at = getattr(token, "expires", None) if token else None
now_ms = int(time.time() * 1000)
return {
"configured": bool(
token and token.access and expires_at and expires_at > int(time.time() * 1000)
token
and token.access
and (getattr(token, "refresh", None) or (expires_at and expires_at > now_ms))
),
"account": getattr(token, "account_id", None) if token else None,
"expires_at": expires_at,