-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix remote control multi endpoint still use default credentials #3466
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ import { | |
| createKimiDeviceId, | ||
| FileTokenStorage, | ||
| KIMI_CODE_PROVIDER_NAME, | ||
| kimiCodeEnvBaseUrl, | ||
| kimiCodeEnvOAuthHost, | ||
| resolveKimiCodeOAuthKey, | ||
| resolveKimiTokenStorageName, | ||
| } from '@moonshot-ai/kimi-code-oauth'; | ||
| import { WebSocket, type RawData } from 'ws'; | ||
|
|
@@ -294,8 +297,18 @@ export async function startRemoteControl( | |
| throw new Error('Remote Control requires local server authentication.'); | ||
| } | ||
| const storage = new FileTokenStorage(join(options.homeDir, 'credentials')); | ||
| // Resolve the credential slot the same way login and the runtime provider | ||
| // do: with KIMI_CODE_OAUTH_HOST / KIMI_CODE_BASE_URL overrides the token | ||
| // lives in an env-scoped slot (kimi-code-env-<hash>), and reading only the | ||
| // default slot would pick up a credential for the wrong environment. | ||
| const token = await storage.load( | ||
| resolveKimiTokenStorageName({ providerName: KIMI_CODE_PROVIDER_NAME }), | ||
| resolveKimiTokenStorageName({ | ||
| providerName: KIMI_CODE_PROVIDER_NAME, | ||
| oauthKey: resolveKimiCodeOAuthKey({ | ||
| oauthHost: kimiCodeEnvOAuthHost(), | ||
| baseUrl: kimiCodeEnvBaseUrl(), | ||
| }), | ||
|
Comment on lines
+307
to
+310
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user selects the global OAuth login (or another endpoint persisted in AGENTS.md reference: apps/kimi-code/AGENTS.md:L45-L45 Useful? React with 👍 / 👎. |
||
| }), | ||
| ); | ||
| if (token?.refreshToken === undefined || token.refreshToken.length === 0) { | ||
| throw new Error('Remote Control requires a Kimi login. Run `kimi login` first.'); | ||
|
|
||
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.
This changes shipped CLI behavior by making Remote Control select a different credential slot, but the commit contains no
.changesetentry. Without the required CLI patch changeset, this user-visible bug fix will be omitted from the generated release changelog; add a short@moonshot-ai/kimi-codepatch changeset.AGENTS.md reference: AGENTS.md:L85-L85
Useful? React with 👍 / 👎.