Skip to content

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

address review (ollama): key the settled probe on an explicit ok flag

[._.]/ Adam Eivy16c09f4a60cd
diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.js
index bb97765bed..79d7aee0d2 100644
--- a/server/lib/aiToolkit/providers.js
+++ b/server/lib/aiToolkit/providers.js
@@ -1344,10 +1344,13 @@ export function createProviderService(config = {}) {
typeof cachedModelIds === 'function'
? Promise.resolve().then(() => cachedModelIds(provider)).catch(() => null)
: null,
- probeServed().then((result) => ({ result }), (error) => ({ error })),
+ // `ok` carries the outcome rather than the error's truthiness — the
+ // same absent-vs-falsy sentinel rule the rest of this file follows, so
+ // the two reads below say which case they mean instead of inferring it.
+ probeServed().then((result) => ({ ok: true, result }), (error) => ({ ok: false, error })),
]);
if (!Array.isArray(cached) || cached.length === 0) {
- if (probed.error) throw probed.error;
+ if (!probed.ok) throw probed.error;
return probed.result;
}
const catalog = toModelCatalog(probed.result) || { models: [], contextWindows: {} };
@@ -1358,7 +1361,7 @@ export function createProviderService(config = {}) {
// `defaultModel`, so dropping it would prune the pin off a provider merely
// because its server was stopped. A SUCCESSFUL probe stays authoritative,
// so a genuinely delisted model still disappears.
- const stale = probed.error && Array.isArray(provider?.models) ? provider.models : [];
+ const stale = !probed.ok && Array.isArray(provider?.models) ? provider.models : [];
return {
models: [...new Set([...catalog.models, ...stale, ...cached])],
contextWindows: catalog.contextWindows,
diff --git a/server/lib/aiToolkit/providers.test.js b/server/lib/aiToolkit/providers.test.js
index 182ee89e3f..5b609fbd6a 100644
--- a/server/lib/aiToolkit/providers.test.js
+++ b/server/lib/aiToolkit/providers.test.js
@@ -1674,6 +1674,11 @@ rl.on('line', (line) => {
expect((await hostedService.getProviderById(provider.id)).models).toEqual([SERVED]);
});
+ // A rejection carrying a falsy value is still a failure. Keyed on the
+ // outcome rather than the error's truthiness, or this probe reads as a
+ // success whose catalog is `undefined` — swallowed instead of rethrown,
+ // and treated as authoritative so the record's own ids get pruned.
+
it('leaves a provider the host does not claim exactly as the endpoint answered', async () => {
servesModels(['gpt-example']);
const provider = await hostedService.createProvider({