fix(vscode): make the gear sign-in actually log in - #1779
Conversation
…ake the gear sign-in actually log in
|
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6e046a215
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| */ | ||
| export function hasConfiguredProviderCredentials(config: KimiConfig): boolean { | ||
| return Object.values(config.providers ?? {}).some( | ||
| (provider) => typeof provider.apiKey === "string" && provider.apiKey.trim().length > 0, |
There was a problem hiding this comment.
Don't treat unrelated provider keys as managed login
When a config has a static API key for one provider but the default/first model still uses managed:kimi-code without an OAuth token, this returns true just because some provider has apiKey. useAppInit then calls requiresManagedProviderLogin(..., loginStatus.loggedIn), which short-circuits on loggedIn and skips the login screen, leaving the UI ready even though the active managed model has no token and prompts will fail; the check needs to be tied to the active provider (or keep managed OAuth status separate from other provider credentials).
Useful? React with 👍 / 👎.
* fix(vscode): count configured provider credentials as signed in and make the gear sign-in actually log in * fix(vscode): keep the gear auth action scoped to the Kimi account session
Related Issue
No issue — the problem is explained in the next section.
Problem
The gear (Action) menu's Sign in item in the VS Code webview was a dead button. When not logged in,
ActionMenu.handleAuthActiononly closed the menu and triggered a refresh — it never calledbridge.login(). The fullLoginScreenonly appears when zero models are configured, so for users with a workingconfig.tomlsetup the click had no visible effect at all.The menu deliberately reflects only the managed Kimi account OAuth session — statically provisioned
api_keyproviders inconfig.tomldon't count, because Sign out must remain a meaningful action that maps to deleting the OAuth session, mirroring the CLI's/loginand/logout. An earlier revision of this PR counted configured api keys as signed in; that made Sign out a no-op for those users, so it was reverted.What changed
webview-ui/src/components/ActionMenu.tsx: the gear Sign in item now actually callsbridge.login()(device-code flow opens the browser automatically) with the existing loading state, and surfaces failures via a toast. Sign out keeps callingbridge.logout(); because the menu state tracks the OAuth session only, both actions now visibly toggle the menu state.updateLoginContextstays OAuth-based) or to the login-screen gating (unchanged: the screen only shows when no models are configured).Checklist
gen-changesetsskill, or this PR needs no changeset. (No changeset: vscode-extension-only change, nothing enters the CLI bundle.)gen-docsskill, or this PR needs no doc update. (Internal behavior fix, no user-facing docs affected.)