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 (codex): surface model refresh for Claude Ollama TUI + fix advisory

[._.]/ Adam Eivy7b28f9662f3f
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index f106fb408f..3fd3859916 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -563,7 +563,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
</div>
{apiOnlyProviders && (
<div className="px-3 py-2 bg-port-warning/10 border border-port-warning/40 rounded-lg text-xs text-port-warning">
- Your enabled providers (Ollama / LM Studio) are HTTP API providers with no file-writing harness, so they can't run agent tasks. Add the <span className="font-semibold">Claude Ollama</span> sample provider (a <code>claude</code> CLI/TUI pointed at your local model) from AI Providers → Add Sample to run file-writing tasks on a local model.
+ Your enabled providers (Ollama / LM Studio) are HTTP API providers with no file-writing harness, so they can't run agent tasks. Enable the <span className="font-semibold">Claude Ollama</span> provider (a <code>claude</code> CLI/TUI pointed at your local model) on the AI Providers page to run file-writing tasks on a local model.
</div>
)}
{/* Screenshot and Attachment Upload */}
diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsx
index 81789b93e1..47feded4bc 100644
--- a/client/src/pages/AIProviders.jsx
+++ b/client/src/pages/AIProviders.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
import toast from '../components/ui/Toast';
import * as api from '../services/api';
import socket from '../services/socket';
-import { filterSelectableModels, filterGenerationModels, isEmbeddingModel, mergeModelLists, localBackendForProvider, modelOptionLabel, providerTypeClass, isTuiProvider, isApiProvider, isProcessProvider, isClaudeCodePlanCli, effectiveModelContextWindow } from '../utils/providers';
+import { filterSelectableModels, filterGenerationModels, isEmbeddingModel, mergeModelLists, localBackendForProvider, modelOptionLabel, providerTypeClass, isTuiProvider, isApiProvider, isProcessProvider, isOllamaBackedProvider, isClaudeCodePlanCli, effectiveModelContextWindow } from '../utils/providers';
import useLocalModels from '../hooks/useLocalModels';
import EmptyState from '../components/EmptyState';
import {
@@ -136,6 +136,13 @@ export default function AIProviders() {
};
const supportsModelRefresh = (provider) => {
+ // Claude Ollama (ollama-backed claude CLI/TUI) refreshes its model list from
+ // the local Ollama daemon — including the TUI variant, which the server now
+ // refreshes via the type==='tui' && ollamaBacked branch. Check this before
+ // the generic TUI gate so the TUI variant's Refresh Models button shows.
+ if (isOllamaBackedProvider(provider)) {
+ return true;
+ }
if (isTuiProvider(provider)) {
return false;
}
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index 5273bfd9b8..b40eab8eca 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -245,6 +245,21 @@ export const enabledApiProviderFilter = (provider) => Boolean(provider?.enabled)
*/
export const isProcessProvider = (provider) => isCliProvider(provider) || isTuiProvider(provider);
+/**
+ * A `claude` CLI/TUI provider is "Ollama-backed" — the Claude Ollama pattern —
+ * when it carries the `ollamaBacked` marker or its ANTHROPIC_BASE_URL points at
+ * an Ollama daemon. Such a provider runs the Claude Code harness but generates
+ * tokens locally, so its model list is refreshed from Ollama (including the TUI
+ * variant, which the server refreshes via the `type==='tui' && ollamaBacked`
+ * branch). MIRROR of `isOllamaBackedProvider` in server/lib/aiToolkit/providers.js.
+ * @param {{ollamaBacked?:boolean,envVars?:Record<string,string>}} provider
+ */
+export const isOllamaBackedProvider = (provider) => {
+ if (provider?.ollamaBacked === true) return true;
+ const base = String(provider?.envVars?.ANTHROPIC_BASE_URL || '');
+ return /:11434\b/.test(base) || /ollama/i.test(base);
+};
+
/**
* Check if a provider is the headless Claude Code CLI (`claude --print`) whose
* *provider-level config* points it at a Claude Code subscription plan — i.e. the
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index d8e0d70b57..f6aec7dff2 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -18,6 +18,7 @@ import {
isCliProvider,
isApiProvider,
isProcessProvider,
+ isOllamaBackedProvider,
isClaudeCodePlanCli,
enabledApiProviderFilter,
providerTypeClass,
@@ -87,6 +88,19 @@ describe('provider type predicates', () => {
expect(isProcessProvider(api)).toBe(false);
});
+ it('isOllamaBackedProvider matches the marker or an Ollama base URL', () => {
+ // explicit marker (Claude Ollama CLI + TUI samples carry this)
+ expect(isOllamaBackedProvider({ type: 'tui', ollamaBacked: true })).toBe(true);
+ expect(isOllamaBackedProvider({ type: 'cli', ollamaBacked: true })).toBe(true);
+ // inferred from ANTHROPIC_BASE_URL (port 11434 or "ollama" host)
+ expect(isOllamaBackedProvider({ envVars: { ANTHROPIC_BASE_URL: 'http://localhost:11434' } })).toBe(true);
+ expect(isOllamaBackedProvider({ envVars: { ANTHROPIC_BASE_URL: 'http://my-ollama:1234' } })).toBe(true);
+ // plain claude TUI / cloud providers are NOT ollama-backed
+ expect(isOllamaBackedProvider({ type: 'tui', command: 'claude' })).toBe(false);
+ expect(isOllamaBackedProvider({ type: 'cli', command: 'claude', envVars: {} })).toBe(false);
+ expect(isOllamaBackedProvider(null)).toBe(false);
+ });
+
it('all predicates safely return false for nullish input', () => {
expect(isTuiProvider(null)).toBe(false);
expect(isTuiProvider(undefined)).toBe(false);
@@ -94,6 +108,7 @@ describe('provider type predicates', () => {
expect(isApiProvider(null)).toBe(false);
expect(isApiProvider(undefined)).toBe(false);
expect(isProcessProvider(null)).toBe(false);
+ expect(isOllamaBackedProvider(undefined)).toBe(false);
});
});
diff --git a/docs/features/claude-ollama.md b/docs/features/claude-ollama.md
index bd95d185b8..c7cfeaa6a9 100644
--- a/docs/features/claude-ollama.md
+++ b/docs/features/claude-ollama.md
@@ -34,10 +34,10 @@ daemon, with its model list pulled live from Ollama.
2. **Run Ollama ≥ 0.14** (locally or on a remote box) — it natively serves the
Anthropic Messages API, so no proxy is needed. (LM Studio / vLLM / older Ollama:
put **LiteLLM** in front to translate Anthropic ↔ OpenAI.)
-3. **Pick a variant** — after `./update.sh`, both **Claude Ollama (local model)**
- (CLI) and **Claude Ollama TUI (local model)** appear on the **AI Providers** page.
- (On older installs you can also adopt them via **Add Sample**.) Edit
- `ANTHROPIC_BASE_URL` if your Ollama isn't on `localhost:11434`
+3. **Pick a variant** — after `./update.sh` (or a server restart), both
+ **Claude Ollama (local model)** (CLI) and **Claude Ollama TUI (local model)**
+ appear on the **AI Providers** page, disabled by default. Enable the one you
+ want. Edit `ANTHROPIC_BASE_URL` if your Ollama isn't on `localhost:11434`
(e.g. `http://<remote-host>:11434`).
4. **Refresh models** — hit the provider's **Refresh Models** button. PortOS pulls the
installed Ollama models and **keeps only the tool-use-capable ones** (the harness