Repository navigation
v0.8.9
Fix: streams killed by dirty keep-alive sockets
Health probes (/v1/models) and fetch-models error paths checked the HTTP status and dropped the response body. undici pooled those sockets with unread responses, and the next request reusing one died with an uncaught TypeError: terminated — which, for a live SSE stream, ended the Claude Code request mid-body:
API Error: 400 AI service stream failed: The AI model service is temporarily
unavailable or undergoing maintenance.
Changes
- New
drain()helper (resp.body.cancel()) inserver/lib/health.mjsreturns sockets clean to the pool probe()drains on every pathdeepCheck()drains before early returns/api/providers/fetch-modelserror branches (401/403/404/405/other) drain
Verification
- 160/160 tests pass
- Streaming verified end-to-end on 0.8.9
- Proxy log clean of uncaught errors across probe cycles after restart