pub fn try_load_codex_chatgpt_session() -> Result<Option<OpenAIChatGptSession>>Expand description
Try to load a ChatGPT session from Codex’s auth.json.
Wraps the retry-free loader with a small bounded
synchronous retry loop. Codex writes auth.json by truncating and
rewriting without an atomic rename, so a concurrent Codex refresh can make
the file momentarily empty or partial. The retry absorbs that transient
window without sleeping when the file is absent (Ok(None)) or already
successfully parsed (Ok(Some(_))).
Returns Ok(Some(session)) if Codex has ChatGPT OAuth tokens, Ok(None) if
the file does not exist, contains no token data, or is configured for a
non-ChatGPT auth mode (e.g. API key). Returns Err if the file exists but
cannot be read or parsed after all retries.