refreshOllamaBackedProviders in server/services/localLlm.js (~line 818, added for the fix that pushes a live model-list refresh to every Ollama-backed provider after installModel/deleteModel succeeds) fans out with no dedup:
function refreshOllamaBackedProviders() {
getAllProviders().then(({ providers }) => {
const targets = (providers || []).filter(isOllamaBackedProvider)
return Promise.all(targets.map((p) => refreshProviderModels(p.id).catch((err) => { ... })))
})...
}
When N providers (the built-in ollama provider plus one or more Claude/Codex/Gemini-over-Ollama CLI/TUI providers) all resolve to the same Ollama daemon — commonly the shared http://localhost:11434 default, see ollamaBaseFromProvider in server/lib/aiToolkit/providers.js (~line 129) — this Promise.all calls refreshProviderModels(p.id) once per provider, each independently re-fetching /api/tags and re-running the full per-model /api/show tool-capability probe against the identical daemon/model set.
Fix shape
Group providers by normalized base URL (ollamaBaseFromProvider) before fanning out: compute the tool-capable model list once per unique base, then apply the same result to every provider sharing that base. This needs a "compute without persisting" variant exposed from server/lib/aiToolkit/providers.js (today refreshProviderModels(id) both fetches AND persists in one call — see the companion issue on batching writes, which shares this same "split compute from persist" prerequisite). Deferred because it's a larger surface change than a localLlm.js-only fix — needs a new toolkit-level export, not just a caller-side change.
Migrated from PLAN.md by /do:replan --issues.
refreshOllamaBackedProvidersinserver/services/localLlm.js(~line 818, added for the fix that pushes a live model-list refresh to every Ollama-backed provider afterinstallModel/deleteModelsucceeds) fans out with no dedup:When N providers (the built-in
ollamaprovider plus one or more Claude/Codex/Gemini-over-Ollama CLI/TUI providers) all resolve to the same Ollama daemon — commonly the sharedhttp://localhost:11434default, seeollamaBaseFromProviderinserver/lib/aiToolkit/providers.js(~line 129) — thisPromise.allcallsrefreshProviderModels(p.id)once per provider, each independently re-fetching/api/tagsand re-running the full per-model/api/showtool-capability probe against the identical daemon/model set.Fix shape
Group providers by normalized base URL (
ollamaBaseFromProvider) before fanning out: compute the tool-capable model list once per unique base, then apply the same result to every provider sharing that base. This needs a "compute without persisting" variant exposed fromserver/lib/aiToolkit/providers.js(todayrefreshProviderModels(id)both fetches AND persists in one call — see the companion issue on batching writes, which shares this same "split compute from persist" prerequisite). Deferred because it's a larger surface change than alocalLlm.js-only fix — needs a new toolkit-level export, not just a caller-side change.Migrated from PLAN.md by /do:replan --issues.