Codex App: preview selection Edit fails on send with custom Responses provider

Open 💬 1 comment Opened Aug 6, 2026 by hellohuanghuang

What version of the Codex App are you using?

26.730.61639 (build 6234), macOS desktop app

What subscription do you have?

Not determined at report time (ChatGPT login session was expired when the bug occurred; the app is configured to use a custom third-party model provider).

What platform is your computer?

macOS: Darwin 25.6.0 arm64 arm

What issue are you seeing?

When I connect a third-party Responses-API model provider (DeepSeek) in the Codex desktop app, normal chat works correctly: requests go to https://api.deepseek.com/responses and return 200 OK. However, when I select text in the right-hand file preview pane and click Edit (the "Describe the edit…" overlay), the input box opens, but submitting the instruction immediately errors.

The local app logs show the ChatGPT session token is expired and cannot be refreshed:

auth: Failed to refresh token: Your access token could not be refreshed. Please log out and sign in again.
Provided authentication token is expired ... code=token_expired ... status 401
sa_server_request_failed ... status=401 ... "Unauthorized - Access token is missing"

Normal chat keeps working via the custom provider even while these auth errors appear, so the failure is specific to the preview selection-edit path.

What steps can reproduce the bug?

  1. Configure a custom model provider with wire_api = "responses" in ~/.codex/config.toml and select it as model_provider. Example (no credentials):
model = "deepseek-v4-flash"
model_provider = "deepseek"

[model_providers.deepseek]
name = "deepseek"
base_url = "https://api.deepseek.com/"
wire_api = "responses"
  1. Start a Codex desktop thread using that provider and open a generated file in the right-side preview pane.
  2. Select a range of text, click Edit, type an instruction, and press send.
  3. The submission fails with an error instead of dispatching the edit.

What is the expected behavior?

The selection-edit action should use the configured model provider (the same path normal chat uses), or fall back to a regular user message to the current thread, so it works with third-party Responses-compatible providers. If it intentionally requires OpenAI/ChatGPT backend access, the UI should clearly state that requirement instead of erroring after the user submits.

Additional information

I traced the request in the installed app bundle (app.asar):

  • requestSelectionEdit()$9a()Cdt()mp.getInstance().stream("POST", "/codex/responses", ...)
  • The payload hardcodes model: "gpt-5.6-luna" and includes X-OpenAI-Attach-Auth / X-OpenAI-Attach-Integrity-State headers.

So this preview edit path never goes through the configured model_provider; it requires a valid ChatGPT login token and fails when that session is expired (or when the user is in API/third-party mode).

Related issues:

  • #37009 Memory writer sends hardcoded gpt-5.6-luna and gpt-5.6-terra requests to non-OpenAI model providers
  • #33405 Feature request: expose a provider-compatible native edit tool for third-party models
  • #25371 Selection actions no longer appear for text selected inside Project Preview panel

View original on GitHub ↗

1 Comment

hellohuanghuang · 18 days ago

Adding a few related issues that appear to share the same root-cause pattern: native Codex features bypassing the configured custom model provider and hitting OpenAI-only paths / hardcoded OpenAI model IDs.

  • #37009 Memory writer sends hardcoded gpt-5.6-luna and gpt-5.6-terra requests to non-OpenAI model providers
  • #33405 Feature request: expose a provider-compatible native edit tool for third-party models
  • #25371 Selection actions no longer appear for text selected inside Project Preview panel

These all look like they belong on the same provider-routing boundary rather than being independent one-off bugs.