Repository navigation
Description
What version of Codex is running?
- Installed CLI:
codex-cli 0.150.1 - Affected persisted thread was created by Codex Desktop / CLI
0.146.1 - A new working thread in the same Desktop/app-server process was created by CLI
0.149.1 - Auth mode: ChatGPT (
codex login statusreportsLogged in using ChatGPT)
What platform is your computer?
Ubuntu 22.04.5 LTS, Linux 6.8.0, x86_64. Codex Desktop is driving a local/SSH-style app-server session (source = "vscode" in persisted thread metadata).
What issue are you seeing?
An older Desktop thread can be read successfully, but every new prompt in that thread fails with:
unexpected status 401 Unauthorized: {"detail":"Unauthorized"},
url: https://chatgpt.com/backend-api/codex/responses
At the same time, a newly created thread in the same app-server process, with the same ChatGPT account and workspace, sends prompts successfully.
The key persisted metadata difference is:
affected old thread: model_provider=openai_http, cli_version=0.146.1
working new thread: model_provider=openai, cli_version=0.149.1
The legacy provider is still present in config.toml:
[model_providers.openai_http]
name = "OpenAI HTTP only"
wire_api = "responses"
supports_websockets = false
startup_timeout_sec = 60It has no custom base_url or API-key environment variable and historically used ChatGPT authentication. The affected installation contains many persisted threads with this legacy provider name.
Local logs have also reported token_revoked / token_invalidated for the legacy request path, even though the current login status is valid and new openai threads work. This suggests that resume preserves a legacy/custom provider route whose OAuth/token refresh context is no longer compatible with the current built-in ChatGPT provider.
The failure is isolated to turn submission. SQLite integrity checks pass, persisted messages are readable, and the current thread works, so this is not a general network, account-plan, or history-database failure.
What steps can reproduce the bug?
- Configure a provider alias equivalent to the old HTTP-only OpenAI route:
[model_providers.openai_http] name = "OpenAI HTTP only" wire_api = "responses" supports_websockets = false
- Sign in with ChatGPT and create a Desktop conversation using
model_provider = "openai_http"on an older Codex version. - Upgrade Codex/Desktop so newly created ChatGPT threads use the built-in
model_provider = "openai". - Confirm
codex login statusreports a valid ChatGPT login and that a newopenaithread works. - Open the persisted
openai_httpthread and submit a follow-up prompt. - Observe repeated POST failures to
/backend-api/codex/responseswith HTTP 401{"detail":"Unauthorized"}.
What is the expected behavior?
Resuming a persisted thread should remain usable after upgrading Codex.
If a legacy provider alias represents the built-in ChatGPT/OpenAI route, Codex should either:
- migrate or normalize it to the current built-in
openaiprovider; - refresh/rebind authentication correctly for the persisted provider; or
- show an actionable provider/auth migration error before submitting the turn.
It should not display the history normally and then fail every follow-up with a generic 401 while new threads work under the same login.
Additional information
The persisted provider is present both in state_5.sqlite:threads.model_provider and the rollout session_meta.payload.model_provider. Manually rewriting both locations may be a workaround, but it is risky for long sessions containing provider-bound encrypted content and should not be required.
Related issues:
- Codex Desktop keeps using revoked ChatGPT OAuth token after logout/login #31459 — Desktop keeps using a revoked ChatGPT OAuth token after logout/login
- Codex Desktop should preserve local history visibility and continuation across providers/accounts #20004 — history visibility and continuation across providers/accounts
- thread/resume does not restore model_provider from persisted metadata — breaks cross-provider conversation continuation #15219 / Restore persisted model provider on thread resume #19287 — restoring persisted
model_providerduring resume
Request IDs, account identifiers, thread identifiers, local usernames, and absolute paths have been omitted.
Activity
github-actions commentedon Aug 28, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
chatgpt_http) #40909Powered by Codex Action
joyven commentedon Aug 31, 2026
是少了
requires_openai_auth = true配置引起的。