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): unconditional ref rewrite + no billing warning for local Claude Ollama

[._.]/ Adam Eivyec9af55f933e
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index b40eab8eca..6db1e0f64f 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -280,6 +280,10 @@ export const isOllamaBackedProvider = (provider) => {
export const isClaudeCodePlanCli = (provider) =>
isCliProvider(provider) &&
provider?.command === 'claude' &&
+ // Ollama-backed Claude (the "Claude Ollama" sample) routes generation to a
+ // local daemon via ANTHROPIC_BASE_URL — it's never plan/API-billed, so the
+ // billing warning would be misleading and discourage the shipped local setup.
+ !isOllamaBackedProvider(provider) &&
!provider?.envVars?.CLAUDE_CODE_USE_BEDROCK &&
!provider?.envVars?.CLAUDE_CODE_USE_VERTEX;
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index f6aec7dff2..41e40810b5 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -132,6 +132,13 @@ describe('isClaudeCodePlanCli', () => {
expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude', envVars: { CLAUDE_CODE_USE_VERTEX: '1' } })).toBe(false);
});
+ it('excludes Ollama-backed Claude (local model — never plan/API-billed)', () => {
+ // Claude Ollama CLI carries the ollamaBacked marker + ANTHROPIC_BASE_URL
+ expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude', ollamaBacked: true, envVars: { ANTHROPIC_BASE_URL: 'http://localhost:11434' } })).toBe(false);
+ // inferred purely from the base URL too
+ expect(isClaudeCodePlanCli({ type: 'cli', command: 'claude', envVars: { ANTHROPIC_BASE_URL: 'http://localhost:11434' } })).toBe(false);
+ });
+
it('safely returns false for nullish input', () => {
expect(isClaudeCodePlanCli(null)).toBe(false);
expect(isClaudeCodePlanCli(undefined)).toBe(false);
diff --git a/scripts/migrations/146-claude-ollama-providers.js b/scripts/migrations/146-claude-ollama-providers.js
index e8aade0649..3b35343a75 100644
--- a/scripts/migrations/146-claude-ollama-providers.js
+++ b/scripts/migrations/146-claude-ollama-providers.js
@@ -193,11 +193,6 @@ export default {
if (promoted.name === OLD_DEFAULT_NAME) promoted.name = NEW_DEFAULT_NAME;
providers[NEW_ID] = promoted;
delete providers[OLD_ID];
-
- if (config.activeProvider === OLD_ID) config.activeProvider = NEW_ID;
- for (const p of Object.values(providers)) {
- if (p && p.fallbackProvider === OLD_ID) p.fallbackProvider = NEW_ID;
- }
changed = true;
console.log(`📝 ${PROVIDERS_REL_PATH}: renamed ${OLD_ID} → ${NEW_ID} (preserving your settings)`);
}
@@ -211,6 +206,22 @@ export default {
}
}
+ // 3. Rewrite activeProvider / fallbackProvider references off the retired id.
+ // OUTSIDE the promotion branch: an install can have the reference dangling
+ // with the clawed-ollama entry already gone (manual delete / setup drift) —
+ // leaving it would resolve as "provider not found". claude-ollama is
+ // guaranteed to exist by now (renamed above or added in step 2).
+ if (config.activeProvider === OLD_ID) {
+ config.activeProvider = NEW_ID;
+ changed = true;
+ }
+ for (const p of Object.values(providers)) {
+ if (p && p.fallbackProvider === OLD_ID) {
+ p.fallbackProvider = NEW_ID;
+ changed = true;
+ }
+ }
+
if (changed) {
await writeFile(providersPath, `${JSON.stringify(config, null, 2)}\n`);
} else {
diff --git a/scripts/migrations/146-claude-ollama-providers.test.js b/scripts/migrations/146-claude-ollama-providers.test.js
index ee41dd6c09..5244ef7c77 100644
--- a/scripts/migrations/146-claude-ollama-providers.test.js
+++ b/scripts/migrations/146-claude-ollama-providers.test.js
@@ -111,6 +111,24 @@ describe('migration 146 — Claude Ollama providers', () => {
expect(out.providers['claude-ollama'].models).toEqual(['qwen2.5:7b']);
});
+ it('rewrites dangling active/fallback refs even when the clawed entry is already gone', async () => {
+ // clawed-ollama entry removed (manual delete / setup drift) but refs linger
+ writeJson(providersPath, {
+ activeProvider: 'clawed-ollama',
+ providers: {
+ 'claude-code': { id: 'claude-code', type: 'cli', command: 'claude', fallbackProvider: 'clawed-ollama' },
+ },
+ });
+
+ await migration.up({ rootDir });
+
+ const out = readJson(providersPath);
+ expect(out.activeProvider).toBe('claude-ollama');
+ expect(out.providers['claude-code'].fallbackProvider).toBe('claude-ollama');
+ // and the target now exists (added in step 2)
+ expect(out.providers['claude-ollama']).toBeDefined();
+ });
+
it('adds both shipped providers to an install that never had clawed', async () => {
writeJson(providersPath, {
activeProvider: 'claude-code',