Resuming a ChatGPT-login codex session on Azure OpenAI (cross-provider)
Resuming a codex session started on ChatGPT-login under a different provider (Azure) fails in three stacked ways, each with a distinct error. (1) invalid_encrypted_content / cmp_ item could not be verified: the saved rollout .jsonl embeds provider-sealed encrypted_content in reasoning items, agent_message items, and BOTH levels of compacted.replacement_history; Azure cannot decrypt it. Fix: recursively strip every encrypted_content key and drop standalone reasoning items (the unshipped fix from openai/codex#17541). (2) 429 rate limit: resume sends the whole context at once; raise the Azure GlobalStandard deployment sku-capacity (per-token billing, capacity is only the TPM ceiling). (3) ran out of room / Failed to run pre-sampling compact: codex resume replays the ENTIRE item history (can be ~1M tokens), and it has no cached context-window metadata for the Azure model so it defaults too small. Fix: trim the rollout to the last compacted record boundary (codex own summarization point ~150-200K) and pin model_context_window in the profile. Also: codex 0.147 moved [profiles.x] into ~/.codex/x.config.toml; provider auth can use [model_providers.x.auth] command=... to fetch the key from macOS Keychain instead of a global env var.