fix: implement TD-02.

This commit is contained in:
2026-06-11 16:18:09 +02:00
parent 284637970f
commit a5391e8e25
7 changed files with 315 additions and 57 deletions

View File

@@ -82,10 +82,22 @@ for `BDS.Desktop.Endpoint`.
---
### TD-02: Replace the hand-rolled `:httpc` client with Req
### TD-02: Replace the hand-rolled `:httpc` client with Req ✅ DONE (2026-06-11)
**Severity: High (reliability), enables TD-06 (streaming).**
**Status: implemented.** `BDS.AI.HttpClient` is a Req wrapper with explicit
connect/receive timeouts and constant-delay transient retries for GETs only
(POST completions are never retried), configurable under
`config :bds, BDS.AI.HttpClient` (`:connect_timeout_ms`,
`:receive_timeout_ms`, `:get_max_retries`, `:retry_delay_ms`). The legacy
`{:ok, %{status, headers, body}}` contract is preserved (raw binary body,
downcased single-valued headers), so runtime/catalog callers are unchanged.
The automation driver's health check also moved to Req, `:inets` left
`extra_applications`, and no `:httpc` remains under `lib/`
(test files still use `:httpc` as a client against local servers — they start
`:inets` themselves). TD-06 (SSE streaming via Req `into:`) is now unblocked.
**Context.** `BDS.AI.HttpClient` wraps `:httpc` with empty http options — the
default timeout is **infinity**, so a hung LLM endpoint (Ollama, LM Studio,
any OpenAI-compatible server) blocks the chat task forever (see TD-03 for the