Repository navigation
fix(embeddings): time out hung Ollama requests - #202
Conversation
Agent: Codex 01a23fb0-312d-7822-9166-ea3b2e2f0763
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Confidence Score: 4/5
[Medium impact] The change affects Ollama-backed embedding workflows, from indexing calls to provider setup. The PR appears safe to merge, with a non-blocking request to test timeout defaults and invalid values. Findings
SummaryAdds deadlines to Ollama model checks and embedding requests.
Reviews (1) · Last reviewed commit: "fix(embeddings): time out hung Ollama re..." · Reviewed by Greptile |
| export function resolveOllamaRequestTimeoutMs(configured?: number): number { | ||
| const timeoutMs = configured ?? Number(process.env.OLLAMA_REQUEST_TIMEOUT_MS); | ||
| if (Number.isInteger(timeoutMs) && timeoutMs > 0 && timeoutMs <= MAX_TIMER_DELAY_MS) { | ||
| return timeoutMs; | ||
| } | ||
| if (configured !== undefined) { | ||
| throw new RangeError( | ||
| `Ollama requestTimeoutMs must be an integer from 1 to ${MAX_TIMER_DELAY_MS}` | ||
| ); | ||
| } | ||
| return DEFAULT_OLLAMA_REQUEST_TIMEOUT_MS; |
There was a problem hiding this comment.
Timeout settings lack edge-case tests
resolveOllamaRequestTimeoutMs adds three untested behaviors: the 120-second default, fallback for invalid environment values, and rejection of invalid explicit values. The new tests use only valid overrides.
Add table-driven tests for unset values, zero, negative numbers, fractions, non-numbers, and the timer limit. These would catch changes that silently alter the deadline or let an invalid delay reach AbortSignal.timeout.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Agent: Codex 01a23fd8-6141-77b1-823b-9ae174818da1
|
Added regression coverage for both review items.
The full local suite passed with 1,555 tests passed and 2 skipped. |
The review of #146 flagged that a stalled Ollama server could leave indexing waiting indefinitely. Both
/api/showand/api/embednow have a per-request deadline that covers waiting for headers and reading the response body. A timeout reports the server, endpoint, and deadline.The default is 120 seconds. Set
OLLAMA_REQUEST_TIMEOUT_MSto override it, or setembedding.requestTimeoutMswhen configuring the indexer in code.pnpm testpassed 167 files and 1,540 tests, with 2 skipped and 0 failed.pnpm type-checkandpnpm format:checkpassed.