Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: preserve refreshed provider catalogs
[._.]/ Adam Eivyb01c4cf6623b
diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsxindex 1c672369ad..7fed617fb7 100644--- a/client/src/pages/AIProviders.jsx+++ b/client/src/pages/AIProviders.jsx@@ -492,13 +492,15 @@ export default function AIProviders() {// user at the top of the list — a card several screens down was unreachable// after refreshing it.//- // Only the two fields a refresh writes are taken from the response: the record+ // Only the fields a refresh writes are taken from the response: the record// it returns is a bare `presentProvider`, so replacing the whole entry would// drop the fields only the LIST endpoint adds (`executionModes`,- // `prerequisitesMet`, the codex account) and un-group a unified card. Those- // two fields fan out to every mode in the group server-side+ // `prerequisitesMet`, the codex account) and un-group a unified card. The+ // model and catalog fields fan out to every mode in the group server-side// (`sharedModeUpdates`), so they are applied to the siblings here too rather// than leaving them showing the pre-refresh catalog until the next poll.+ // `modelCatalog` is the unscoped full list when model access hides entries;+ // the editor saves from it, so it must move with each refresh.// `modelContextWindows` is copied even when absent — a refresh that pruned it// must not leave the stale map behind.const handleRefreshModels = async (id) => {@@ -507,11 +509,12 @@ export default function AIProviders() {const result = await api.refreshProviderModels(id, { silent: true });if (result) {toast.success(`Models refreshed for ${result.name}`);+ const modelCatalog = Array.isArray(result.modelCatalog) ? result.modelCatalog : result.models;setProviders(current => {const refreshed = current.find(p => p.id === result.id);const group = new Set([result.id, ...(refreshed?.executionModes || []).map(mode => mode.id)]);return current.map(p => (group.has(p.id)- ? { ...p, models: result.models, modelContextWindows: result.modelContextWindows }+ ? { ...p, models: result.models, modelCatalog, modelContextWindows: result.modelContextWindows }: p));});// The catalog a card just learned is graded by the readiness checklist,diff --git a/client/src/pages/AIProviders.test.jsx b/client/src/pages/AIProviders.test.jsxindex fbb58276a8..5a3c2281ac 100644--- a/client/src/pages/AIProviders.test.jsx+++ b/client/src/pages/AIProviders.test.jsx@@ -2049,6 +2049,51 @@ describe('AIProviders model refresh', () => {expect(screen.getAllByRole('button', { name: 'Refresh Models' })).toHaveLength(1);});+ it.each([+ { mode: 'CLI', providerId: 'claude-code' },+ { mode: 'TUI', providerId: 'claude-code-tui' },+ ])('uses the refreshed full catalog when editing a paired $mode preset', async ({ mode, providerId }) => {+ const catalogBeforeRefresh = ['example-claude-old', 'example-claude-retired'];+ const catalogAfterRefresh = ['example-claude-current', 'example-claude-preview'];+ const claudeExecutionModes = [{ id: 'claude-code', type: 'cli' }, { id: 'claude-code-tui', type: 'tui' }];+ const claudeProviders = {+ activeProvider: null,+ providers: ['cli', 'tui'].map((type) => ({+ id: `claude-code${type === 'tui' ? '-tui' : ''}`,+ name: `Claude Code${type === 'tui' ? ' TUI' : ''}`,+ type,+ command: 'claude',+ enabled: true,+ models: [catalogBeforeRefresh[0]],+ modelCatalog: catalogBeforeRefresh,+ modelAccess: { mode: 'allow', patterns: ['example-claude-*'] },+ canRefreshModels: true,+ executionModes: claudeExecutionModes,+ })),+ };+ api.getProviders.mockResolvedValue(claudeProviders);+ api.refreshProviderModels.mockResolvedValue({+ ...claudeProviders.providers[0],+ models: [catalogAfterRefresh[0]],+ modelCatalog: catalogAfterRefresh,+ canRefreshModels: true,+ });+ api.updateProvider.mockResolvedValue({});++ await renderPage();+ fireEvent.click(await screen.findByRole('button', { name: 'Refresh Models' }));+ await waitFor(() => expect(toast.success).toHaveBeenCalledWith('Models refreshed for Claude Code'));++ fireEvent.click(await screen.findByRole('button', { name: `Edit ${mode}` }));+ await openEditorTab('Models');+ const catalogField = screen.getByRole('textbox', { name: /Available Models/i });+ expect(catalogField).toHaveValue(catalogAfterRefresh.join(', '));++ fireEvent.click(screen.getByRole('button', { name: 'Save' }));+ await waitFor(() => expect(api.updateProvider).toHaveBeenCalled());+ expect(api.updateProvider).toHaveBeenCalledWith(providerId, expect.objectContaining({ models: catalogAfterRefresh }));+ });+it('keeps the stored catalog when the refresh is unsupported', async () => {api.refreshProviderModels.mockResolvedValue(null);