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): don't clobber a user-customized claude-ollama on rename

[._.]/ Adam Eivya661d8fb7e5f
diff --git a/scripts/migrations/146-claude-ollama-providers.js b/scripts/migrations/146-claude-ollama-providers.js
index cc82d0bafc..49164c2bc4 100644
--- a/scripts/migrations/146-claude-ollama-providers.js
+++ b/scripts/migrations/146-claude-ollama-providers.js
@@ -207,15 +207,27 @@ export default {
let changed = false;
// 1. Promote an existing clawed-ollama to claude-ollama, preserving the
- // user's config (it wins over any fresh default merged in this run).
+ // user's config. The promoted entry must win over the *freshly merged
+ // default* claude-ollama (pristine: not enabled, no models) — but NOT over
+ // a claude-ollama the user already customized (enabled or with a refreshed
+ // model list). In that rare both-exist-and-customized state, keep the
+ // user's claude-ollama and just drop the stale clawed entry.
const clawed = providers[OLD_ID];
if (clawed) {
- const promoted = { ...clawed, id: NEW_ID };
- if (promoted.name === OLD_DEFAULT_NAME) promoted.name = NEW_DEFAULT_NAME;
- providers[NEW_ID] = promoted;
- delete providers[OLD_ID];
+ const existing = providers[NEW_ID];
+ const existingIsCustomized = !!existing
+ && (existing.enabled === true || (Array.isArray(existing.models) && existing.models.length > 0));
+ if (existingIsCustomized) {
+ delete providers[OLD_ID];
+ console.log(`📝 ${PROVIDERS_REL_PATH}: kept your customized ${NEW_ID}, removed stale ${OLD_ID}`);
+ } else {
+ const promoted = { ...clawed, id: NEW_ID };
+ if (promoted.name === OLD_DEFAULT_NAME) promoted.name = NEW_DEFAULT_NAME;
+ providers[NEW_ID] = promoted;
+ delete providers[OLD_ID];
+ console.log(`📝 ${PROVIDERS_REL_PATH}: renamed ${OLD_ID} → ${NEW_ID} (preserving your settings)`);
+ }
changed = true;
- console.log(`📝 ${PROVIDERS_REL_PATH}: renamed ${OLD_ID} → ${NEW_ID} (preserving your settings)`);
}
// 2. Add the shipped CLI + TUI providers when missing (idempotent).
diff --git a/scripts/migrations/146-claude-ollama-providers.test.js b/scripts/migrations/146-claude-ollama-providers.test.js
index 15ad146310..3016db7d74 100644
--- a/scripts/migrations/146-claude-ollama-providers.test.js
+++ b/scripts/migrations/146-claude-ollama-providers.test.js
@@ -129,6 +129,26 @@ describe('migration 146 — Claude Ollama providers', () => {
expect(out.providers['claude-ollama']).toBeDefined();
});
+ it('does not clobber a user-customized claude-ollama when clawed also exists', async () => {
+ // Both exist, and claude-ollama is genuinely customized (enabled + models) —
+ // not the freshly-merged pristine default. Keep it; just drop stale clawed.
+ writeJson(providersPath, {
+ providers: {
+ 'clawed-ollama': clawed({ enabled: false, models: ['old-model'] }),
+ 'claude-ollama': clawed({ id: 'claude-ollama', name: 'My Tuned Local', enabled: true, models: ['qwen2.5-coder:32b'] }),
+ },
+ });
+
+ await migration.up({ rootDir });
+
+ const out = readJson(providersPath);
+ expect(out.providers['clawed-ollama']).toBeUndefined();
+ // user's customized claude-ollama survives untouched
+ expect(out.providers['claude-ollama'].name).toBe('My Tuned Local');
+ expect(out.providers['claude-ollama'].enabled).toBe(true);
+ expect(out.providers['claude-ollama'].models).toEqual(['qwen2.5-coder:32b']);
+ });
+
it('adds both shipped providers to an install that never had clawed', async () => {
writeJson(providersPath, {
activeProvider: 'claude-code',