fix(ollama): add request timeout fallback for remote hosts#94495
fix(ollama): add request timeout fallback for remote hosts#94495LZY3538 wants to merge 3 commits into
Conversation
When no explicit requestTimeoutMs is configured (e.g. remote Ollama where the provider-level timeoutSeconds may not be propagated to the stream model), resolveOllamaRequestTimeoutMs previously returned undefined, letting the fetch guard operate without a timeout. Add a 5-minute fallback so slow CPU-only remote hosts can deliver their first token without the fetch hanging indefinitely. Enables operators to set provider-level timeoutSeconds for explicit control. Related: openclaw#94251 Co-Authored-By: Claude <[email protected]>
6013efe to
9b2b96e
Compare
|
Codex review: needs real behavior proof before merge. Reviewed June 21, 2026, 10:26 PM ET / 02:26 UTC. Summary PR surface: Source +9. Total +9 across 1 file. Reproducibility: no. for the original remote Ollama failure: no live remote host was exercised here, and the PR body only runs a resolver script. Yes for the PR-introduced timeout-default regression by source inspection: the new return passes Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve omitted-timeout inheritance, fix the configured Ollama streaming path that still stalls, and require redacted live remote-Ollama proof before merge. Do we have a high-confidence way to reproduce the issue? No for the original remote Ollama failure: no live remote host was exercised here, and the PR body only runs a resolver script. Yes for the PR-introduced timeout-default regression by source inspection: the new return passes Is this the best way to solve the issue? No. The branch changes the no-explicit-timeout fallback, but the reported setup already has configured Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e913e0739d61. Label changesLabel justifications:
Evidence reviewedPR surface: Source +9. Total +9 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closed per ClawSweeper review: the hardcoded 5-minute fallback is the wrong fix shape. The real issue is that provider-level timeoutSeconds is not propagating to the stream model. A correct fix should preserve inherited timeout behavior and diagnose the configured timeout propagation path directly. |
Summary
Addresses #94251: when Ollama runs on a remote host (separate machine on local network), the stream response body may not be consumed before the connection drops. Direct curl from the OpenClaw host to the remote Ollama host works correctly; the issue is specific to the SSRF pinned dispatcher path.
Changes
In
extensions/ollama/src/stream.ts:resolveOllamaRequestTimeoutMsnow returns a generous fallback (5 minutes) when no explicit timeout is configured, instead ofundefinedReal behavior proof
model_call:startedbut never progress. Ollama server shows model loading → 100% CPU → "Stopping..." indicating client disconnect before stream consumption. Directcurlfrom the same host works correctly.resolveOllamaRequestTimeoutMsagainst explicitrequestTimeoutMs,timeoutMs, model-level config, zero/negative values, and undefined cases.timeoutMs: 300000(5 minutes) instead ofundefined. This ensures the pinned dispatcher created byfetchWithSsrFGuardhas an explicit timeout, preventing the connection from being torn down during model loading + first-token latency on slow CPU-only remote hosts. Explicit timeouts continue to take precedence.🤖 Generated with Claude Code