Skip to content

fix(claude-plugin): sync current provider config to settings.json#1905

Open
chengww5217 wants to merge 1 commit intofarion1231:mainfrom
chengww5217:fix/enable-claude-plugin-integration-sync
Open

fix(claude-plugin): sync current provider config to settings.json#1905
chengww5217 wants to merge 1 commit intofarion1231:mainfrom
chengww5217:fix/enable-claude-plugin-integration-sync

Conversation

@chengww5217
Copy link
Copy Markdown

@chengww5217 chengww5217 commented Apr 5, 2026

Summary / 概述

When enabling the "Apply to Claude Code extension" toggle (enableClaudePluginIntegration), the app only wrote primaryApiKey to ~/.claude/config.json but never synced the current provider's full config (apiKey, apiBaseUrl, etc.) to ~/.claude/settings.json. This caused the VS Code Claude Code extension to fail to connect, especially for first-time users.

This PR fixes the issue by:

  1. Determining the actual provider type (official or not) instead of hardcoding official: false
  2. Calling syncCurrentProvidersLiveSafe() to write the current provider's full config to ~/.claude/settings.json when the toggle is enabled

Related Issue / 关联 Issue

Fixes #1904

Screenshots / 截图

Before / 修改前 After / 修改后
Toggle on → settings.json empty, extension cannot connect Toggle on → settings.json synced with current provider config immediately

Checklist / 检查清单

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

@chengww5217
Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5bf24ae97

ℹ️ 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".

@chengww5217 chengww5217 force-pushed the fix/enable-claude-plugin-integration-sync branch from c5bf24a to 13110a2 Compare April 5, 2026 09:53
…toggle enable

- Extract syncClaudePluginIfChanged to share logic between autoSaveSettings and saveSettings
- Fix P1: enableClaudePluginIntegration toggle in General tab now actually syncs ~/.claude/settings.json
- Fix P2: check syncCurrentProvidersLiveSafe() return value and show toast on failure
- Fix P3: sync providers on both enable and disable, not just enable
- Fix P4: avoid double syncCurrentProvidersLiveSafe when plugin toggle + dir change happen together
- Remove duplicate comment
- Add missing providersApi.getCurrent/getAll mocks in tests
@chengww5217 chengww5217 force-pushed the fix/enable-claude-plugin-integration-sync branch from 13110a2 to b994f5f Compare April 5, 2026 12:13
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.

enableClaudePluginIntegration Does Not Immediately Sync Current Provider on Enable

2 participants