Skip to content

fix: 补齐 LLM Provider 的 SDK 连接重试与 deadline 检查 - #164

Merged
rojim666 merged 1 commit into
rojim666:mainfrom
z2Ace0107:codex/issue-69-pr03-followup-provider-boundaries
Sep 17, 2026
Merged

rojim666 merged 1 commit into
rojim666:mainfrom
z2Ace0107:codex/issue-69-pr03-followup-provider-boundaries

Conversation

@z2Ace0107

@z2Ace0107 z2Ace0107 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

关联

这是对已合并 PR #162 的 review follow-up,继续处理 Issue #69 中 LLM Provider 的 timeout/retry boundary。

本次改动

  • 捕获 Anthropic SDK 的 APIConnectionError,使其进入 Provider 的网络重试分支。
  • 捕获 OpenAI SDK 的 APIConnectionError,使其进入 Provider 的网络重试分支。
  • 在真正调用 SDK 前再次检查 run deadline;剩余预算耗尽时不再发起请求。
  • 为 Anthropic 和 OpenAI-compatible Provider 增加对应回归测试。

验证结果

  • 聚焦 Provider deadline/retry 测试:19 passed, 45 deselected
  • Ruff:通过
  • mypy:通过
  • compileall:通过
  • git diff --check:通过

完整运行两个 Provider 测试文件的结果为:39 passed, 25 failed。

这 25 个失败均出现同一个既有导入错误:

ModuleNotFoundError: No module named 'sztu_code.core.prompts.Sztubuddy'

错误来源为 py-runtime/src/sztu_code/core/prompts/system_prompt.py 的主线 prompt 模块导入,与本 PR 修改的 Provider 和测试文件无关。本 PR 不修改该 prompt 命名问题,也不将其隐藏为通过。

范围说明

本 PR 只处理 Provider 层的 SDK 连接异常重试和 deadline 最终检查,不声称完整解决 Issue #69。工具调用 timeout、权限等待与 pending request 清理、Parent/Subagent deadline 传播、context compaction、cleanup、Trace 以及完整生命周期集成测试仍属于后续独立工作。

本次只修改 Python Provider 和对应单元测试,因此未运行 TypeScript/桌面端检查。

GitHub CI 状态

PR #164 的两个 GitHub Actions 均已失败,但失败位置不在本 PR 修改的 4 个 Python 文件中,并且在同一 origin/main 基线的 push CI 中复现:

这两类失败在 origin/main 对照运行中也出现,说明它们是仓库当前 CI/基线问题,不是本 PR 的 Provider 改动引入。本 PR 仅修改 Python LLM Provider 与相应单元测试,不将这些无关失败伪装为通过或扩大本 PR 范围。

@rojim666
rojim666 marked this pull request as ready for review September 17, 2026 01:56
@rojim666
rojim666 self-requested a review as a code owner September 17, 2026 01:56
Copilot AI lite review requested due to automatic review settings September 17, 2026 01:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rojim666
rojim666 merged commit 0aa8158 into rojim666:main Sep 17, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants