-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix model selection after anonymous usage #5503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: babe584 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (3 files)
|
|
|
||
| // 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" |
There was a problem hiding this comment.
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.
| 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" |
There was a problem hiding this comment.
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.
| const currentApiConfigName = getGlobalState("currentApiConfigName") || "default" | |
| const currentApiConfigName = getGlobalState("currentApiConfigName") ?? "default" |
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:
currentApiConfigNameisundefined, soisActiveProfileevaluates tofalse, causing the profile to be saved but NOT activated.