Repository navigation
fix(ollama): release failed discovery bodies - #109967
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 10:16 PM ET / July 28, 2026, 02:16 UTC. ClawSweeper reviewWhat this changesThe Ollama provider cancels non-successful model-discovery response streams before returning its existing empty metadata or model-list fallback values, with regression tests for stream cancellation and real socket closure. Merge readinessThis PR remains necessary: current main still returns the existing fail-soft Ollama discovery fallbacks without cancelling non-OK Priority: P2 Review scores
Verification
How this fits togetherThe bundled Ollama plugin probes flowchart LR
A[Ollama API] --> B[Tags and show requests]
B --> C[Ollama discovery plugin]
C --> D{HTTP response OK?}
D -->|Yes| E[Parse model metadata]
D -->|No| F[Cancel response body]
E --> G[Provider model catalog]
F --> H[Existing empty fallback]
H --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +2, Tests +164. Total +166 across 2 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase or merge current main into this focused PR, retain the two non-OK body-cancellation branches and their regression coverage, then land the refreshed head. Do we have a high-confidence way to reproduce the issue? Yes. The branch supplies a concrete localhost HTTP-server path that returns 503 bodies from both discovery endpoints and observes whether the client closes the underlying socket; current-main source also directly shows the two unconsumed non-OK branches. Is this the best way to solve the issue? Yes. Cancelling only the unconsumed failed response bodies at their two owner branches preserves the established fail-soft discovery contract and avoids adding configuration, fallback changes, or a competing transport layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c3713317b86b. LabelsLabel 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 (5 earlier review cycles)
|
b9a38a1 to
d22617f
Compare
d22617f to
e4fa311
Compare
|
Merged via squash.
|
* fix(ollama): release failed discovery bodies * test(ollama): prove failed discovery sockets close --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes an issue where Ollama model discovery could leave non-OK
/api/tagsor/api/showresponse bodies open while falling back to empty discovery results.Why This Change Was Made
The discovery fallback behavior is unchanged: failed tag listing still returns an empty reachable model list, and failed show metadata still returns no metadata. Those fallback branches now cancel any response body before returning.
User Impact
Ollama users keep the same fail-soft model discovery behavior while OpenClaw releases failed discovery response streams promptly.
Evidence
./node_modules/.bin/tsx proof-ollama-provider-models.tsstarted a localhost Ollama-style HTTP server, exercised/api/tagsand/api/show503 fallback responses, and used 200 JSON negative-control responses to verify successful discovery still works.node scripts/run-vitest.mjs extensions/ollama/src/provider-models.test.ts -- -t "cancels non-OK discovery response bodies|fails soft and stops reading"node scripts/run-vitest.mjs extensions/ollama/src/provider-models.test.tsproof-ollama-provider-models.ts
AI-assisted: built with Codex