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

Highlight tool-capable local models in agent/CoS model pickers

Adam Eivy95e3a59308fb
diff --git a/PLAN.md b/PLAN.md
index de510c52dc..d35965d2b0 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -209,6 +209,17 @@ by `/do:replan --issues`:
- [ ] **Suppress `/simplify` + `/do:push` + PR in CD agent completions WITHOUT breaking their API output contract.** CD plan/treatment/evaluation agents persist their real output via an HTTP call in the task BODY (e.g. `PATCH http://localhost:5555/api/creative-director/{id}/plan` — see the plan prompt), and use the `.agent-done` sentinel only as a *done-signal* (a short markdown summary that PortOS's 2s poll consumes to finalize the run). They run on `main` (`useWorktree:false`, `configCodingOnMain:true`) and make no repo changes, so the trailing `/simplify` → `/do:push` completion is both pointless and dangerous (a `/do:push` on main could commit stray working-tree files). The fix must remove `/simplify`+`/do:push`+PR from the CD completion while KEEPING (a) the sentinel done-signal handshake and (b) the task-body PATCH as the output channel. **Do NOT reuse `discardWorktree`** — codex review (2026-07-16) correctly flagged that it routes to `buildProgrammaticOutputCompletionSection`, whose wording ("your *only* output channel is the `.agent-done` sentinel; write your result there in the payload format from your instructions") directly contradicts the PATCH and could make the agent write the plan to the sentinel instead of PATCHing → plan never persists → project stalls/re-enqueues. `readOnly:true` is also wrong ("read data and report findings only" contradicts the PATCH, and the CLI read-only path emits no sentinel). The correct fix is a NEW completion contract (e.g. a `apiOutput`/`noRepoOutput` metadata flag) that emits: "This task persists its output via the API/tool calls described above and makes no repo changes — do NOT run `/simplify`, `/do:push`, `/do:pr`, `git commit/push`, or open a PR; when done write a short summary to the sentinel to signal completion." Thread the flag through the completion selection in `server/services/agentPromptBuilder.js` (lines ~1137-1160 light path + the full-context path ~790, and whichever of `buildTuiCompletionSection`/`buildCliCompletionSection` CD actually reaches — confirm via a regenerated CD prompt fixture) and add a test asserting the CD prompt contains the sentinel step but NO `/do:push`/`/do:pr`/`/simplify`. Deferred from this PR because it needs a carefully-designed prompt-contract change + fixture test, not a rushed flag reuse.
+### CD plan/treatment run wedges when the agent signals done but writes nothing (validationPassed:false)
+
+- [ ] **Fail (and don't silently re-dispatch) a CD plan/treatment run whose agent signaled completion but never PATCHed its output.** Failure mode: a directive-driven CD project assigned to an Ollama-backed CLI/TUI provider running a non-tool-calling local model (e.g. Gemma). The agent narrates a done-message and signals completion, but never calls `PATCH /api/creative-director/:id/plan`. The CoS finalizer marks the run `success/exitCode 0` with `validationPassed:false`, yet nothing fails the project's `plan` run (recorded `running` on first dispatch) — so it stays `running` (only boot-recovery reaps it) and CoS re-dispatches the same incapable model repeatedly while the project sits wedged in `planning`. Manual recovery: reap the run (set its status `failed`) + PATCH a valid one-step plan. Fix options: (a) when a CD plan/treatment task finalizes with `validationPassed:false`, have the completion path mark the corresponding project `plan`/`treatment` run `failed` (so it's reaped live, not at next boot) instead of leaving it `running`; (b) stop re-dispatching the identical task to a model that already produced a `validationPassed:false` narration — either surface it as a blocked stage for the user or escalate off the local model. Touchpoints: `server/services/creativeDirector/completionHook.js` (run finalization), the CoS finalizer that sets `validationPassed`/`completionReason`, and `planAdvance.js` re-dispatch. Deferred from the model-picker-highlight change (which addresses the *upstream* cause — steering users to tool-capable models — but not the wedge mechanics).
+- [ ] **(config, no code) Ensure the CoS provider for CD tasks uses a tool-capable model.** A scheduled/recurring CD project re-wedges (per the item above) whenever the CD treatment/plan stages (or the CoS default provider) resolve to a non-tool-calling local model. Pin them to a tool-capable model — `qwen3.6:35b` locally, or a cloud/CLI Claude provider. The new tool-use highlight in the CD models drawer + `ProviderModelSelector` now flags this at pick time, but a pre-existing stored assignment predates it.
+
+### Agent model pickers — union authoritative tool-use capability into the id-regex heuristic
+
+- [ ] **Plumb per-model tool-use capability into the agent pickers so the warning stops relying solely on the id regex.** The tool-use highlight (`localToolUseHint`/`withToolUseOptionLabel` in `client/src/utils/providers.js`, consumed by `ProviderModelSelector`'s `highlightToolUse` prop and `CreativeDirectorModelsDrawer`'s treatment/plan stages) keys off `isToolUseModel(id)` — a **positive-allowlist id regex** (mirror of `server/lib/localModelHeuristics.js`). A match is a reliable "tool-capable"; a non-match only means "not a recognized family", so a genuinely tool-capable local model whose id isn't in the regex yet (e.g. `phi4-mini`, newer `gemma3` function-calling builds) is marked "⚠ no known tool use". The copy was softened to a heuristic hedge (not a false-certain "can't call tools") to avoid overclaiming, but the *authoritative* signal — Ollama `/api/show`'s `tools` capability (already the both-directions-authoritative branch in the server's `isToolUseModel(model-object)`) — is not consulted client-side. The `LocalLlmTab` "Agents" badge DOES read authoritative catalog capabilities, so the two surfaces can disagree for such a model. Proper fix: add a `useToolUseModelIds()` hook mirroring `useVisionModelIds()` (server endpoint that reads `/api/show` tool capability + LM Studio metadata), union it into `localToolUseHint` so an authoritative `tools`-capable model is treated as capable regardless of id, and fall back to the regex only for bare ids with no metadata — mirroring the server's object-vs-string contract. Deferred from the model-picker-highlight PR (which shipped the regex heuristic + honest copy, fully tested); the capability-fetch hook + endpoint is a distinct change deserving its own tests. Flagged by the local `claude` review pass on that PR.
+
+- [ ] **Drive the agent-picker tool-use flag from server-side assignment metadata so `AiAssignmentsTab` also warns.** The tool-use highlight marks/warns the CD treatment+plan stages in `CreativeDirectorModelsDrawer` (via a hard-coded `needsTools` on its `STAGES`) and in any `ProviderModelSelector` with `highlightToolUse`. But the SAME `settings.creativeDirector.treatment`/`.plan` pins are editable through `client/src/components/settings/AiAssignmentsTab.jsx`, a generic per-assignment table whose model `<select>` (~line 261/282) renders no annotation or warning — so a user following the drawer's own "Also editable from AI Assignments" link can still pin a tool-less local model and recreate the stage-wedge. Don't hard-code the two CD assignment ids into AiAssignmentsTab (a third copy of the `needsTools` knowledge); instead have the server tag agent/tool-use assignments with a `needsTools: true` (or `modelFilter: 'tools'`) marker on the assignment entry — mirroring how the evaluation assignment already carries `modelFilter: 'vision'` — then read that one flag uniformly in AiAssignmentsTab, the CD drawer, and any future editor to gate `withToolUseOptionLabel`/`localToolUseHint`. That collapses the `needsTools` source of truth to the server and closes every editor at once. Deferred from the model-picker-highlight PR (client-only, scoped to the drawer + ProviderModelSelector); this adds server assignment metadata + a third editor and deserves its own tests. Flagged by the local `codex` review pass on that PR.
+
### Vision model pickers — `useProviderModels` auto-select ignores a late-arriving capability list
- [ ] **Make `VisionProviderPicker` union the server's authoritative vision-model list into its filter (the `gemma4` gap), which requires `useProviderModels` to re-pick its initial model when `modelFilter` changes.** The Creative Director / AI Assignments vision pickers were fixed to union `useVisionModelIds()` (the server's `/api/local-llm/vision-models`, which reads Ollama `/api/show` capabilities + LM Studio's `vlm` tag) into `visionLocalModelFilter`, because the client id regex in `client/src/utils/providers.js#isVisionModel` knows `gemma-3` but not `gemma4`/`glm-4.6v` and so hides installed VLMs. `client/src/components/universe/VisionProviderPicker.jsx:27` has the identical defect but was **deliberately left unfixed**: it gets its models from `useProviderModels({ modelFilter })`, and passing a `modelFilter` whose identity changes when the fetch resolves (null → Set) breaks two ways. (1) `pickInitialModel` (`client/src/hooks/useProviderModels.js:44-49`) closes over `modelFilter`, and `load` (`:52-68`) depends on `pickInitialModel`, so the `useEffect(() => { load(); }, [load])` at `:70` re-fires a redundant `api.getProviders()`. (2) Worse, `load` guards initial selection behind `hasSetInitialRef` (`:62`), so the model auto-picked during the FIRST load (regex-only, returns `''` when the only VLM is `gemma4`) is never re-picked once the authoritative set lands — leaving `selectedModel === ''` while `availableModels` now contains `gemma4`, which renders the "no vision model" blocker (`VisionProviderPicker.jsx:41` `noVisionModel = hasProviders && !selectedModel`) *next to a populated dropdown*. That half-fixed state is more confusing than the current consistent-but-wrong behavior, so the change was reverted. Doing it properly means teaching `useProviderModels` to re-run its initial pick when `modelFilter`'s identity changes (e.g. re-pick when the current `selectedModel` is no longer in / absent from `availableModels`, without clobbering a deliberate user clear) — that hook is shared by many callers and `VisionProviderPicker` has no test file, so it needs its own PR + tests. Deferred from the Creative-Director vision-picker fix, which is scoped to the `assignment*` helpers and ships fully tested.
diff --git a/client/src/components/ProviderModelSelector.jsx b/client/src/components/ProviderModelSelector.jsx
index 2941020e18..9955686795 100644
--- a/client/src/components/ProviderModelSelector.jsx
+++ b/client/src/components/ProviderModelSelector.jsx
@@ -30,8 +30,15 @@
* @param {'row'|'stacked'} [props.layout] - 'row' (default) lays the two selects
* side by side; 'stacked' places the model select under the provider select for
* narrow columns.
+ * @param {boolean} [props.highlightToolUse] - Opt-in for AGENT / CoS-task pickers:
+ * marks each LOCAL (Ollama / LM Studio) model option with a tool-use indicator
+ * and warns below the select when the chosen local model can't call tools (it
+ * would narrate instead of acting). Off by default so non-agent pickers
+ * (embeddings, vision, prose generation) stay unannotated. No-op for cloud/API
+ * providers, whose ids don't encode their family.
*/
import { useId } from 'react';
+import { localToolUseHint, withToolUseOptionLabel } from '../utils/providers.js';
const SELECT_CLASS =
'w-full px-3 py-1.5 min-h-[36px] bg-port-bg border border-port-border rounded-lg text-white text-sm';
@@ -59,10 +66,23 @@ export default function ProviderModelSelector({
emptyProviderOption,
emptyModelOption,
alwaysShowModel = false,
- layout = 'row'
+ layout = 'row',
+ highlightToolUse = false
}) {
const providerSelectId = useId();
const modelSelectId = useId();
+ // Agent-picker tool-use highlight (opt-in). Resolve the selected provider so
+ // the annotation only fires for local backends (the heuristic mislabels cloud
+ // ids). `localToolUseHint` returns null for cloud/blank, so the warning stays
+ // scoped to a genuinely tool-incapable local pin.
+ const selectedProvider = providers.find((p) => p.id === selectedProviderId);
+ // A blank model ("Default model") isn't a no-op: the agent resolver then runs
+ // the provider's own defaultModel — which for an Ollama-backed provider can be
+ // a non-tool model that silently wedges the stage. So evaluate the EFFECTIVE
+ // model (explicit selection, else the provider default) for the warning.
+ const effectiveModel = selectedModel || selectedProvider?.defaultModel || '';
+ const toolHint = highlightToolUse ? localToolUseHint(effectiveModel, selectedProvider) : null;
+ const toolIncapable = toolHint?.toolCapable === false;
// Only offer enabled providers (treat a missing `enabled` as enabled). The
// currently-selected provider stays visible even if disabled, so a record
// pinned to a now-disabled provider still renders its value instead of
@@ -108,9 +128,20 @@ export default function ProviderModelSelector({
{availableModels.map(m => {
const opt = modelOption(m);
if (!opt) return null;
- return <option key={opt.value} value={opt.value}>{opt.label}</option>;
+ const label = highlightToolUse
+ ? withToolUseOptionLabel(opt.value, opt.label, selectedProvider)
+ : opt.label;
+ return <option key={opt.value} value={opt.value}>{label}</option>;
})}
</select>
+ {toolIncapable && (
+ <p className="mt-1 text-xs text-port-warning">
+ ⚠ <span className="font-medium">{effectiveModel}</span>
+ {!selectedModel && ' (this provider’s default)'} isn't a recognized tool-calling
+ model — many local models (e.g. Gemma) reply with text instead of calling tools, which
+ stalls an agent. Prefer a recognized tool-capable model (e.g. qwen3.6:35b).
+ </p>
+ )}
</div>
)}
</div>
diff --git a/client/src/components/ProviderModelSelector.test.jsx b/client/src/components/ProviderModelSelector.test.jsx
index 23a3ddb6c4..0307e5ae2b 100644
--- a/client/src/components/ProviderModelSelector.test.jsx
+++ b/client/src/components/ProviderModelSelector.test.jsx
@@ -116,4 +116,82 @@ describe('ProviderModelSelector', () => {
const { container } = renderSelector({ layout: 'stacked' });
expect(container.firstChild.className).toContain('flex-col');
});
+
+ describe('highlightToolUse (agent pickers)', () => {
+ const OLLAMA = [{ id: 'ollama', name: 'Ollama' }];
+
+ it('marks local model options with a tool-use indicator', () => {
+ renderSelector({
+ providers: OLLAMA,
+ selectedProviderId: 'ollama',
+ selectedModel: 'qwen3.6:35b',
+ availableModels: ['qwen3.6:35b', 'gemma4:e4b'],
+ highlightToolUse: true,
+ });
+ const labels = [...screen.getAllByRole('combobox')[1].querySelectorAll('option')].map((o) => o.textContent);
+ expect(labels).toEqual(['qwen3.6:35b · 🔧 tool use', 'gemma4:e4b · ⚠ no known tool use']);
+ });
+
+ it('warns when the selected LOCAL model cannot call tools', () => {
+ renderSelector({
+ providers: OLLAMA,
+ selectedProviderId: 'ollama',
+ selectedModel: 'gemma4:e4b',
+ availableModels: ['qwen3.6:35b', 'gemma4:e4b'],
+ highlightToolUse: true,
+ });
+ expect(screen.getByText(/recognized tool-calling model/i)).toBeInTheDocument();
+ });
+
+ it('warns on the provider default when the model selection is blank', () => {
+ // "Default model" (blank) isn't a no-op — the resolver runs the provider's
+ // defaultModel, which here is a non-tool local model.
+ renderSelector({
+ providers: [{ id: 'ollama', name: 'Ollama', defaultModel: 'gemma4:e4b' }],
+ selectedProviderId: 'ollama',
+ selectedModel: '',
+ availableModels: ['qwen3.6:35b', 'gemma4:e4b'],
+ alwaysShowModel: true,
+ emptyModelOption: 'Default model',
+ highlightToolUse: true,
+ });
+ expect(screen.getByText(/recognized tool-calling model/i)).toBeInTheDocument();
+ });
+
+ it('does not warn when the selected local model is tool-capable', () => {
+ renderSelector({
+ providers: OLLAMA,
+ selectedProviderId: 'ollama',
+ selectedModel: 'qwen3.6:35b',
+ availableModels: ['qwen3.6:35b', 'gemma4:e4b'],
+ highlightToolUse: true,
+ });
+ expect(screen.queryByText(/recognized tool-calling model/i)).not.toBeInTheDocument();
+ });
+
+ it('is a no-op for cloud providers (ids do not encode family)', () => {
+ renderSelector({
+ providers: [{ id: 'openai', name: 'OpenAI', endpoint: 'https://api.openai.com/v1' }],
+ selectedProviderId: 'openai',
+ selectedModel: 'gpt-4o',
+ availableModels: ['gpt-4o', 'o1'],
+ highlightToolUse: true,
+ });
+ const labels = [...screen.getAllByRole('combobox')[1].querySelectorAll('option')].map((o) => o.textContent);
+ expect(labels).toEqual(['gpt-4o', 'o1']);
+ expect(screen.queryByText(/recognized tool-calling model/i)).not.toBeInTheDocument();
+ });
+
+ it('leaves options unannotated when highlightToolUse is off (default)', () => {
+ renderSelector({
+ providers: OLLAMA,
+ selectedProviderId: 'ollama',
+ selectedModel: 'gemma4:e4b',
+ availableModels: ['qwen3.6:35b', 'gemma4:e4b'],
+ });
+ const labels = [...screen.getAllByRole('combobox')[1].querySelectorAll('option')].map((o) => o.textContent);
+ expect(labels).toEqual(['qwen3.6:35b', 'gemma4:e4b']);
+ expect(screen.queryByText(/recognized tool-calling model/i)).not.toBeInTheDocument();
+ });
+ });
});
diff --git a/client/src/components/creative-commission/CommissionConfigForm.jsx b/client/src/components/creative-commission/CommissionConfigForm.jsx
index 06d1c5962f..7b77488680 100644
--- a/client/src/components/creative-commission/CommissionConfigForm.jsx
+++ b/client/src/components/creative-commission/CommissionConfigForm.jsx
@@ -283,6 +283,7 @@ function AssignmentPicker({ assignment, onChange }) {
label="Provider"
modelDisabled={availableModels.length === 0}
alwaysShowModel
+ highlightToolUse
emptyProviderOption="Install default (Creative Director assignment)"
emptyModelOption="Default model"
/>
diff --git a/client/src/components/creative-director/CreativeDirectorModelsDrawer.jsx b/client/src/components/creative-director/CreativeDirectorModelsDrawer.jsx
index 92e4c58572..1a14663f94 100644
--- a/client/src/components/creative-director/CreativeDirectorModelsDrawer.jsx
+++ b/client/src/components/creative-director/CreativeDirectorModelsDrawer.jsx
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { Link } from 'react-router-dom';
-import { Bot, Save } from 'lucide-react';
+import { Bot, Save, AlertTriangle } from 'lucide-react';
import Drawer from '../Drawer.jsx';
import toast from '../ui/Toast';
import { getAiAssignments, updateAiAssignment } from '../../services/api';
@@ -12,6 +12,8 @@ import {
assignmentModelOptions,
assignmentDefaultModel,
localBackendForProvider,
+ localToolUseHint,
+ withToolUseOptionLabel,
} from '../../utils/providers.js';
// Creative Director provider/model pins, at either of two scopes:
@@ -25,8 +27,12 @@ import {
// The server's `resolveStagePin` resolves project override → CD default →
// system default; the inherit hint mirrors that chain for display only.
const STAGES = [
- { key: 'treatment', label: 'Treatment', help: 'Agent that turns the brief into a treatment + scene plan.' },
- { key: 'plan', label: 'Production plan', help: 'Agent that converts a production directive into an executable plan.' },
+ // `needsTools`: these stages run as agent-harness tasks that must emit native
+ // tool calls (the plan agent PATCHes the API to write the plan). A local model
+ // without tool-calling (e.g. Gemma) narrates a done-message instead of acting,
+ // silently wedging the project — so the picker marks + warns on those.
+ { key: 'treatment', label: 'Treatment', needsTools: true, help: 'Agent that turns the brief into a treatment + scene plan.' },
+ { key: 'plan', label: 'Production plan', needsTools: true, help: 'Agent that converts a production directive into an executable plan.' },
{
key: 'evaluation',
label: 'Scene evaluation',
@@ -220,16 +226,30 @@ export default function CreativeDirectorModelsDrawer({ open, onClose, project, o
{STAGES.map((stage) => {
const entry = entryById[assignmentIdFor(stage.key)];
const draft = drafts[stage.key] || { providerId: '', model: '' };
+ const selectedProvider = providers.find((p) => p.id === draft.providerId);
const providerOptions = assignmentProviderOptions(entry, providers);
const modelOptions = assignmentModelOptions(entry, providers, draft.providerId, visionIdsByProvider);
const pinned = !!draft.providerId;
+ // Agent stages (treatment/plan) need native tool calling. Warn when a
+ // pinned LOCAL model can't do it (Gemma & friends narrate instead of
+ // PATCHing) — the incident behind this: a plan agent on gemma4:e4b
+ // reported "done" without ever writing the plan. `localToolUseHint`
+ // is null for cloud providers (their ids don't encode family), so the
+ // warning only fires where the heuristic is trustworthy.
+ // A blank model runs the provider's default at fire time, so evaluate
+ // the EFFECTIVE model (explicit pin, else provider default) — a pinned
+ // provider whose default is a non-tool local model wedges the stage
+ // just the same.
+ const effectiveModel = draft.model || selectedProvider?.defaultModel || '';
+ const toolHint = stage.needsTools ? localToolUseHint(effectiveModel, selectedProvider) : null;
+ const toolIncapable = pinned && toolHint?.toolCapable === false;
// Both hints below are about the LOCAL capability scan, so they only
// apply when the pinned provider is an Ollama / LM Studio backend. A
// cloud API provider's list is never vision-filtered, so an empty one
// just means no models are configured on it — "install a VLM" would
// be the wrong remediation, and the free-text input still works.
const visionLocal = entry?.modelFilter === 'vision'
- && !!localBackendForProvider(providers.find((p) => p.id === draft.providerId));
+ && !!localBackendForProvider(selectedProvider);
// A vision stage's options are only trustworthy once the capability
// scan has settled — until then `modelOptions` is regex-only, which
// is exactly the stale answer that hid the user's VLMs.
@@ -300,7 +320,11 @@ export default function CreativeDirectorModelsDrawer({ open, onClose, project, o
className="bg-port-card border border-port-border rounded px-2 py-2 text-sm text-white"
>
<option value="">Provider default / auto</option>
- {modelOptions.map((m) => <option key={m} value={m}>{m}</option>)}
+ {modelOptions.map((m) => (
+ <option key={m} value={m}>
+ {stage.needsTools ? withToolUseOptionLabel(m, m, selectedProvider) : m}
+ </option>
+ ))}
</select>
) : (
<input
@@ -321,6 +345,20 @@ export default function CreativeDirectorModelsDrawer({ open, onClose, project, o
{' '}(e.g. qwen3-vl, gemma4) or type a model id above.
</p>
)}
+
+ {toolIncapable && (
+ <p className="flex items-start gap-1.5 text-xs text-port-warning">
+ <AlertTriangle size={13} className="shrink-0 mt-0.5" />
+ <span>
+ <span className="font-medium">{effectiveModel}</span>
+ {!draft.model && ' (this provider’s default)'} isn't a recognized tool-calling
+ model — many local models (e.g. Gemma) reply with text instead of calling tools,
+ which can leave this agent's stage stuck. Prefer a recognized tool-capable local
+ model (e.g. <span className="text-gray-300">qwen3.6:35b</span>) or an API/CLI provider.{' '}
+ <Link to="/settings/local-llm" className="underline hover:text-port-warning/80">Browse models</Link>.
+ </span>
+ </p>
+ )}
</section>
);
})}
diff --git a/client/src/components/creative-director/CreativeDirectorModelsDrawer.test.jsx b/client/src/components/creative-director/CreativeDirectorModelsDrawer.test.jsx
index 807d488239..2f98d78c05 100644
--- a/client/src/components/creative-director/CreativeDirectorModelsDrawer.test.jsx
+++ b/client/src/components/creative-director/CreativeDirectorModelsDrawer.test.jsx
@@ -60,6 +60,35 @@ describe('CreativeDirectorModelsDrawer', () => {
expect(screen.getByLabelText('Treatment model').value).toBe('a-big');
});
+ it('warns when the plan stage is pinned to a local model that cannot call tools', async () => {
+ // The incident: a plan agent on gemma (no tool use) narrates "done" without
+ // ever PATCHing the plan, wedging the project. The drawer must flag it.
+ renderDrawer({ id: 'cd-1', name: 'Demo', modelOverrides: { plan: { providerId: 'ollama', model: 'gemma4:26b' } } });
+ await waitFor(() => expect(screen.getByLabelText('Production plan model')).toBeTruthy());
+ expect(screen.getByText(/recognized tool-calling model/i)).toBeInTheDocument();
+ });
+
+ it('does not warn when the plan stage is pinned to a tool-capable local model', async () => {
+ renderDrawer({ id: 'cd-1', name: 'Demo', modelOverrides: { plan: { providerId: 'ollama', model: 'qwen2.5vl:latest' } } });
+ await waitFor(() => expect(screen.getByLabelText('Production plan model')).toBeTruthy());
+ expect(screen.queryByText(/recognized tool-calling model/i)).not.toBeInTheDocument();
+ });
+
+ it('warns when the plan stage inherits a non-tool provider default (blank model)', async () => {
+ // ollama's defaultModel is gemma4:26b; a blank model pin runs that default.
+ renderDrawer({ id: 'cd-1', name: 'Demo', modelOverrides: { plan: { providerId: 'ollama', model: '' } } });
+ await waitFor(() => expect(screen.getByLabelText('Production plan provider')).toBeTruthy());
+ expect(screen.getByText(/recognized tool-calling model/i)).toBeInTheDocument();
+ });
+
+ it('never shows a tool-use warning on the vision (evaluation) stage', async () => {
+ // The evaluation stage is a direct vision call, not an agent — a non-tool
+ // local model there is expected and must NOT be flagged as tool-incapable.
+ renderDrawer({ id: 'cd-1', name: 'Demo', modelOverrides: { evaluation: { providerId: 'ollama', model: 'gemma4:26b' } } });
+ await waitFor(() => expect(screen.getByLabelText('Scene evaluation provider')).toBeTruthy());
+ expect(screen.queryByText(/recognized tool-calling model/i)).not.toBeInTheDocument();
+ });
+
it('saves only stages that name a provider, omitting inherited ones', async () => {
updateCreativeDirectorProject.mockResolvedValue({ modelOverrides: { evaluation: { providerId: 'vlm-x', model: 'moondream' } } });
const onSaved = vi.fn();
diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsx
index b7e95bab9d..b6e7019128 100644
--- a/client/src/components/settings/LocalLlmTab.jsx
+++ b/client/src/components/settings/LocalLlmTab.jsx
@@ -48,6 +48,18 @@ const CAPABILITY_META = {
audio: { Icon: Music, label: 'Audio generation', cls: 'text-pink-400 border-pink-400/50' },
};
+// A model suited to AGENT / CoS tasks (coding agents, the Creative Director
+// treatment/plan agents) needs BOTH native tool calling AND enough coding /
+// instruction-following muscle to drive a multi-step loop. A chat-only
+// tool-caller (e.g. a small function-calling voice brain) clears `tools` but
+// isn't an agent workhorse, and a `code` model without `tools` narrates instead
+// of acting — so we require both. Keyed off catalog capabilities (server truth),
+// NOT a hard-coded model list, so new agentic models light up automatically.
+const isAgentRecommendedModel = (capabilities) =>
+ Array.isArray(capabilities)
+ && capabilities.includes('tools')
+ && capabilities.includes('code');
+
// Server-computed per-quant fit verdict → badge styling + short label. Drives
// the RAM-fit hint on the quant picker so a too-large build reads as a warning.
const FIT_META = {
@@ -828,6 +840,14 @@ export function LocalLlmTab() {
{FORMAT_META[m.format].label}
</span>
)}
+ {isAgentRecommendedModel(m.capabilities) && (
+ <span
+ title="Recommended for agent & CoS tasks — has native tool calling plus coding strength, so it can actually drive multi-step agent work (unlike chat-only or tool-less models)."
+ className="ml-1.5 align-middle inline-flex items-center gap-0.5 text-[10px] px-1 py-0.5 rounded border border-port-accent/50 text-port-accent"
+ >
+ <Star size={9} className="fill-current" /> Agents
+ </span>
+ )}
</div>
<div className="text-xs text-gray-500 truncate">{chosenId}</div>
<div className="text-xs text-gray-500 mt-0.5">{m.description}</div>
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index b09b1b4c57..5f3b76582b 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -181,6 +181,57 @@ export const isToolUseModel = (id) =>
export const toolUseLocalModelFilter = (id, provider) =>
localBackendForProvider(provider) ? isToolUseModel(id) : true;
+/**
+ * Agent-picker tool-use annotation for a model id. Agent / CoS tasks (the CD
+ * treatment + plan stages, coding agents) only work with a model that can emit
+ * native tool calls — a local model that can't (e.g. Gemma) narrates a
+ * done-message instead of acting, silently wedging the task. This decides the
+ * per-option marker + the "pick a tool-capable model" warning in agent pickers.
+ *
+ * Returns `null` for cloud / API providers: their model ids don't encode their
+ * family, so the name heuristic would mislabel them (same reason
+ * `toolUseLocalModelFilter` leaves cloud lists untouched). LOCAL backends return
+ * `{ toolCapable }` keyed on {@link isToolUseModel} — where "local" is BOTH a
+ * direct Ollama / LM Studio backend ({@link localBackendForProvider}) AND an
+ * Ollama-BACKED CLI/TUI wrapper ({@link isOllamaBackedProvider}): a renamed
+ * `claude-ollama-tui` / OpenCode wrapper keeps `ollamaBacked: true` but may lose
+ * the "ollama" name/endpoint/id that `localBackendForProvider` matches on, and
+ * that wrapper is exactly the incident's provider class — so it must still be
+ * flagged, not silently skipped.
+ * @param {string} id
+ * @param {object} [provider]
+ * @returns {{toolCapable:boolean}|null}
+ */
+export const localToolUseHint = (id, provider) =>
+ (localBackendForProvider(provider) || isOllamaBackedProvider(provider))
+ && typeof id === 'string' && id.length > 0
+ ? { toolCapable: isToolUseModel(id) }
+ : null;
+
+/**
+ * Suffix a native `<option>` label with a tool-use marker for an agent picker.
+ * No-op (returns `label` unchanged) for cloud providers or a blank id, so it's
+ * safe to wrap every option. Pairs with {@link localToolUseHint} for the
+ * below-the-select warning. Emoji (not lucide icons) because native `<option>`
+ * elements can't render markup.
+ *
+ * The signal is asymmetric because {@link isToolUseModel} is a *positive
+ * allowlist* of families with dependable function-calling: a match is a reliable
+ * "tool-capable", but a NON-match only means "not a recognized tool-caller" —
+ * NOT a proven negative (a newer tool-capable family whose id isn't in the regex
+ * yet would fall here). So the negative marker is worded as unverified, not a
+ * false-certain "no tool use".
+ * @param {string} id - model id (drives the heuristic)
+ * @param {string} label - display label to annotate (often === id)
+ * @param {object} [provider] - the selected provider object
+ * @returns {string}
+ */
+export const withToolUseOptionLabel = (id, label, provider) => {
+ const hint = localToolUseHint(id, provider);
+ if (!hint) return label;
+ return `${label}${hint.toolCapable ? ' · 🔧 tool use' : ' · ⚠ no known tool use'}`;
+};
+
/**
* Selectable models for a generation/chat picker: drops internal sentinels AND
* embedding-only models. Use anywhere the user picks a model that will run a
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index 95846457b0..23948efa6e 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -15,6 +15,8 @@ import {
visionLocalModelFilter,
isToolUseModel,
toolUseLocalModelFilter,
+ localToolUseHint,
+ withToolUseOptionLabel,
localBackendForProvider,
knownProviderContextWindow,
CODEX_CONTEXT_WINDOW,
@@ -315,6 +317,56 @@ describe('toolUseLocalModelFilter', () => {
});
});
+describe('localToolUseHint', () => {
+ const ollama = { name: 'Ollama', endpoint: 'http://localhost:11434/v1' };
+
+ it('flags a local tool-capable model', () => {
+ expect(localToolUseHint('qwen3.6:35b', ollama)).toEqual({ toolCapable: true });
+ });
+
+ it('flags a local non-tool model (Gemma narrates instead of acting)', () => {
+ expect(localToolUseHint('gemma4:e4b', ollama)).toEqual({ toolCapable: false });
+ expect(localToolUseHint('gemma2:9b', ollama)).toEqual({ toolCapable: false });
+ });
+
+ it('returns null for cloud providers (their ids do not encode family)', () => {
+ const cloud = { name: 'OpenAI', endpoint: 'https://api.openai.com/v1' };
+ expect(localToolUseHint('gpt-4o', cloud)).toBeNull();
+ expect(localToolUseHint('gemma4:e4b', undefined)).toBeNull();
+ });
+
+ it('flags a renamed Ollama-backed CLI/TUI wrapper (no "ollama" name/endpoint)', () => {
+ // The incident's provider class: a claude-ollama-tui wrapper the user renamed,
+ // so localBackendForProvider misses it — but it still carries ollamaBacked.
+ const wrapper = { id: 'my-local-agent', name: 'My Local Agent', ollamaBacked: true };
+ expect(localToolUseHint('gemma4:e4b', wrapper)).toEqual({ toolCapable: false });
+ expect(localToolUseHint('qwen3.6:35b', wrapper)).toEqual({ toolCapable: true });
+ // Also via ANTHROPIC_BASE_URL pointing at the Ollama daemon.
+ const viaBase = { name: 'Renamed', envVars: { ANTHROPIC_BASE_URL: 'http://localhost:11434/v1' } };
+ expect(localToolUseHint('gemma4:e4b', viaBase)).toEqual({ toolCapable: false });
+ });
+
+ it('returns null for a blank id', () => {
+ expect(localToolUseHint('', ollama)).toBeNull();
+ });
+});
+
+describe('withToolUseOptionLabel', () => {
+ const ollama = { name: 'Ollama', endpoint: 'http://localhost:11434/v1' };
+
+ it('marks recognized-tool vs unrecognized local models', () => {
+ expect(withToolUseOptionLabel('qwen3.6:35b', 'qwen3.6:35b', ollama)).toBe('qwen3.6:35b · 🔧 tool use');
+ // Non-match is worded as unverified, not a false-certain negative — the id
+ // regex is a positive allowlist, so a miss only means "not recognized".
+ expect(withToolUseOptionLabel('gemma4:e4b', 'gemma4:e4b', ollama)).toBe('gemma4:e4b · ⚠ no known tool use');
+ });
+
+ it('leaves cloud provider labels unchanged', () => {
+ const cloud = { name: 'OpenAI', endpoint: 'https://api.openai.com/v1' };
+ expect(withToolUseOptionLabel('gpt-4o', 'GPT-4o', cloud)).toBe('GPT-4o');
+ });
+});
+
describe('localBackendForProvider', () => {
it('detects Ollama by id, endpoint, or name', () => {
expect(localBackendForProvider({ id: 'ollama' })).toBe('ollama');