Repository navigation
fix(upstream):404 类确定性失败不再原地重发,省下换号前的白等(#255) - #266
Merged
aimod-cc merged 1 commit intoOct 15, 2026
Merged
Conversation
issue aimod-cc#255 的面板截图:OfficeAce 对目录里有、套餐里没有的名字回 `404 {"code":null,"message":"Invalid model."}`,fallback_retry_advice 把它当普通 Fatal,按「同一账号重试次数」原地重发 3 次 × 5 秒才换号——客户端白等 15 秒, 换来的还是同一个 404(截图里 AutoClaw 第二账号一次就成了)。 404 与 aimod-cc#241 的 413 同一类:结论只由「这份 body 长什么样」决定,同一账号重发 同一份 body 必然得到同一个失败,变量是账号不是字节。所以把 `DETERMINISTIC_NOT_FOUND_STATUSES = [404]` 加进 fallback_retry_advice 的豁免 (与 PAYLOAD_SIZE_REJECTION_STATUSES 分开两个常量:一个是字节、一个是名字, 出处不同,将来排除面也可能各自变)。豁免后直接进账号轮换——别的账号可能有 这个模型(截图里第二发就成 200)。 413 那条豁免的完整论证(代价不对称:每次往返 13 秒 + 5 秒间隔,客户端 60 秒墙先到) 见 fallback_retry_advice 的函数头,404 同样适用。普通 400 不在豁免面(语义由上游定, 重发是安全默认),测试里有对照断言。
Closed
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.
现象
issue #255 的截图:客户端请求
glm-5.3-flash,第一跳 OfficeAce 对这个套餐里没有的名字回404 {"code":null,"message":"Invalid model."},然后按「同一账号重试次数」原地重发 3 次 × 5 秒,才轮到第二家(AutoClaw,一次 200)。客户端白等 15 秒,换来的还是同一个 404。
根因
fallback_retry_advice对非限额的 Fatal 失败给「换账号前先原地重发」的兜底,豁免名单里只有#241 加的 413(体积拒收)。404 走进了兜底档,但它的性质和 413 一样:上游在解析请求时就没找到
目标(模型不在这家套餐里 / 路由不存在),结论只由「这份 body 长什么样」决定,同一账号重发
同一份 body 必然得到同一个失败——有变化的量是账号,不是字节或名字。
修法
新增
DETERMINISTIC_NOT_FOUND_STATUSES = [404],加进fallback_retry_advice的豁免,与
PAYLOAD_SIZE_REJECTION_STATUSES分成两个常量(一个是字节、一个是名字,出处不同,将来排除面也可能各自变)。豁免后直接进账号轮换——别的账号可能有这个模型(截图里第二发就成)。
普通 400 不在豁免面:400 的语义完全由上游决定,重发仍是安全默认(#241 时定下的取向),
用例里有对照断言。
验证
与本修复冲突)。
cargo test -p agent2api-server:基点(16b8855)581 → 582 passed,0 failed。影响面
只动
provider_loop.rs的重试豁免与其测试。408/5xx 的瞬时重试、429 的冷却换号、401 的刷新凭证、400 的兜底重发全部不变。
另外说明:#255 还有一半是「目录声称有、套餐里没有」的路由面问题(为什么 OfficeAce 会成为
这个模型的第一候选),比 404 的重试策略大,不在本 PR 里动——404 不再原地重发之后,
这一半的实际代价已经从「15 秒 + 3 次上游往返」降到「一次 404 就换号」。