Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

fix(console): a model the server has not vouched for is not offered as runnable (#136)

github-actions[bot]7e21d8807b88
diff --git a/ui/src/components/HarnessSettings.tsx b/ui/src/components/HarnessSettings.tsx
index 0eca9cff..1cdfa8a1 100644
--- a/ui/src/components/HarnessSettings.tsx
+++ b/ui/src/components/HarnessSettings.tsx
@@ -7,7 +7,7 @@ import { useEffect, useMemo, useState } from 'react';
import { SkelPage } from '@/components/Skel';
import { useRouter } from 'next/navigation';
import {
- OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,
+ OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, modelAvailability, availabilityNote, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,
type CustomHarness, type OobHarness,
} from '@/lib/harness';
import { HarnessLogo } from '@/components/HarnessLogo';
@@ -179,7 +179,7 @@ export function HarnessSettings({ id, embedded = false, onNavigate }: {
onChange={(e) => upd({ defaultModel: e.target.value })}>
{models.map((m) => (
<option key={m} value={m} disabled={!modelAvailable((oob?.backend || oobById(draft?.base || '')?.backend) || '', m)}>
- {m}{modelAvailable((oob?.backend || oobById(draft?.base || '')?.backend) || '', m) ? '' : ' (no provider)'}
+ {m}{availabilityNote(modelAvailability((oob?.backend || oobById(draft?.base || '')?.backend) || '', m)) ? ` (${availabilityNote(modelAvailability((oob?.backend || oobById(draft?.base || '')?.backend) || '', m))})` : ''}
</option>
))}
</select>
diff --git a/ui/src/components/TaskChat.tsx b/ui/src/components/TaskChat.tsx
index 8bae5bd2..ed87e06f 100644
--- a/ui/src/components/TaskChat.tsx
+++ b/ui/src/components/TaskChat.tsx
@@ -6,7 +6,7 @@ import { SkelListItems, SkelPage } from '@/components/Skel';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { Mermaid } from '@/components/Mermaid';
-import { OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, saveCustom, listCustom, getSkillFiles, storeMcpSecret, testMcp, type CustomHarness, type OobHarness } from '@/lib/harness';
+import { OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, modelAvailability, availabilityNote, saveCustom, listCustom, getSkillFiles, storeMcpSecret, testMcp, type CustomHarness, type OobHarness } from '@/lib/harness';
import { HarnessLogo } from '@/components/HarnessLogo';
import { streamResponse, subscribeHarnessEvents, containerFileUrl, downloadFile, loadSessionTurns, cancelSession, authHeaders, type RespFile, type SessionTurn } from '@/lib/chat';
import { appendWorkspaceQuery, getCurrentWorkspaceRef } from '@/lib/workspace';
@@ -409,7 +409,7 @@ function ModelSelect({ models, value, onChange, backend }: {
<select className="wbx-select full" value={value} onChange={(e) => onChange(e.target.value)}>
{models.map((m) => (
<option key={m} value={m} disabled={!modelAvailable(backend, m)}>
- {m}{modelAvailable(backend, m) ? '' : ' (no provider)'}
+ {m}{availabilityNote(modelAvailability(backend, m)) ? ` (${availabilityNote(modelAvailability(backend, m))})` : ''}
</option>
))}
</select>
@@ -673,11 +673,11 @@ function Conversation({ harnessId, sessionId, target, models, onModel, onRan, on
<div className="wbx-model-head">Model for this task</div>
<div role="listbox" aria-label="Model for this task" className="uic-pop-list">
{models.map((m) => {
- const ok = modelAvailable(target.backend, m);
+ const state = modelAvailability(target.backend, m); const ok = state === 'yes';
return (
<button key={m} type="button" role="option" aria-selected={m === target.model} className={'wbx-model-opt' + (m === target.model ? ' is-on' : '')} disabled={!ok}
onClick={() => { onModel(m); setModelOpen(false); }}>
- <span>{m}</span>{!ok && <span className="wbx-model-meta">no provider</span>}
+ <span>{m}</span>{!ok && <span className="wbx-model-meta">{availabilityNote(state)}</span>}
</button>
);
})}
diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.ts
index 397be057..353db094 100644
--- a/ui/src/lib/harness.ts
+++ b/ui/src/lib/harness.ts
@@ -139,27 +139,31 @@ export async function fetchModelCatalog(): Promise<ModelCatalog> {
if (_catalog) return _catalog;
if (_catalogInflight) return _catalogInflight;
_catalogInflight = (async () => {
- try {
- const r = await harnessFetch('/api/harness/v1/models', { headers: gwHeaders(), cache: 'no-store' });
- if (!r.ok) throw new Error(String(r.status));
- const j = await r.json();
- const out: ModelCatalog = {};
- for (const [backend, c] of Object.entries((j?.backends || {}) as Record<string, {
- default?: string; models?: Array<{ id?: string; available?: boolean }> }>)) {
- const rows = (c?.models || []).filter((m) => m?.id);
- out[backend] = {
- default: String(c?.default || ''),
- models: rows.map((m) => String(m.id)),
- unavailable: rows.filter((m) => m.available === false).map((m) => String(m.id)),
- };
+ // A few tries, not one: the first paint of a tab races this read, and one failed read used
+ // to leave the placeholder standing in for the server for the life of the tab.
+ for (const wait of [0, 1500, 3000, 6000]) {
+ if (wait) await new Promise((r) => setTimeout(r, wait));
+ try {
+ const r = await harnessFetch('/api/harness/v1/models', { headers: gwHeaders(), cache: 'no-store' });
+ if (!r.ok) throw new Error(String(r.status));
+ const j = await r.json();
+ const out: ModelCatalog = {};
+ for (const [backend, c] of Object.entries((j?.backends || {}) as Record<string, {
+ default?: string; models?: Array<{ id?: string; available?: boolean }> }>)) {
+ const rows = (c?.models || []).filter((m) => m?.id);
+ out[backend] = {
+ default: String(c?.default || ''),
+ models: rows.map((m) => String(m.id)),
+ unavailable: rows.filter((m) => m.available === false).map((m) => String(m.id)),
+ };
+ }
+ if (Object.keys(out).length) { _catalog = out; break; }
+ } catch {
+ // try again; the placeholder keeps painting meanwhile, with nothing offered as runnable
}
- if (Object.keys(out).length) _catalog = out;
- return _catalog || {};
- } catch {
- return {}; // keep the placeholder; a picker that renders beats one that throws
- } finally {
- _catalogInflight = null;
}
+ _catalogInflight = null;
+ return _catalog || {};
})();
return _catalogInflight;
}
@@ -171,11 +175,25 @@ export const oobModels = (o: OobHarness | null | undefined): string[] => {
return (fromServer && fromServer.length) ? fromServer : o.models;
};
-/** Can this backend actually run this model? False only when the server said so — before the
- * catalog loads (or if the fetch failed) nothing is greyed out on a guess. */
+/** Whether this backend can run this model, as three answers rather than two. "unknown" is the
+ * state before the server's catalog has arrived (or while every read of it has failed), and it
+ * is not "yes": the picker used to treat it that way, offering the placeholder list as runnable
+ * for the second or two before the catalog landed, and a model picked in that window was refused
+ * at the send ("no provider serves it") after it had been accepted. Measured 2026-09-08: a
+ * matrix worker read the picker in that window and was offered four models the platform's
+ * provider has no channel for. Unknown is shown as unknown, and nothing unknown can be sent. */
+export type ModelAvailability = 'yes' | 'no' | 'unknown';
+export function modelAvailability(backend: string | null | undefined, id: string): ModelAvailability {
+ const entry = backend ? _catalog?.[backend] : undefined;
+ if (!entry) return 'unknown';
+ return entry.unavailable.includes(id) ? 'no' : 'yes';
+}
+/** The picker's note beside a model that cannot be picked; one wording everywhere. */
+export function availabilityNote(state: ModelAvailability): string {
+ return state === 'no' ? 'no provider' : state === 'unknown' ? 'checking providers' : '';
+}
export function modelAvailable(backend: string | null | undefined, id: string): boolean {
- const list = backend ? _catalog?.[backend]?.unavailable : undefined;
- return !list || !list.includes(id);
+ return modelAvailability(backend, id) === 'yes';
}
export const oobDefaultModel = (o: OobHarness | null | undefined): string => {