refactor(model-catalog): drop WS catalog-changed event; refresh on picker open - #1772
Conversation
…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 detectedLatest commit: 773724d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
There was a problem hiding this comment.
💡 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".
| // 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(); |
There was a problem hiding this comment.
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 👍 / 👎.
…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
Related Issue
None — the problem is explained below.
Problem
The daemon pushed
event.model_catalog.changedover 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
event.model_catalog.changedfrom the v1 WS surface — dropped the broadcaster forwarding branch and its payload extractor, theModelCatalogChangedEventwire type and its union member, and themodelCatalogChangedEventSchemazod registration. The scheduled/startup catalog refresh itself is unchanged.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.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
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.