fix(/provider): add Anthropic option to switch back without restarting (#1426)#1439
Open
ajsai47 wants to merge 1 commit into
Open
fix(/provider): add Anthropic option to switch back without restarting (#1426)#1439ajsai47 wants to merge 1 commit into
ajsai47 wants to merge 1 commit into
Conversation
…n switch back without restarting (Gitlawb#1426) Previously, once a third-party provider was activated via /provider, the "Set active provider" screen had no way to return to Anthropic — users had to manually edit ~/.openclaude.json and restart. This change: - Adds an "Anthropic / Claude" entry to the "Set active provider" list - Selecting it calls clearActiveProviderProfile() which clears activeProviderProfileId from config and deletes the startup profile file - Wipes all CLAUDE_CODE_USE_* and provider-specific env vars from the running process so the switch takes effect immediately without a restart - Marks the Anthropic option as "(active)" when no third-party profile is set Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #1426.
Once a third-party provider was activated via
/provider, the "Set active provider" screen offered no path back to Anthropic. Users had to manually edit~/.openclaude.json, setactiveProviderProfileIdtonull, clearproviderProfiles, and fully restart. Even then,openclaude auth statusstill showedauthMethod: third_partyuntil the restart completed.Root cause
renderProfileSelectioninProviderManager.tsxonly listed saved third-party profiles and (optionally) GitHub Models. There was no Anthropic entry and no function to clear the active provider profile from config.Fix
src/utils/providerProfiles.tsclearActiveProviderProfile()— setsactiveProviderProfileId: undefinedin global config and deletes the startup profile file so Anthropic is used on next launch toosrc/utils/providerProfile.tsPROFILE_ENV_KEYS(wasconst) so ProviderManager can use the authoritative list of provider env vars to wipesrc/components/ProviderManager.tsxANTHROPIC_PROVIDER_ID = '__anthropic__'sentinelincludeAnthropicoption torenderProfileSelection— appends "Anthropic / Claude" to the list, marked "(active)" when no third-party profile is setincludeAnthropic: trueto theselect-activescreenactivateSelectedProvider: callsclearActiveProviderProfile(), wipes allPROFILE_ENV_KEYSfromprocess.env, clears the startup override — switch takes effect immediately without a restartsrc/utils/providerProfiles.test.tsclearActiveProviderProfile()and assertsactiveProviderProfileIdis clearedTest plan
/provider→ add a DeepSeek profile → activate it/provider→ "Set active provider" → select "Anthropic / Claude"bun test src/utils/providerProfiles.test.ts— 193 pass, 0 fail🤖 Generated with Claude Code