fix(llm): retry deepseek rounds on zero-progress transport failures

↗ view on GitHub · Eli Ziff · 2026-08-06 · d972f3e3

A single undici "TypeError: terminated" (mid-stream TLS reset) killed a
40-minute flash lab run at top level - the deepseek adapter had no retry
at all, unlike the openai/claude-p lanes. Wrap each round's request +
SSE consumption in a classified retry (3 attempts, 2s/4s backoff):
transport-class errors only (socket/DNS errnos, undici terminated/fetch
failed, HTTP 429/5xx), and only while zero deltas have been forwarded -
consumers accumulate deltas into the persisted turn, so post-emission
retries would duplicate text and resampled output cannot be stitched.
The exposed window is dominated by silent prefill on large contexts,
which is exactly the zero-progress case. Retries are trace-recorded as
"transport_retry". Semantic errors (4xx, provider chunk.error) stay
fatal; classifier probed against the captured error shapes (10/10).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011pfUVhNFTRvhYGXBwoKNj6
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents 0723f4f7
Stats 1 file changed , +124 , -60
Part of Legal agent-surface and context-compaction experiments

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-d972f3e3.md from inside the repo you want the change in.

⬇ Download capture-commit-d972f3e3.md