fix(cli): invalidate provider state after auth changes#8898
Merged
marius-kilocode merged 3 commits intomainfrom Apr 14, 2026
Merged
fix(cli): invalidate provider state after auth changes#8898marius-kilocode merged 3 commits intomainfrom
marius-kilocode merged 3 commits intomainfrom
Conversation
After the Effect migration in #8870, provider state is cached via InstanceState/ScopedCache. The hasKey check that determines which models are available ran once at init and was never re-evaluated. When auth changed (login, logout, org switch), only ModelCache was cleared but the provider state retained the stale hasKey decision, causing authenticated users to be stuck on the free model.
| Instance: { | ||
| readonly directory: string | ||
| readonly project: { readonly id: string } | ||
| disposeAll(): Promise<void> |
Contributor
There was a problem hiding this comment.
WARNING: This widens the exported route dependency contract
createKiloRoutes() is part of @kilocode/kilo-gateway's public API, and its deps shape inherits this ImportDeps.Instance type. Making disposeAll() required will break existing TypeScript callers that pass the previous Instance object shape even though importSessionToDb() still only uses directory and project.id. Consider keeping this requirement in the route-layer deps instead of the shared import deps so this fix doesn't introduce an undocumented source-breaking change.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by gpt-5.4-20260305 · 444,393 tokens |
johnnyeric
approved these changes
Apr 14, 2026
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.
Summary
InstanceState(provider cache) after auth changes so thehasKeycheck re-evaluates with updated credentialshasKeydecision was cached viaScopedCacheand never refreshed — causing authenticated users to be stuck on the free model when auth state changed after provider initRelates to #8870