Skip to content

fix(codex): prefer provider bearer token in form#4692

Open
jzcangshu wants to merge 1 commit into
farion1231:mainfrom
jzcangshu:codex/fix-codex-api-key-preserve-mode
Open

fix(codex): prefer provider bearer token in form#4692
jzcangshu wants to merge 1 commit into
farion1231:mainfrom
jzcangshu:codex/fix-codex-api-key-preserve-mode

Conversation

@jzcangshu

@jzcangshu jzcangshu commented Jun 27, 2026

Copy link
Copy Markdown

Summary / 概述

  • Fix Codex provider form state when official-auth preservation leaves a stale auth.json OPENAI_API_KEY while the active third-party token is stored in config.toml as experimental_bearer_token.
  • Third-party Codex configs now prefer the provider bearer token and normalize auth JSON before saving, so stale auth values are not written back over provider edits.
  • Official Codex configs continue to use auth.json as the source of truth.
  • Add regression tests for third-party bearer-token priority, official auth priority, and empty-auth fallback.

Related Issue / 关联 Issue

Fixes #4108

Screenshots / 截图

Before / 修改前 After / 修改后
pre PixPin_2026-06-27_15-08-22

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • cargo clippy passes (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)
  • Updated i18n files if user-facing text changed / 如修改了用户可见文本,已更新国际化文件

Test Notes / 测试说明

  • Passed: pnpm --config.allowBuilds.esbuild=true --config.allowBuilds.msw=true vitest run tests/hooks/useCodexConfigState.test.tsx tests/utils/providerConfigUtils.codex.test.ts --reporter=verbose (26 tests).
  • Passed: pnpm --config.allowBuilds.esbuild=true --config.allowBuilds.msw=true typecheck.
  • Passed: pnpm --config.allowBuilds.esbuild=true --config.allowBuilds.msw=true format:check.
  • Passed: git diff --check HEAD^ HEAD.
  • pnpm --config.allowBuilds.esbuild=true --config.allowBuilds.msw=true test:unit currently fails in existing tests/integration/App.test.tsx coverage: covers basic provider flows via real hooks times out at 5000ms, and shows toast when auto sync fails in background sees duplicate provider-list DOM nodes after the prior timeout. The targeted Codex regression tests pass, and the failing integration file is unrelated to this form-state change.
  • No Rust code or user-facing text changed, so cargo clippy and i18n updates are not applicable.

@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: b22626ad85

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants