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: report a partial catalog refresh honestly and refuse an empty model subset
[._.]/ Adam Eivy549a57a96ed3
diff --git a/client/src/components/providers/ProviderConnections.jsx b/client/src/components/providers/ProviderConnections.jsxindex c9bd8c2721..05db8f5388 100644--- a/client/src/components/providers/ProviderConnections.jsx+++ b/client/src/components/providers/ProviderConnections.jsx@@ -40,6 +40,14 @@ import {* shareable, bookmarkable and reachable from ⌘K and voice.*/+/** How each catalog state reads at a glance — the four are deliberately distinct. */+const CATALOG_TONE_CLASS = {+ error: 'text-port-error',+ ok: 'text-port-success',+ warn: 'text-port-warning',+ muted: 'text-port-muted',+};+/** A transports map edited as flat text, back to the wire shape. */const transportsFromDraft = (draft) => Object.fromEntries(Object.entries(draft)@@ -188,6 +196,14 @@ export default function ProviderConnections({}, [selected, run]);const saveBindingModels = useCallback(async (binding, selectedModels) => {+ // `[]` on the wire means "offer the whole shared catalog", so clearing the+ // last checkbox would silently re-select everything — the opposite of the+ // click. Refuse it and say why; removing a harness is a route action, not a+ // model menu one.+ if (selectedModels.length === 0) {+ toast.error('Keep at least one model — an empty selection means the whole shared catalog.');+ return;+ }const saved = await run('Saving the model selection', () => api.updateProviderBinding(binding.id,{ expectedRevision: binding.revision, selectedModels },@@ -305,7 +321,7 @@ export default function ProviderConnections({{group.connection.hasCredentials ? ' · key set' : ''}</span></span>- <span className={`shrink-0 text-xs ${summary.tone === 'error' ? 'text-port-error' : summary.tone === 'ok' ? 'text-port-success' : 'text-port-muted'}`}>+ <span className={`shrink-0 text-xs ${CATALOG_TONE_CLASS[summary.tone]}`}>{summary.text}</span></button>diff --git a/client/src/components/providers/ProviderConnections.test.jsx b/client/src/components/providers/ProviderConnections.test.jsxindex 6a11452e32..cf65ef4719 100644--- a/client/src/components/providers/ProviderConnections.test.jsx+++ b/client/src/components/providers/ProviderConnections.test.jsx@@ -210,3 +210,17 @@ describe('backend connection management', () => {expect(screen.queryByText(/does not expose connection management/)).not.toBeInTheDocument();});});++describe('the empty-selection inversion', () => {+ it('refuses to clear the last model, because `[]` means the whole catalog', async () => {+ renderPanel();++ // `example-model` is the only CATALOG entry currently selected (the other+ // selection, `retired-model`, is stale and not offered), so unchecking it+ // would send `[]` — read by every consumer as "offer everything".+ fireEvent.click(await screen.findByLabelText('example-model'));++ await waitFor(() => expect(toast.error).toHaveBeenCalledWith(expect.stringContaining('at least one model')));+ expect(api.updateProviderBinding).not.toHaveBeenCalled();+ });+});diff --git a/server/lib/providerGraphRecords.js b/server/lib/providerGraphRecords.jsindex 5b5746be40..451f63597b 100644--- a/server/lib/providerGraphRecords.js+++ b/server/lib/providerGraphRecords.js@@ -443,6 +443,11 @@ export function sanitizeCatalogError(error, credentials = {}) {* empty list — a real answer from a backend whose last model was deleted, not* the same state as "never asked".*+ * A PARTIAL result — some harnesses on the backend answered, others did not —+ * is `known` (the models it lists really were observed) that KEEPS the error,+ * because reporting it as clean would hide a harness that cannot reach the+ * backend behind the models of one that can.+ ** @param {{state:string, models:string[]}} current - the stored catalog* @param {{refreshed: boolean, models?: string[], error?: string|null}} outcome* @returns {{state:'unknown'|'known'|'failed', models:string[], error:string|null}}@@ -452,5 +457,5 @@ export function nextConnectionCatalog(current, outcome) {if (!outcome?.refreshed) {return { state: 'failed', models, error: outcome?.error ?? 'The model refresh failed' };}- return { state: 'known', models: [...new Set(outcome.models || [])], error: null };+ return { state: 'known', models: [...new Set(outcome.models || [])], error: outcome.error ?? null };}diff --git a/server/routes/providers.connectionManagement.test.js b/server/routes/providers.connectionManagement.test.jsindex 666b284513..0934b8a845 100644--- a/server/routes/providers.connectionManagement.test.js+++ b/server/routes/providers.connectionManagement.test.js@@ -427,3 +427,20 @@ describe('the management graph a browser actually receives', () => {expect(res.body.routes[0]).not.toHaveProperty('pending');});});++describe('a partially reachable backend', () => {+ it('reports the models it did observe AND the harness that could not reach it', async () => {+ providerService.refreshProviderModelsBatch.mockResolvedValue([+ { ids: ['claude-ollama', 'claude-ollama-tui'], leadId: 'claude-ollama', status: 'updated' },+ { ids: ['codex-ollama'], leadId: 'codex-ollama', status: 'failed', error: new Error('404 from the /v1 port') },+ ]);++ const res = await request(app()).post(`/api/providers/connections/${CONNECTION}/refresh-models`);++ // `known`, because the listed models really were observed…+ expect(res.body.catalog.state).toBe('known');+ // …but the failure is not swallowed by the group that worked.+ expect(res.body.catalog.error).toContain('/v1 port');+ expect(res.body.failedGroups).toBe(1);+ });+});diff --git a/server/services/providerGraph.js b/server/services/providerGraph.jsindex a3d209e4db..d31f0c877f 100644--- a/server/services/providerGraph.js+++ b/server/services/providerGraph.js@@ -432,6 +432,11 @@ function connectionFanout(graph, connectionId) {** A stale `expectedRevision` is a 409, not a last-writer merge: the human was* editing values they had read, and a moved row means they were not.+ *+ * `transports` replaces the map WHOLESALE rather than merging into it, so+ * dropping a protocol is expressible. That is why the editor renders one field+ * per declared transport and sends them all back: a client that sends a partial+ * map is asking to remove the rest.*/export function updateConnectionSettings({ connectionId, expectedRevision, label, transports, credentials }) {return serialize(async () => {@@ -479,17 +484,13 @@ export function updateBindingSettings({ bindingId, expectedRevision, label, seleif (binding.revision !== expectedRevision) throw stale('The binding');requireSettledRoutes(graph.routes.filter((route) => route.bindingId === binding.id));- const revision = await saveBindingSettings({+ const next = {id: binding.id,label: label ?? binding.label,selectedModels: selectedModels ?? binding.selectedModels,- });- return {- bindingId: binding.id,- revision,- label: label ?? binding.label,- selectedModels: selectedModels ?? binding.selectedModels,};+ const revision = await saveBindingSettings(next);+ return { bindingId: binding.id, revision, label: next.label, selectedModels: next.selectedModels };});}@@ -535,9 +536,13 @@ export function refreshConnectionCatalog(connectionId) {models.push(...Object.keys(modelMap));}- const catalog = nextConnectionCatalog(connection.catalog, refreshed- ? { refreshed: true, models }- : { refreshed: false, error: sanitizeCatalogError(failures[0]?.error, connection.credentials) });+ // A failure is reported whether or not another group succeeded: a partial+ // answer is still a harness that cannot reach this backend.+ const error = failures.length > 0+ ? sanitizeCatalogError(failures[0].error, connection.credentials)+ : null;+ const catalog = nextConnectionCatalog(connection.catalog,+ refreshed ? { refreshed: true, models, error } : { refreshed: false, error });await saveConnectionSettings({ ...connection, catalog });console.log(`🔗 Refreshed connection ${connection.id} catalog: ${catalog.state}, `