Skip to content

refactor(model-catalog): drop WS catalog-changed event; refresh on picker open - #1772

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:refactor/model-catalog-refresh
Jul 16, 2026
Merged

refactor(model-catalog): drop WS catalog-changed event; refresh on picker open#1772
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:refactor/model-catalog-refresh

Conversation

@sailist

@sailist sailist commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

None — the problem is explained below.

Problem

The daemon pushed event.model_catalog.changed over the v1 WebSocket after every provider-model refresh (manual, OAuth, or the scheduled one), and the only consumer that reacted to it was the web app, which reloaded its model/provider caches on receipt. The push event was redundant coupling — a missed push left the cache stale — and meanwhile the web model picker only refreshed the OAuth-managed provider on open, so models from other refreshable providers could stay stale until a scheduled refresh happened to land.

What changed

  • kap-server: removed event.model_catalog.changed from the v1 WS surface — dropped the broadcaster forwarding branch and its payload extractor, the ModelCatalogChangedEvent wire type and its union member, and the modelCatalogChangedEventSchema zod registration. The scheduled/startup catalog refresh itself is unchanged.
  • kimi-web: opening the model picker now performs a full provider refresh (POST /providers:refresh, scope: all) before loading the model list, so the list always reflects the live catalog regardless of provider type. The now-unused OAuth-only facade helper was removed. Composer dropdown, mobile settings, and onboarding entries all share this path.
  • Kept for compatibility with older daemons: the domain-level publishers (agent-core / agent-core-v2), the shared protocol schema, and the web client's receiver for this event type — a new web build talking to an older daemon still refreshes on push as before.

Replacing push with pull makes the web client's catalog behavior deterministic: the data is re-fetched exactly when the user asks to see it.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • Tests updated and passing (kap-server and kimi-web suites; the fan-out test for the removed event was deleted alongside it).
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

…cker open

- kap-server: remove event.model_catalog.changed from the v1 WS union,
  broadcaster forwarding, and the zod event registry
- web: refresh all providers (POST /providers:refresh) before loading
  models when the model picker opens, replacing the event-driven refresh
- keep domain publishers, the protocol schema, and the web receiver for
  compatibility with older daemons
@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 773724d

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 Jul 16, 2026

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

commit: 773724d

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 773724dc8a

ℹ️ 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".

Comment thread apps/kimi-web/src/App.vue
// Full refresh first (every refreshable provider, not just OAuth), so the
// list always reflects the live catalog — the WS model-catalog event that
// used to keep the cache warm is no longer forwarded by the daemon.
await client.refreshAllProviders();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh the quick model menu before showing it

When the daemon's scheduled/startup catalog refresh adds models after the initial loadModels(), the current server no longer sends event.model_catalog.changed, and the composer model pill still opens its quick dropdown directly from client.models.value without calling openModelPicker(); only the “More models” row reaches this refreshed path. That leaves the quick-switch list stale until the user opens the full picker or reloads, which regresses the cache-warming behavior being removed here. Please trigger the same refresh on the composer dropdown-open path, or keep another cache refresh for scheduled catalog changes.

Useful? React with 👍 / 👎.

@sailist
sailist merged commit 78967e2 into MoonshotAI:main Jul 16, 2026
15 checks passed
This was referenced Jul 16, 2026
ywh114 pushed a commit to ywh114/kimi-code that referenced this pull request Jul 19, 2026
…cker open (MoonshotAI#1772)

- kap-server: remove event.model_catalog.changed from the v1 WS union,
  broadcaster forwarding, and the zod event registry
- web: refresh all providers (POST /providers:refresh) before loading
  models when the model picker opens, replacing the event-driven refresh
- keep domain publishers, the protocol schema, and the web receiver for
  compatibility with older daemons
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