Repository navigation
Description
Overview
Repurposed. This issue originally proposed adding a request timeout to OllamaInferenceEngine's reqwest::Client. That fix is superseded: we have decided to drive Ollama through its OpenAI-compatible endpoint rather than its native API, so the client being hardened is one we intend to delete. Adding a timeout would harden code on its way out.
The original defect is real and stated below for the record — it disappears with the removal.
Decision
Ollama exposes an OpenAI-compatible API (/v1). OpenAiCompatInferenceEngine already exists, is wired into production, and covers that protocol. Maintaining a second, Ollama-native client duplicates the same capability against a bespoke wire format.
Per the greenfield rule in CLAUDE.md — no deprecation, no feature flags for compatibility, delete replaced patterns outright — the native path is removed rather than flagged.
Scope
Delete (~1,130 lines production):
packages/agent/src/local_agent/ollama_inference.rs(495)packages/agent/src/local_agent/ollama_ndjson.rs(183) — NDJSON streaming, specific to Ollama's native formatpackages/agent/src/local_agent/ollama_model_manager.rs(453)
Delete (~1,843 lines test):
packages/agent/tests/ollama_integration.rs- Ollama-specific paths in
packages/agent/tests/search_skills_latency.rs:40,81,90
Rework, do not delete:
packages/agent/src/local_agent/composite_model_manager.rs:13,32— holdsArc<OllamaModelManager>as a field; the composite needs restructuring, not just an import removedpackages/daemon/src/services/local_agent_service.rs:1054,1189— the branch selectingOllamaInferenceEngine::with_base_urlcollapses into the existingOpenAiCompatInferenceEnginebranch at :1117packages/agent/src/local_agent/model_manager.rs:396—ModelFamily::Ollama | ModelFamily::OpenAiCompatarm loses one variantpackages/agent/src/agent_types.rs:253—ModelFamily::Ollamavariant
Frontend (coupling is thin):
packages/desktop-app/src/lib/types/agent-types.ts:19—ModelFamilyunion drops'ollama'- Display/selector strings in
model-store.svelte.ts,model-manager.svelte,ai-chat-model-selector.svelte,tauri-commands.ts,ai-chat-node.ts - Corresponding test updates in
src/tests/components/ai-chat-model-selector.test.ts,src/tests/services/tauri-commands.test.ts
Also check: packages/core/src/models/ai_chat_node.rs, packages/core/src/behaviors/mod.rs, packages/nodespace-types/src/convert.rs, packages/agent/src/prompt_assembler.rs, packages/agent/src/agent_guidance.rs — all reference Ollama; confirm whether each is a family variant, a display string, or dead.
Open question to resolve first
OllamaModelManager provides model discovery (is_available(), base-url handling, progress callbacks) that OpenAiCompatInferenceEngine does not — the latter has no listing surface at all. Before deleting, decide how a user picks an Ollama model:
- via
/v1/modelson the OpenAI-compatible endpoint (likely sufficient — it is part of the OpenAI protocol), or - users configure the model identifier by hand, as with any other OpenAI-compatible server
Verify /v1/models against a real Ollama instance before deleting the manager. If discovery regresses, the model selector gets worse for Ollama users even though inference still works.
Prerequisite
Confirm OpenAiCompatInferenceEngine actually works end-to-end against a live Ollama /v1 endpoint — tool calls included, not just plain completion. Removing the native path before verifying makes this a bet rather than a cleanup. Ollama's OpenAI-compat layer has historically had gaps around tool/function calling.
Acceptance Criteria
-
/v1path verified against a live Ollama instance, including a tool-calling turn - Model discovery for Ollama works via the OpenAI-compatible path, or is a documented manual-configuration step
- The three native modules and the Ollama integration test are deleted
-
ModelFamily::Ollamaremoved from both Rust and the TS union; no orphan match arms or display strings -
composite_model_manager.rsrestructured, not left holding a vestigial field - No
--no-verify; the pre-push gate passes with the full suite -
grep -ri ollamaacrosspackages/returns only intentional references (e.g. a doc note that Ollama is reached via the OpenAI-compatible endpoint)
Original defect (for the record)
OllamaInferenceEngine built its HTTP client with reqwest::Client::new(), applying no request timeout (packages/agent/src/local_agent/ollama_inference.rs:22,31). An endpoint that accepts the TCP connection then stalls leaves the call hung indefinitely — reqwest surfaces an error only on transport failure, and a connected-but-silent server is not one.
If OpenAiCompatInferenceEngine has the same gap, fix it there — that client is staying. Check its constructor for a .timeout(..) before closing this issue.
Activity
[-]Ollama engine's HTTP client has no timeout: a stalled endpoint can hang a turn[/-][+]Remove the Ollama-native inference path: drive Ollama through its OpenAI-compatible endpoint[/+]malibio commentedon Jul 29, 2026
Checked the surviving client: the timeout defect exists there too.
packages/agent/src/local_agent/openai_compat_inference.rs:53buildshttp_client: reqwest::Client::new()— same missing.timeout(..), same hang risk from a connected-but-silent endpoint.So the original defect does not disappear with the removal; it relocates to the client we are keeping. That makes it more important, not less: after this change every remote inference call goes through
OpenAiCompatInferenceEngine, so a stalled endpoint hangs the only remote path there is.Added to the acceptance criteria in spirit — whoever implements this should set an explicit request timeout on
OpenAiCompatInferenceEngine's client as part of the same change. It is a two-line fix in code that is staying, and skipping it would mean deleting the buggy client while leaving the bug.malibio commentedon Jul 29, 2026
Baseline (worktree issue-1793-ollama-openai-compat): Frontend: 170 test files, 4106 tests passed.
Prerequisite verification against live Ollama 0.32.1 — both green:
/v1/modelsreturns the same catalog as native/api/tags(mistral:7b, ornith:9b, gemma4:e4b)/v1/chat/completionstool calling works non-streaming and streaming (finish_reason: tool_calls, well-formedtool_callsdeltas)Two findings that shape the work:
CompositeModelManager::list()auto-merges Ollama models into the selector; OpenAI-compat models come only from hand-written[[openai_compat.configs]]in daemon.toml, andOpenAiCompatInferenceEnginehas no listing surface at all (only/chat/completions). Decision: add/v1/modelsdiscovery to the OpenAI-compat path so Ollama/LM Studio/vLLM models auto-populate — preserving today's UX rather than regressing users to manual config.openai_compat_inference.rs:53is a barereqwest::Client::new()with no.timeout(..), same as the Ollama client. Fixing it here as the issue's closing note asks.Address review: normalize encodeSelection so a saved default cannot s…
Remove the Ollama-native inference path: drive Ollama through its Ope…