Skip to content

fix(codex): stop installing an empty codeg provider in the shared config.toml - #706

Open
Adam-Dalloul wants to merge 1 commit into
xintaofei:mainfrom
Adam-Dalloul:fix/codex-config-empty-provider
Open

fix(codex): stop installing an empty codeg provider in the shared config.toml#706
Adam-Dalloul wants to merge 1 commit into
xintaofei:mainfrom
Adam-Dalloul:fix/codex-config-empty-provider

Conversation

@Adam-Dalloul

Copy link
Copy Markdown
Contributor

Fixes #520.

Flipping the Codex WebSocket switch, or clearing the API base URL, on a ~/.codex/config.toml that names no model_provider writes this into it:

model_provider = "codeg"

[model_providers.codeg]
base_url = ""

That file is shared with the codex CLI and the native Codex app. An empty base_url fails the Responses request builder, so every Codex turn dies with stream disconnected before completion: builder error in all of them, and nothing in the settings panel takes it back out.

patchCodexConfigTomlText fell back to codeg whenever neither the patch nor the file named a provider. It no longer does:

  • The WebSocket switch writes supports_websockets only onto a provider that is already bound. With none bound it writes features.responses_websockets_v2, which is exactly what the reader falls back to, so the switch still round-trips on and off.
  • The API base URL binds codeg only when the patch actually carries a URL. Clearing the box no longer creates a provider whose whole content would be base_url = "".

Choosing API Key or Model provider in the auth selector still binds codeg deliberately, and a provider the user did bind keeps its current behaviour.

Tests cover both controls from an unbound config and from a bound one; reverting the source change fails five of them.

…fig.toml

An unrelated switch could bind codeg as codex's model provider with no URL
behind it, writing model_provider = "codeg" beside a
[model_providers.codeg] whose base_url is "". codex then fails every
request at the builder stage, in codeg and in every other client that
reads ~/.codex/config.toml, and nothing in the panel undoes it.

The WebSocket switch no longer adopts a provider. With none bound it
writes only features.responses_websockets_v2, which is what the reader
falls back to, so the control still round-trips. Clearing the API base
URL no longer creates a provider either; typing one still binds codeg as
before.

Fixes xintaofei#520
@Adam-Dalloul
Adam-Dalloul force-pushed the fix/codex-config-empty-provider branch from db80d05 to f9ee522 Compare September 10, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: CodeG 向 ~/.codex/config.toml 写入空的 model_providers.codeg,污染原生 Codex App

1 participant