Skip to content

fix(codex): align OAuth client identity for GPT-6 - #465

Open
qiufuyu123 wants to merge 1 commit into
SaladDay:mainfrom
qiufuyu123:fix/codex-oauth-gpt6-identity
Open

qiufuyu123 wants to merge 1 commit into
SaladDay:mainfrom
qiufuyu123:fix/codex-oauth-gpt6-identity

Conversation

@qiufuyu123

Copy link
Copy Markdown

Summary

Port the Codex OAuth client-identity fix from
farion1231/cc-switch#7132.

Use the same GPT-6-compatible Codex CLI identity for both generation and
model-discovery requests:

  • originator: codex_cli_rs
  • version: 0.153.4
  • client_version=0.153.4

Problem

The generation and model-discovery paths currently advertise different,
outdated client identities:

  • Generation requests use codex_cli_rs with version 0.144.1.
  • Model discovery uses originator: cc-switch and derives
    client_version from the cc-switch package version.
  • Model discovery does not send a matching version header.

ChatGPT uses this identity when selecting model cohorts and enforcing minimum
client versions. In particular, gpt-6-astra requires Codex version
>= 0.153.0, so the old identity can result in an upgrade-required HTTP 400
response or prevent the model from being discovered consistently.

Changes

  • Define one shared Codex OAuth identity for generation and model discovery.
  • Update the advertised client version from 0.144.1 to 0.153.4.
  • Send the same originator, version, and client_version values during
    model discovery.
  • Preserve the existing models endpoint, bearer authorization,
    chatgpt-account-id, and request timeout.
  • Add credential-free request-construction regression tests for both paths.
  • Update the existing forwarder assertion for the new version.

The generic provider model-discovery path is unchanged.

Validation

Validated with the repository-pinned Rust 1.91.1 toolchain and isolated
temporary configuration directories:

  • cargo fmt --check: passed.
  • Focused generation identity regression test: passed.
  • Focused model-discovery identity regression test: passed.
  • Existing Codex OAuth forwarder request test: passed.
  • cargo check --lib --no-default-features: passed.
  • cargo test --lib --no-default-features --no-run: passed.
  • cargo check --bin cc-switch: passed.
  • Library suite with umask 077: 4,353 passed, 0 failed, 2 ignored.
  • git diff --check: passed.
  • Fresh-context blind review: no actionable findings.

The complete cargo test run reaches two unrelated prompt_commands
integration failures because the test environment reports that no default
external editor is configured. Both failures reproduce on the unchanged base
commit.

cargo clippy is blocked by the existing
clippy::reversed_empty_ranges error at
src/cli/tui/ui/home_chart.rs:806, which also reproduces on the unchanged
base commit.

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.

1 participant