diff --git a/src/utils/providerProfiles.test.ts b/src/utils/providerProfiles.test.ts index 917f8dd6..e1222ec7 100644 --- a/src/utils/providerProfiles.test.ts +++ b/src/utils/providerProfiles.test.ts @@ -259,6 +259,8 @@ describe('applyActiveProviderProfileFromConfig', () => { delete process.env.CLAUDE_CODE_USE_BEDROCK delete process.env.CLAUDE_CODE_USE_VERTEX delete process.env.CLAUDE_CODE_USE_FOUNDRY + delete process.env.CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED + delete process.env.CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED_ID process.env.OPENAI_BASE_URL = 'http://localhost:11434/v1' process.env.OPENAI_MODEL = 'qwen2.5:3b' diff --git a/src/utils/providerProfiles.ts b/src/utils/providerProfiles.ts index c928e620..b8ba3edf 100644 --- a/src/utils/providerProfiles.ts +++ b/src/utils/providerProfiles.ts @@ -417,7 +417,7 @@ export function applyActiveProviderProfileFromConfig( processEnv[PROFILE_ENV_APPLIED_FLAG] === '1' && trimOrUndefined(processEnv[PROFILE_ENV_APPLIED_ID]) === activeProfile.id - if (!options?.force && hasProviderSelectionFlags(processEnv)) { + if (!options?.force && (hasProviderSelectionFlags(processEnv) || processEnv[PROFILE_ENV_APPLIED_FLAG] === '1')) { // Respect explicit startup provider intent. Auto-heal only when this // exact active profile previously applied the current env. if (!isCurrentEnvProfileManaged) {