fix: cover httpx disconnect family in transient error set

This commit is contained in:
2026-07-16 05:26:52 -04:00
parent 200053fbdc
commit 1cbfa97b8d
2 changed files with 14 additions and 1 deletions
+10
View File
@@ -259,6 +259,16 @@ async def test_qwen_thinking_stripped():
assert thinking2 == ""
def test_transient_covers_disconnect_family():
"""瞬时错误清单覆盖断连族(RemoteProtocolError/ReadError/ConnectTimeout/PoolTimeout)。"""
from adapters.llm import _is_transient_error
assert _is_transient_error(httpx.RemoteProtocolError("peer reset"))
assert _is_transient_error(httpx.ReadError("read"))
assert _is_transient_error(httpx.ConnectTimeout("ct"))
assert _is_transient_error(httpx.PoolTimeout("pt"))
@pytest.mark.asyncio
async def test_truncated_stream_without_done_raises():
"""SSE 流耗尽但未收 [DONE] → _SseAnomaly(进重试,不当成功)。"""