fix: retry transient direct model failures

Direct model conversations previously stopped after the first transient network error or request timeout, including TLS setup ECONNRESET failures. Text requests now retry up to three times with cancellable backoff before visible output, while partial streamed responses are never replayed.

Release note: 直连模型遇到临时网络故障或请求超时时,会在尚未输出内容的情况下自动重试最多 3 次,并支持随时取消。
This commit is contained in:
mesalogo
2026-09-03 14:24:09 +08:00
parent f18e4abb3c
commit 74c3ec19b4
9 changed files with 718 additions and 194 deletions
@@ -5,8 +5,8 @@
| 项目 | 内容 |
| --- | --- |
| 状态 | 已实施,跨平台 CI 待验证 |
| 版本 | 0.2 |
| 日期 | 2026-09-01 |
| 版本 | 0.3 |
| 日期 | 2026-09-03 |
| 关联 PRD | [直连模型 Agent 能力 PRD](./prd.md) |
| 关联逻辑 | [功能逻辑设计](./logic-design.md) |
@@ -70,6 +70,14 @@ Given 命令仍在运行,When 用户取消父请求,Then 当前 Shell 及其
Given 命令输出超过上限,When 工具返回结果,Then 保留有用的开头和结尾并明确
`truncated: true`,And 模型与用户都不会把结果理解为完整日志。
### US-A7 从瞬时模型网络故障恢复
关联:FR-7、FR-9、FR-11。
Given 直连模型在 TLS 建连、网络传输或单次请求超时时失败且尚未显示输出,When 请求仍未
取消,Then GoodBuddy 显示当前重试次数并使用递增等待时间最多重试 3 次,And 成功后继续
原问答或工具轮次。Given 已经显示文本或推理内容,Then 不自动重放该调用。
## 3. Epic B:编程闭环
### US-B1 修改后运行验证