Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/desktop/src/main/codex-oauth-ipc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ describe('codex-oauth:v1:login', () => {
expect(writeConfigMock).toHaveBeenCalledTimes(2);
expect(fakeCachedConfig?.providers['chatgpt-codex']).toMatchObject({
id: 'chatgpt-codex',
name: 'ChatGPT 订阅',
wire: 'openai-codex-responses',
baseUrl: 'https://chatgpt.com/backend-api',
defaultModel: 'gpt-5.3-codex',
Expand Down Expand Up @@ -303,7 +304,9 @@ describe('codex-oauth:v1:login', () => {
});

await register();
await expect(handlers.get('codex-oauth:v1:login')?.()).rejects.toThrow(/ChatGPT.*ID/);
await expect(handlers.get('codex-oauth:v1:login')?.()).rejects.toThrow(
'Codex 登录成功但无法读取 ChatGPT 账户 ID,请重试登录。',
);
expect(closeMock).toHaveBeenCalledTimes(1);
expect(writeConfigMock).not.toHaveBeenCalled();

Expand Down
10 changes: 5 additions & 5 deletions apps/desktop/src/main/codex-oauth-ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export { CHATGPT_CODEX_PROVIDER_ID };

const CHATGPT_CODEX_PROVIDER: ProviderEntry = {
id: CHATGPT_CODEX_PROVIDER_ID,
name: 'ChatGPT 璁㈤槄',
name: 'ChatGPT 订阅',
builtin: false,
wire: 'openai-codex-responses',
// pi-ai's openai-codex-responses wire appends `/codex/responses` itself, so
// we store the bare base. Do not add `/codex` here 鈥?it'd produce
// we store the bare base. Do not add `/codex` here it'd produce
// `/codex/codex/responses`.
baseUrl: 'https://chatgpt.com/backend-api',
defaultModel: 'gpt-5.3-codex',
Expand Down Expand Up @@ -90,7 +90,7 @@ export function getCodexTokenStore(): CodexTokenStore {
return tokenStoreSingleton;
}

/** Test-only reset hook 鈥?vitest resets module state between test cases. */
/** Test-only reset hook vitest resets module state between test cases. */
export function __resetCodexTokenStoreForTests(): void {
tokenStoreSingleton = null;
activeLoginAbortController = null;
Expand Down Expand Up @@ -178,7 +178,7 @@ async function runLoginFlow(abortController: AbortController): Promise<CodexOAut
const tokenSet: TokenSet = await exchangeCode(code, pkce.verifier, server.redirectUri);
if (tokenSet.accountId === null) {
throw new CodesignError(
'Codex 鐧诲綍鎴愬姛浣嗘棤娉曡鍙?ChatGPT 璐︽埛 ID锛岃閲嶈瘯鐧诲綍銆?',
'Codex 登录成功但无法读取 ChatGPT 账户 ID,请重试登录。',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor] This restores the message, but there is still no exact regression assertion for it. The current test only checks /ChatGPT.*ID/ at apps/desktop/src/main/codex-oauth-ipc.test.ts:306, so the same mojibake could return without failing CI.

Suggested fix:

await expect(handlers.get('codex-oauth:v1:login')?.()).rejects.toThrow(
  'Codex 登录成功但无法读取 ChatGPT 账户 ID,请重试登录。',
);

ERROR_CODES.PROVIDER_ERROR,
{ cause: null },
);
Expand Down Expand Up @@ -275,7 +275,7 @@ async function runLogout(): Promise<CodexOAuthStatus> {
* `chatgpt-codex` with Phase 1's stale `wire`/`baseUrl`, overwrite with the
* Phase 2 canonical values so the first generate after upgrade works without
* requiring a manual re-login. No-op when the entry is absent or already
* canonical. Safe to call on every boot 鈥?writes only when state diverges.
* canonical. Safe to call on every boot writes only when state diverges.
*
* Phase 1 released the card in "coming soon" disabled mode, so this migration
* only fires for users who ran this feat branch directly; zero writes on
Expand Down
Loading