Repository navigation
fix(ollama): start local services for native chat - #128034
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 4:50 PM ET / 20:50 UTC. ClawSweeper reviewWhat this changesThe PR makes native Ollama chat acquire and retain a configured provider local-service lease through streamed-response cleanup, while leaving model-specific remote endpoints unmanaged. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this protected maintainer PR open. The current main path sends native Ollama chat directly to the selected endpoint without acquiring the configured local service; the branch repairs that owner boundary and covers both provider-local and model-remote endpoint selection. No blocking source finding was found; await exact-head CI before landing. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe bundled Ollama plugin converts selected model and provider configuration into a native flowchart LR
A[Model and provider configuration] --> B[Ollama stream registration]
B --> C[Endpoint ownership decision]
C -->|Provider or default endpoint| D[Acquire local-service lease]
C -->|Model remote endpoint| E[Native chat request]
D --> E
E --> F[NDJSON response stream]
F --> G[Guarded cleanup and lease release]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +48, Tests +554. Total +602 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land the owner-boundary repair after exact-head CI confirms the existing provider-local and remote-model endpoint regressions; no net-neutral extraction was found because only the native stream owner knows when the response lease may end. Do we have a high-confidence way to reproduce the issue? Yes in source: current main constructs native chat without a local-service acquirer and fetches directly; this read-only review did not execute a live local-service reproduction. Is this the best way to solve the issue? Yes. The repair belongs in the native Ollama stream owner, matches the embedding endpoint-ownership rule, and keeps lease lifetime aligned with actual response cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d0db8a9241bc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
fcd3318 to
4aeee9f
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4aeee9f to
643c88c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
643c88c to
b4578c9
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact-head configured local-service proof for
This satisfies the latest exact-head ClawSweeper rank-up move without exposing machine paths or host details. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix(ollama): lease native chat local services * test(ollama): type local-service timeout fixtures * fix(ollama): preserve configured service aliases * fix(ollama): preserve remote model endpoints * fix(ollama): normalize model endpoint ownership
What Problem This Solves
Fixes an issue where native Ollama chat requests failed when a configured
models.providers.<id>.localServicewas responsible for starting the Ollamaserver. Embedding requests already acquired that service, but native
/api/chatrequests bypassed it and fetched the stopped endpoint directly.
Why This Change Was Made
The Ollama plugin now carries the exact configured provider alias and the
host-owned local-service acquirer through its lazy stream registration. Native
chat acquires the service after final payload and header composition, holds the
lease through complete NDJSON response handling, and releases it after guarded
HTTP cleanup.
Acquisition is limited to provider-owned or default endpoints. When a provider
has no
baseUrland the selected model supplies a remotebaseUrl, native chatpreserves that model endpoint and streams it without trying to start the
provider's local service. This matches the existing embedding
remote-configownership boundary.
Root cause: the native Ollama transport issued
/api/chatdirectly while thegeneric OpenAI-compatible and Ollama embedding transports already honored the
provider local-service lifecycle.
Architectural owner: the bundled Ollama provider transport.
Production source LOC: +98/-50 (net +48) | Tests: +562/-8
User Impact
Operators can configure an on-demand Ollama server once and expect native chat
and embedding requests to start and lease the same provider-owned service.
Configured provider aliases remain distinct, idle shutdown waits until the full
chat response has been consumed, and model-specific remote endpoints remain
independent of the provider's local service.
Evidence
22327a53cab44a1be2d71a30b38a62473e08793eextensions/ollama/index.test.ts,extensions/ollama/lazy-import.test.ts,and
extensions/ollama/src/stream-runtime.test.tsbaseUrlabsent, model remotebaseUrlselected; acquisition stayed at zero,/api/chatused the remote endpoint, and the stream completedbaseUrlnormalizes tothe default provider-owned endpoint, acquires the configured local service,
and completes the native stream
git diff --check, and allcheck:changedlanes before the extension-wide typecheck passedacpxandcua-computerdependency/type drift; exact-head hosted CI is the freshdependency authority for this head
Configured local-service smoke
Redacted Crabbox proof at production predecessor
b4578c98b5f2a96f994e1c0b26bd338da93849a4:cbx_52c2e5d28478; artifact SHA-2563b73bbefe115aad752034f0024c440ed78bb389e6a131f50ec3cc661f89fc3adnondefault provider alias matched exactly
shutdown stopped the managed process
before fetch
0 -> 1 -> 0That live proof remains applicable to the provider-owned local endpoint path.
The current repair only omits acquisition when a model-specific endpoint wins
because the provider has no
baseUrl; provider-owned local selection,acquisition, timeout, streaming retention, cleanup, and release ordering are
unchanged.
ClawSweeper Review Response
The latest endpoint-ownership findings are resolved at the Ollama transport owner. Local-service
acquisition now follows endpoint ownership: provider/default endpoints retain
the managed lifecycle, while model-specific remote endpoints skip acquisition.
The regressions prove both zero acquisition for a real remote endpoint and
acquisition for a whitespace-only model endpoint that falls back to the native
default.
Earlier review findings remain resolved: acquisition is bounded by the request
timeout and caller signal, its timer is cleaned when acquisition settles, the
progressing fetch keeps the refreshable timeout, mixed-case configured aliases
are preserved, guarded response cleanup precedes exactly-once lease release,
and the release-owned changelog entry remains absent.
Fresh exact-head CI and ClawSweeper review are required before landing.