diff --git a/.changeset/early-ideas-hug.md b/.changeset/early-ideas-hug.md new file mode 100644 index 00000000000..b8199cde141 --- /dev/null +++ b/.changeset/early-ideas-hug.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Fix mode selection after anonymous usage diff --git a/src/core/webview/__tests__/webviewMessageHandler.autoSwitch.spec.ts b/src/core/webview/__tests__/webviewMessageHandler.autoSwitch.spec.ts index 036cd307f58..d76565d339f 100644 --- a/src/core/webview/__tests__/webviewMessageHandler.autoSwitch.spec.ts +++ b/src/core/webview/__tests__/webviewMessageHandler.autoSwitch.spec.ts @@ -145,7 +145,7 @@ describe("webviewMessageHandler - Automatic Organization Switching", () => { kilocodeToken: "test-token", kilocodeOrganizationId: "org-1", }, - false, + true, // Changed: Now correctly activates the profile (fix for PR #5415 bug) ) // Verify flag was set to true after the recursive call @@ -407,7 +407,7 @@ describe("webviewMessageHandler - Automatic Organization Switching", () => { kilocodeToken: "new-token", kilocodeOrganizationId: undefined, }, - false, + true, // Changed: Now correctly activates the profile (fix for PR #5415 bug) ) }) @@ -569,7 +569,7 @@ describe("webviewMessageHandler - Automatic Organization Switching", () => { kilocodeToken: "test-token", kilocodeOrganizationId: "org-1", }, - false, + true, // Changed: Now correctly activates the profile (fix for PR #5415 bug) ) // Verify log message mentions the correct organization diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index 9aa7dfc64ba..13dd8ef5edc 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2305,7 +2305,7 @@ export const webviewMessageHandler = async ( } // kilocode_change start: If we're updating the active profile, we need to activate it to ensure it's persisted - const currentApiConfigName = getGlobalState("currentApiConfigName") + const currentApiConfigName = getGlobalState("currentApiConfigName") || "default" const isActiveProfile = message.text === currentApiConfigName await provider.upsertProviderProfile(message.text, configToSave, isActiveProfile) // Activate if it's the current active profile vscode.commands.executeCommand("kilo-code.ghost.reload")