fix(provider): add Use Anthropic option to switch back from third-party profiles#1429
Open
0xghost42 wants to merge 1 commit into
Open
fix(provider): add Use Anthropic option to switch back from third-party profiles#14290xghost42 wants to merge 1 commit into
0xghost42 wants to merge 1 commit into
Conversation
…ty profiles The /provider menu offered no way back to built-in Anthropic once any third-party provider profile was active: getActiveProviderProfile falls back to profiles[0] when activeProviderProfileId is unset, so clearing the active id still re-selected a saved profile. Users had to hand-edit ~/.openclaude.json and restart. Add an explicit ANTHROPIC_DEFAULT_PROFILE_ID sentinel that getActive- ProviderProfile resolves to undefined (Anthropic) instead of profiles[0], and a clearActiveProviderProfile() that records the sentinel, clears the managed provider env in-session, and removes the startup profile mirror. Surface it as a 'Use Anthropic (built-in)' choice in /provider, shown whenever the current provider is not Anthropic. Saved profiles are kept for re-selection; the switch takes effect without a restart. Fixes Gitlawb#1426
Contributor
Author
|
Heads up on the red I checked out a clean
The diff only touches provider profile state ( |
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.
Fixes #1426
Problem
Once any third-party provider profile is active,
/provideroffers no way back to built-in Anthropic.getActiveProviderProfilefalls back toprofiles[0]wheneveractiveProviderProfileIdis unset, so clearing the active id still re-selects a saved profile. The only escape was hand-editing~/.openclaude.json(null the active id, emptyproviderProfiles) and a full restart — andauth statuskept reportingthird_partyuntil then due to stale session env.Fix
ANTHROPIC_DEFAULT_PROFILE_IDsentinel.getActiveProviderProfileresolves it toundefined(built-in Anthropic) instead of falling through toprofiles[0].clearActiveProviderProfile(): records the sentinel as the active id, clears the managed provider env from the current session (so the switch is immediate, no restart), and removes the startup profile mirror file.Use Anthropic (built-in)choice in the/providermenu, shown whenever the current provider is not Anthropic. Selecting it switches mid-session and emits a provider-switch system reminder.Saved profiles are preserved for re-selection — this only changes which one is active.
Test plan
bun test src/utils/providerProfiles.test.ts— added coverage: sentinel resolves to undefined while saved profiles persist; managed env cleared from session.bun test src/commands/provider/provider.test.tsxbun run buildnode dist/cli.mjs --version(smoke)