Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lambertjosh
Copy link
Contributor

After https://github.com/Kilo-Org/kilocode/pull/5415/changes model changes while logged out no longer worked. This PR should hopefully fix it.

The theoretical cause: currentApiConfigName is undefined, so isActiveProfile evaluates to false, causing the profile to be saved but NOT activated.

@changeset-bot
Copy link

changeset-bot bot commented Jan 29, 2026

🦋 Changeset detected

Latest commit: babe584

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

}
} catch (error) {
// Config might not exist yet, that's fine
// Profile doesn't exist yet (expected for new profiles)

This comment was marked as outdated.

@kiloconnect
Copy link
Contributor

kiloconnect bot commented Jan 29, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

CRITICAL

File Line Issue

WARNING

File Line Issue

SUGGESTION

File Line Issue
src/core/webview/webviewMessageHandler.ts 2308 Prefer ?? over `
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (3 files)
  • .changeset/early-ideas-hug.md - 0 issues
  • src/core/webview/__tests__/webviewMessageHandler.autoSwitch.spec.ts - 0 issues
  • src/core/webview/webviewMessageHandler.ts - 1 suggestion


// 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"
Copy link
Contributor

Choose a reason for hiding this comment

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

SUGGESTION: Prefer nullish coalescing to avoid treating falsy-but-valid values as "default"

Using || will replace any falsy value (e.g. an empty string) with "default". If currentApiConfigName is only ever string | undefined, using ?? is a safer defaulting pattern.

Suggested change
const currentApiConfigName = getGlobalState("currentApiConfigName") || "default"
const currentApiConfigName = getGlobalState("currentApiConfigName") ?? "default"


// 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"
Copy link
Contributor

Choose a reason for hiding this comment

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

SUGGESTION: Prefer nullish coalescing (??) over || when defaulting currentApiConfigName

Using || treats "" (empty string) as missing. If currentApiConfigName can ever be an empty string (e.g. corrupted/migrated state), this will unexpectedly fall back to "default". ?? only falls back for null/undefined.

Suggested change
const currentApiConfigName = getGlobalState("currentApiConfigName") || "default"
const currentApiConfigName = getGlobalState("currentApiConfigName") ?? "default"

@kevinvandijk kevinvandijk merged commit 9ba79f3 into main Jan 29, 2026
12 checks passed
@kevinvandijk kevinvandijk deleted the jl-fix-model-picker branch January 29, 2026 14:08
@github-actions github-actions bot mentioned this pull request Jan 29, 2026
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.

3 participants