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

fix: address review (codex): preserve capability probe state

Adam Eivydf4275124b66
diff --git a/client/src/components/models/ModelCapabilitySummary.jsx b/client/src/components/models/ModelCapabilitySummary.jsx
index 785ef27793..f9e5fec7cc 100644
--- a/client/src/components/models/ModelCapabilitySummary.jsx
+++ b/client/src/components/models/ModelCapabilitySummary.jsx
@@ -2,6 +2,7 @@ import CapabilityBadges from './CapabilityBadges.jsx';
const SOURCE_COPY = {
runtime: 'Reported by the local model runtime.',
+ 'runtime-unknown': 'The local runtime found this model but could not report its capabilities right now.',
provider: 'These are provider-level harness capabilities; this provider does not publish a separate per-model report.',
inferred: 'Some badges are inferred from the model id. A runtime report takes precedence when available.',
loading: 'Checking the local runtime for an authoritative capability report…',
diff --git a/client/src/components/models/ModelCapabilitySummary.test.jsx b/client/src/components/models/ModelCapabilitySummary.test.jsx
index f5bf00f02e..807fbc83b2 100644
--- a/client/src/components/models/ModelCapabilitySummary.test.jsx
+++ b/client/src/components/models/ModelCapabilitySummary.test.jsx
@@ -35,6 +35,16 @@ describe('ModelCapabilitySummary', () => {
expect(screen.getByText('No optional capabilities reported')).toBeInTheDocument();
expect(screen.getByText('The runtime reported no optional capabilities for this model.')).toBeInTheDocument();
+ rerender(
+ <ModelCapabilitySummary
+ provider={{ id: 'ollama' }}
+ model="qwen3.6:35b"
+ capabilities={null}
+ source="runtime-unknown"
+ />,
+ );
+ expect(screen.getByText('The local runtime found this model but could not report its capabilities right now.')).toBeInTheDocument();
+
rerender(
<ModelCapabilitySummary
provider={{ id: 'openai' }}
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index 70f0823731..13cc7184cc 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -1120,13 +1120,14 @@ export const isOllamaBackedProvider = (provider) => {
*
* `[]` is a valid runtime answer meaning no optional capabilities were
* reported. `null` means the capability set is unknown, and `source` tells the
- * UI whether that is because the runtime is still loading, the provider gave a
- * harness-level fact, or no authoritative metadata exists.
+ * UI whether that is because the runtime is still loading, the runtime probe
+ * failed, the provider gave a harness-level fact, or no authoritative metadata
+ * exists.
*
* @param {{id?:string,type?:string,command?:string,endpoint?:string,name?:string,ollamaBacked?:boolean}|null|undefined} provider
* @param {string|null|undefined} model
* @param {{capabilitiesByBackend?: {ollama?: Record<string, string[]|null>, lmstudio?: Record<string, string[]|null>}, recommendations?: {ollama?: object|null, lmstudio?: object|null}, loading?: boolean}} [options]
- * @returns {{capabilities: string[]|null, source: 'unselected'|'runtime'|'provider'|'inferred'|'loading'|'unknown', recommendation: object|null}}
+ * @returns {{capabilities: string[]|null, source: 'unselected'|'runtime'|'runtime-unknown'|'provider'|'inferred'|'loading'|'unknown', recommendation: object|null}}
*/
export const modelCapabilityInfo = (provider, model, {
capabilitiesByBackend = {},
@@ -1139,7 +1140,9 @@ export const modelCapabilityInfo = (provider, model, {
}
const backend = localBackendForProvider(provider);
- const canonicalLocalProvider = backend && provider.id === backend;
+ const canonicalLocalProvider = backend
+ && provider.id === backend
+ && isLocalInstanceProvider(provider);
const recommendation = canonicalLocalProvider ? recommendations?.[backend] : null;
const selectedRecommendation = recommendation?.id === modelId ? recommendation : null;
@@ -1149,7 +1152,7 @@ export const modelCapabilityInfo = (provider, model, {
const capabilities = modelCapabilities[modelId];
return {
capabilities: Array.isArray(capabilities) ? [...new Set(capabilities)] : null,
- source: 'runtime',
+ source: Array.isArray(capabilities) ? 'runtime' : 'runtime-unknown',
recommendation: selectedRecommendation,
};
}
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index 801e16d0f8..f7bd7a26d1 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -916,6 +916,20 @@ describe('modelCapabilityInfo', () => {
})).toEqual({ capabilities: null, source: 'unknown', recommendation: null });
});
+ it('does not let the canonical provider id override a remote endpoint', () => {
+ const remoteCanonicalOllama = { ...ollama, endpoint: 'http://192.0.2.10:11434/v1' };
+ expect(modelCapabilityInfo(remoteCanonicalOllama, 'phi4-mini:latest', {
+ capabilitiesByBackend: { ollama: { 'phi4-mini:latest': ['chat', 'tools'] } },
+ recommendations: { ollama: { id: 'phi4-mini:latest', reason: 'Local-only recommendation.' } },
+ })).toEqual({ capabilities: null, source: 'unknown', recommendation: null });
+ });
+
+ it('distinguishes a failed local capability probe from a reported empty set', () => {
+ expect(modelCapabilityInfo(ollama, 'qwen3.6:35b', {
+ capabilitiesByBackend: { ollama: { 'qwen3.6:35b': null } },
+ })).toEqual({ capabilities: null, source: 'runtime-unknown', recommendation: null });
+ });
+
it('shows known CLI harness capabilities separately from per-model metadata', () => {
expect(modelCapabilityInfo({ id: 'codex', type: 'cli', command: 'codex' }, 'gpt-5'))
.toEqual({ capabilities: ['tools', 'vision'], source: 'provider', recommendation: null });
diff --git a/server/services/localLlm.js b/server/services/localLlm.js
index 060f667290..0225b07063 100644
--- a/server/services/localLlm.js
+++ b/server/services/localLlm.js
@@ -755,7 +755,7 @@ export async function listVisionModels() {
// in the picker. Models the id heuristic already caught skip the round-trip.
const ollamaVision = await Promise.all(ollama.map(async (m) => {
if (m.vision) return m
- const capabilities = await ollamaManager.getModelCapabilities(m.id).catch(() => [])
+ const capabilities = await ollamaManager.getModelCapabilities(m.id).catch(() => null)
return { ...m, vision: isVisionModel({ id: m.id, capabilities }) }
}))
const tag = (backend, models) => models
@@ -801,10 +801,10 @@ export async function listToolUseModels() {
// client can already decide for itself, so skipping the round-trip would leave
// this list adding nothing beyond what the caller already knows.
const ollamaToolUse = await Promise.all(ollama.map(async (m) => {
- const capabilities = await ollamaManager.getModelCapabilities(m.id).catch(() => [])
+ const capabilities = await ollamaManager.getModelCapabilities(m.id).catch(() => null)
// `isToolUseModel` treats a NON-EMPTY capabilities array as authoritative in
- // both directions; an empty one (daemon didn't report, or /api/show failed)
- // falls back to the id regex.
+ // both directions; null/empty (probe failed or daemon didn't report) falls
+ // back to the id regex.
return { ...m, toolUse: isToolUseModel({ id: m.id, capabilities }) }
}))
// LM Studio reports no tool-calling flag, so `lmStudioBadgeCapabilities`
diff --git a/server/services/ollamaManager.js b/server/services/ollamaManager.js
index 99483fc6a9..900ebd4609 100644
--- a/server/services/ollamaManager.js
+++ b/server/services/ollamaManager.js
@@ -1076,19 +1076,21 @@ export async function getVersion() {
// enriching the model list on every status poll doesn't re-hit /api/show.
// Busted alongside installedModels on delete (a deleted name shouldn't linger),
// but a re-pull of the same name yields the same details so we don't bust on pull.
-const modelDetailsCache = new Map() // name -> { contextLength: number|null, capabilities: string[] }
+const modelDetailsCache = new Map() // name -> { contextLength: number|null, capabilities: string[]|null }
/**
* Fetch a model's native details (max context length + capability set) via
* /api/show. Ollama nests context under `model_info["<arch>.context_length"]`
* (the arch prefix varies by family so we scan for the suffix) and reports a
* top-level `capabilities` array (`["completion","vision","tools",…]`). Cached;
- * returns nulls/empty when the daemon doesn't report a field.
+ * returns nulls/null when the request fails, and nulls/empty when the daemon
+ * answers without reporting a field. The distinction keeps a transient probe
+ * failure from looking like an authoritative empty capability set.
* @param {string} name
- * @returns {Promise<{ contextLength: number|null, capabilities: string[] }>}
+ * @returns {Promise<{ contextLength: number|null, capabilities: string[]|null }>}
*/
async function getModelDetails(name) {
- const miss = { contextLength: null, capabilities: [] }
+ const miss = { contextLength: null, capabilities: null }
if (!name) return miss
if (modelDetailsCache.has(name)) return modelDetailsCache.get(name)
// /api/show documents the id under `model`; current Ollama also accepts the
@@ -1116,9 +1118,10 @@ async function getModelDetails(name) {
* A model's capability set (`["completion","vision","tools",…]`) from /api/show.
* Lets vision detection see capabilities that the /api/tags id can't reveal —
* e.g. a vision-capable MoE like `qwen3.6:35b` whose id has no `vl`/`vision`
- * token. Cached; returns `[]` when the daemon doesn't report capabilities.
+ * token. Cached; returns `null` when the per-model probe fails and `[]` when
+ * the daemon answers without reporting capabilities.
* @param {string} name
- * @returns {Promise<string[]>}
+ * @returns {Promise<string[]|null>}
*/
async function getModelCapabilities(name) {
return (await getModelDetails(name)).capabilities
diff --git a/server/services/ollamaManager.test.js b/server/services/ollamaManager.test.js
index 6ea075d03e..ce54f87136 100644
--- a/server/services/ollamaManager.test.js
+++ b/server/services/ollamaManager.test.js
@@ -121,6 +121,28 @@ describe('ollamaManager residency status', () => {
})
})
+describe('ollamaManager model capability sentinel', () => {
+ afterEach(() => vi.unstubAllGlobals())
+
+ it('returns unknown when a per-model capability probe fails', async () => {
+ vi.stubGlobal('fetch', vi.fn(async () => { throw new Error('show offline') }))
+ const { getModelCapabilities } = await loadManager()
+
+ await expect(getModelCapabilities('example-model')).resolves.toBeNull()
+ })
+
+ it('keeps an answered empty capability set distinct from a failed probe', async () => {
+ vi.stubGlobal('fetch', vi.fn(async () => ({
+ ok: true,
+ status: 200,
+ text: async () => JSON.stringify({ model_info: {} }),
+ })))
+ const { getModelCapabilities } = await loadManager()
+
+ await expect(getModelCapabilities('example-model')).resolves.toEqual([])
+ })
+})
+
describe('ollamaManager.pullModel transient-error retry', () => {
beforeEach(() => { vi.useFakeTimers() })
afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals() })