Skip to content

feat(kimi-code): refresh OAuth provider models before opening model picker#713

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:oauth-autoupdate
Jun 13, 2026
Merged

feat(kimi-code): refresh OAuth provider models before opening model picker#713
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:oauth-autoupdate

Conversation

@sailist

@sailist sailist commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR makes the /model slash command refresh OAuth-backed provider models right before opening the model picker, so newly-available or changed OAuth models show up without forcing a full provider refresh. It introduces a scoped refresh mode so the picker can refresh only OAuth providers, and adds a short timeout so the UI stays responsive even if the refresh hangs.


1. Refresh OAuth models before opening the model picker

Problem: The /model picker could display stale model lists for OAuth providers because it did not refresh provider models before rendering.

What was done:

  • Changed handleModelCommand to async and call refreshOAuthProviderModels() before showing the picker.
  • Added a MODEL_PICKER_REFRESH_TIMEOUT_MS (2 s) helper so the picker still opens promptly even if the refresh is slow or fails.
  • Surfaced non-fatal refresh failures as warning status messages instead of throwing.

2. Scoped provider model refresh

Problem: refreshAllProviderModels always refreshed every provider, which is unnecessary when the picker only needs OAuth provider data.

What was done:

  • Added RefreshProviderScope = 'all' | 'oauth' and RefreshProviderOptions to refresh-providers.ts.
  • Updated AuthFlowController with refreshOAuthProviderModels() (scope 'oauth') and kept refreshProviderModels() as 'all'.
  • Preserved existing behavior for non-OAuth providers by defaulting the scope to 'all'.

3. Tests

What was done:

  • Added tests in test/tui/utils/refresh-providers.test.ts for OAuth-only refresh behavior.
  • Updated test/tui/kimi-tui-message-flow.test.ts to cover async model picker rendering after the refresh call.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs a doc update.
  • I have run make gen-changelog to update the changelog.

…icker

- call refreshOAuthProviderModels before /model picker opens\n- add scoped refreshAllProviderModels with 'oauth' and 'all' scopes\n- update tests for async picker rendering and OAuth-only refresh
@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b0c0e02

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

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-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

@pkg-pr-new

pkg-pr-new Bot commented Jun 13, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@b0c0e02
npx https://pkg.pr.new/@moonshot-ai/kimi-code@b0c0e02

commit: b0c0e02

@sailist sailist merged commit f874251 into MoonshotAI:main Jun 13, 2026
9 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 13, 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.

1 participant