Skip to content

fix(desktop): restore garbled Chinese text in codex-oauth-ipc.ts (#202)#231

Merged
hqhq1025 merged 3 commits intoOpenCoworkAI:mainfrom
GoDiao:issue/202-fix-mojibake
Apr 27, 2026
Merged

fix(desktop): restore garbled Chinese text in codex-oauth-ipc.ts (#202)#231
hqhq1025 merged 3 commits intoOpenCoworkAI:mainfrom
GoDiao:issue/202-fix-mojibake

Conversation

@GoDiao
Copy link
Copy Markdown
Contributor

@GoDiao GoDiao commented Apr 25, 2026

Summary

Fixes mojibake (garbled text) in apps/desktop/src/main/codex-oauth-ipc.ts caused by
UTF-8 text being incorrectly decoded as GBK then re-saved as UTF-8.

  • Restored ChatGPT Codex provider display name from ChatGPT 璁㈤槄 to ChatGPT 订阅
  • Fixed Chinese error message shown when ChatGPT account ID lookup fails
  • Fixed em dash corruption (鈥?) in 3 code comments

Closes #202

Changes

apps/desktop/src/main/codex-oauth-ipc.ts — 5 string replacements, no logic changes.

Test plan

  • Visual: provider entry in Settings → Models shows ChatGPT 订阅

@github-actions github-actions Bot added the area:desktop apps/desktop (Electron shell, renderer) label Apr 25, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Minor] Add regression assertions for the restored localized strings — this PR fixes user-visible mojibake at apps/desktop/src/main/codex-oauth-ipc.ts:43 and apps/desktop/src/main/codex-oauth-ipc.ts:181, but the existing tests only assert the provider config shape without name at apps/desktop/src/main/codex-oauth-ipc.test.ts:189 and use a broad /ChatGPT.*ID/ match at apps/desktop/src/main/codex-oauth-ipc.test.ts:306. The exact strings repaired here can regress again without failing CI.
    Suggested fix:
    expect(fakeCachedConfig?.providers['chatgpt-codex']).toMatchObject({
      name: 'ChatGPT 订阅',
      wire: 'openai-codex-responses',
      baseUrl: 'https://chatgpt.com/backend-api',
    });
    
    await expect(handlers.get('codex-oauth:v1:login')?.()).rejects.toThrow(
      'Codex 登录成功但无法读取 ChatGPT 账户 ID,请重试登录。',
    );

Summary

  • Review mode: initial
  • 1 minor issue found: this fix restores the literals, but CI still would not fail if those exact localized strings became mojibake again.
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs.

Testing

  • Not run (automation). Suggested coverage: extend apps/desktop/src/main/codex-oauth-ipc.test.ts to assert the exact provider name and null-account error message literals.

open-codesign Bot

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,请重试登录。',
);

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • None.

Summary

  • Review mode: follow-up after new commits
  • No issues found in the added or modified lines for this update. The follow-up diff closes the prior regression-coverage gap by asserting the restored provider name and the exact localized null-account error message.
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs.
  • Residual risk: the mojibake fixes in comments at apps/desktop/src/main/codex-oauth-ipc.ts:47, apps/desktop/src/main/codex-oauth-ipc.ts:93, and apps/desktop/src/main/codex-oauth-ipc.ts:278 are non-functional and not separately test-covered.

Testing

  • Not run (automation). Existing Vitest coverage in apps/desktop/src/main/codex-oauth-ipc.test.ts:191 and apps/desktop/src/main/codex-oauth-ipc.test.ts:307 now covers the restored user-visible strings.

open-codesign Bot

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • None.

Summary

  • Review mode: follow-up after new commits
  • No issues found in the added or modified lines for this update. The linked issue's acceptance criteria appear satisfied in the public diff: the provider label is restored at apps/desktop/src/main/codex-oauth-ipc.ts:43, the user-facing null-account error message is restored at apps/desktop/src/main/codex-oauth-ipc.ts:181, and the remaining mojibake comments called out in #202 are corrected at apps/desktop/src/main/codex-oauth-ipc.ts:47, apps/desktop/src/main/codex-oauth-ipc.ts:93, and apps/desktop/src/main/codex-oauth-ipc.ts:278.
  • The follow-up diff versus the last bot-reviewed commit only reformats the existing assertion at apps/desktop/src/main/codex-oauth-ipc.test.ts:307.
  • Residual risk: the comment-only fixes are not separately test-covered, but the user-visible strings are covered by assertions at apps/desktop/src/main/codex-oauth-ipc.test.ts:189 and apps/desktop/src/main/codex-oauth-ipc.test.ts:307.

Testing

  • Not run in automation environment (pnpm unavailable on PATH). Static review only.

open-codesign Bot

@hqhq1025 hqhq1025 merged commit ff9b6ee into OpenCoworkAI:main Apr 27, 2026
6 checks passed
@hqhq1025
Copy link
Copy Markdown
Collaborator

Thanks for fixing the mojibake in the Codex OAuth strings and adding regression coverage. I merged this into main after the formatting fix and fresh CI passed.

GoDiao added a commit to GoDiao/blog-source that referenced this pull request Apr 27, 2026
PR #231 merged: fix garbled Chinese text in codex-oauth-ipc.ts
OpenCoworkAI/open-codesign#231

- Add open-codesign card to Projects page OSS grid
- Add open-codesign row to homepage OSS list
- Add en/zh i18n strings
- Download project social preview image

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mojibake in codex-oauth-ipc.ts: ChatGPT provider name and several comments are garbled

3 participants