Skip to content

[codex] fix Claude Code config import env parsing#388

Draft
xuqian-git wants to merge 1 commit into
OpenCoworkAI:mainfrom
xuqian-git:codex/fix-claude-code-import-env
Draft

[codex] fix Claude Code config import env parsing#388
xuqian-git wants to merge 1 commit into
OpenCoworkAI:mainfrom
xuqian-git:codex/fix-claude-code-import-env

Conversation

@xuqian-git

Copy link
Copy Markdown

Summary

Fixes Claude Code config import when ~/.claude/settings.json contains Claude Code-specific env flags whose values are not strings.

Root Cause

The importer validated every key under settings.env as a string, even though Open CoDesign only consumes a small set of Anthropic import fields. A boolean flag such as CLAUDE_CODE_DISABLE_1M_CONTEXT caused the whole config to be classified as parse-error; the import IPC then surfaced that as a misleading "No Claude Code settings found" error.

Changes

  • Validate only imported Anthropic env keys: ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, and ANTHROPIC_MODEL.
  • Preserve validation for malformed imported fields.
  • Surface direct import parse failures as CONFIG_PARSE_FAILED with the actual reason instead of reporting a missing file.
  • Add regression coverage for non-string unrelated Claude Code env flags and the direct import parse-error branch.

Validation

  • pnpm --filter @open-codesign/desktop exec vitest run src/main/imports/claude-code-config.test.ts src/main/onboarding-ipc.test.ts
  • pnpm exec biome check apps/desktop/src/main/imports/claude-code-config.ts apps/desktop/src/main/imports/claude-code-config.test.ts apps/desktop/src/main/onboarding/register.ts apps/desktop/src/main/onboarding-ipc.test.ts
  • pnpm --filter @open-codesign/desktop typecheck

Note: local pre-commit/pre-push hooks run full biome check . and were blocked by an unrelated untracked apps/desktop/release-local-arm64/ build directory in this checkout; that directory is not part of this PR.

@github-actions github-actions Bot added the area:desktop apps/desktop (Electron shell, renderer) label Jun 14, 2026
@xuqian-git xuqian-git force-pushed the codex/fix-claude-code-import-env branch from 6e002b8 to d3e01f2 Compare June 14, 2026 19:13
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.

1 participant