修复 ChatGPT 后端传输错误不切换候选账号#278
Merged
KilimiaoSix merged 1 commit intoMay 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
在排查 v0.3.6 Docker 部署的流式响应卡顿时发现:ChatGPT backend 目标发生传输层错误时,即使还有其他候选账号,当前 primary attempt 会直接返回 502,而不是继续 failover。这样会把偶发网络/边缘节点问题放大成用户可见的长时间等待或失败。
改动
chatgpt.com/backend-api/chat.openai.com/backend-api这类 ChatGPT backend 目标,传输错误且仍有候选账号时继续 failover。api.openai.com/v1的原有 terminal 行为不变,避免扩大通用官方 API 行为变更范围。验证
cargo test -p codexmanager-service transport_error